@@ -26,9 +26,9 @@ |
||
26 | 26 | require_once __DIR__ . '/pens.php'; |
27 | 27 | |
28 | 28 | class MyPackageHandler extends PENSPackageHandler { |
29 | - public function processPackage($request, $path_to_package) { |
|
30 | - // Do the package processing here |
|
31 | - } |
|
29 | + public function processPackage($request, $path_to_package) { |
|
30 | + // Do the package processing here |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $handler = new MyPackageHandler(); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @licence http://www.gnu.org/licenses/gpl.txt |
24 | 24 | */ |
25 | 25 | |
26 | -require_once __DIR__ . '/pens.php'; |
|
26 | +require_once __DIR__.'/pens.php'; |
|
27 | 27 | |
28 | 28 | class MyPackageHandler extends PENSPackageHandler { |
29 | 29 | public function processPackage($request, $path_to_package) { |
@@ -44,25 +44,25 @@ |
||
44 | 44 | */ |
45 | 45 | class TestPENSResponse extends UnitTestCase { |
46 | 46 | |
47 | - public function testCreationFromPENSException() { |
|
48 | - $object = new PENSResponse(new PENSException(1101)); |
|
49 | - $this->assertEqual($object->getError(), 1101); |
|
50 | - $this->assertNotNull($object->getErrorText()); |
|
51 | - } |
|
47 | + public function testCreationFromPENSException() { |
|
48 | + $object = new PENSResponse(new PENSException(1101)); |
|
49 | + $this->assertEqual($object->getError(), 1101); |
|
50 | + $this->assertNotNull($object->getErrorText()); |
|
51 | + } |
|
52 | 52 | |
53 | - public function testCreationFromArguments() { |
|
54 | - $object = new PENSResponse(0, "collect command received and understood"); |
|
55 | - $this->assertIdentical($object->getError(), 0); |
|
56 | - $this->assertEqual($object->getErrorText(), "collect command received and understood"); |
|
57 | - } |
|
53 | + public function testCreationFromArguments() { |
|
54 | + $object = new PENSResponse(0, "collect command received and understood"); |
|
55 | + $this->assertIdentical($object->getError(), 0); |
|
56 | + $this->assertEqual($object->getErrorText(), "collect command received and understood"); |
|
57 | + } |
|
58 | 58 | |
59 | - public function testCreationFromHTTPResponse() { |
|
60 | - $eol = PENSConfig::$eol; |
|
61 | - $response = "error=1101".$eol."error-text=unable to parse PENS command".$eol."version=1.0.0".$eol."pens-data=".$eol; |
|
62 | - $object = new PENSResponse($response); |
|
63 | - $this->assertIdentical($object->getError(), 1101); |
|
64 | - $this->assertIdentical($object->getErrorText(), "unable to parse PENS command"); |
|
65 | - $this->assertIdentical($object->getVersion(), "1.0.0"); |
|
66 | - $this->assertNull($object->getPensData()); |
|
67 | - } |
|
59 | + public function testCreationFromHTTPResponse() { |
|
60 | + $eol = PENSConfig::$eol; |
|
61 | + $response = "error=1101".$eol."error-text=unable to parse PENS command".$eol."version=1.0.0".$eol."pens-data=".$eol; |
|
62 | + $object = new PENSResponse($response); |
|
63 | + $this->assertIdentical($object->getError(), 1101); |
|
64 | + $this->assertIdentical($object->getErrorText(), "unable to parse PENS command"); |
|
65 | + $this->assertIdentical($object->getVersion(), "1.0.0"); |
|
66 | + $this->assertNull($object->getPensData()); |
|
67 | + } |
|
68 | 68 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | require_once(dirname(__FILE__)."/../pens.php"); |
34 | 34 | |
35 | 35 | class MyPackageHandler extends PENSPackageHandler { |
36 | - public function processPackage($request, $path_to_package) { |
|
37 | - } |
|
36 | + public function processPackage($request, $path_to_package) { |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -49,39 +49,39 @@ discard block |
||
49 | 49 | */ |
50 | 50 | class TestPENSPackageHandler extends UnitTestCase { |
51 | 51 | |
52 | - public function testSupportedPackageTypesInvalid() { |
|
53 | - $object = new MyPackageHandler(); |
|
54 | - $object->setSupportedPackageTypes("testing"); |
|
55 | - $this->assertEqual($object->getSupportedPackageTypes(), null); |
|
56 | - } |
|
52 | + public function testSupportedPackageTypesInvalid() { |
|
53 | + $object = new MyPackageHandler(); |
|
54 | + $object->setSupportedPackageTypes("testing"); |
|
55 | + $this->assertEqual($object->getSupportedPackageTypes(), null); |
|
56 | + } |
|
57 | 57 | |
58 | - public function testSupportedPackageTypesInvalid2() { |
|
59 | - $object = new MyPackageHandler(); |
|
60 | - $object->setSupportedPackageTypes(array("aicc-pkg", "testing")); |
|
61 | - $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg")); |
|
62 | - } |
|
58 | + public function testSupportedPackageTypesInvalid2() { |
|
59 | + $object = new MyPackageHandler(); |
|
60 | + $object->setSupportedPackageTypes(array("aicc-pkg", "testing")); |
|
61 | + $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg")); |
|
62 | + } |
|
63 | 63 | |
64 | - public function testSupportedPackageTypesValid() { |
|
65 | - $object = new MyPackageHandler(); |
|
66 | - $object->setSupportedPackageTypes(array("aicc-pkg", "lms-qti")); |
|
67 | - $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg", "lms-qti")); |
|
68 | - } |
|
64 | + public function testSupportedPackageTypesValid() { |
|
65 | + $object = new MyPackageHandler(); |
|
66 | + $object->setSupportedPackageTypes(array("aicc-pkg", "lms-qti")); |
|
67 | + $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg", "lms-qti")); |
|
68 | + } |
|
69 | 69 | |
70 | - public function testSupportedPackageFormatsInvalid() { |
|
71 | - $object = new MyPackageHandler(); |
|
72 | - $object->setSupportedPackageFormats("testing"); |
|
73 | - $this->assertEqual($object->getSupportedPackageFormats(), null); |
|
74 | - } |
|
70 | + public function testSupportedPackageFormatsInvalid() { |
|
71 | + $object = new MyPackageHandler(); |
|
72 | + $object->setSupportedPackageFormats("testing"); |
|
73 | + $this->assertEqual($object->getSupportedPackageFormats(), null); |
|
74 | + } |
|
75 | 75 | |
76 | - public function testSupportedPackageFormatsInvalid2() { |
|
77 | - $object = new MyPackageHandler(); |
|
78 | - $object->setSupportedPackageFormats(array("zip", "testing")); |
|
79 | - $this->assertEqual($object->getSupportedPackageFormats(), array("zip")); |
|
80 | - } |
|
76 | + public function testSupportedPackageFormatsInvalid2() { |
|
77 | + $object = new MyPackageHandler(); |
|
78 | + $object->setSupportedPackageFormats(array("zip", "testing")); |
|
79 | + $this->assertEqual($object->getSupportedPackageFormats(), array("zip")); |
|
80 | + } |
|
81 | 81 | |
82 | - public function testSupportedPackageFormatsValid() { |
|
83 | - $object = new MyPackageHandler(); |
|
84 | - $object->setSupportedPackageFormats(array("zip", "jar")); |
|
85 | - $this->assertEqual($object->getSupportedPackageFormats(), array("zip", "jar")); |
|
86 | - } |
|
82 | + public function testSupportedPackageFormatsValid() { |
|
83 | + $object = new MyPackageHandler(); |
|
84 | + $object->setSupportedPackageFormats(array("zip", "jar")); |
|
85 | + $this->assertEqual($object->getSupportedPackageFormats(), array("zip", "jar")); |
|
86 | + } |
|
87 | 87 | } |
@@ -46,77 +46,77 @@ |
||
46 | 46 | */ |
47 | 47 | class TestPENSServer extends WebTestCase { |
48 | 48 | |
49 | - private $_valid_params = array( |
|
50 | - "command" => "collect", |
|
51 | - "pens-version" => "1.0.0", |
|
52 | - "package-type" => "aicc-pkg", |
|
53 | - "package-type-version" => "1.0", |
|
54 | - "package-format" => "zip", |
|
55 | - "package-id" => "http://myurl.com/12345", |
|
56 | - "package-url" => "http://www.aicc.org/pens/sample/captivatequiz.zip", |
|
57 | - "package-url-expiry" => "2099-04-09T14:17:43Z", |
|
58 | - "client" => "test-pens-server", |
|
59 | - "receipt" => PENS_TEST_RECEIPT_MAILTO); |
|
49 | + private $_valid_params = array( |
|
50 | + "command" => "collect", |
|
51 | + "pens-version" => "1.0.0", |
|
52 | + "package-type" => "aicc-pkg", |
|
53 | + "package-type-version" => "1.0", |
|
54 | + "package-format" => "zip", |
|
55 | + "package-id" => "http://myurl.com/12345", |
|
56 | + "package-url" => "http://www.aicc.org/pens/sample/captivatequiz.zip", |
|
57 | + "package-url-expiry" => "2099-04-09T14:17:43Z", |
|
58 | + "client" => "test-pens-server", |
|
59 | + "receipt" => PENS_TEST_RECEIPT_MAILTO); |
|
60 | 60 | |
61 | - public function testEmptyQuery() { |
|
62 | - $this->get(PENS_TEST_SERVER_URL); |
|
63 | - $this->assertText("error=2002"); |
|
64 | - } |
|
61 | + public function testEmptyQuery() { |
|
62 | + $this->get(PENS_TEST_SERVER_URL); |
|
63 | + $this->assertText("error=2002"); |
|
64 | + } |
|
65 | 65 | |
66 | - public function testValidQuery() { |
|
67 | - $this->get(PENS_TEST_SERVER_URL, $this->_valid_params); |
|
68 | - $this->assertText("error=0"); |
|
69 | - } |
|
66 | + public function testValidQuery() { |
|
67 | + $this->get(PENS_TEST_SERVER_URL, $this->_valid_params); |
|
68 | + $this->assertText("error=0"); |
|
69 | + } |
|
70 | 70 | |
71 | - private function invalidParameterTest($name, $value, $error) { |
|
72 | - $params = $this->_valid_params; |
|
73 | - $params[$name] = $value; |
|
74 | - $this->get(PENS_TEST_SERVER_URL, $params); |
|
75 | - $this->assertText("error=".$error); |
|
76 | - } |
|
71 | + private function invalidParameterTest($name, $value, $error) { |
|
72 | + $params = $this->_valid_params; |
|
73 | + $params[$name] = $value; |
|
74 | + $this->get(PENS_TEST_SERVER_URL, $params); |
|
75 | + $this->assertText("error=".$error); |
|
76 | + } |
|
77 | 77 | |
78 | - private function validParameterTest($name, $value) { |
|
79 | - $params = $this->_valid_params; |
|
80 | - $params[$name] = $value; |
|
81 | - $this->get(PENS_TEST_SERVER_URL, $params); |
|
82 | - $this->assertText("error=0"); |
|
83 | - } |
|
78 | + private function validParameterTest($name, $value) { |
|
79 | + $params = $this->_valid_params; |
|
80 | + $params[$name] = $value; |
|
81 | + $this->get(PENS_TEST_SERVER_URL, $params); |
|
82 | + $this->assertText("error=0"); |
|
83 | + } |
|
84 | 84 | |
85 | - public function testInvalidCommand() { |
|
86 | - $this->invalidParameterTest("command", "invalid", 2002); |
|
87 | - } |
|
85 | + public function testInvalidCommand() { |
|
86 | + $this->invalidParameterTest("command", "invalid", 2002); |
|
87 | + } |
|
88 | 88 | |
89 | - public function testInvalidVersion() { |
|
90 | - $this->invalidParameterTest("pens-version", "0.8.0", 2001); |
|
91 | - } |
|
89 | + public function testInvalidVersion() { |
|
90 | + $this->invalidParameterTest("pens-version", "0.8.0", 2001); |
|
91 | + } |
|
92 | 92 | |
93 | - public function testInvalidPackageType() { |
|
94 | - $this->invalidParameterTest("package-type", "invalid", 2003); |
|
95 | - } |
|
93 | + public function testInvalidPackageType() { |
|
94 | + $this->invalidParameterTest("package-type", "invalid", 2003); |
|
95 | + } |
|
96 | 96 | |
97 | - public function testEmptyPackageTypeVersion() { |
|
98 | - $this->invalidParameterTest("package-type-version", null, 2004); |
|
99 | - } |
|
97 | + public function testEmptyPackageTypeVersion() { |
|
98 | + $this->invalidParameterTest("package-type-version", null, 2004); |
|
99 | + } |
|
100 | 100 | |
101 | - public function testInvalidPackageFormat() { |
|
102 | - $this->invalidParameterTest("package-format", "invalid", 2005); |
|
103 | - } |
|
101 | + public function testInvalidPackageFormat() { |
|
102 | + $this->invalidParameterTest("package-format", "invalid", 2005); |
|
103 | + } |
|
104 | 104 | |
105 | - public function testInvalidPackageId() { |
|
106 | - $this->invalidParameterTest("package-id", "invalid", 2007); |
|
107 | - } |
|
105 | + public function testInvalidPackageId() { |
|
106 | + $this->invalidParameterTest("package-id", "invalid", 2007); |
|
107 | + } |
|
108 | 108 | |
109 | - public function testInvalidPackageUrl() { |
|
110 | - $this->invalidParameterTest("package-url", "invalid", 2008); |
|
111 | - } |
|
109 | + public function testInvalidPackageUrl() { |
|
110 | + $this->invalidParameterTest("package-url", "invalid", 2008); |
|
111 | + } |
|
112 | 112 | |
113 | - public function testInvalidPackageUrlExpiry() { |
|
114 | - $this->invalidParameterTest("package-url-expiry", "invalid", 2009); |
|
115 | - } |
|
113 | + public function testInvalidPackageUrlExpiry() { |
|
114 | + $this->invalidParameterTest("package-url-expiry", "invalid", 2009); |
|
115 | + } |
|
116 | 116 | |
117 | - public function testValidPackageUrlExpiry() { |
|
118 | - $this->validParameterTest("package-url-expiry", "2099-01-01"); |
|
119 | - } |
|
117 | + public function testValidPackageUrlExpiry() { |
|
118 | + $this->validParameterTest("package-url-expiry", "2099-01-01"); |
|
119 | + } |
|
120 | 120 | |
121 | 121 | } |
122 | 122 |
@@ -8,8 +8,8 @@ |
||
8 | 8 | /** |
9 | 9 | * Init |
10 | 10 | */ |
11 | -require_once __DIR__ . '/../../../main/inc/global.inc.php'; |
|
12 | -require_once __DIR__ . '/../config.php'; |
|
11 | +require_once __DIR__.'/../../../main/inc/global.inc.php'; |
|
12 | +require_once __DIR__.'/../config.php'; |
|
13 | 13 | |
14 | 14 | if (!api_is_anonymous()) { |
15 | 15 | $currentPageClass = isset($_POST['page_class']) ? $_POST['page_class'] : ''; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if ($data['type'] === HOOK_EVENT_TYPE_PRE) { |
68 | 68 | |
69 | 69 | } elseif ($data['type'] === HOOK_EVENT_TYPE_POST) { |
70 | - /** @var \nusoap_server $server */ |
|
70 | + /** @var \nusoap_server $server */ |
|
71 | 71 | $server = &$data['server']; |
72 | 72 | |
73 | 73 | /** WSSessionListInCategory */ |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | } |
425 | 425 | if (!WSHelperVerifyKey($params)) { |
426 | 426 | |
427 | - //return return_error(WS_ERROR_SECRET_KEY); |
|
427 | + //return return_error(WS_ERROR_SECRET_KEY); |
|
428 | 428 | } |
429 | 429 | // Check if category ID is set |
430 | 430 | if (!empty($params['id']) && empty($params['name'])) { |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package chamilo.plugin.advanced_subscription |
7 | 7 | */ |
8 | 8 | |
9 | -require_once __DIR__ . '/../config.php'; |
|
9 | +require_once __DIR__.'/../config.php'; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Class HookAdvancedSubscription extends the HookObserver to implements |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | if ($debug) { |
422 | 422 | error_log(__FUNCTION__); |
423 | - error_log('Params ' . print_r($params, 1)); |
|
423 | + error_log('Params '.print_r($params, 1)); |
|
424 | 424 | } |
425 | 425 | if (!WSHelperVerifyKey($params)) { |
426 | 426 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | |
472 | 472 | if ($debug) { |
473 | 473 | error_log('WSUserSubscribedInCourse'); |
474 | - error_log('Params ' . print_r($params, 1)); |
|
474 | + error_log('Params '.print_r($params, 1)); |
|
475 | 475 | } |
476 | 476 | if (!WSHelperVerifyKey($params)) { |
477 | 477 | return return_error(WS_ERROR_SECRET_KEY); |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | |
577 | 577 | if ($debug) { |
578 | 578 | error_log('WSListSessionsDetailsByCategory'); |
579 | - error_log('Params ' . print_r($params, 1)); |
|
579 | + error_log('Params '.print_r($params, 1)); |
|
580 | 580 | } |
581 | 581 | $secretKey = $params['secret_key']; |
582 | 582 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * Init |
9 | 9 | */ |
10 | -require_once __DIR__ . '/../config.php'; |
|
10 | +require_once __DIR__.'/../config.php'; |
|
11 | 11 | // protect |
12 | 12 | api_protect_admin_script(); |
13 | 13 | // start plugin |
@@ -85,8 +85,7 @@ discard block |
||
85 | 85 | $data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED; |
86 | 86 | $student['rejectUrl'] = $plugin->getQueueUrl($data); |
87 | 87 | $student['complete_name'] = $isWesternNameOrder ? |
88 | - $student['firstname'] . ', ' . $student['lastname'] : |
|
89 | - $student['lastname'] . ', ' . $student['firstname']; |
|
88 | + $student['firstname'].', '.$student['lastname'] : $student['lastname'].', '.$student['firstname']; |
|
90 | 89 | } |
91 | 90 | $tpl->assign('session', $sessionArray); |
92 | 91 | $tpl->assign('students', $studentList['students']); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | //exit; |
9 | 9 | |
10 | -require_once __DIR__ . '/../../config.php'; |
|
10 | +require_once __DIR__.'/../../config.php'; |
|
11 | 11 | |
12 | 12 | api_protect_admin_script(); |
13 | 13 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * Init |
9 | 9 | */ |
10 | -require_once __DIR__ . '/../config.php'; |
|
10 | +require_once __DIR__.'/../config.php'; |
|
11 | 11 | // start plugin |
12 | 12 | $plugin = AdvancedSubscriptionPlugin::create(); |
13 | 13 | // Session ID |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // Init template |
25 | 25 | $tpl = new Template($plugin->get_lang('plugin_title')); |
26 | 26 | |
27 | -$isAllowToDoRequest = $plugin->isAllowedToDoRequest( $data['studentUserId'], $data, true); |
|
27 | +$isAllowToDoRequest = $plugin->isAllowedToDoRequest($data['studentUserId'], $data, true); |
|
28 | 28 | |
29 | 29 | if (!$isAllowToDoRequest) { |
30 | 30 | $tpl->assign('errorMessages', $plugin->getErrorMessages()); |