@@ -58,19 +58,22 @@ discard block |
||
58 | 58 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
59 | 59 | $ip = trim($ip1); |
60 | 60 | } |
61 | - if ($debug) |
|
62 | - error_log("ip: $ip"); |
|
61 | + if ($debug) { |
|
62 | + error_log("ip: $ip"); |
|
63 | + } |
|
63 | 64 | // Check if a file that limits access from webservices exists and contains |
64 | 65 | // the restraining check |
65 | 66 | if (is_file('webservice-auth-ip.conf.php')) { |
66 | 67 | include 'webservice-auth-ip.conf.php'; |
67 | - if ($debug) |
|
68 | - error_log("webservice-auth-ip.conf.php file included"); |
|
68 | + if ($debug) { |
|
69 | + error_log("webservice-auth-ip.conf.php file included"); |
|
70 | + } |
|
69 | 71 | if (!empty($ws_auth_ip)) { |
70 | 72 | $check_ip = true; |
71 | 73 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
72 | - if ($debug) |
|
73 | - error_log("ip_matches: $ip_matches"); |
|
74 | + if ($debug) { |
|
75 | + error_log("ip_matches: $ip_matches"); |
|
76 | + } |
|
74 | 77 | } |
75 | 78 | } |
76 | 79 | |
@@ -87,8 +90,9 @@ discard block |
||
87 | 90 | |
88 | 91 | $result = api_is_valid_secret_key($secret_key, $security_key); |
89 | 92 | //error_log($secret_key.'-'.$security_key); |
90 | - if ($debug) |
|
91 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
93 | + if ($debug) { |
|
94 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
95 | + } |
|
92 | 96 | return $result; |
93 | 97 | } |
94 | 98 |
@@ -48,19 +48,22 @@ discard block |
||
48 | 48 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
49 | 49 | $ip = trim($ip1); |
50 | 50 | } |
51 | - if ($debug) |
|
52 | - error_log("ip: $ip"); |
|
51 | + if ($debug) { |
|
52 | + error_log("ip: $ip"); |
|
53 | + } |
|
53 | 54 | // Check if a file that limits access from webservices exists and contains |
54 | 55 | // the restraining check |
55 | 56 | if (is_file('webservice-auth-ip.conf.php')) { |
56 | 57 | include 'webservice-auth-ip.conf.php'; |
57 | - if ($debug) |
|
58 | - error_log("webservice-auth-ip.conf.php file included"); |
|
58 | + if ($debug) { |
|
59 | + error_log("webservice-auth-ip.conf.php file included"); |
|
60 | + } |
|
59 | 61 | if (!empty($ws_auth_ip)) { |
60 | 62 | $check_ip = true; |
61 | 63 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
62 | - if ($debug) |
|
63 | - error_log("ip_matches: $ip_matches"); |
|
64 | + if ($debug) { |
|
65 | + error_log("ip_matches: $ip_matches"); |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | } |
66 | 69 | |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | } |
77 | 80 | $result = api_is_valid_secret_key($secret_key, $security_key); |
78 | 81 | //error_log($secret_key.'-'.$security_key); |
79 | - if ($debug) |
|
80 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
82 | + if ($debug) { |
|
83 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
84 | + } |
|
81 | 85 | return $result; |
82 | 86 | } |
83 | 87 | |
@@ -140,7 +144,9 @@ discard block |
||
140 | 144 | if (!WSHelperVerifyKey($params)) { |
141 | 145 | return return_error(WS_ERROR_SECRET_KEY); |
142 | 146 | } |
143 | - if ($debug) error_log('WSImportLP'); |
|
147 | + if ($debug) { |
|
148 | + error_log('WSImportLP'); |
|
149 | + } |
|
144 | 150 | |
145 | 151 | $courseIdName = $params['course_id_name']; |
146 | 152 | $courseIdValue = $params['course_id_value']; |
@@ -156,7 +162,9 @@ discard block |
||
156 | 162 | $courseId = $courseInfo['real_id']; |
157 | 163 | |
158 | 164 | if (empty($courseInfo)) { |
159 | - if ($debug) error_log('Course not found'); |
|
165 | + if ($debug) { |
|
166 | + error_log('Course not found'); |
|
167 | + } |
|
160 | 168 | return 'Course not found'; |
161 | 169 | } |
162 | 170 | |
@@ -169,7 +177,9 @@ discard block |
||
169 | 177 | |
170 | 178 | if (empty($sessionId)) { |
171 | 179 | |
172 | - if ($debug) error_log('Session not found'); |
|
180 | + if ($debug) { |
|
181 | + error_log('Session not found'); |
|
182 | + } |
|
173 | 183 | return 'Session not found'; |
174 | 184 | } |
175 | 185 | } |
@@ -196,7 +206,9 @@ discard block |
||
196 | 206 | $manifest = $oScorm->import_package($fileInfo, '', $courseInfo); |
197 | 207 | |
198 | 208 | if (!$manifest) { |
199 | - if ($debug) error_log('manifest.xml file not found'); |
|
209 | + if ($debug) { |
|
210 | + error_log('manifest.xml file not found'); |
|
211 | + } |
|
200 | 212 | //if api_set_failure |
201 | 213 | return 'manifest.xml file not found'; |
202 | 214 | } |
@@ -215,10 +227,14 @@ discard block |
||
215 | 227 | $oScorm->set_maker($maker, $courseId); |
216 | 228 | //$oScorm->set_jslib('scorm_api.php'); |
217 | 229 | |
218 | - if ($debug) error_log('scorm was added'); |
|
230 | + if ($debug) { |
|
231 | + error_log('scorm was added'); |
|
232 | + } |
|
219 | 233 | return 1; |
220 | 234 | } else { |
221 | - if ($debug) error_log('manifest data empty'); |
|
235 | + if ($debug) { |
|
236 | + error_log('manifest data empty'); |
|
237 | + } |
|
222 | 238 | return 'manifest data empty'; |
223 | 239 | } |
224 | 240 | } |
@@ -311,7 +327,9 @@ discard block |
||
311 | 327 | ); |
312 | 328 | |
313 | 329 | if (empty($courseInfo)) { |
314 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
330 | + if ($debug) { |
|
331 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
332 | + } |
|
315 | 333 | return 'Course not found'; |
316 | 334 | } |
317 | 335 | |
@@ -326,7 +344,9 @@ discard block |
||
326 | 344 | |
327 | 345 | if (empty($sessionId)) { |
328 | 346 | |
329 | - if ($debug) error_log('Session not found'); |
|
347 | + if ($debug) { |
|
348 | + error_log('Session not found'); |
|
349 | + } |
|
330 | 350 | return 'Session not found'; |
331 | 351 | } |
332 | 352 | } |
@@ -407,7 +427,9 @@ discard block |
||
407 | 427 | ); |
408 | 428 | |
409 | 429 | if (empty($courseInfo)) { |
410 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
430 | + if ($debug) { |
|
431 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
432 | + } |
|
411 | 433 | return 'Course not found'; |
412 | 434 | } |
413 | 435 | $courseId = $courseInfo['real_id']; |
@@ -432,7 +454,9 @@ discard block |
||
432 | 454 | |
433 | 455 | $lp = new learnpath($courseCode, $lpId, null); |
434 | 456 | if ($lp) { |
435 | - if ($debug) error_log("LP deleted $lpId"); |
|
457 | + if ($debug) { |
|
458 | + error_log("LP deleted $lpId"); |
|
459 | + } |
|
436 | 460 | |
437 | 461 | $course_dir = $courseInfo['directory'] . '/document'; |
438 | 462 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
@@ -448,7 +472,9 @@ discard block |
||
448 | 472 | if ($item) { |
449 | 473 | $documentId = $item->get_path(); |
450 | 474 | |
451 | - if ($debug) error_log("lp item id found #$itemId"); |
|
475 | + if ($debug) { |
|
476 | + error_log("lp item id found #$itemId"); |
|
477 | + } |
|
452 | 478 | |
453 | 479 | $documentInfo = DocumentManager::get_document_data_by_id( |
454 | 480 | $documentId, |
@@ -474,7 +500,9 @@ discard block |
||
474 | 500 | } |
475 | 501 | } |
476 | 502 | } else { |
477 | - if ($debug) error_log("Document not found #$itemId"); |
|
503 | + if ($debug) { |
|
504 | + error_log("Document not found #$itemId"); |
|
505 | + } |
|
478 | 506 | } |
479 | 507 | } |
480 | 508 | } |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | return $foruns_id; |
35 | - } else |
|
36 | - return get_lang('InvalidId'); |
|
35 | + } else { |
|
36 | + return get_lang('InvalidId'); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | public function get_forum_title($username, $password, $course_code, $forum_id) |
@@ -54,8 +55,9 @@ discard block |
||
54 | 55 | |
55 | 56 | $forum_title = utf8_decode($forum_info['forum_title']); |
56 | 57 | return $forum_title; |
57 | - } else |
|
58 | - return get_lang('InvalidId'); |
|
58 | + } else { |
|
59 | + return get_lang('InvalidId'); |
|
60 | + } |
|
59 | 61 | } |
60 | 62 | |
61 | 63 | public function get_forum_threads_id($username, $password, $course_code, $forum_id) |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | |
74 | 76 | return $threads_id; |
75 | 77 | |
76 | - } else |
|
77 | - return get_lang('InvalidId'); |
|
78 | + } else { |
|
79 | + return get_lang('InvalidId'); |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | public function get_forum_thread_data($username, $password, $course_code, $thread_id, $field) |
@@ -115,8 +118,9 @@ discard block |
||
115 | 118 | |
116 | 119 | return $thread_info[$field_table]; |
117 | 120 | |
118 | - } else |
|
119 | - return get_lang('InvalidId'); |
|
121 | + } else { |
|
122 | + return get_lang('InvalidId'); |
|
123 | + } |
|
120 | 124 | } |
121 | 125 | |
122 | 126 | public function get_forum_thread_title($username, $password, $course_code, $thread_id) |
@@ -139,8 +143,9 @@ discard block |
||
139 | 143 | |
140 | 144 | return $thread_info[$field_table]; |
141 | 145 | |
142 | - } else |
|
143 | - return get_lang('InvalidId'); |
|
146 | + } else { |
|
147 | + return get_lang('InvalidId'); |
|
148 | + } |
|
144 | 149 | } |
145 | 150 | |
146 | 151 | |
@@ -184,8 +189,9 @@ discard block |
||
184 | 189 | } |
185 | 190 | } |
186 | 191 | return $posts_id; |
187 | - } else |
|
188 | - return get_lang('InvalidId'); |
|
192 | + } else { |
|
193 | + return get_lang('InvalidId'); |
|
194 | + } |
|
189 | 195 | } |
190 | 196 | |
191 | 197 | public function get_post_data($username, $password, $course_code, $post_id, $field) |
@@ -226,8 +232,9 @@ discard block |
||
226 | 232 | $field_table = "title"; |
227 | 233 | } |
228 | 234 | return (htmlcode) ? html_entity_decode($post_info[$field_table]) : $post_info[$field_table]; |
229 | - } else |
|
230 | - return get_lang('InvalidId'); |
|
235 | + } else { |
|
236 | + return get_lang('InvalidId'); |
|
237 | + } |
|
231 | 238 | } |
232 | 239 | |
233 | 240 | public function send_post($username, $password, $course_code, $forum_id, $thread_id, $title, $content) |
@@ -269,8 +276,9 @@ discard block |
||
269 | 276 | |
270 | 277 | //send_notification_mails($thread_id, $values); |
271 | 278 | |
272 | - } else |
|
273 | - return get_lang('InvalidId'); |
|
279 | + } else { |
|
280 | + return get_lang('InvalidId'); |
|
281 | + } |
|
274 | 282 | |
275 | 283 | } |
276 | 284 |
@@ -98,8 +98,9 @@ |
||
98 | 98 | |
99 | 99 | $user_id = UserManager :: create_user($user['FirstName'], $user['LastName'], $user['Status'], $user['Email'], $user['UserName'], $user['Password'], $user['OfficialCode'], api_get_setting('PlatformLanguage'), $user['PhoneNumber'], '', $user['AuthSource']); |
100 | 100 | foreach ($user['Courses'] as $index => $course) { |
101 | - if(CourseManager :: course_exists($course)) |
|
102 | - CourseManager :: subscribe_user($user_id, $course,$user['Status']); |
|
101 | + if(CourseManager :: course_exists($course)) { |
|
102 | + CourseManager :: subscribe_user($user_id, $course,$user['Status']); |
|
103 | + } |
|
103 | 104 | } |
104 | 105 | if (strlen($user['ClassName']) > 0) { |
105 | 106 | $class_id = ClassManager :: get_class_id($user['ClassName']); |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | } |
27 | 27 | return $announcements; |
28 | 28 | |
29 | - } else |
|
30 | - return get_lang('InvalidId'); |
|
29 | + } else { |
|
30 | + return get_lang('InvalidId'); |
|
31 | + } |
|
31 | 32 | |
32 | 33 | } |
33 | 34 | |
@@ -69,8 +70,9 @@ discard block |
||
69 | 70 | |
70 | 71 | return (htmlcode) ? html_entity_decode($announcements[0][$field_table]) : $announcements[0][$field_table]; |
71 | 72 | |
72 | - }else |
|
73 | - return get_lang('InvalidId'); |
|
73 | + } else { |
|
74 | + return get_lang('InvalidId'); |
|
75 | + } |
|
74 | 76 | } |
75 | 77 | |
76 | 78 |
@@ -521,8 +521,9 @@ |
||
521 | 521 | |
522 | 522 | public function nada($username, $password) |
523 | 523 | { |
524 | - if($this->verifyUserPass($username, $password) == "valid") |
|
525 | - return $username.$password; |
|
524 | + if($this->verifyUserPass($username, $password) == "valid") { |
|
525 | + return $username.$password; |
|
526 | + } |
|
526 | 527 | return $username; |
527 | 528 | } |
528 | 529 |
@@ -35,8 +35,9 @@ |
||
35 | 35 | { |
36 | 36 | $course_info = CourseManager::get_course_information($course_code); |
37 | 37 | return $course_info['title']; |
38 | - } else |
|
39 | - return get_lang('InvalidId'); |
|
38 | + } else { |
|
39 | + return get_lang('InvalidId'); |
|
40 | + } |
|
40 | 41 | |
41 | 42 | } |
42 | 43 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | $digest = getDigest(); |
13 | 13 | |
14 | 14 | // If there was no digest, show login |
15 | -if (is_null($digest)) requireLogin($realm,$nonce); |
|
15 | +if (is_null($digest)) { |
|
16 | + requireLogin($realm,$nonce); |
|
17 | +} |
|
16 | 18 | |
17 | 19 | $digestParts = digestParse($digest); |
18 | 20 | |
@@ -25,9 +27,9 @@ discard block |
||
25 | 27 | |
26 | 28 | $validResponse = md5("{$A1}:{$digestParts['nonce']}:{$digestParts['nc']}:{$digestParts['cnonce']}:{$digestParts['qop']}:{$A2}"); |
27 | 29 | |
28 | -if ($digestParts['response'] != $validResponse) |
|
30 | +if ($digestParts['response'] != $validResponse) { |
|
29 | 31 | requireLogin($realm,$nonce); |
30 | -else { |
|
32 | +} else { |
|
31 | 33 | // We're in! |
32 | 34 | echo 'a7532ae474e5e66a0c16eddab02e02a7'; |
33 | 35 | die(); |
@@ -40,12 +42,11 @@ discard block |
||
40 | 42 | if (isset($_SERVER['PHP_AUTH_DIGEST'])) { |
41 | 43 | $digest = $_SERVER['PHP_AUTH_DIGEST']; |
42 | 44 | // most other servers |
43 | - } |
|
44 | - elseif (isset($_SERVER['HTTP_AUTHENTICATION'])) { |
|
45 | - if (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']),'digest')===0) |
|
46 | - $digest = substr($_SERVER['HTTP_AUTHORIZATION'], 7); |
|
47 | - } |
|
48 | - elseif (isset($_SERVER['HTTP_WWW_AUTHENTICATE'])) { |
|
45 | + } elseif (isset($_SERVER['HTTP_AUTHENTICATION'])) { |
|
46 | + if (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']),'digest')===0) { |
|
47 | + $digest = substr($_SERVER['HTTP_AUTHORIZATION'], 7); |
|
48 | + } |
|
49 | + } elseif (isset($_SERVER['HTTP_WWW_AUTHENTICATE'])) { |
|
49 | 50 | $digest = $_SERVER['HTTP_WWW_AUTHENTICATE']; |
50 | 51 | } |
51 | 52 | return $digest; |
@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | return $message; |
50 | 50 | |
51 | - } else |
|
52 | - return get_lang('InvalidId'); |
|
51 | + } else { |
|
52 | + return get_lang('InvalidId'); |
|
53 | + } |
|
53 | 54 | |
54 | 55 | } |
55 | 56 | |
@@ -92,8 +93,9 @@ discard block |
||
92 | 93 | $result = Database::fetch_row($sql_result); |
93 | 94 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
94 | 95 | |
95 | - }else |
|
96 | - return get_lang('InvalidId'); |
|
96 | + } else { |
|
97 | + return get_lang('InvalidId'); |
|
98 | + } |
|
97 | 99 | |
98 | 100 | |
99 | 101 | } |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | |
119 | 121 | return $message; |
120 | 122 | |
121 | - } else |
|
122 | - return get_lang('InvalidId'); |
|
123 | + } else { |
|
124 | + return get_lang('InvalidId'); |
|
125 | + } |
|
123 | 126 | |
124 | 127 | } |
125 | 128 | |
@@ -164,8 +167,9 @@ discard block |
||
164 | 167 | |
165 | 168 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
166 | 169 | |
167 | - }else |
|
168 | - return get_lang('InvalidId'); |
|
170 | + } else { |
|
171 | + return get_lang('InvalidId'); |
|
172 | + } |
|
169 | 173 | |
170 | 174 | |
171 | 175 | } |
@@ -199,8 +203,9 @@ discard block |
||
199 | 203 | |
200 | 204 | return $inbox_last_id; |
201 | 205 | |
202 | - } else |
|
203 | - return get_lang('InvalidId'); |
|
206 | + } else { |
|
207 | + return get_lang('InvalidId'); |
|
208 | + } |
|
204 | 209 | |
205 | 210 | } |
206 | 211 |