-rw-r--r-- | backend/php/src/configuration.php | 6 | ||||
-rw-r--r-- | backend/php/src/index.php | 189 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/Record.js | 7 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Proxy.js | 3 | ||||
-rwxr-xr-x | frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js | 262 | ||||
-rw-r--r-- | frontend/gamma/html/index_template.html | 5 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Async.js | 19 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/Proxy.js | 2 |
8 files changed, 205 insertions, 288 deletions
diff --git a/backend/php/src/configuration.php b/backend/php/src/configuration.php index 291e3a1..85f680e 100644 --- a/backend/php/src/configuration.php +++ b/backend/php/src/configuration.php | |||
@@ -3,34 +3,34 @@ global $configuration; | |||
3 | $configuration['soap'] = "http://www.phpobjectgenerator.com/services/soap.php?wsdl"; | 3 | $configuration['soap'] = "http://www.phpobjectgenerator.com/services/soap.php?wsdl"; |
4 | $configuration['homepage'] = "http://www.phpobjectgenerator.com"; | 4 | $configuration['homepage'] = "http://www.phpobjectgenerator.com"; |
5 | $configuration['revisionNumber'] = ""; | 5 | $configuration['revisionNumber'] = ""; |
6 | $configuration['versionNumber'] = "3.0d"; | 6 | $configuration['versionNumber'] = "3.0d"; |
7 | 7 | ||
8 | $configuration['setup_password'] = ''; | 8 | $configuration['setup_password'] = ''; |
9 | 9 | ||
10 | 10 | ||
11 | // to enable automatic data encoding, run setup, go to the manage plugins tab and install the base64 plugin. | 11 | // to enable automatic data encoding, run setup, go to the manage plugins tab and install the base64 plugin. |
12 | // then set db_encoding = 1 below. | 12 | // then set db_encoding = 1 below. |
13 | // when enabled, db_encoding transparently encodes and decodes data to and from the database without any | 13 | // when enabled, db_encoding transparently encodes and decodes data to and from the database without any |
14 | // programmatic effort on your part. | 14 | // programmatic effort on your part. |
15 | $configuration['db_encoding'] = 0; | 15 | $configuration['db_encoding'] = 0; |
16 | 16 | ||
17 | // edit the information below to match your database settings | 17 | // edit the information below to match your database settings |
18 | 18 | ||
19 | $configuration['db'] = 'clipperz'; //database name | 19 | $configuration['db'] = 'clipperz'; //database name |
20 | $configuration['host'] = 'localhost'; //database host | 20 | $configuration['host'] = 'localhost'; //database host |
21 | $configuration['user'] = 'root'; //database user | 21 | $configuration['user'] = 'clipperz'; //database user |
22 | $configuration['pass'] = 'pass'; //database password | 22 | $configuration['pass'] = 'clipperz'; //database password |
23 | $configuration['port'] = '3306'; //database port | 23 | $configuration['port'] = '3306'; //database port |
24 | 24 | ||
25 | 25 | ||
26 | //proxy settings - if you are behnd a proxy, change the settings below | 26 | //proxy settings - if you are behnd a proxy, change the settings below |
27 | $configuration['proxy_host'] = false; | 27 | $configuration['proxy_host'] = false; |
28 | $configuration['proxy_port'] = false; | 28 | $configuration['proxy_port'] = false; |
29 | $configuration['proxy_username'] = false; | 29 | $configuration['proxy_username'] = false; |
30 | $configuration['proxy_password'] = false; | 30 | $configuration['proxy_password'] = false; |
31 | 31 | ||
32 | 32 | ||
33 | //plugin settings | 33 | //plugin settings |
34 | $configuration['plugins_path'] = dirname(__FILE__).'/plugins'; | 34 | $configuration['plugins_path'] = dirname(__FILE__).'/plugins'; |
35 | 35 | ||
36 | ?> \ No newline at end of file | 36 | ?> \ No newline at end of file |
diff --git a/backend/php/src/index.php b/backend/php/src/index.php index 214ac01..da7c60c 100644 --- a/backend/php/src/index.php +++ b/backend/php/src/index.php | |||
@@ -127,46 +127,50 @@ function clipperz_randomSeed() { | |||
127 | return $result; | 127 | return $result; |
128 | } | 128 | } |
129 | 129 | ||
130 | //----------------------------------------------------------------------------- | 130 | //----------------------------------------------------------------------------- |
131 | 131 | ||
132 | function updateUserCredentials($parameters, &$user) { | 132 | function updateUserCredentials($parameters, &$user) { |
133 | $user->username = $parameters["C"]; | 133 | $user->username = $parameters["C"]; |
134 | $user->srp_s = $parameters["s"]; | 134 | $user->srp_s = $parameters["s"]; |
135 | $user->srp_v = $parameters["v"]; | 135 | $user->srp_v = $parameters["v"]; |
136 | $user->auth_version =$parameters["version"]; | 136 | $user->auth_version =$parameters["version"]; |
137 | } | 137 | } |
138 | 138 | ||
139 | function updateUserData($parameters, &$user) { | 139 | function updateUserData($parameters, &$user) { |
140 | $user->header = $parameters["header"]; | 140 | $user->header = $parameters["header"]; |
141 | $user->statistics =$parameters["statistics"]; | 141 | $user->statistics =$parameters["statistics"]; |
142 | $user->version =$parameters["version"]; | 142 | $user->version =$parameters["version"]; |
143 | $user->lock = $parameters["lock"]; | 143 | if (array_key_exists("lock", $parameters)) { |
144 | $user->lock = $parameters["lock"]; | ||
145 | } | ||
144 | } | 146 | } |
145 | 147 | ||
146 | function updateRecordData($parameters, &$record, &$recordVersion) { | 148 | function updateRecordData($parameters, &$record, &$recordVersion) { |
147 | $recordData = $parameters["record"]; | 149 | $recordData = $parameters["record"]; |
148 | $record->reference =$recordData["reference"]; | 150 | $record->reference =$recordData["reference"]; |
149 | $record->data = $recordData["data"]; | 151 | $record->data = $recordData["data"]; |
150 | $record->version = $recordData["version"]; | 152 | $record->version = $recordData["version"]; |
151 | 153 | ||
152 | $recordVersionData = $parameters["currentRecordVersion"]; | 154 | $recordVersionData = $parameters["currentRecordVersion"]; |
153 | $recordVersion->reference = $recordVersionData ["reference"]; | 155 | $recordVersion->reference = $recordVersionData ["reference"]; |
154 | $recordVersion->data = $recordVersionData ["data"]; | 156 | $recordVersion->data = $recordVersionData ["data"]; |
155 | $recordVersion->version = $recordVersionData ["version"]; | 157 | $recordVersion->version = $recordVersionData ["version"]; |
156 | $recordVersion->previous_version_id =$recordVersionData ["previousVersion"]; | 158 | if (array_key_exists("previousVersion", $recordVersionData)) { |
159 | $recordVersion->previous_version_id =$recordVersionData ["previousVersion"]; | ||
160 | } | ||
157 | $recordVersion->previous_version_key =$recordVersionData ["previousVersionKey"]; | 161 | $recordVersion->previous_version_key =$recordVersionData ["previousVersionKey"]; |
158 | } | 162 | } |
159 | 163 | ||
160 | //----------------------------------------------------------------------------- | 164 | //----------------------------------------------------------------------------- |
161 | 165 | ||
162 | function updateOTPStatus(&$otp, $status) { | 166 | function updateOTPStatus(&$otp, $status) { |
163 | $otpStatus = new onetimepasswordstatus(); | 167 | $otpStatus = new onetimepasswordstatus(); |
164 | $selectedStatuses = $otpStatus->GetList(array(array("code", "=", $status))); | 168 | $selectedStatuses = $otpStatus->GetList(array(array("code", "=", $status))); |
165 | $otpStatus = $selectedStatuses[0]; | 169 | $otpStatus = $selectedStatuses[0]; |
166 | $otp->SetOnetimepasswordstatus($otpStatus); | 170 | $otp->SetOnetimepasswordstatus($otpStatus); |
167 | } | 171 | } |
168 | 172 | ||
169 | function updateOTP($parameters, &$otp, $status) { | 173 | function updateOTP($parameters, &$otp, $status) { |
170 | $otp->reference = $parameters["reference"]; | 174 | $otp->reference = $parameters["reference"]; |
171 | $otp->key = $parameters["key"]; | 175 | $otp->key = $parameters["key"]; |
172 | $otp->key_checksum= $parameters["keyChecksum"]; | 176 | $otp->key_checksum= $parameters["keyChecksum"]; |
@@ -352,32 +356,33 @@ error_log("oneTimePassword"); | |||
352 | throw new Exception("The requested One Time Password has been disabled, due to a wrong keyChecksum"); | 356 | throw new Exception("The requested One Time Password has been disabled, due to a wrong keyChecksum"); |
353 | } | 357 | } |
354 | } else { | 358 | } else { |
355 | throw new Exception("The requested One Time Password was not active"); | 359 | throw new Exception("The requested One Time Password was not active"); |
356 | } | 360 | } |
357 | } else { | 361 | } else { |
358 | throw new Exception("The requested One Time Password has not been found"); | 362 | throw new Exception("The requested One Time Password has not been found"); |
359 | } | 363 | } |
360 | 364 | ||
361 | //============================================================= | 365 | //============================================================= |
362 | } | 366 | } |
363 | 367 | ||
364 | break; | 368 | break; |
365 | 369 | ||
366 | case "message": | 370 | case "message": |
367 | error_log("message"); | 371 | error_log("message"); |
372 | //error_log("message: ".json_encode($parameters)); | ||
368 | if ($parameters["srpSharedSecret"] == $_SESSION["K"]) { | 373 | if ($parameters["srpSharedSecret"] == $_SESSION["K"]) { |
369 | $message = $parameters["message"]; | 374 | $message = $parameters["message"]; |
370 | 375 | ||
371 | //============================================================= | 376 | //============================================================= |
372 | if ($message == "getUserDetails") { | 377 | if ($message == "getUserDetails") { |
373 | //{"message":"getUserDetails", "srpSharedSecret":"f18e5cf7c3a83b67d4db9444af813ee48c13daf4f8f6635397d593e52ba89a08", "parameters":{}} | 378 | //{"message":"getUserDetails", "srpSharedSecret":"f18e5cf7c3a83b67d4db9444af813ee48c13daf4f8f6635397d593e52ba89a08", "parameters":{}} |
374 | $user = new user(); | 379 | $user = new user(); |
375 | $user = $user->Get($_SESSION["userId"]); | 380 | $user = $user->Get($_SESSION["userId"]); |
376 | 381 | ||
377 | $result["header"] = $user->header; | 382 | $result["header"] = $user->header; |
378 | 383 | ||
379 | $records = $user->GetRecordList(); | 384 | $records = $user->GetRecordList(); |
380 | foreach ($records as $record) { | 385 | foreach ($records as $record) { |
381 | $recordStats["updateDate"] = $record->update_date; | 386 | $recordStats["updateDate"] = $record->update_date; |
382 | $recordsStats[$record->reference] = $recordStats; | 387 | $recordsStats[$record->reference] = $recordStats; |
383 | } | 388 | } |
@@ -434,74 +439,229 @@ error_log("message"); | |||
434 | $record->SaveNew(); | 439 | $record->SaveNew(); |
435 | $recordVersion->SaveNew(); | 440 | $recordVersion->SaveNew(); |
436 | 441 | ||
437 | $record->AddRecordversion($recordVersion); | 442 | $record->AddRecordversion($recordVersion); |
438 | $user->AddRecord($record); | 443 | $user->AddRecord($record); |
439 | 444 | ||
440 | $record->Save(); | 445 | $record->Save(); |
441 | $recordVersion->Save(); | 446 | $recordVersion->Save(); |
442 | } | 447 | } |
443 | 448 | ||
444 | $user->Save(); | 449 | $user->Save(); |
445 | 450 | ||
446 | $result["lock"] = $user->lock; | 451 | $result["lock"] = $user->lock; |
447 | $result["result"] = "done"; | 452 | $result["result"] = "done"; |
448 | 453 | ||
449 | //============================================================= | 454 | //============================================================= |
455 | } else if ($message == "saveChanges") { | ||
456 | |||
457 | //{ | ||
458 | // "message":"saveChanges", | ||
459 | // "srpSharedSecret":"edc78508907c942173818f7247fa64869ba80672a7aa8d27b8fa6bfe524fb9c8", | ||
460 | // "parameters":{ | ||
461 | // "records":{ | ||
462 | // "updated":[ | ||
463 | // { | ||
464 | // "currentRecordVersion":{ | ||
465 | // "previousVersionKey":"####", | ||
466 | // "reference":"08c8eb7ec528fbf987bbfb84fe2e960cf9ae937b19fbb5f05d8d90a7039fac6a", | ||
467 | // "data":"WYQ16AjodjsmyZDXa4MKxOju0F…beD/zXlbVb0Zj0ZI/N55bZ", | ||
468 | // "version":"0.3" | ||
469 | // }, | ||
470 | // "record":{ | ||
471 | // "reference":"83de5304f60a808e48a815c6203d7d3f24874d3f40faba420bbc60b376fcc356", | ||
472 | // "data":"B6uBuBE Aly0knvgrUppodDTGZQC…guizL9QvHCWyM bQQBGBVvHZ6LfA==", | ||
473 | // "version":"0.3" | ||
474 | // } | ||
475 | // } | ||
476 | // ], | ||
477 | // "deleted":[ | ||
478 | // | ||
479 | // ] | ||
480 | // }, | ||
481 | // "user":{ | ||
482 | // "header":"{\"rec…sion\":\"0.1\"}", | ||
483 | // "statistics":"e6iXVEM4i8ZatPZFCCads/9F", | ||
484 | // "version":"0.3" | ||
485 | // } | ||
486 | // } | ||
487 | //} | ||
488 | $user = new user(); | ||
489 | $user = $user->Get($_SESSION["userId"]); | ||
490 | updateUserData($parameters["parameters"]["user"], $user); | ||
491 | |||
492 | $recordToUpdateParameterList = $parameters["parameters"]["records"]["updated"]; | ||
493 | $c = count($recordToUpdateParameterList); | ||
494 | for ($i=0; $i<$c; $i++) { | ||
495 | $recordList = $user->GetRecordList(array(array("reference", "=", $recordToUpdateParameterList [$i]["record"]["reference"]))); | ||
496 | if (count($recordList) == 0) { | ||
497 | $currentRecord = new record(); | ||
498 | $currentVersion = new recordversion(); | ||
499 | $isNewRecord = true; | ||
500 | } else { | ||
501 | $currentRecord = $recordList[0]; | ||
502 | $currentRecordVersions = $currentRecord->GetRecordversionList(); | ||
503 | $currentVersion = $currentRecordVersions[0]; | ||
504 | $isNewRecord = false; | ||
505 | } | ||
506 | |||
507 | updateRecordData($recordToUpdateParameterList[$i], $currentRecord, $currentVersion); | ||
508 | |||
509 | if ($isNewRecord == true) { | ||
510 | $currentRecord->SaveNew(); | ||
511 | $currentVersion->SaveNew(); | ||
512 | |||
513 | $currentRecord->AddRecordversion($currentVersion); | ||
514 | $user->AddRecord($currentRecord); | ||
515 | } | ||
516 | |||
517 | $currentRecord->Save(); | ||
518 | $currentVersion->Save(); | ||
519 | } | ||
520 | |||
521 | $user->Save(); | ||
522 | |||
523 | $recordToDeleteReferenceList = $parameters["parameters"]["records"]["deleted"]; | ||
524 | $recordList = array(); | ||
525 | $c = count($recordToDeleteReferenceList); | ||
526 | for ($i=0; $i<$c; $i++) { | ||
527 | array_push($recordList, array("reference", "=", $recordToDeleteReferenceList[$i])); | ||
528 | } | ||
529 | |||
530 | $record = new record(); | ||
531 | $record->DeleteList($recordList, true); | ||
532 | |||
533 | $result["lock"] = $user->lock; | ||
534 | $result["result"] = "done"; | ||
535 | |||
536 | //============================================================= | ||
450 | } else if ($message == "getRecordDetail") { | 537 | } else if ($message == "getRecordDetail") { |
451 | //{ | 538 | //{ |
452 | //"message":"getRecordDetail", | 539 | //"message":"getRecordDetail", |
453 | //"srpSharedSecret":"4c00dcb66a9f2aea41a87e4707c526874e2eb29cc72d2c7086837e53d6bf2dfe", | 540 | //"srpSharedSecret":"4c00dcb66a9f2aea41a87e4707c526874e2eb29cc72d2c7086837e53d6bf2dfe", |
454 | //"parameters":{ | 541 | //"parameters":{ |
455 | // "reference":"740009737139a189cfa2b1019a6271aaa39467b59e259706564b642ff3838d50" | 542 | // "reference":"740009737139a189cfa2b1019a6271aaa39467b59e259706564b642ff3838d50" |
456 | //} | 543 | //} |
457 | //} | 544 | //} |
458 | // | 545 | // |
459 | //result = { | 546 | //result = { |
460 | // currentVersion:{ | 547 | // currentVersion:{ |
461 | // reference:"88943d709c3ea2442d4f58eaaec6409276037e5a37e0a6d167b9dad9e947e854", | 548 | // reference:"88943d709c3ea2442d4f58eaaec6409276037e5a37e0a6d167b9dad9e947e854", |
462 | // accessDate:"Wed, 13 February 2008 14:25:12 UTC", | 549 | // accessDate:"Wed, 13 February 2008 14:25:12 UTC", |
463 | // creationDate:"Tue, 17 April 2007 17:17:52 UTC", | 550 | // creationDate:"Tue, 17 April 2007 17:17:52 UTC", |
464 | // version:"0.2", | 551 | // version:"0.2", |
465 | // data:"xI3WXddQLFtL......EGyKnnAVik", | 552 | // data:"xI3WXddQLFtL......EGyKnnAVik", |
466 | // updateDate:"Tue, 17 April 2007 17:17:52 UTC", | 553 | // updateDate:"Tue, 17 April 2007 17:17:52 UTC", |
467 | // header:"####" | 554 | // header:"####" |
468 | // } | 555 | // } |
469 | // reference:"13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551", | 556 | // reference:"13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551", |
470 | // oldestUsedEncryptedVersion:"0.2", | 557 | // oldestUsedEncryptedVersion:"0.2", |
471 | // accessDate:"Wed, 13 February 2008 14:25:12 UTC", | 558 | // accessDate:"Wed, 13 February 2008 14:25:12 UTC", |
472 | // creationDate:"Wed, 14 March 2007 13:53:11 UTC", | 559 | // creationDate:"Wed, 14 March 2007 13:53:11 UTC", |
473 | // version:"0.2", | 560 | // version:"0.2", |
474 | // updatedDate:"Tue, 17 April 2007 17:17:52 UTC", | 561 | // updatedDate:"Tue, 17 April 2007 17:17:52 UTC", |
475 | // data:"0/BjzyY6jeh71h...pAw2++NEyylGhMC5C5f5m8pBApYziN84s4O3JQ3khW/1UttQl4=" | 562 | // data:"0/BjzyY6jeh71h...pAw2++NEyylGhMC5C5f5m8pBApYziN84s4O3JQ3khW/1UttQl4=" |
476 | //} | 563 | //} |
564 | |||
565 | |||
566 | // #Actual result (causing error in /gamma) | ||
567 | //{ | ||
568 | // "result" : { | ||
569 | // "currentVersion" : { | ||
570 | // "reference" : "cb05177f96a832062c6b936d24323cb74a64e2ef1d97ee026cd1003755af7495", | ||
571 | // "data" : "RAnoHmikp7RmiZ2WVyEMW+Ia", | ||
572 | // "header" : "", | ||
573 | // "version" : "0.3", | ||
574 | // "creationDate" : "0000-00-00 00:00:00", | ||
575 | // "updateDate" : "2011-10-09 19:49:11", | ||
576 | // "accessDate" : "2011-10-09 19:49:11" | ||
577 | // }, | ||
578 | // "reference" : "b07e2afa2ba782b9f379649b36ded6de0452b43c27e6b887c7ce4f2a93f44346", | ||
579 | // "data" : "NtK1nkLUabbJQx5uO8ept...ZJ5dkJYYkyh3VQ==", | ||
580 | // "version" : "0.3", | ||
581 | // "creationDate" : "2011-10-09 19:49:11", | ||
582 | // "updateDate" : "Tue, 30 Nov 1999 00:00:00 +0000", | ||
583 | // "accessDate" : "0000-00-00 00:00:00", | ||
584 | // "oldestUsedEncryptedVersion" : "---" | ||
585 | // } | ||
586 | //} | ||
587 | |||
588 | |||
589 | // #Response from the online /gamma version | ||
590 | //{ | ||
591 | // "result" : { | ||
592 | // "versions" : { | ||
593 | // "e2c193f017ad4f6babf51de59f7550a40596afc0c27373b6a360e426b5bc06de" : { | ||
594 | // "reference" : "e2c193f017ad4f6babf51de59f7550a40596afc0c27373b6a360e426b5bc06de", | ||
595 | // "data" : "s\/3ClggH4uCcf+BkIMqQ...+W0PVt\/MJ3t7s1g0g", | ||
596 | // "creationDate" : "Mon, 10 October 2011 14:42:42 UTC", | ||
597 | // "header" : "####", | ||
598 | // "updateDate" : "Mon, 10 October 2011 14:42:42 UTC", | ||
599 | // "previousVersion" : "a96a6d8b9ac73fcdf874d8a8534ffb2d43da8f5222e96a4a29bd2ae437619463", | ||
600 | // "version" : "0.3", | ||
601 | // "accessDate" : "Mon, 10 October 2011 14:42:42 UTC", | ||
602 | // "previousVersionKey" : "####" | ||
603 | // }, | ||
604 | // [...] | ||
605 | // "a96a6d8b9ac73fcdf874d8a8534ffb2d43da8f5222e96a4a29bd2ae437619463" : { | ||
606 | // "reference" : "a96a6d8b9ac73fcdf874d8a8534ffb2d43da8f5222e96a4a29bd2ae437619463", | ||
607 | // "accessDate" : "Mon, 10 October 2011 14:41:17 UTC", | ||
608 | // "creationDate" : "Mon, 27 October 2008 08:16:14 UTC", | ||
609 | // "version" : "0.3", | ||
610 | // "data" : "m3yhZu81UAjCY6U2Kn...IUCb9suV0fldGOg=", | ||
611 | // "updateDate" : "Mon, 27 October 2008 08:16:14 UTC", | ||
612 | // "header" : "####" | ||
613 | // } | ||
614 | // }, | ||
615 | // "oldestUsedEncryptedVersion" : "0.2", | ||
616 | // "reference" : "36ec1a41118813ced3553534fa2607d781cba687768db305beed368a8e06e113", | ||
617 | // "data" : "frlUkTbaOWD9j2ROat...ruWioCK0Mss27oHjPg==", | ||
618 | // "creationDate" : "Wed, 14 March 2007 17:39:35 UTC", | ||
619 | // "version" : "0.3", | ||
620 | // "accessDate" : "Mon, 10 October 2011 14:45:12 UTC", | ||
621 | // "currentVersion" : "e2c193f017ad4f6babf51de59f7550a40596afc0c27373b6a360e426b5bc06de", | ||
622 | // "updatedDate" : "Mon, 10 October 2011 14:45:12 UTC" | ||
623 | // }, | ||
624 | // "toll" : { | ||
625 | // "requestType" : "MESSAGE", | ||
626 | // "targetValue" : "a516c942a3792cc620775a41f8870a6c7b51796d9a94da978a75da6a52eb1e10", | ||
627 | // "cost" : 2 | ||
628 | // } | ||
629 | // } | ||
630 | |||
477 | $record = new record(); | 631 | $record = new record(); |
478 | 632 | ||
479 | $recordList = $record->GetList(array(array("reference", "=", $parameters["parameters"]["reference"]))); | 633 | $recordList = $record->GetList(array(array("reference", "=", $parameters["parameters"]["reference"]))); |
480 | $currentRecord = $recordList[0]; | 634 | $currentRecord = $recordList[0]; |
481 | $currentRecordVersions = $currentRecord->GetRecordversionList(); | 635 | $currentRecordVersions = $currentRecord->GetRecordversionList(); |
482 | $currentVersion = $currentRecordVersions[0]; | 636 | $currentVersion = $currentRecordVersions[0]; |
483 | 637 | ||
484 | $result["currentVersion"] = array(); | 638 | $result["versions"] = array(); |
485 | $result["currentVersion"]["reference"] =$currentVersion->reference; | 639 | // foreach ($currentRecordVersions as $currentVersion) { |
486 | $result["currentVersion"]["data"] = $currentVersion->data; | 640 | $result["versions"][$currentVersion->reference] = array(); |
487 | $result["currentVersion"]["header"] = $currentVersion->header; | 641 | $result["versions"][$currentVersion->reference]["reference"]= $currentVersion->reference; |
488 | $result["currentVersion"]["version"] = $currentVersion->version; | 642 | $result["versions"][$currentVersion->reference]["data"] = $currentVersion->data; |
489 | $result["currentVersion"]["creationDate"] =$currentVersion->creation_date; | 643 | $result["versions"][$currentVersion->reference]["header"] = $currentVersion->header; |
490 | $result["currentVersion"]["updateDate"] =$currentVersion->update_date; | 644 | $result["versions"][$currentVersion->reference]["version"] = $currentVersion->version; |
491 | $result["currentVersion"]["accessDate"] =$currentVersion->access_date; | 645 | $result["versions"][$currentVersion->reference]["creationDate"]= $currentVersion->creation_date; |
646 | $result["versions"][$currentVersion->reference]["updateDate"]= $currentVersion->update_date; | ||
647 | $result["versions"][$currentVersion->reference]["accessDate"]= $currentVersion->access_date; | ||
648 | |||
649 | // } | ||
650 | $result["currentVersion"] = $currentVersion->reference; | ||
651 | // $result["currentVersion"] = $currentRecord->currentVersion; //???? | ||
492 | 652 | ||
493 | $result["reference"] = $currentRecord->reference; | 653 | $result["reference"] = $currentRecord->reference; |
494 | $result["data"] = $currentRecord->data; | 654 | $result["data"] = $currentRecord->data; |
495 | $result["version"] = $currentRecord->version; | 655 | $result["version"] = $currentRecord->version; |
496 | $result["creationDate"] =$currentRecord->creation_date; | 656 | $result["creationDate"] =$currentRecord->creation_date; |
497 | $result["updateDate"] = $currentRecord->update_date; | 657 | $result["updateDate"] = $currentRecord->update_date; |
498 | $result["accessDate"] = $currentRecord->access_date; | 658 | $result["accessDate"] = $currentRecord->access_date; |
499 | $result["oldestUsedEncryptedVersion"] ="---"; | 659 | $result["oldestUsedEncryptedVersion"] ="---"; |
500 | 660 | ||
501 | //============================================================= | 661 | //============================================================= |
502 | } else if ($message == "updateData") { | 662 | } else if ($message == "updateData") { |
503 | //{ | 663 | //{ |
504 | //"message":"updateData", | 664 | //"message":"updateData", |
505 | //"srpSharedSecret":"4e4aadb1d64513ec4dd42f5e8d5b2d4363de75e4424b6bcf178c9d6a246356c5", | 665 | //"srpSharedSecret":"4e4aadb1d64513ec4dd42f5e8d5b2d4363de75e4424b6bcf178c9d6a246356c5", |
506 | //"parameters":{ | 666 | //"parameters":{ |
507 | // "records":[ | 667 | // "records":[ |
@@ -736,20 +896,23 @@ error_log("message"); | |||
736 | $result["message"] = "Trying to communicate without an active connection"; | 896 | $result["message"] = "Trying to communicate without an active connection"; |
737 | } | 897 | } |
738 | break; | 898 | break; |
739 | 899 | ||
740 | case "logout": | 900 | case "logout": |
741 | error_log("logout"); | 901 | error_log("logout"); |
742 | session_destroy(); | 902 | session_destroy(); |
743 | break; | 903 | break; |
744 | 904 | ||
745 | default: | 905 | default: |
746 | error_log("default"); | 906 | error_log("default"); |
747 | $result["result"] = $parameters; | 907 | $result["result"] = $parameters; |
748 | break; | 908 | break; |
749 | } | 909 | } |
750 | 910 | ||
751 | session_write_close(); | 911 | session_write_close(); |
912 | |||
913 | $finalResult = Array(); | ||
914 | $finalResult["result"] = $result; | ||
752 | 915 | ||
753 | echo(json_encode($result)); | 916 | echo(json_encode($finalResult)); |
754 | error_log("result: ".json_encode($result)); | 917 | error_log("result: ".json_encode($finalResult)); |
755 | ?> | 918 | ?> |
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Record.js b/frontend/beta/js/Clipperz/PM/DataModel/Record.js index 270f2ae..ffb45de 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/Record.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/Record.js | |||
@@ -266,44 +266,49 @@ Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, { | |||
266 | } else { | 266 | } else { |
267 | result = MochiKit.Async.succeed(this.decryptedData()); | 267 | result = MochiKit.Async.succeed(this.decryptedData()); |
268 | } | 268 | } |
269 | //MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.decryptData"); | 269 | //MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.decryptData"); |
270 | 270 | ||
271 | return result; | 271 | return result; |
272 | }, | 272 | }, |
273 | 273 | ||
274 | //------------------------------------------------------------------------- | 274 | //------------------------------------------------------------------------- |
275 | 275 | ||
276 | 'processData': function(someValues) { | 276 | 'processData': function(someValues) { |
277 | //MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.processData"); | 277 | //MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.processData"); |
278 | //MochiKit.Logging.logDebug("--- Record.processData: " + Clipperz.Base.serializeJSON(someValues)); | 278 | //MochiKit.Logging.logDebug("--- Record.processData: " + Clipperz.Base.serializeJSON(someValues)); |
279 | if (this.shouldProcessData()) { | 279 | if (this.shouldProcessData()) { |
280 | var currentVersionParameters; | 280 | var currentVersionParameters; |
281 | 281 | ||
282 | console.log("Record.processData", someValues); | ||
282 | this.processDataToExtractLegacyValues(someValues['data']); | 283 | this.processDataToExtractLegacyValues(someValues['data']); |
283 | 284 | ||
284 | if (typeof(someValues['data']['notes']) != 'undefined') { | 285 | if (typeof(someValues['data']['notes']) != 'undefined') { |
285 | this.setNotes(someValues['data']['notes']); | 286 | this.setNotes(someValues['data']['notes']); |
286 | } | 287 | } |
288 | |||
287 | if (someValues['data']['currentVersionKey'] != null) { | 289 | if (someValues['data']['currentVersionKey'] != null) { |
288 | this.setCurrentVersionKey(someValues['data']['currentVersionKey']); | 290 | this.setCurrentVersionKey(someValues['data']['currentVersionKey']); |
289 | } else { | 291 | } else { |
290 | this.setCurrentVersionKey(this.key()); | 292 | this.setCurrentVersionKey(this.key()); |
291 | } | 293 | } |
292 | 294 | ||
293 | currentVersionParameters = someValues['currentVersion']; | 295 | // currentVersionParameters = someValues['currentVersion']; |
296 | currentVersionParameters = someValues['versions'][someValues['currentVersion']]; | ||
297 | console.log("Record.processData - this.currentVersionKey()", this.currentVersionKey()); | ||
298 | console.log("Record.processData - currentVersionParameters", currentVersionParameters); | ||
294 | currentVersionParameters['key'] = this.currentVersionKey(); | 299 | currentVersionParameters['key'] = this.currentVersionKey(); |
295 | this.setCurrentVersion(new Clipperz.PM.DataModel.RecordVersion(this, currentVersionParameters)); | 300 | this.setCurrentVersion(new Clipperz.PM.DataModel.RecordVersion(this, currentVersionParameters)); |
296 | 301 | ||
297 | if (someValues['data']['directLogins'] != null) { | 302 | if (someValues['data']['directLogins'] != null) { |
298 | vardirectLoginReference; | 303 | vardirectLoginReference; |
299 | 304 | ||
300 | for (directLoginReference in someValues['data']['directLogins']) { | 305 | for (directLoginReference in someValues['data']['directLogins']) { |
301 | var directLogin; | 306 | var directLogin; |
302 | var directLoginParameters; | 307 | var directLoginParameters; |
303 | 308 | ||
304 | directLoginParameters = someValues['data']['directLogins'][directLoginReference]; | 309 | directLoginParameters = someValues['data']['directLogins'][directLoginReference]; |
305 | directLoginParameters.record = this; | 310 | directLoginParameters.record = this; |
306 | directLoginParameters.reference = directLoginReference; | 311 | directLoginParameters.reference = directLoginReference; |
307 | 312 | ||
308 | directLogin = new Clipperz.PM.DataModel.DirectLogin(directLoginParameters); | 313 | directLogin = new Clipperz.PM.DataModel.DirectLogin(directLoginParameters); |
309 | this.addDirectLogin(directLogin, true); | 314 | this.addDirectLogin(directLogin, true); |
diff --git a/frontend/beta/js/Clipperz/PM/Proxy.js b/frontend/beta/js/Clipperz/PM/Proxy.js index f476196..bec9195 100644 --- a/frontend/beta/js/Clipperz/PM/Proxy.js +++ b/frontend/beta/js/Clipperz/PM/Proxy.js | |||
@@ -103,34 +103,33 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { | |||
103 | 103 | ||
104 | 'addToll': function(aToll) { | 104 | 'addToll': function(aToll) { |
105 | //console.log(">>> Proxy.addToll", aToll); | 105 | //console.log(">>> Proxy.addToll", aToll); |
106 | this.tolls()[aToll.requestType()].push(aToll); | 106 | this.tolls()[aToll.requestType()].push(aToll); |
107 | //console.log("<<< Proxy.addToll"); | 107 | //console.log("<<< Proxy.addToll"); |
108 | }, | 108 | }, |
109 | 109 | ||
110 | //========================================================================= | 110 | //========================================================================= |
111 | 111 | ||
112 | 'setTollCallback': function(someParameters) { | 112 | 'setTollCallback': function(someParameters) { |
113 | //console.log(">>> Proxy.setTollCallback", someParameters); | 113 | //console.log(">>> Proxy.setTollCallback", someParameters); |
114 | if (typeof(someParameters['toll']) != 'undefined') { | 114 | if (typeof(someParameters['toll']) != 'undefined') { |
115 | //console.log("added a new toll", someParameters['toll']); | 115 | //console.log("added a new toll", someParameters['toll']); |
116 | this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); | 116 | this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); |
117 | } | 117 | } |
118 | //console.log("<<< Proxy.setTallCallback", someParameters['result']); | 118 | //console.log("<<< Proxy.setTallCallback", someParameters['result']); |
119 | //return someParameters['result']; | 119 | return someParameters['result']; |
120 | return someParameters; | ||
121 | }, | 120 | }, |
122 | 121 | ||
123 | //========================================================================= | 122 | //========================================================================= |
124 | 123 | ||
125 | 'registration': function (someParameters) { | 124 | 'registration': function (someParameters) { |
126 | return this.processMessage('registration', someParameters, 'REGISTER'); | 125 | return this.processMessage('registration', someParameters, 'REGISTER'); |
127 | }, | 126 | }, |
128 | 127 | ||
129 | 'handshake': function (someParameters) { | 128 | 'handshake': function (someParameters) { |
130 | return this.processMessage('handshake', someParameters, 'CONNECT'); | 129 | return this.processMessage('handshake', someParameters, 'CONNECT'); |
131 | }, | 130 | }, |
132 | 131 | ||
133 | 'message': function (someParameters) { | 132 | 'message': function (someParameters) { |
134 | return this.processMessage('message', someParameters, 'MESSAGE'); | 133 | return this.processMessage('message', someParameters, 'MESSAGE'); |
135 | }, | 134 | }, |
136 | 135 | ||
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js deleted file mode 100755 index 34a10c2..0000000 --- a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js +++ b/dev/null | |||
@@ -1,262 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
28 | |||
29 | //============================================================================= | ||
30 | |||
31 | Clipperz.PM.Proxy.PHP = function(args) { | ||
32 | Clipperz.PM.Proxy.PHP.superclass.constructor.call(this, args); | ||
33 | /* | ||
34 | this._tolls = { | ||
35 | 'CONNECT':[], | ||
36 | 'REGISTER':[], | ||
37 | 'MESSAGE':[] | ||
38 | }; | ||
39 | */ | ||
40 | return this; | ||
41 | } | ||
42 | |||
43 | YAHOO.extendX(Clipperz.PM.Proxy.PHP, Clipperz.PM.Proxy, { | ||
44 | |||
45 | 'toString': function() { | ||
46 | return "Clipperz.PM.Proxy.PHP - " + this.args(); | ||
47 | }, | ||
48 | |||
49 | //========================================================================= | ||
50 | /* | ||
51 | 'tolls': function() { | ||
52 | return this._tolls; | ||
53 | }, | ||
54 | */ | ||
55 | //------------------------------------------------------------------------- | ||
56 | /* | ||
57 | 'payToll': function(aRequestType, someParameters) { | ||
58 | vardeferredResult; | ||
59 | |||
60 | //MochiKit.Logging.logDebug(">>> Proxy.DWR.payToll: " + aRequestType); | ||
61 | if (this.tolls()[aRequestType].length > 0) { | ||
62 | deferredResult = MochiKit.Async.succeed(this.tolls()[aRequestType].pop()); | ||
63 | } else { | ||
64 | //MochiKit.Logging.logDebug("### " + aRequestType + " toll NOT immediately available; request queued."); | ||
65 | deferredResult = new MochiKit.Async.Deferred(); | ||
66 | deferredResult.addCallback(function(someParameters) { | ||
67 | return new Clipperz.PM.Toll(someParameters['toll']); | ||
68 | }) | ||
69 | com_clipperz_pm_Proxy.knock(Clipperz.Base.serializeJSON({requestType:aRequestType}), { | ||
70 | callback:MochiKit.Base.method(deferredResult, 'callback'), | ||
71 | errorHandler:MochiKit.Base.method(deferredResult, 'errback') | ||
72 | }); | ||
73 | } | ||
74 | |||
75 | deferredResult.addCallback(function(aToll) { | ||
76 | return aToll.deferredPay(); | ||
77 | }); | ||
78 | deferredResult.addCallback(function(someParameters, aToll) { | ||
79 | var result; | ||
80 | |||
81 | result = { | ||
82 | parameters: someParameters, | ||
83 | toll: aToll | ||
84 | } | ||
85 | |||
86 | return result; | ||
87 | }, someParameters); | ||
88 | |||
89 | return deferredResult; | ||
90 | }, | ||
91 | */ | ||
92 | //------------------------------------------------------------------------- | ||
93 | /* | ||
94 | 'addToll': function(aToll) { | ||
95 | this.tolls()[aToll.requestType()].push(aToll); | ||
96 | }, | ||
97 | */ | ||
98 | //========================================================================= | ||
99 | /* | ||
100 | 'setTollCallback': function(someParameters) { | ||
101 | //MochiKit.Logging.logDebug(">>> Proxy.DWR.setTollCallback"); | ||
102 | //MochiKit.Logging.logDebug("--- Proxy.DWR.setTollCallback - " + Clipperz.Base.serializeJSON(someParameters)); | ||
103 | if (typeof(someParameters['toll']) != 'undefined') { | ||
104 | this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); | ||
105 | } | ||
106 | return someParameters['result']; | ||
107 | }, | ||
108 | */ | ||
109 | //========================================================================= | ||
110 | |||
111 | 'registration': function(someParameters) { | ||
112 | return this.sendMessage('registration', someParameters, 'REGISTER'); | ||
113 | }, | ||
114 | |||
115 | //------------------------------------------------------------------------- | ||
116 | |||
117 | 'handshake': function(someParameters) { | ||
118 | /* | ||
119 | _s = "e8a2162f29aeaabb729f5625e9740edbf0cd80ac77c6b19ab951ed6c88443b8c"; | ||
120 | _v = new Clipperz.Crypto.BigInt("955e2db0f7844aca372f5799e5f7e51b5866718493096908bd66abcf1d068108", 16); | ||
121 | _b = new Clipperz.Crypto.BigInt("5761e6c84d22ea3c5649de01702d60f674ccfe79238540eb34c61cd020230c53", 16); | ||
122 | |||
123 | _B = _v.add(Clipperz.Crypto.SRP.g().powerModule(_b, Clipperz.Crypto.SRP.n())); | ||
124 | _u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_B.asString(10))).toHexString(), 16); | ||
125 | _A = new Clipperz.Crypto.BigInt("3b3567ec33d73673552e960872eb154d091a2488915941038aef759236a27e64", 16); | ||
126 | _S = (_A.multiply(_v.powerModule(_u, Clipperz.Crypto.SRP.n()))).powerModule(_b, Clipperz.Crypto.SRP.n()); | ||
127 | _K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_S.asString(10))).toHexString().slice(2); | ||
128 | _M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _B.asString(10) + _K)).toHexString().slice(2); | ||
129 | _M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _M1 + _K)).toHexString().slice(2); | ||
130 | |||
131 | // MochiKit.Logging.logDebug("b = " + _b.asString(16)); | ||
132 | // MochiKit.Logging.logDebug("v = " + _v.asString(16)); | ||
133 | MochiKit.Logging.logDebug("B = " + _B.asString(16)); | ||
134 | MochiKit.Logging.logDebug("u = " + _u.asString(16)); | ||
135 | MochiKit.Logging.logDebug("S = " + _S.asString(16)); | ||
136 | MochiKit.Logging.logDebug("K = " + _K); | ||
137 | MochiKit.Logging.logDebug("M1 = " + _M1); | ||
138 | MochiKit.Logging.logDebug("M2 = " + _M2); | ||
139 | // MochiKit.Logging.logDebug("someParameters.version: " + someParameters.version); | ||
140 | */ | ||
141 | return this.sendMessage('handshake', someParameters, 'CONNECT'); | ||
142 | }, | ||
143 | |||
144 | //------------------------------------------------------------------------- | ||
145 | |||
146 | 'message': function(someParameters) { | ||
147 | return this.sendMessage('message', someParameters, 'MESSAGE'); | ||
148 | }, | ||
149 | |||
150 | //------------------------------------------------------------------------- | ||
151 | |||
152 | 'logout': function(someParameters) { | ||
153 | //MochiKit.Logging.logDebug("=== Proxy.DWR.logout"); | ||
154 | return this.sendMessage('logout', someParameters, 'MESSAGE'); | ||
155 | }, | ||
156 | |||
157 | //========================================================================= | ||
158 | |||
159 | 'sendMessage': function(aFunctionName, someParameters, aRequestType) { | ||
160 | /* | ||
161 | vardeferredResult; | ||
162 | var proxy; | ||
163 | |||
164 | //MochiKit.Logging.logDebug(">>> Proxy.DWR.sendMessage - " + aFunctionName + " - " + aRequestType); | ||
165 | proxy = this; | ||
166 | |||
167 | deferredResult = new MochiKit.Async.Deferred(); | ||
168 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.1 Proxy.DWR.sendMessage - 1: " + res); return res;}); | ||
169 | deferredResult.addCallback(MochiKit.Base.method(proxy, 'payToll'), aRequestType); | ||
170 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.2 Proxy.DWR.sendMessage - 2: " + Clipperz.Base.serializeJSON(res)); return res;}); | ||
171 | deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName); | ||
172 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + res); return res;}); | ||
173 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); | ||
174 | deferredResult.callback(someParameters); | ||
175 | |||
176 | //MochiKit.Logging.logDebug("<<< Proxy.DWR.sendMessage"); | ||
177 | return deferredResult; | ||
178 | */ | ||
179 | |||
180 | // return this.sendRemoteMessage(aFunctionName, someParameters); | ||
181 | |||
182 | |||
183 | vardeferredResult; | ||
184 | var proxy; | ||
185 | |||
186 | proxy = this; | ||
187 | |||
188 | deferredResult = new MochiKit.Async.Deferred(); | ||
189 | deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName); | ||
190 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3: " + res); return res;}); | ||
191 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3.1: " + Clipperz.Base.serializeJSON(res)); return res;}); | ||
192 | |||
193 | deferredResult.callback(someParameters); | ||
194 | |||
195 | return deferredResult; | ||
196 | }, | ||
197 | |||
198 | //========================================================================= | ||
199 | |||
200 | 'sendRemoteMessage': function(aFunctionName, someParameters) { | ||
201 | /* | ||
202 | vardeferredResult; | ||
203 | |||
204 | //MochiKit.Logging.logDebug(">>> Proxy.DWR.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this); | ||
205 | deferredResult = new MochiKit.Async.Deferred(); | ||
206 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 1: " + res); return res;}); | ||
207 | // deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback')); | ||
208 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 2: " + res); return res;}); | ||
209 | |||
210 | com_clipperz_pm_Proxy[aFunctionName](Clipperz.Base.serializeJSON(someParameters), { | ||
211 | callback:MochiKit.Base.method(deferredResult, 'callback'), | ||
212 | errorHandler:MochiKit.Base.method(deferredResult, 'errback') | ||
213 | }); | ||
214 | //MochiKit.Logging.logDebug("<<< Proxy.PHP.sendRemoteMessage - result: " + deferredResult); | ||
215 | |||
216 | return deferredResult; | ||
217 | */ | ||
218 | |||
219 | vardeferredResult; | ||
220 | var parameters; | ||
221 | |||
222 | //MochiKit.Logging.logDebug(">>> Proxy.PHP.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this); | ||
223 | parameters = {}; | ||
224 | parameters['method'] = aFunctionName; | ||
225 | // parameters['version'] = someParameters['version']; | ||
226 | // parameters['message'] = someParameters['message']; | ||
227 | parameters['parameters'] = Clipperz.Base.serializeJSON(someParameters); | ||
228 | //MochiKit.Logging.logDebug("--- Proxy.PHP.sendRemoteMessage('" + Clipperz.Base.serializeJSON(parameters) + ") - " + this); | ||
229 | deferredResult = new MochiKit.Async.Deferred(); | ||
230 | deferredResult.addCallback(MochiKit.Async.doXHR, "./php/index.php", { | ||
231 | method:'POST', | ||
232 | sendContent:MochiKit.Base.queryString(parameters), | ||
233 | headers:{"Content-Type":"application/x-www-form-urlencoded"} | ||
234 | }); | ||
235 | //deferredResult.addCallback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - 2: " + res.responseText); return res;}); | ||
236 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - ERROR: " + res); return res;}); | ||
237 | deferredResult.addCallback(MochiKit.Async.evalJSONRequest); | ||
238 | deferredResult.addCallback(function (someValues) { | ||
239 | if (someValues['result'] == 'EXCEPTION') { | ||
240 | throw someValues['message']; | ||
241 | } | ||
242 | return someValues; | ||
243 | }) | ||
244 | deferredResult.callback(); | ||
245 | |||
246 | return deferredResult; | ||
247 | }, | ||
248 | |||
249 | //========================================================================= | ||
250 | |||
251 | 'isReadOnly': function() { | ||
252 | return false; | ||
253 | }, | ||
254 | |||
255 | //========================================================================= | ||
256 | __syntaxFix__: "syntax fix" | ||
257 | |||
258 | }); | ||
259 | |||
260 | //============================================================================= | ||
261 | |||
262 | //Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.PHP("Proxy.PHP - async test"); | ||
diff --git a/frontend/gamma/html/index_template.html b/frontend/gamma/html/index_template.html index 8cf838c..bedb243 100644 --- a/frontend/gamma/html/index_template.html +++ b/frontend/gamma/html/index_template.html | |||
@@ -26,32 +26,37 @@ Clipperz_normalizedNewLine = '\x0d\x0a'; | |||
26 | @js_DEBUG@ | 26 | @js_DEBUG@ |
27 | 27 | ||
28 | </head> | 28 | </head> |
29 | <body> | 29 | <body> |
30 | <div id="mainDiv"> | 30 | <div id="mainDiv"> |
31 | <div id="loading"> | 31 | <div id="loading"> |
32 | <a href="http://www.clipperz.com" target="_blank"><div id="logo"></div></a> | 32 | <a href="http://www.clipperz.com" target="_blank"><div id="logo"></div></a> |
33 | <h5 class="clipperzPayoff">keep it to yourself!</h5> | 33 | <h5 class="clipperzPayoff">keep it to yourself!</h5> |
34 | <h2>loading ...</h2> | 34 | <h2>loading ...</h2> |
35 | </div> | 35 | </div> |
36 | 36 | ||
37 | @js_INSTALL@ | 37 | @js_INSTALL@ |
38 | 38 | ||
39 | </div> | 39 | </div> |
40 | <div id="applicationVersionType" class="@application.version.type@"></div> | 40 | <div id="applicationVersionType" class="@application.version.type@"></div> |
41 | 41 | ||
42 | <script> | ||
43 | Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.JSON({'url':'@request.path@', 'shouldPayTolls':@should.pay.toll@}); | ||
44 | /*offline_data_placeholder*/ | ||
45 | </script> | ||
46 | |||
42 | <!-- --> | 47 | <!-- --> |
43 | <div id="javaScriptAlert"> | 48 | <div id="javaScriptAlert"> |
44 | <div class="mask"></div> | 49 | <div class="mask"></div> |
45 | <div class="message"> | 50 | <div class="message"> |
46 | <div class="header"></div> | 51 | <div class="header"></div> |
47 | <div class="body"> | 52 | <div class="body"> |
48 | <div class="alertLogo"></div> | 53 | <div class="alertLogo"></div> |
49 | <div class="alert"> | 54 | <div class="alert"> |
50 | <h1>Attention!</h1> | 55 | <h1>Attention!</h1> |
51 | <p>If you can read this message, the chances are that your browser does not properly support JavaScript? or you have disabled this functionality yourself.</p> | 56 | <p>If you can read this message, the chances are that your browser does not properly support JavaScript? or you have disabled this functionality yourself.</p> |
52 | <h3>Javascript is required to access Clipperz.</h3> | 57 | <h3>Javascript is required to access Clipperz.</h3> |
53 | <h5>Please enable scripting or upgrade your browser.</h5> | 58 | <h5>Please enable scripting or upgrade your browser.</h5> |
54 | </div> | 59 | </div> |
55 | </div> | 60 | </div> |
56 | <div class="footer"></div> | 61 | <div class="footer"></div> |
57 | </div> | 62 | </div> |
diff --git a/frontend/gamma/js/Clipperz/Async.js b/frontend/gamma/js/Clipperz/Async.js index 7c9d783..97d8ecf 100644 --- a/frontend/gamma/js/Clipperz/Async.js +++ b/frontend/gamma/js/Clipperz/Async.js | |||
@@ -49,88 +49,94 @@ Clipperz.Async.Deferred = function(aName, args) { | |||
49 | //============================================================================= | 49 | //============================================================================= |
50 | 50 | ||
51 | Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { | 51 | Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { |
52 | 52 | ||
53 | 'name': function () { | 53 | 'name': function () { |
54 | return this._name; | 54 | return this._name; |
55 | }, | 55 | }, |
56 | 56 | ||
57 | 'args': function () { | 57 | 'args': function () { |
58 | return this._args; | 58 | return this._args; |
59 | }, | 59 | }, |
60 | 60 | ||
61 | //----------------------------------------------------------------------------- | 61 | //----------------------------------------------------------------------------- |
62 | 62 | ||
63 | 'callback': function (aValue) { | 63 | 'callback': function (aValue) { |
64 | if (this._shouldTrace) { | 64 | if (this._shouldTrace) { |
65 | Clipperz.log("CALLBACK " + this._name, aValue); | 65 | //Clipperz.log("CALLBACK " + this._name, aValue); |
66 | console.log("CALLBACK " + this._name, aValue); | ||
66 | } | 67 | } |
67 | 68 | ||
68 | if (this.chained == false) { | 69 | if (this.chained == false) { |
69 | var message; | 70 | var message; |
70 | 71 | ||
71 | message = "ERROR [" + this._name + "]"; | 72 | message = "ERROR [" + this._name + "]"; |
72 | this.addErrback(function(aResult) { | 73 | this.addErrback(function(aResult) { |
73 | if (! (aResult instanceof MochiKit.Async.CancelledError)) { | 74 | if (! (aResult instanceof MochiKit.Async.CancelledError)) { |
74 | Clipperz.log(message, aResult); | 75 | Clipperz.log(message, aResult); |
75 | } | 76 | } |
76 | return aResult; | 77 | return aResult; |
77 | }); | 78 | }); |
78 | 79 | ||
79 | if (this._shouldTrace) { | 80 | if (this._shouldTrace) { |
80 | var resultMessage; | 81 | var resultMessage; |
81 | 82 | ||
82 | resultMessage = "RESULT " + this._name + " <=="; | 83 | resultMessage = "RESULT " + this._name + " <=="; |
83 | // this.addCallback(function(aResult) { | 84 | // this.addCallback(function(aResult) { |
84 | Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) { | 85 | Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) { |
85 | Clipperz.log(resultMessage, aResult); | 86 | //Clipperz.log(resultMessage, aResult); |
87 | console.log(resultMessage, aResult); | ||
86 | 88 | ||
87 | return aResult; | 89 | return aResult; |
88 | }); | 90 | }); |
89 | } | 91 | } |
90 | } | 92 | } |
91 | 93 | ||
92 | if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) { | 94 | if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) { |
93 | Clipperz.log("callback " + this._name, this); | 95 | Clipperz.log("callback " + this._name, this); |
94 | } | 96 | } |
95 | 97 | ||
96 | return Clipperz.Async.Deferred.superclass.callback.apply(this, arguments); | 98 | return Clipperz.Async.Deferred.superclass.callback.apply(this, arguments); |
97 | }, | 99 | }, |
98 | 100 | ||
99 | //----------------------------------------------------------------------------- | 101 | //----------------------------------------------------------------------------- |
100 | 102 | ||
101 | 'addCallback': function () { | 103 | 'addCallback': function () { |
102 | var message; | 104 | var message; |
103 | 105 | ||
104 | if (this._shouldTrace) { | 106 | if (this._shouldTrace) { |
105 | this._count ++; | 107 | this._count ++; |
106 | message = "[" + this._count + "] " + this._name + " "; | 108 | message = "[" + this._count + "] " + this._name + " "; |
107 | // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;}); | 109 | // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;}); |
108 | this.addCallbacks( | 110 | this.addCallbacks( |
109 | function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, | 111 | //function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, |
110 | function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} | 112 | function(aResult) {console.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, |
113 | //function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} | ||
114 | function(aResult) {console.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} | ||
111 | ); | 115 | ); |
112 | } | 116 | } |
113 | 117 | ||
114 | Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments); | 118 | Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments); |
115 | 119 | ||
116 | if (this._shouldTrace) { | 120 | if (this._shouldTrace) { |
117 | // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;}); | 121 | // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;}); |
118 | this.addCallbacks( | 122 | this.addCallbacks( |
119 | function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;}, | 123 | //function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;}, |
120 | function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;} | 124 | function(aResult) {console.log("-OK- " + message + "<--", aResult); return aResult;}, |
125 | //function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;} | ||
126 | function(aResult) {console.log("FAIL " + message + "<--", aResult); return aResult;} | ||
121 | ); | 127 | ); |
122 | } | 128 | } |
123 | }, | 129 | }, |
124 | 130 | ||
125 | //============================================================================= | 131 | //============================================================================= |
126 | 132 | ||
127 | 'addCallbackPass': function() { | 133 | 'addCallbackPass': function() { |
128 | var passFunction; | 134 | var passFunction; |
129 | 135 | ||
130 | passFunction = MochiKit.Base.partial.apply(null, arguments); | 136 | passFunction = MochiKit.Base.partial.apply(null, arguments); |
131 | 137 | ||
132 | this.addCallback(function() { | 138 | this.addCallback(function() { |
133 | var result; | 139 | var result; |
134 | 140 | ||
135 | result = arguments[arguments.length -1]; | 141 | result = arguments[arguments.length -1]; |
136 | passFunction(); | 142 | passFunction(); |
@@ -393,32 +399,33 @@ MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, { | |||
393 | } | 399 | } |
394 | 400 | ||
395 | return this.result(); | 401 | return this.result(); |
396 | }, | 402 | }, |
397 | 403 | ||
398 | //----------------------------------------------------------------------------- | 404 | //----------------------------------------------------------------------------- |
399 | 405 | ||
400 | 'handleMethodCallDone': function(anIndexValue, aResult) { | 406 | 'handleMethodCallDone': function(anIndexValue, aResult) { |
401 | this.incrementNumberOfMethodsDone(); | 407 | this.incrementNumberOfMethodsDone(); |
402 | this.methodResults()[anIndexValue] = aResult; | 408 | this.methodResults()[anIndexValue] = aResult; |
403 | 409 | ||
404 | if (this.numberOfMethodsDone() < this.methods().length) { | 410 | if (this.numberOfMethodsDone() < this.methods().length) { |
405 | //nothing to do here other than possibly log something | 411 | //nothing to do here other than possibly log something |
406 | } else if (this.numberOfMethodsDone() == this.methods().length) { | 412 | } else if (this.numberOfMethodsDone() == this.methods().length) { |
407 | this.result().callback(); | 413 | this.result().callback(); |
408 | } else if (this.numberOfMethodsDone() > this.methods().length) { | 414 | } else if (this.numberOfMethodsDone() > this.methods().length) { |
415 | alert("Clipperz.Async.Deferred.handleMethodCallDone -> WTF!"); | ||
409 | //WTF!!! :( | 416 | //WTF!!! :( |
410 | } | 417 | } |
411 | 418 | ||
412 | }, | 419 | }, |
413 | 420 | ||
414 | //----------------------------------------------------------------------------- | 421 | //----------------------------------------------------------------------------- |
415 | 422 | ||
416 | __syntaxFix__: "syntax fix" | 423 | __syntaxFix__: "syntax fix" |
417 | }); | 424 | }); |
418 | 425 | ||
419 | //############################################################################# | 426 | //############################################################################# |
420 | 427 | ||
421 | MochiKit.Base.update(Clipperz.Async, { | 428 | MochiKit.Base.update(Clipperz.Async, { |
422 | 429 | ||
423 | 'callbacks': function (aName, someFunctions, someArguments, aCallbackValue) { | 430 | 'callbacks': function (aName, someFunctions, someArguments, aCallbackValue) { |
424 | var deferredResult; | 431 | var deferredResult; |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy.js b/frontend/gamma/js/Clipperz/PM/Proxy.js index 190bffd..9817eac 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy.js | |||
@@ -129,33 +129,33 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { | |||
129 | return this.processMessage('handshake', someParameters, 'CONNECT'); | 129 | return this.processMessage('handshake', someParameters, 'CONNECT'); |
130 | }, | 130 | }, |
131 | 131 | ||
132 | 'message': function (someParameters) { | 132 | 'message': function (someParameters) { |
133 | return this.processMessage('message', someParameters, 'MESSAGE'); | 133 | return this.processMessage('message', someParameters, 'MESSAGE'); |
134 | }, | 134 | }, |
135 | 135 | ||
136 | 'logout': function (someParameters) { | 136 | 'logout': function (someParameters) { |
137 | return this.processMessage('logout', someParameters, 'MESSAGE'); | 137 | return this.processMessage('logout', someParameters, 'MESSAGE'); |
138 | }, | 138 | }, |
139 | 139 | ||
140 | //========================================================================= | 140 | //========================================================================= |
141 | 141 | ||
142 | 'processMessage': function (aFunctionName, someParameters, aRequestType) { | 142 | 'processMessage': function (aFunctionName, someParameters, aRequestType) { |
143 | vardeferredResult; | 143 | vardeferredResult; |
144 | 144 | ||
145 | deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:false}); | 145 | deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:true}); |
146 | deferredResult.addMethod(this, 'payToll', aRequestType); | 146 | deferredResult.addMethod(this, 'payToll', aRequestType); |
147 | deferredResult.addMethod(this, 'sendMessage', aFunctionName); | 147 | deferredResult.addMethod(this, 'sendMessage', aFunctionName); |
148 | deferredResult.addMethod(this, 'setTollCallback'); | 148 | deferredResult.addMethod(this, 'setTollCallback'); |
149 | deferredResult.callback(someParameters); | 149 | deferredResult.callback(someParameters); |
150 | 150 | ||
151 | return deferredResult; | 151 | return deferredResult; |
152 | }, | 152 | }, |
153 | 153 | ||
154 | //========================================================================= | 154 | //========================================================================= |
155 | 155 | ||
156 | 'sendMessage': function () { | 156 | 'sendMessage': function () { |
157 | throw Clipperz.Base.exception.AbstractMethod; | 157 | throw Clipperz.Base.exception.AbstractMethod; |
158 | }, | 158 | }, |
159 | 159 | ||
160 | //========================================================================= | 160 | //========================================================================= |
161 | 161 | ||