@@ -260,10 +260,11 @@ |
||
260 | 260 | <td colspan="3" align="center"> |
261 | 261 | <br /> |
262 | 262 | <?php |
263 | - if(isset($_GET['add'])) |
|
264 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
265 | - else |
|
266 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
263 | + if(isset($_GET['add'])) { |
|
264 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
265 | + } else { |
|
266 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
267 | + } |
|
267 | 268 | ?> |
268 | 269 | </td> |
269 | 270 | </tr> |
@@ -509,7 +509,9 @@ discard block |
||
509 | 509 | if ($file != '.' && $file != '..') { |
510 | 510 | $filetype = 'file'; |
511 | 511 | |
512 | - if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder'; |
|
512 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
513 | + $filetype = 'folder'; |
|
514 | + } |
|
513 | 515 | |
514 | 516 | // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! |
515 | 517 | //$safe_file = api_replace_dangerous_char($file, 'strict'); |
@@ -908,37 +910,43 @@ discard block |
||
908 | 910 | if ($enclosed && $data{$i+1} == $enclosure) { |
909 | 911 | $fldval .= $chr; |
910 | 912 | ++$i; // Skip the next character. |
911 | - } else |
|
912 | - $enclosed = !$enclosed; |
|
913 | + } else { |
|
914 | + $enclosed = !$enclosed; |
|
915 | + } |
|
913 | 916 | break; |
914 | 917 | case $delim: |
915 | 918 | if (!$enclosed) { |
916 | 919 | $ret_array[$linecount][$fldcount++] = $fldval; |
917 | 920 | $fldval = ''; |
918 | - } else |
|
919 | - $fldval .= $chr; |
|
921 | + } else { |
|
922 | + $fldval .= $chr; |
|
923 | + } |
|
920 | 924 | break; |
921 | 925 | case "\r": |
922 | - if (!$enclosed&&$data{$i+1} == "\n") |
|
923 | - continue; |
|
926 | + if (!$enclosed&&$data{$i+1} == "\n") { |
|
927 | + continue; |
|
928 | + } |
|
924 | 929 | case "\n": |
925 | 930 | if (!$enclosed) { |
926 | 931 | $ret_array[$linecount++][$fldcount] = $fldval; |
927 | 932 | $fldcount = 0; |
928 | 933 | $fldval = ''; |
929 | - } else |
|
930 | - $fldval .= $chr; |
|
934 | + } else { |
|
935 | + $fldval .= $chr; |
|
936 | + } |
|
931 | 937 | break; |
932 | 938 | case "\\r": |
933 | - if (!$enclosed&&$data{$i+1} == "\\n") |
|
934 | - continue; |
|
939 | + if (!$enclosed&&$data{$i+1} == "\\n") { |
|
940 | + continue; |
|
941 | + } |
|
935 | 942 | case "\\n": |
936 | 943 | if (!$enclosed) { |
937 | 944 | $ret_array[$linecount++][$fldcount] = $fldval; |
938 | 945 | $fldcount = 0; |
939 | 946 | $fldval = ''; |
940 | - } else |
|
941 | - $fldval .= $chr; |
|
947 | + } else { |
|
948 | + $fldval .= $chr; |
|
949 | + } |
|
942 | 950 | break; |
943 | 951 | default: |
944 | 952 | $fldval .= $chr; |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | $use_anonymous = true; |
14 | 14 | |
15 | 15 | $debug = 0; |
16 | -if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
16 | +if ($debug > 0) { |
|
17 | + error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
18 | +} |
|
17 | 19 | |
18 | 20 | // Language files that needs to be included. |
19 | 21 | if (isset($_GET['action'])) { |
@@ -209,10 +211,14 @@ discard block |
||
209 | 211 | // If refresh is set, we regenerate the oLP object from the database (kind of flush). |
210 | 212 | Session::erase('refresh'); |
211 | 213 | $myrefresh = 1; |
212 | - if ($debug > 0) error_log('New LP - Refresh asked', 0); |
|
213 | -} |
|
214 | + if ($debug > 0) { |
|
215 | + error_log('New LP - Refresh asked', 0); |
|
216 | + } |
|
217 | + } |
|
214 | 218 | |
215 | -if ($debug > 0) error_log('New LP - Passed refresh check', 0); |
|
219 | +if ($debug > 0) { |
|
220 | + error_log('New LP - Passed refresh check', 0); |
|
221 | +} |
|
216 | 222 | |
217 | 223 | if (!empty($_REQUEST['dialog_box'])) { |
218 | 224 | $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box'])); |
@@ -222,17 +228,23 @@ discard block |
||
222 | 228 | $lp_found = false; |
223 | 229 | |
224 | 230 | if (isset($_SESSION['lpobject'])) { |
225 | - if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0); |
|
231 | + if ($debug > 0) { |
|
232 | + error_log('New LP - SESSION[lpobject] is defined', 0); |
|
233 | + } |
|
226 | 234 | $oLP = unserialize($_SESSION['lpobject']); |
227 | 235 | if (isset($oLP) && is_object($oLP)) { |
228 | - if ($debug > 0) error_log('New LP - oLP is object', 0); |
|
236 | + if ($debug > 0) { |
|
237 | + error_log('New LP - oLP is object', 0); |
|
238 | + } |
|
229 | 239 | if ($myrefresh == 1 || |
230 | 240 | empty($oLP->cc) || |
231 | 241 | $oLP->cc != api_get_course_id() || |
232 | 242 | $oLP->lp_view_session_id != $session_id || |
233 | 243 | $oLP->scorm_debug == '1' |
234 | 244 | ) { |
235 | - if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0); |
|
245 | + if ($debug > 0) { |
|
246 | + error_log('New LP - Course has changed, discard lp object', 0); |
|
247 | + } |
|
236 | 248 | if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); } |
237 | 249 | $oLP = null; |
238 | 250 | Session::erase('oLP'); |
@@ -246,13 +258,19 @@ discard block |
||
246 | 258 | |
247 | 259 | $course_id = api_get_course_int_id(); |
248 | 260 | |
249 | -if ($debug>0) error_log('New LP - Passed data remains check', 0); |
|
261 | +if ($debug>0) { |
|
262 | + error_log('New LP - Passed data remains check', 0); |
|
263 | +} |
|
250 | 264 | |
251 | 265 | if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) { |
252 | - if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
266 | + if ($debug > 0) { |
|
267 | + error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
268 | + } |
|
253 | 269 | // Regenerate a new lp object? Not always as some pages don't need the object (like upload?) |
254 | 270 | if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) { |
255 | - if ($debug > 0) error_log('New LP - lp_id is defined', 0); |
|
271 | + if ($debug > 0) { |
|
272 | + error_log('New LP - lp_id is defined', 0); |
|
273 | + } |
|
256 | 274 | // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the |
257 | 275 | // right object. |
258 | 276 | if (!empty($_REQUEST['lp_id'])) { |
@@ -264,16 +282,22 @@ discard block |
||
264 | 282 | $lp_table = Database::get_course_table(TABLE_LP_MAIN); |
265 | 283 | if (is_numeric($lp_id)) { |
266 | 284 | $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id"; |
267 | - if ($debug > 0) error_log('New LP - querying '.$sel, 0); |
|
285 | + if ($debug > 0) { |
|
286 | + error_log('New LP - querying '.$sel, 0); |
|
287 | + } |
|
268 | 288 | $res = Database::query($sel); |
269 | 289 | |
270 | 290 | if (Database::num_rows($res)) { |
271 | 291 | $row = Database::fetch_array($res); |
272 | 292 | $type = $row['lp_type']; |
273 | - if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
293 | + if ($debug > 0) { |
|
294 | + error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
295 | + } |
|
274 | 296 | switch ($type) { |
275 | 297 | case 1: |
276 | - if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
298 | + if ($debug > 0) { |
|
299 | + error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
300 | + } |
|
277 | 301 | |
278 | 302 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
279 | 303 | if ($oLP !== false) { |
@@ -283,7 +307,9 @@ discard block |
||
283 | 307 | } |
284 | 308 | break; |
285 | 309 | case 2: |
286 | - if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
310 | + if ($debug > 0) { |
|
311 | + error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
312 | + } |
|
287 | 313 | $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id()); |
288 | 314 | if ($oLP !== false) { |
289 | 315 | $lp_found = true; |
@@ -292,7 +318,9 @@ discard block |
||
292 | 318 | } |
293 | 319 | break; |
294 | 320 | case 3: |
295 | - if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
321 | + if ($debug > 0) { |
|
322 | + error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
323 | + } |
|
296 | 324 | $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id()); |
297 | 325 | if ($oLP !== false) { |
298 | 326 | $lp_found = true; |
@@ -301,7 +329,9 @@ discard block |
||
301 | 329 | } |
302 | 330 | break; |
303 | 331 | default: |
304 | - if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
332 | + if ($debug > 0) { |
|
333 | + error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
334 | + } |
|
305 | 335 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
306 | 336 | if ($oLP !== false) { |
307 | 337 | $lp_found = true; |
@@ -312,17 +342,23 @@ discard block |
||
312 | 342 | } |
313 | 343 | } |
314 | 344 | } else { |
315 | - if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0); |
|
345 | + if ($debug > 0) { |
|
346 | + error_log('New LP - Request[lp_id] is not numeric', 0); |
|
347 | + } |
|
316 | 348 | } |
317 | 349 | } else { |
318 | - if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
350 | + if ($debug > 0) { |
|
351 | + error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
352 | + } |
|
319 | 353 | } |
320 | 354 | if ($lp_found) { |
321 | 355 | $_SESSION['oLP'] = $oLP; |
322 | 356 | } |
323 | 357 | } |
324 | 358 | |
325 | -if ($debug > 0) error_log('New LP - Passed oLP creation check', 0); |
|
359 | +if ($debug > 0) { |
|
360 | + error_log('New LP - Passed oLP creation check', 0); |
|
361 | +} |
|
326 | 362 | |
327 | 363 | $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false); |
328 | 364 | |
@@ -359,7 +395,9 @@ discard block |
||
359 | 395 | } |
360 | 396 | |
361 | 397 | $redirectTo = ''; |
362 | -if ($debug > 0) error_log('New LP - action "'.$action.'" triggered'); |
|
398 | +if ($debug > 0) { |
|
399 | + error_log('New LP - action "'.$action.'" triggered'); |
|
400 | +} |
|
363 | 401 | |
364 | 402 | switch ($action) { |
365 | 403 | case 'add_item': |
@@ -368,7 +406,9 @@ discard block |
||
368 | 406 | } |
369 | 407 | if (!$lp_found) { |
370 | 408 | //check if the learnpath ID was defined, otherwise send back to list |
371 | - if ($debug > 0) error_log('New LP - No learnpath given for add item', 0); |
|
409 | + if ($debug > 0) { |
|
410 | + error_log('New LP - No learnpath given for add item', 0); |
|
411 | + } |
|
372 | 412 | require 'lp_list.php'; |
373 | 413 | } else { |
374 | 414 | $_SESSION['refresh'] = 1; |
@@ -458,7 +498,9 @@ discard block |
||
458 | 498 | } |
459 | 499 | if (!$lp_found) { |
460 | 500 | //check if the learnpath ID was defined, otherwise send back to list |
461 | - if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0); |
|
501 | + if ($debug > 0) { |
|
502 | + error_log('New LP - No learnpath given for add audio', 0); |
|
503 | + } |
|
462 | 504 | require 'lp_list.php'; |
463 | 505 | } else { |
464 | 506 | $_SESSION['refresh'] = 1; |
@@ -606,8 +648,7 @@ discard block |
||
606 | 648 | if (!$is_allowed_to_edit) { |
607 | 649 | api_not_allowed(true); |
608 | 650 | } |
609 | - if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } |
|
610 | - else { |
|
651 | + if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else { |
|
611 | 652 | $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']); |
612 | 653 | require 'lp_list.php'; |
613 | 654 | exit; |
@@ -688,8 +729,7 @@ discard block |
||
688 | 729 | if (!$is_allowed_to_edit) { |
689 | 730 | api_not_allowed(true); |
690 | 731 | } |
691 | - if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } |
|
692 | - else { |
|
732 | + if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else { |
|
693 | 733 | if (isset($_POST['submit_button'])) { |
694 | 734 | //Updating the lp.modified_on |
695 | 735 | $_SESSION['oLP']->set_modified_on(); |
@@ -983,8 +1023,9 @@ discard block |
||
983 | 1023 | ); |
984 | 1024 | $extraFieldValue->saveFieldValues($_REQUEST); |
985 | 1025 | |
986 | - if ($_FILES['lp_preview_image']['size'] > 0) |
|
987 | - $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']); |
|
1026 | + if ($_FILES['lp_preview_image']['size'] > 0) { |
|
1027 | + $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']); |
|
1028 | + } |
|
988 | 1029 | |
989 | 1030 | if (api_get_setting('search_enabled') === 'true') { |
990 | 1031 | require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
@@ -1117,16 +1158,24 @@ discard block |
||
1117 | 1158 | } |
1118 | 1159 | break; |
1119 | 1160 | case 'content': |
1120 | - if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1161 | + if ($debug > 0) { |
|
1162 | + error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1163 | + } |
|
1121 | 1164 | if (!$lp_found) { |
1122 | 1165 | error_log('New LP - No learnpath given for content', 0); |
1123 | 1166 | require 'lp_list.php'; |
1124 | 1167 | } else { |
1125 | - if ($debug > 0) error_log('New LP - save_last()', 0); |
|
1168 | + if ($debug > 0) { |
|
1169 | + error_log('New LP - save_last()', 0); |
|
1170 | + } |
|
1126 | 1171 | $_SESSION['oLP']->save_last(); |
1127 | - if ($debug > 0) error_log('New LP - set_current_item()', 0); |
|
1172 | + if ($debug > 0) { |
|
1173 | + error_log('New LP - set_current_item()', 0); |
|
1174 | + } |
|
1128 | 1175 | $_SESSION['oLP']->set_current_item($_GET['item_id']); |
1129 | - if ($debug > 0) error_log('New LP - start_current_item()', 0); |
|
1176 | + if ($debug > 0) { |
|
1177 | + error_log('New LP - start_current_item()', 0); |
|
1178 | + } |
|
1130 | 1179 | $_SESSION['oLP']->start_current_item(); |
1131 | 1180 | require 'lp_content.php'; |
1132 | 1181 | } |
@@ -1242,8 +1291,7 @@ discard block |
||
1242 | 1291 | require 'lp_message.php'; |
1243 | 1292 | break; |
1244 | 1293 | case 'return_to_course_homepage': |
1245 | - if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } |
|
1246 | - else { |
|
1294 | + if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else { |
|
1247 | 1295 | $_SESSION['oLP']->save_current(); |
1248 | 1296 | $_SESSION['oLP']->save_last(); |
1249 | 1297 | $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id(); |
@@ -1436,8 +1484,10 @@ discard block |
||
1436 | 1484 | |
1437 | 1485 | if (!empty($_SESSION['oLP'])) { |
1438 | 1486 | $_SESSION['lpobject'] = serialize($_SESSION['oLP']); |
1439 | - if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0); |
|
1440 | -} |
|
1487 | + if ($debug > 0) { |
|
1488 | + error_log('New LP - lpobject is serialized in session', 0); |
|
1489 | + } |
|
1490 | + } |
|
1441 | 1491 | |
1442 | 1492 | if (!empty($redirectTo)) { |
1443 | 1493 | header("Location: $redirectTo"); |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | <div id="message" style="display: none"> |
137 | 137 | <?php |
138 | - if(!empty($message)) |
|
139 | - Display::display_normal_message($message) |
|
138 | + if(!empty($message)) { |
|
139 | + Display::display_normal_message($message) |
|
140 | 140 | ?> |
141 | 141 | </div> |
142 | 142 | |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | </div> |
151 | 151 | <div class="row"> |
152 | 152 | <div class="col-md-5"> |
153 | - <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?> |
|
153 | + <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); |
|
154 | + } |
|
155 | + ?> |
|
154 | 156 | </div> |
155 | 157 | <div class="col-md-7"> |
156 | 158 | <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>"> |
@@ -2165,8 +2165,9 @@ discard block |
||
2165 | 2165 | if (empty($user_id)) { |
2166 | 2166 | $user_id = 0; |
2167 | 2167 | } else { |
2168 | - if ($user_id != strval(intval($user_id))) |
|
2169 | - return array(); |
|
2168 | + if ($user_id != strval(intval($user_id))) { |
|
2169 | + return array(); |
|
2170 | + } |
|
2170 | 2171 | } |
2171 | 2172 | $extra_data = array(); |
2172 | 2173 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2258,8 +2259,9 @@ discard block |
||
2258 | 2259 | if (empty($user_id)) { |
2259 | 2260 | $user_id = 0; |
2260 | 2261 | } else { |
2261 | - if ($user_id != strval(intval($user_id))) |
|
2262 | - return array(); |
|
2262 | + if ($user_id != strval(intval($user_id))) { |
|
2263 | + return array(); |
|
2264 | + } |
|
2263 | 2265 | } |
2264 | 2266 | $extra_data = array(); |
2265 | 2267 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -3042,13 +3044,15 @@ discard block |
||
3042 | 3044 | */ |
3043 | 3045 | public static function get_api_keys($user_id = null, $api_service = 'dokeos') |
3044 | 3046 | { |
3045 | - if ($user_id != strval(intval($user_id))) |
|
3046 | - return false; |
|
3047 | + if ($user_id != strval(intval($user_id))) { |
|
3048 | + return false; |
|
3049 | + } |
|
3047 | 3050 | if (empty($user_id)) { |
3048 | 3051 | $user_id = api_get_user_id(); |
3049 | 3052 | } |
3050 | - if ($user_id === false) |
|
3051 | - return false; |
|
3053 | + if ($user_id === false) { |
|
3054 | + return false; |
|
3055 | + } |
|
3052 | 3056 | $service_name = Database::escape_string($api_service); |
3053 | 3057 | if (is_string($service_name) === false) { |
3054 | 3058 | return false; |
@@ -3056,11 +3060,14 @@ discard block |
||
3056 | 3060 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3057 | 3061 | $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';"; |
3058 | 3062 | $res = Database::query($sql); |
3059 | - if ($res === false) |
|
3060 | - return false; //error during query |
|
3063 | + if ($res === false) { |
|
3064 | + return false; |
|
3065 | + } |
|
3066 | + //error during query |
|
3061 | 3067 | $num = Database::num_rows($res); |
3062 | - if ($num == 0) |
|
3063 | - return false; |
|
3068 | + if ($num == 0) { |
|
3069 | + return false; |
|
3070 | + } |
|
3064 | 3071 | $list = array(); |
3065 | 3072 | while ($row = Database::fetch_array($res)) { |
3066 | 3073 | $list[$row['id']] = $row['api_key']; |
@@ -3075,13 +3082,15 @@ discard block |
||
3075 | 3082 | */ |
3076 | 3083 | public static function add_api_key($user_id = null, $api_service = 'dokeos') |
3077 | 3084 | { |
3078 | - if ($user_id != strval(intval($user_id))) |
|
3079 | - return false; |
|
3085 | + if ($user_id != strval(intval($user_id))) { |
|
3086 | + return false; |
|
3087 | + } |
|
3080 | 3088 | if (empty($user_id)) { |
3081 | 3089 | $user_id = api_get_user_id(); |
3082 | 3090 | } |
3083 | - if ($user_id === false) |
|
3084 | - return false; |
|
3091 | + if ($user_id === false) { |
|
3092 | + return false; |
|
3093 | + } |
|
3085 | 3094 | $service_name = Database::escape_string($api_service); |
3086 | 3095 | if (is_string($service_name) === false) { |
3087 | 3096 | return false; |
@@ -3090,8 +3099,10 @@ discard block |
||
3090 | 3099 | $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key |
3091 | 3100 | $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')"; |
3092 | 3101 | $res = Database::query($sql); |
3093 | - if ($res === false) |
|
3094 | - return false; //error during query |
|
3102 | + if ($res === false) { |
|
3103 | + return false; |
|
3104 | + } |
|
3105 | + //error during query |
|
3095 | 3106 | $num = Database::insert_id(); |
3096 | 3107 | return ($num == 0) ? false : $num; |
3097 | 3108 | } |
@@ -3103,22 +3114,29 @@ discard block |
||
3103 | 3114 | */ |
3104 | 3115 | public static function delete_api_key($key_id) |
3105 | 3116 | { |
3106 | - if ($key_id != strval(intval($key_id))) |
|
3107 | - return false; |
|
3108 | - if ($key_id === false) |
|
3109 | - return false; |
|
3117 | + if ($key_id != strval(intval($key_id))) { |
|
3118 | + return false; |
|
3119 | + } |
|
3120 | + if ($key_id === false) { |
|
3121 | + return false; |
|
3122 | + } |
|
3110 | 3123 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3111 | 3124 | $sql = "SELECT * FROM $t_api WHERE id = ".$key_id; |
3112 | 3125 | $res = Database::query($sql); |
3113 | - if ($res === false) |
|
3114 | - return false; //error during query |
|
3126 | + if ($res === false) { |
|
3127 | + return false; |
|
3128 | + } |
|
3129 | + //error during query |
|
3115 | 3130 | $num = Database::num_rows($res); |
3116 | - if ($num !== 1) |
|
3117 | - return false; |
|
3131 | + if ($num !== 1) { |
|
3132 | + return false; |
|
3133 | + } |
|
3118 | 3134 | $sql = "DELETE FROM $t_api WHERE id = ".$key_id; |
3119 | 3135 | $res = Database::query($sql); |
3120 | - if ($res === false) |
|
3121 | - return false; //error during query |
|
3136 | + if ($res === false) { |
|
3137 | + return false; |
|
3138 | + } |
|
3139 | + //error during query |
|
3122 | 3140 | return true; |
3123 | 3141 | } |
3124 | 3142 | |
@@ -3130,10 +3148,12 @@ discard block |
||
3130 | 3148 | */ |
3131 | 3149 | public static function update_api_key($user_id, $api_service) |
3132 | 3150 | { |
3133 | - if ($user_id != strval(intval($user_id))) |
|
3134 | - return false; |
|
3135 | - if ($user_id === false) |
|
3136 | - return false; |
|
3151 | + if ($user_id != strval(intval($user_id))) { |
|
3152 | + return false; |
|
3153 | + } |
|
3154 | + if ($user_id === false) { |
|
3155 | + return false; |
|
3156 | + } |
|
3137 | 3157 | $service_name = Database::escape_string($api_service); |
3138 | 3158 | if (is_string($service_name) === false) { |
3139 | 3159 | return false; |
@@ -3159,12 +3179,15 @@ discard block |
||
3159 | 3179 | */ |
3160 | 3180 | public static function get_api_key_id($user_id, $api_service) |
3161 | 3181 | { |
3162 | - if ($user_id != strval(intval($user_id))) |
|
3163 | - return false; |
|
3164 | - if ($user_id === false) |
|
3165 | - return false; |
|
3166 | - if (empty($api_service)) |
|
3167 | - return false; |
|
3182 | + if ($user_id != strval(intval($user_id))) { |
|
3183 | + return false; |
|
3184 | + } |
|
3185 | + if ($user_id === false) { |
|
3186 | + return false; |
|
3187 | + } |
|
3188 | + if (empty($api_service)) { |
|
3189 | + return false; |
|
3190 | + } |
|
3168 | 3191 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3169 | 3192 | $api_service = Database::escape_string($api_service); |
3170 | 3193 | $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'"; |
@@ -4666,8 +4689,9 @@ discard block |
||
4666 | 4689 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4667 | 4690 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4668 | 4691 | if (!$admin_permissions) { |
4669 | - if ($field_details[7] == 0) |
|
4670 | - $form->freeze('extra_'.$field_details[1]); |
|
4692 | + if ($field_details[7] == 0) { |
|
4693 | + $form->freeze('extra_'.$field_details[1]); |
|
4694 | + } |
|
4671 | 4695 | } |
4672 | 4696 | break; |
4673 | 4697 | case ExtraField::FIELD_TYPE_RADIO: |
@@ -4724,8 +4748,9 @@ discard block |
||
4724 | 4748 | ); |
4725 | 4749 | |
4726 | 4750 | if (!$admin_permissions) { |
4727 | - if ($field_details[7] == 0) |
|
4728 | - $form->freeze('extra_'.$field_details[1]); |
|
4751 | + if ($field_details[7] == 0) { |
|
4752 | + $form->freeze('extra_'.$field_details[1]); |
|
4753 | + } |
|
4729 | 4754 | } |
4730 | 4755 | break; |
4731 | 4756 | case ExtraField::FIELD_TYPE_SELECT_MULTIPLE: |
@@ -4741,8 +4766,9 @@ discard block |
||
4741 | 4766 | array('multiple' => 'multiple') |
4742 | 4767 | ); |
4743 | 4768 | if (!$admin_permissions) { |
4744 | - if ($field_details[7] == 0) |
|
4745 | - $form->freeze('extra_'.$field_details[1]); |
|
4769 | + if ($field_details[7] == 0) { |
|
4770 | + $form->freeze('extra_'.$field_details[1]); |
|
4771 | + } |
|
4746 | 4772 | } |
4747 | 4773 | break; |
4748 | 4774 | case ExtraField::FIELD_TYPE_DATE: |
@@ -4750,8 +4776,9 @@ discard block |
||
4750 | 4776 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4751 | 4777 | $form->setDefaults($defaults); |
4752 | 4778 | if (!$admin_permissions) { |
4753 | - if ($field_details[7] == 0) |
|
4754 | - $form->freeze('extra_'.$field_details[1]); |
|
4779 | + if ($field_details[7] == 0) { |
|
4780 | + $form->freeze('extra_'.$field_details[1]); |
|
4781 | + } |
|
4755 | 4782 | } |
4756 | 4783 | $form->applyFilter('theme', 'trim'); |
4757 | 4784 | break; |
@@ -4760,8 +4787,9 @@ discard block |
||
4760 | 4787 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4761 | 4788 | $form->setDefaults($defaults); |
4762 | 4789 | if (!$admin_permissions) { |
4763 | - if ($field_details[7] == 0) |
|
4764 | - $form->freeze('extra_'.$field_details[1]); |
|
4790 | + if ($field_details[7] == 0) { |
|
4791 | + $form->freeze('extra_'.$field_details[1]); |
|
4792 | + } |
|
4765 | 4793 | } |
4766 | 4794 | $form->applyFilter('theme', 'trim'); |
4767 | 4795 | break; |
@@ -4780,8 +4808,9 @@ discard block |
||
4780 | 4808 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3]); |
4781 | 4809 | |
4782 | 4810 | if (!$admin_permissions) { |
4783 | - if ($field_details[7] == 0) |
|
4784 | - $form->freeze('extra_'.$field_details[1]); |
|
4811 | + if ($field_details[7] == 0) { |
|
4812 | + $form->freeze('extra_'.$field_details[1]); |
|
4813 | + } |
|
4785 | 4814 | } |
4786 | 4815 | |
4787 | 4816 | /* Recoding the selected values for double : if the user has |
@@ -4841,8 +4870,9 @@ discard block |
||
4841 | 4870 | break; |
4842 | 4871 | case ExtraField::FIELD_TYPE_TIMEZONE: |
4843 | 4872 | $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), ''); |
4844 | - if ($field_details[7] == 0) |
|
4845 | - $form->freeze('extra_'.$field_details[1]); |
|
4873 | + if ($field_details[7] == 0) { |
|
4874 | + $form->freeze('extra_'.$field_details[1]); |
|
4875 | + } |
|
4846 | 4876 | break; |
4847 | 4877 | case ExtraField::FIELD_TYPE_SOCIAL_PROFILE: |
4848 | 4878 | // get the social network's favicon |
@@ -4867,8 +4897,9 @@ discard block |
||
4867 | 4897 | ); |
4868 | 4898 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4869 | 4899 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4870 | - if ($field_details[7] == 0) |
|
4871 | - $form->freeze('extra_'.$field_details[1]); |
|
4900 | + if ($field_details[7] == 0) { |
|
4901 | + $form->freeze('extra_'.$field_details[1]); |
|
4902 | + } |
|
4872 | 4903 | break; |
4873 | 4904 | case ExtraField::FIELD_TYPE_FILE: |
4874 | 4905 | $extra_field = 'extra_'.$field_details[1]; |
@@ -5277,8 +5308,9 @@ discard block |
||
5277 | 5308 | $url .= "?s=$s&d=$d&r=$r"; |
5278 | 5309 | if ( $img ) { |
5279 | 5310 | $url = '<img src="' . $url . '"'; |
5280 | - foreach ( $atts as $key => $val ) |
|
5281 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
5311 | + foreach ( $atts as $key => $val ) { |
|
5312 | + $url .= ' ' . $key . '="' . $val . '"'; |
|
5313 | + } |
|
5282 | 5314 | $url .= ' />'; |
5283 | 5315 | } |
5284 | 5316 | return $url; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | $isAdmin = api_is_platform_admin(); |
139 | 139 | |
140 | 140 | Display::display_header(get_lang('MyTickets')); |
141 | -if (!empty($projectId)) |
|
142 | -if ($isAdmin) { |
|
141 | +if (!empty($projectId)) { |
|
142 | + if ($isAdmin) { |
|
143 | 143 | $getParameters = [ |
144 | 144 | 'keyword', |
145 | 145 | 'keyword_status', |
@@ -151,6 +151,7 @@ discard block |
||
151 | 151 | 'Tickets_per_page', |
152 | 152 | 'Tickets_column' |
153 | 153 | ]; |
154 | +} |
|
154 | 155 | $get_parameter = ''; |
155 | 156 | foreach ($getParameters as $getParameter) { |
156 | 157 | if (isset($_GET[$getParameter])) { |
@@ -2801,8 +2801,9 @@ |
||
2801 | 2801 | echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>'; |
2802 | 2802 | }*/ |
2803 | 2803 | } elseif(is_dir($path)) { |
2804 | - if (!is_dir($dest . '/' . $file)) |
|
2805 | - mkdir($dest . '/' . $file); |
|
2804 | + if (!is_dir($dest . '/' . $file)) { |
|
2805 | + mkdir($dest . '/' . $file); |
|
2806 | + } |
|
2806 | 2807 | self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite); |
2807 | 2808 | } |
2808 | 2809 | } |
@@ -1761,7 +1761,9 @@ |
||
1761 | 1761 | $friendHtml.= '<ul class="nav nav-list">'; |
1762 | 1762 | $j = 1; |
1763 | 1763 | for ($k=0; $k < $number_friends; $k++) { |
1764 | - if ($j > $number_of_images) break; |
|
1764 | + if ($j > $number_of_images) { |
|
1765 | + break; |
|
1766 | + } |
|
1765 | 1767 | |
1766 | 1768 | if (isset($friends[$k])) { |
1767 | 1769 | $friend = $friends[$k]; |
@@ -40,7 +40,11 @@ |
||
40 | 40 | '</tr>'."\n"; |
41 | 41 | while (list ($key, $val) = each($nom_form)) { |
42 | 42 | $nbre=$nbre+1; |
43 | - if($nbre & 1) $ndiv=2; else $ndiv=3; |
|
43 | + if($nbre & 1) { |
|
44 | + $ndiv=2; |
|
45 | + } else { |
|
46 | + $ndiv=3; |
|
47 | + } |
|
44 | 48 | echo '<tr align="center" id="header'.$ndiv.'">'; |
45 | 49 | echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>'; |
46 | 50 | echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>'; |