@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * @licence http://www.gnu.org/licenses/gpl.txt |
27 | 27 | */ |
28 | 28 | |
29 | -require_once __DIR__ . '/pens_config.php'; |
|
30 | -require_once __DIR__ . '/pens_message.php'; |
|
31 | -require_once __DIR__ . '/pens_exception.php'; |
|
29 | +require_once __DIR__.'/pens_config.php'; |
|
30 | +require_once __DIR__.'/pens_message.php'; |
|
31 | +require_once __DIR__.'/pens_exception.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * PENSResponse |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function __construct($error, $error_text = null, $pens_data = null) { |
75 | 75 | $this->_pens_version = PENSConfig::$version; |
76 | - if($error instanceof PENSException) { |
|
76 | + if ($error instanceof PENSException) { |
|
77 | 77 | $this->_error = $error->getCode(); |
78 | 78 | $this->_error_text = $error->getMessage(); |
79 | - } else if(is_string($error)){ |
|
79 | + } else if (is_string($error)) { |
|
80 | 80 | // Parse the string |
81 | 81 | $this->parseResponse($error); |
82 | - } else if(is_array($error)) { |
|
82 | + } else if (is_array($error)) { |
|
83 | 83 | // Try to build from array |
84 | 84 | $this->_error = $error["error"]; |
85 | 85 | $this->_error_text = $error["error-text"]; |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | protected function parseResponse($response) { |
101 | 101 | $lines = explode(PENSConfig::$eol, $response); |
102 | 102 | $i = 1; |
103 | - foreach($lines as $line) { |
|
104 | - if($i < 5) { |
|
103 | + foreach ($lines as $line) { |
|
104 | + if ($i < 5) { |
|
105 | 105 | $pair = explode("=", $line); |
106 | - if($pair[0] == "error") { |
|
106 | + if ($pair[0] == "error") { |
|
107 | 107 | $this->_error = intval($pair[1]); |
108 | - } else if($pair[0] == "error-text") { |
|
108 | + } else if ($pair[0] == "error-text") { |
|
109 | 109 | $this->_error_text = $pair[1]; |
110 | - } else if($pair[0] == "version") { |
|
110 | + } else if ($pair[0] == "version") { |
|
111 | 111 | $this->_pens_version = $pair[1]; |
112 | - } else if($pair[0] == "pens-data") { |
|
113 | - if(!empty($pair[1])) { |
|
112 | + } else if ($pair[0] == "pens-data") { |
|
113 | + if (!empty($pair[1])) { |
|
114 | 114 | $this->_pens_data = $pair[1].PENSConfig::$eol; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | } else { |
118 | - if(!empty($line)) { |
|
118 | + if (!empty($line)) { |
|
119 | 119 | $this->_pens_data .= $line.PENSConfig::$eol; |
120 | 120 | } |
121 | 121 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/pens/pens_request_factory.php'; |
|
4 | -require_once __DIR__ . '/pens/pens_response.php'; |
|
5 | -require_once __DIR__ . '/pens/pens_package_handler.php'; |
|
6 | -require_once __DIR__ . '/pens/pens_server.php'; |
|
7 | -require_once __DIR__ . '/pens/pens_client.php'; |
|
3 | +require_once __DIR__.'/pens/pens_request_factory.php'; |
|
4 | +require_once __DIR__.'/pens/pens_response.php'; |
|
5 | +require_once __DIR__.'/pens/pens_package_handler.php'; |
|
6 | +require_once __DIR__.'/pens/pens_server.php'; |
|
7 | +require_once __DIR__.'/pens/pens_client.php'; |
@@ -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) { |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | public function exceptionTestForValue($key, $value, $code) { |
80 | 80 | try { |
81 | 81 | $myargs = $this->args; |
82 | - if($value === null) { |
|
82 | + if ($value === null) { |
|
83 | 83 | unset($myargs[$key]); |
84 | 84 | } else { |
85 | 85 | $myargs[$key] = $value; |
86 | 86 | } |
87 | 87 | $object = $this->createObject($myargs); |
88 | 88 | $this->fail(); |
89 | - } catch(PENSException $e) { |
|
89 | + } catch (PENSException $e) { |
|
90 | 90 | $this->assertEqual($e->getCode(), $code); |
91 | 91 | } |
92 | 92 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $myargs["receipt"] = "mailto:[email protected],[email protected]"; |
179 | 179 | $object = $this->createObject($myargs); |
180 | 180 | $this->pass(); |
181 | - } catch(PENSException $e) { |
|
181 | + } catch (PENSException $e) { |
|
182 | 182 | $this->fail(); |
183 | 183 | } |
184 | 184 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $this->assertEqual($object->getAlerts(), "http://myurl.com/alerts"); |
205 | 205 | $this->assertEqual($object->getVendorData(), "here are my data"); |
206 | 206 | |
207 | - } catch(PENSException $e) { |
|
207 | + } catch (PENSException $e) { |
|
208 | 208 | $this->fail(); |
209 | 209 | } |
210 | 210 | } |
@@ -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'] : ''; |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | { |
107 | 107 | $advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE); |
108 | 108 | |
109 | - $sql = "CREATE TABLE IF NOT EXISTS $advancedSubscriptionQueueTable (" . |
|
110 | - "id int UNSIGNED NOT NULL AUTO_INCREMENT, " . |
|
111 | - "session_id int UNSIGNED NOT NULL, " . |
|
112 | - "user_id int UNSIGNED NOT NULL, " . |
|
113 | - "status int UNSIGNED NOT NULL, " . |
|
114 | - "last_message_id int UNSIGNED NOT NULL, " . |
|
115 | - "created_at datetime NOT NULL, " . |
|
116 | - "updated_at datetime NULL, " . |
|
117 | - "PRIMARY KEY PK_advanced_subscription_queue (id), " . |
|
109 | + $sql = "CREATE TABLE IF NOT EXISTS $advancedSubscriptionQueueTable (". |
|
110 | + "id int UNSIGNED NOT NULL AUTO_INCREMENT, ". |
|
111 | + "session_id int UNSIGNED NOT NULL, ". |
|
112 | + "user_id int UNSIGNED NOT NULL, ". |
|
113 | + "status int UNSIGNED NOT NULL, ". |
|
114 | + "last_message_id int UNSIGNED NOT NULL, ". |
|
115 | + "created_at datetime NOT NULL, ". |
|
116 | + "updated_at datetime NULL, ". |
|
117 | + "PRIMARY KEY PK_advanced_subscription_queue (id), ". |
|
118 | 118 | "UNIQUE KEY UK_advanced_subscription_queue (user_id, session_id)); "; |
119 | 119 | Database::query($sql); |
120 | 120 | } |
@@ -265,11 +265,10 @@ discard block |
||
265 | 265 | $now = new DateTime(api_get_utc_datetime()); |
266 | 266 | $newYearDate = $plugin->get('course_session_credit_year_start_date'); |
267 | 267 | $newYearDate = !empty($newYearDate) ? |
268 | - new \DateTime($newYearDate . $now->format('/Y')) : |
|
269 | - $now; |
|
268 | + new \DateTime($newYearDate.$now->format('/Y')) : $now; |
|
270 | 269 | $extra = new ExtraFieldValue('session'); |
271 | - $joinSessionTable = Database::get_main_table(TABLE_MAIN_SESSION_USER) . ' su INNER JOIN ' . |
|
272 | - Database::get_main_table(TABLE_MAIN_SESSION) . ' s ON s.id = su.session_id'; |
|
270 | + $joinSessionTable = Database::get_main_table(TABLE_MAIN_SESSION_USER).' su INNER JOIN '. |
|
271 | + Database::get_main_table(TABLE_MAIN_SESSION).' s ON s.id = su.session_id'; |
|
273 | 272 | $whereSessionParams = 'su.relation_type = ? AND s.access_start_date >= ? AND su.user_id = ?'; |
274 | 273 | $whereSessionParamsValues = array( |
275 | 274 | 0, |
@@ -734,14 +733,14 @@ discard block |
||
734 | 733 | $tpl->assign('termsContent', $termsAndConditions); |
735 | 734 | $termsAndConditions = $tpl->fetch('/advanced_subscription/views/terms_and_conditions_to_pdf.tpl'); |
736 | 735 | $pdf = new PDF(); |
737 | - $filename = 'terms' . sha1(rand(0,99999)); |
|
736 | + $filename = 'terms'.sha1(rand(0, 99999)); |
|
738 | 737 | $pdf->content_to_pdf($termsAndConditions, null, $filename, null, 'F'); |
739 | 738 | $fileAttachments['file'][] = array( |
740 | - 'name' => $filename . '.pdf', |
|
741 | - 'application/pdf' => $filename . '.pdf', |
|
742 | - 'tmp_name' => api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf', |
|
739 | + 'name' => $filename.'.pdf', |
|
740 | + 'application/pdf' => $filename.'.pdf', |
|
741 | + 'tmp_name' => api_get_path(SYS_ARCHIVE_PATH).$filename.'.pdf', |
|
743 | 742 | 'error' => UPLOAD_ERR_OK, |
744 | - 'size' => filesize(api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf'), |
|
743 | + 'size' => filesize(api_get_path(SYS_ARCHIVE_PATH).$filename.'.pdf'), |
|
745 | 744 | ); |
746 | 745 | $fileAttachments['comments'][] = get_lang('TermsAndConditions'); |
747 | 746 | } |
@@ -1032,7 +1031,7 @@ discard block |
||
1032 | 1031 | |
1033 | 1032 | $mergedArray = array_merge(array($sessionId), array_keys($fields)); |
1034 | 1033 | |
1035 | - $sql = "SELECT * FROM " . Database::get_main_table(TABLE_EXTRA_FIELD_VALUES) ." |
|
1034 | + $sql = "SELECT * FROM ".Database::get_main_table(TABLE_EXTRA_FIELD_VALUES)." |
|
1036 | 1035 | WHERE item_id = %d AND field_id IN (%d, %d, %d, %d, %d, %d, %d)"; |
1037 | 1036 | $sql = vsprintf($sql, $mergedArray); |
1038 | 1037 | $sessionFieldValueList = Database::query($sql); |
@@ -1048,10 +1047,10 @@ discard block |
||
1048 | 1047 | $sessionArray['description'] = SessionManager::getDescriptionFromSessionId($sessionId); |
1049 | 1048 | |
1050 | 1049 | if (isset($sessionArray['brochure'])) { |
1051 | - $sessionArray['brochure'] = api_get_path(WEB_UPLOAD_PATH) . $sessionArray['brochure']; |
|
1050 | + $sessionArray['brochure'] = api_get_path(WEB_UPLOAD_PATH).$sessionArray['brochure']; |
|
1052 | 1051 | } |
1053 | 1052 | if (isset($sessionArray['banner'])) { |
1054 | - $sessionArray['banner'] = api_get_path(WEB_UPLOAD_PATH) . $sessionArray['banner']; |
|
1053 | + $sessionArray['banner'] = api_get_path(WEB_UPLOAD_PATH).$sessionArray['banner']; |
|
1055 | 1054 | } |
1056 | 1055 | |
1057 | 1056 | return $sessionArray; |
@@ -1108,7 +1107,7 @@ discard block |
||
1108 | 1107 | */ |
1109 | 1108 | public function getSessionUrl($sessionId) |
1110 | 1109 | { |
1111 | - $url = api_get_path(WEB_CODE_PATH) . 'session/?session_id=' . intval($sessionId); |
|
1110 | + $url = api_get_path(WEB_CODE_PATH).'session/?session_id='.intval($sessionId); |
|
1112 | 1111 | |
1113 | 1112 | return $url; |
1114 | 1113 | } |
@@ -1157,16 +1156,16 @@ discard block |
||
1157 | 1156 | */ |
1158 | 1157 | public function getQueueUrl($params) |
1159 | 1158 | { |
1160 | - $url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/ajax/advanced_subscription.ajax.php?' . |
|
1161 | - 'a=' . Security::remove_XSS($params['action']) . '&' . |
|
1162 | - 's=' . intval($params['sessionId']) . '&' . |
|
1163 | - 'current_user_id=' . intval($params['currentUserId']) . '&' . |
|
1164 | - 'e=' . intval($params['newStatus']) . '&' . |
|
1165 | - 'u=' . intval($params['studentUserId']) . '&' . |
|
1166 | - 'q=' . intval($params['queueId']) . '&' . |
|
1167 | - 'is_connected=' . 1 . '&' . |
|
1168 | - 'profile_completed=' . intval($params['profile_completed']) . '&' . |
|
1169 | - 'v=' . $this->generateHash($params); |
|
1159 | + $url = api_get_path(WEB_PLUGIN_PATH).'advanced_subscription/ajax/advanced_subscription.ajax.php?'. |
|
1160 | + 'a='.Security::remove_XSS($params['action']).'&'. |
|
1161 | + 's='.intval($params['sessionId']).'&'. |
|
1162 | + 'current_user_id='.intval($params['currentUserId']).'&'. |
|
1163 | + 'e='.intval($params['newStatus']).'&'. |
|
1164 | + 'u='.intval($params['studentUserId']).'&'. |
|
1165 | + 'q='.intval($params['queueId']).'&'. |
|
1166 | + 'is_connected='.1.'&'. |
|
1167 | + 'profile_completed='.intval($params['profile_completed']).'&'. |
|
1168 | + 'v='.$this->generateHash($params); |
|
1170 | 1169 | |
1171 | 1170 | return $url; |
1172 | 1171 | } |
@@ -1219,7 +1218,7 @@ discard block |
||
1219 | 1218 | } |
1220 | 1219 | $queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE); |
1221 | 1220 | $userTable = Database::get_main_table(TABLE_MAIN_USER); |
1222 | - $userJoinTable = $queueTable . ' q INNER JOIN ' . $userTable . ' u ON q.user_id = u.user_id'; |
|
1221 | + $userJoinTable = $queueTable.' q INNER JOIN '.$userTable.' u ON q.user_id = u.user_id'; |
|
1223 | 1222 | $where = array( |
1224 | 1223 | 'where' => array( |
1225 | 1224 | 'q.session_id = ?' => array( |
@@ -1232,7 +1231,7 @@ discard block |
||
1232 | 1231 | $students = Database::select($select, $userJoinTable, $where); |
1233 | 1232 | foreach ($students as &$student) { |
1234 | 1233 | $status = intval($student['status']); |
1235 | - switch($status) { |
|
1234 | + switch ($status) { |
|
1236 | 1235 | case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE: |
1237 | 1236 | case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START: |
1238 | 1237 | $student['validation'] = ''; |
@@ -1246,7 +1245,7 @@ discard block |
||
1246 | 1245 | $student['validation'] = 'Yes'; |
1247 | 1246 | break; |
1248 | 1247 | default: |
1249 | - error_log(__FILE__ . ' ' . __FUNCTION__ . ' Student status no detected'); |
|
1248 | + error_log(__FILE__.' '.__FUNCTION__.' Student status no detected'); |
|
1250 | 1249 | } |
1251 | 1250 | } |
1252 | 1251 | $return = array( |
@@ -1295,7 +1294,7 @@ discard block |
||
1295 | 1294 | $dataPrepared['queueId'] = intval($data['queueId']); |
1296 | 1295 | $dataPrepared['newStatus'] = intval($data['newStatus']); |
1297 | 1296 | $dataPrepared = serialize($dataPrepared); |
1298 | - return sha1($dataPrepared . $key); |
|
1297 | + return sha1($dataPrepared.$key); |
|
1299 | 1298 | } |
1300 | 1299 | |
1301 | 1300 | /** |
@@ -1350,12 +1349,12 @@ discard block |
||
1350 | 1349 | break; |
1351 | 1350 | } |
1352 | 1351 | |
1353 | - $url = api_get_path(WEB_PLUGIN_PATH) . "advanced_subscription/src/terms_and_conditions.php?"; |
|
1352 | + $url = api_get_path(WEB_PLUGIN_PATH)."advanced_subscription/src/terms_and_conditions.php?"; |
|
1354 | 1353 | $url .= http_build_query($urlParams); |
1355 | 1354 | |
1356 | 1355 | // Launch popup |
1357 | 1356 | if ($mode == ADVANCED_SUBSCRIPTION_TERMS_MODE_POPUP) { |
1358 | - $url = 'javascript:void(window.open(\'' . $url .'\',\'AdvancedSubscriptionTerms\', \'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700px,height=600px\', \'100\' ))'; |
|
1357 | + $url = 'javascript:void(window.open(\''.$url.'\',\'AdvancedSubscriptionTerms\', \'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700px,height=600px\', \'100\' ))'; |
|
1359 | 1358 | } |
1360 | 1359 | return $url; |
1361 | 1360 | } |
@@ -1367,9 +1366,9 @@ discard block |
||
1367 | 1366 | */ |
1368 | 1367 | public function getRenderMailUrl($params) |
1369 | 1368 | { |
1370 | - $url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/src/render_mail.php?' . |
|
1371 | - 'q=' . $params['queueId'] . '&' . |
|
1372 | - 'v=' . $this->generateHash($params); |
|
1369 | + $url = api_get_path(WEB_PLUGIN_PATH).'advanced_subscription/src/render_mail.php?'. |
|
1370 | + 'q='.$params['queueId'].'&'. |
|
1371 | + 'v='.$this->generateHash($params); |
|
1373 | 1372 | return $url; |
1374 | 1373 | } |
1375 | 1374 | |
@@ -1440,7 +1439,7 @@ discard block |
||
1440 | 1439 | sf.extra_field_type = $extraFieldType AND |
1441 | 1440 | sf.variable = 'is_induction_session' AND |
1442 | 1441 | su.relation_type = 0 AND |
1443 | - su.user_id = " . intval($userId); |
|
1442 | + su.user_id = ".intval($userId); |
|
1444 | 1443 | |
1445 | 1444 | $result = Database::query($sql); |
1446 | 1445 |
@@ -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 |