@@ -154,7 +154,9 @@ discard block |
||
154 | 154 | |
155 | 155 | public function set_image_wrapper() |
156 | 156 | { |
157 | - if ($this->debug) error_log('Image::set_image_wrapper loaded'); |
|
157 | + if ($this->debug) { |
|
158 | + error_log('Image::set_image_wrapper loaded'); |
|
159 | + } |
|
158 | 160 | try { |
159 | 161 | if (file_exists($this->path)) { |
160 | 162 | $this->image = new Imagick($this->path); |
@@ -163,10 +165,14 @@ discard block |
||
163 | 165 | $this->fill_image_info(); //Fills height, width and type |
164 | 166 | } |
165 | 167 | } else { |
166 | - if ($this->debug) error_log('Image::image does not exist'); |
|
168 | + if ($this->debug) { |
|
169 | + error_log('Image::image does not exist'); |
|
170 | + } |
|
167 | 171 | } |
168 | 172 | } catch(ImagickException $e) { |
169 | - if ($this->debug) error_log($e->getMessage()); |
|
173 | + if ($this->debug) { |
|
174 | + error_log($e->getMessage()); |
|
175 | + } |
|
170 | 176 | } |
171 | 177 | } |
172 | 178 | |
@@ -180,7 +186,9 @@ discard block |
||
180 | 186 | |
181 | 187 | if (in_array($this->type, $this->allowed_extensions)) { |
182 | 188 | $this->image_validated = true; |
183 | - if ($this->debug) error_log('image_validated true'); |
|
189 | + if ($this->debug) { |
|
190 | + error_log('image_validated true'); |
|
191 | + } |
|
184 | 192 | } |
185 | 193 | } |
186 | 194 | |
@@ -196,7 +204,9 @@ discard block |
||
196 | 204 | //@todo implement border logic case for Imagick |
197 | 205 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
198 | 206 | { |
199 | - if (!$this->image_validated) return false; |
|
207 | + if (!$this->image_validated) { |
|
208 | + return false; |
|
209 | + } |
|
200 | 210 | |
201 | 211 | if ($specific_size) { |
202 | 212 | $width = $thumbw; |
@@ -222,7 +232,9 @@ discard block |
||
222 | 232 | */ |
223 | 233 | |
224 | 234 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
225 | - if (!$this->image_validated) return false; |
|
235 | + if (!$this->image_validated) { |
|
236 | + return false; |
|
237 | + } |
|
226 | 238 | $this->image->cropimage($width, $height, $x, $y); |
227 | 239 | $this->width = $width; |
228 | 240 | $this->height = $height; |
@@ -230,7 +242,9 @@ discard block |
||
230 | 242 | |
231 | 243 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
232 | 244 | { |
233 | - if (!$this->image_validated) return false; |
|
245 | + if (!$this->image_validated) { |
|
246 | + return false; |
|
247 | + } |
|
234 | 248 | $type = $this->type; |
235 | 249 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
236 | 250 | $type = $convert_file_to; |
@@ -238,20 +252,28 @@ discard block |
||
238 | 252 | switch ($type) { |
239 | 253 | case 'jpeg': |
240 | 254 | case 'jpg': |
241 | - if (!$file) header("Content-type: image/jpeg"); |
|
255 | + if (!$file) { |
|
256 | + header("Content-type: image/jpeg"); |
|
257 | + } |
|
242 | 258 | break; |
243 | 259 | case 'png': |
244 | - if (!$file) header("Content-type: image/png"); |
|
260 | + if (!$file) { |
|
261 | + header("Content-type: image/png"); |
|
262 | + } |
|
245 | 263 | break; |
246 | 264 | case 'gif': |
247 | - if (!$file) header("Content-type: image/gif"); |
|
265 | + if (!$file) { |
|
266 | + header("Content-type: image/gif"); |
|
267 | + } |
|
248 | 268 | break; |
249 | 269 | } |
250 | 270 | $result = false; |
251 | 271 | try { |
252 | 272 | $result = $this->image->writeImage($file); |
253 | 273 | } catch(ImagickException $e) { |
254 | - if ($this->debug) error_log($e->getMessage()); |
|
274 | + if ($this->debug) { |
|
275 | + error_log($e->getMessage()); |
|
276 | + } |
|
255 | 277 | } |
256 | 278 | |
257 | 279 | if (!$file) { |
@@ -334,7 +356,9 @@ discard block |
||
334 | 356 | |
335 | 357 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
336 | 358 | { |
337 | - if (!$this->image_validated) return false; |
|
359 | + if (!$this->image_validated) { |
|
360 | + return false; |
|
361 | + } |
|
338 | 362 | if ($border == 1) { |
339 | 363 | if ($specific_size) { |
340 | 364 | $width = $thumbw; |
@@ -387,7 +411,9 @@ discard block |
||
387 | 411 | * @param int $src_height the source height of the original image |
388 | 412 | */ |
389 | 413 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
390 | - if (!$this->image_validated) return false; |
|
414 | + if (!$this->image_validated) { |
|
415 | + return false; |
|
416 | + } |
|
391 | 417 | $this->width = $width; |
392 | 418 | $this->height = $height; |
393 | 419 | $src = null; |
@@ -418,7 +444,9 @@ discard block |
||
418 | 444 | |
419 | 445 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
420 | 446 | { |
421 | - if (!$this->image_validated) return false; |
|
447 | + if (!$this->image_validated) { |
|
448 | + return false; |
|
449 | + } |
|
422 | 450 | $compress = (int)$compress; |
423 | 451 | $type = $this->type; |
424 | 452 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
@@ -427,19 +455,27 @@ discard block |
||
427 | 455 | switch ($type) { |
428 | 456 | case 'jpeg': |
429 | 457 | case 'jpg': |
430 | - if (!$file) header("Content-type: image/jpeg"); |
|
431 | - if ($compress == -1) $compress = 100; |
|
458 | + if (!$file) { |
|
459 | + header("Content-type: image/jpeg"); |
|
460 | + } |
|
461 | + if ($compress == -1) { |
|
462 | + $compress = 100; |
|
463 | + } |
|
432 | 464 | return imagejpeg($this->bg, $file, $compress); |
433 | 465 | break; |
434 | 466 | case 'png': |
435 | - if (!$file) header("Content-type: image/png"); |
|
467 | + if (!$file) { |
|
468 | + header("Content-type: image/png"); |
|
469 | + } |
|
436 | 470 | if ($compress != -1) { |
437 | 471 | @imagetruecolortopalette($this->bg, true, $compress); |
438 | 472 | } |
439 | 473 | return imagepng($this->bg, $file, $compress); |
440 | 474 | break; |
441 | 475 | case 'gif': |
442 | - if (!$file) header("Content-type: image/gif"); |
|
476 | + if (!$file) { |
|
477 | + header("Content-type: image/gif"); |
|
478 | + } |
|
443 | 479 | if ($compress != -1) { |
444 | 480 | @imagetruecolortopalette($this->bg, true, $compress); |
445 | 481 | } |
@@ -456,7 +492,9 @@ discard block |
||
456 | 492 | */ |
457 | 493 | function convert2bw() |
458 | 494 | { |
459 | - if (!$this->image_validated) return false; |
|
495 | + if (!$this->image_validated) { |
|
496 | + return false; |
|
497 | + } |
|
460 | 498 | |
461 | 499 | $dest_img = imagecreatetruecolor(imagesx($this->bg), imagesy($this->bg)); |
462 | 500 | /* copy ignore the transparent color |
@@ -262,8 +262,9 @@ |
||
262 | 262 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
263 | 263 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
264 | 264 | |
265 | - if (!empty($access_url_id)) |
|
266 | - $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
265 | + if (!empty($access_url_id)) { |
|
266 | + $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
267 | + } |
|
267 | 268 | |
268 | 269 | $sql = "SELECT id, name, access_url_id |
269 | 270 | FROM $tbl_session u |
@@ -2259,7 +2259,9 @@ discard block |
||
2259 | 2259 | $debug = false; |
2260 | 2260 | } |
2261 | 2261 | |
2262 | - if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2262 | + if ($debug) { |
|
2263 | + echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2264 | + } |
|
2263 | 2265 | $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
2264 | 2266 | $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
2265 | 2267 | |
@@ -2336,7 +2338,9 @@ discard block |
||
2336 | 2338 | $condition_user1 AND |
2337 | 2339 | session_id = $session_id |
2338 | 2340 | GROUP BY lp_id, user_id"; |
2339 | - if ($debug) echo $sql; |
|
2341 | + if ($debug) { |
|
2342 | + echo $sql; |
|
2343 | + } |
|
2340 | 2344 | |
2341 | 2345 | $rs_last_lp_view_id = Database::query($sql); |
2342 | 2346 | |
@@ -2352,7 +2356,9 @@ discard block |
||
2352 | 2356 | $lp_view_id = $row_lp_view['id']; |
2353 | 2357 | $lp_id = $row_lp_view['lp_id']; |
2354 | 2358 | $user_id = $row_lp_view['user_id']; |
2355 | - if ($debug) echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2359 | + if ($debug) { |
|
2360 | + echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2361 | + } |
|
2356 | 2362 | |
2357 | 2363 | if ($get_only_latest_attempt_results) { |
2358 | 2364 | //Getting lp_items done by the user |
@@ -2409,7 +2415,9 @@ discard block |
||
2409 | 2415 | lp_i.c_id = $course_id AND |
2410 | 2416 | (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') |
2411 | 2417 | WHERE lp_view_id = $lp_view_id "; |
2412 | - if ($debug) echo $sql.'<br />'; |
|
2418 | + if ($debug) { |
|
2419 | + echo $sql.'<br />'; |
|
2420 | + } |
|
2413 | 2421 | $res_max_score = Database::query($sql); |
2414 | 2422 | |
2415 | 2423 | while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
@@ -2428,7 +2436,9 @@ discard block |
||
2428 | 2436 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2429 | 2437 | $score = $row_max_score['score']; |
2430 | 2438 | |
2431 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2439 | + if ($debug) { |
|
2440 | + echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2441 | + } |
|
2432 | 2442 | |
2433 | 2443 | if ($row_max_score['item_type'] == 'sco') { |
2434 | 2444 | /* Check if it is sco (easier to get max_score) |
@@ -2448,7 +2458,9 @@ discard block |
||
2448 | 2458 | if (!empty($max_score)) { |
2449 | 2459 | $lp_partial_total += $score/$max_score; |
2450 | 2460 | } |
2451 | - if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2461 | + if ($debug) { |
|
2462 | + echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2463 | + } |
|
2452 | 2464 | } else { |
2453 | 2465 | // Case of a TOOL_QUIZ element |
2454 | 2466 | $item_id = $row_max_score['iid']; |
@@ -2470,12 +2482,16 @@ discard block |
||
2470 | 2482 | ORDER BY exe_date DESC |
2471 | 2483 | LIMIT 1"; |
2472 | 2484 | |
2473 | - if ($debug) echo $sql .'<br />'; |
|
2485 | + if ($debug) { |
|
2486 | + echo $sql .'<br />'; |
|
2487 | + } |
|
2474 | 2488 | $result_last_attempt = Database::query($sql); |
2475 | 2489 | $num = Database :: num_rows($result_last_attempt); |
2476 | 2490 | if ($num > 0 ) { |
2477 | 2491 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2478 | - if ($debug) echo $id_last_attempt.'<br />'; |
|
2492 | + if ($debug) { |
|
2493 | + echo $id_last_attempt.'<br />'; |
|
2494 | + } |
|
2479 | 2495 | |
2480 | 2496 | // Within the last attempt number tracking, get the sum of |
2481 | 2497 | // the max_scores of all questions that it was |
@@ -2494,7 +2510,9 @@ discard block |
||
2494 | 2510 | q.c_id = $course_id |
2495 | 2511 | ) |
2496 | 2512 | AS t"; |
2497 | - if ($debug) echo '$sql: '.$sql.' <br />'; |
|
2513 | + if ($debug) { |
|
2514 | + echo '$sql: '.$sql.' <br />'; |
|
2515 | + } |
|
2498 | 2516 | $res_max_score_bis = Database::query($sql); |
2499 | 2517 | $row_max_score_bis = Database::fetch_array($res_max_score_bis); |
2500 | 2518 | |
@@ -2504,7 +2522,9 @@ discard block |
||
2504 | 2522 | if (!empty($max_score) && floatval($max_score) > 0) { |
2505 | 2523 | $lp_partial_total += $score/$max_score; |
2506 | 2524 | } |
2507 | - if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2525 | + if ($debug) { |
|
2526 | + echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2527 | + } |
|
2508 | 2528 | } |
2509 | 2529 | } |
2510 | 2530 | |
@@ -2517,17 +2537,25 @@ discard block |
||
2517 | 2537 | $count_items++; |
2518 | 2538 | } |
2519 | 2539 | } |
2520 | - if ($debug) echo '$count_items: '.$count_items; |
|
2540 | + if ($debug) { |
|
2541 | + echo '$count_items: '.$count_items; |
|
2542 | + } |
|
2521 | 2543 | } |
2522 | 2544 | } //end for |
2523 | 2545 | |
2524 | 2546 | $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0; |
2525 | 2547 | |
2526 | - if ($debug) echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2527 | - if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2548 | + if ($debug) { |
|
2549 | + echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2550 | + } |
|
2551 | + if ($debug) { |
|
2552 | + echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2553 | + } |
|
2528 | 2554 | |
2529 | 2555 | $global_result += $score_of_scorm_calculate; |
2530 | - if ($debug) echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2556 | + if ($debug) { |
|
2557 | + echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2558 | + } |
|
2531 | 2559 | } // end while |
2532 | 2560 | } |
2533 | 2561 | |
@@ -2540,7 +2568,9 @@ discard block |
||
2540 | 2568 | c_id = $course_id AND |
2541 | 2569 | (item_type = 'quiz' OR item_type = 'sco') AND |
2542 | 2570 | lp_id = ".$lp_id; |
2543 | - if ($debug) echo $sql; |
|
2571 | + if ($debug) { |
|
2572 | + echo $sql; |
|
2573 | + } |
|
2544 | 2574 | $result_have_quiz = Database::query($sql); |
2545 | 2575 | |
2546 | 2576 | if (Database::num_rows($result_have_quiz) > 0 ) { |
@@ -2551,19 +2581,29 @@ discard block |
||
2551 | 2581 | } |
2552 | 2582 | } |
2553 | 2583 | |
2554 | - if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2555 | - if ($debug) echo '<h3>Final return</h3>'; |
|
2584 | + if ($debug) { |
|
2585 | + echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2586 | + } |
|
2587 | + if ($debug) { |
|
2588 | + echo '<h3>Final return</h3>'; |
|
2589 | + } |
|
2556 | 2590 | |
2557 | 2591 | if ($lp_with_quiz != 0) { |
2558 | 2592 | if (!$return_array) { |
2559 | 2593 | $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
2560 | - if ($debug) var_dump($score_of_scorm_calculate); |
|
2594 | + if ($debug) { |
|
2595 | + var_dump($score_of_scorm_calculate); |
|
2596 | + } |
|
2561 | 2597 | if (empty($lp_ids)) { |
2562 | - if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2598 | + if ($debug) { |
|
2599 | + echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2600 | + } |
|
2563 | 2601 | } |
2564 | 2602 | return $score_of_scorm_calculate; |
2565 | 2603 | } else { |
2566 | - if ($debug) var_dump($global_result, $lp_with_quiz); |
|
2604 | + if ($debug) { |
|
2605 | + var_dump($global_result, $lp_with_quiz); |
|
2606 | + } |
|
2567 | 2607 | return array($global_result, $lp_with_quiz); |
2568 | 2608 | } |
2569 | 2609 | } else { |
@@ -3050,11 +3090,13 @@ discard block |
||
3050 | 3090 | |
3051 | 3091 | if (!empty ($id_session)) { |
3052 | 3092 | $sql .= ' WHERE session_course.session_id=' . $id_session; |
3053 | - if (api_is_multiple_url_enabled()) |
|
3054 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3055 | - } else { |
|
3056 | - if (api_is_multiple_url_enabled()) |
|
3057 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3093 | + if (api_is_multiple_url_enabled()) { |
|
3094 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3095 | + } |
|
3096 | + } else { |
|
3097 | + if (api_is_multiple_url_enabled()) { |
|
3098 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3099 | + } |
|
3058 | 3100 | } |
3059 | 3101 | |
3060 | 3102 | $result = Database::query($sql); |
@@ -3162,8 +3204,7 @@ discard block |
||
3162 | 3204 | if ($session['access_start_date'] == '0000-00-00 00:00:00' || empty($session['access_start_date']) |
3163 | 3205 | ) { |
3164 | 3206 | $session['status'] = get_lang('SessionActive'); |
3165 | - } |
|
3166 | - else { |
|
3207 | + } else { |
|
3167 | 3208 | $time_start = api_strtotime($session['access_start_date'], 'UTC'); |
3168 | 3209 | $time_end = api_strtotime($session['access_end_date'], 'UTC'); |
3169 | 3210 | if ($time_start < time() && time() < $time_end) { |
@@ -6599,8 +6640,9 @@ discard block |
||
6599 | 6640 | if (is_array($hpresults)) { |
6600 | 6641 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6601 | 6642 | $title = GetQuizName($hpresults[$i][0],''); |
6602 | - if ($title == '') |
|
6603 | - $title = basename($hpresults[$i][0]); |
|
6643 | + if ($title == '') { |
|
6644 | + $title = basename($hpresults[$i][0]); |
|
6645 | + } |
|
6604 | 6646 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6605 | 6647 | ?> |
6606 | 6648 | <tr> |
@@ -6972,8 +7014,9 @@ discard block |
||
6972 | 7014 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6973 | 7015 | $title = GetQuizName($hpresults[$i][0],''); |
6974 | 7016 | |
6975 | - if ($title == '') |
|
6976 | - $title = basename($hpresults[$i][0]); |
|
7017 | + if ($title == '') { |
|
7018 | + $title = basename($hpresults[$i][0]); |
|
7019 | + } |
|
6977 | 7020 | |
6978 | 7021 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6979 | 7022 |
@@ -213,16 +213,19 @@ |
||
213 | 213 | if (is_dir($dir)) { |
214 | 214 | while(($entry = $dir->read()) !== false) |
215 | 215 | { |
216 | - if ($entry != '.' && $entry != '..') |
|
217 | - continue; |
|
216 | + if ($entry != '.' && $entry != '..') { |
|
217 | + continue; |
|
218 | + } |
|
218 | 219 | |
219 | - if (!is_dir($dir_name.'/'.$entry)) |
|
220 | - $current_modified = filemtime($dir_name.'/'.$entry); |
|
221 | - elseif ($do_recursive) |
|
222 | - $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true); |
|
220 | + if (!is_dir($dir_name.'/'.$entry)) { |
|
221 | + $current_modified = filemtime($dir_name.'/'.$entry); |
|
222 | + } elseif ($do_recursive) { |
|
223 | + $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true); |
|
224 | + } |
|
223 | 225 | |
224 | - if ($current_modified > $last_modified) |
|
225 | - $last_modified = $current_modified; |
|
226 | + if ($current_modified > $last_modified) { |
|
227 | + $last_modified = $current_modified; |
|
228 | + } |
|
226 | 229 | } |
227 | 230 | |
228 | 231 | $dir->close(); |
@@ -993,7 +993,9 @@ |
||
993 | 993 | if ($file != '.' && $file != '..') { |
994 | 994 | |
995 | 995 | $filetype = 'file'; |
996 | - if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
|
996 | + if (is_dir($base_work_dir.$upload_path.'/'.$file)) { |
|
997 | + $filetype = 'folder'; |
|
998 | + } |
|
997 | 999 | |
998 | 1000 | $safe_file = api_replace_dangerous_char($file, 'strict'); |
999 | 1001 | @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
@@ -1906,8 +1906,9 @@ |
||
1906 | 1906 | $new_relation_type[] ="'$rel'"; |
1907 | 1907 | } |
1908 | 1908 | $relation_type = implode(',', $new_relation_type); |
1909 | - if (!empty($relation_type)) |
|
1910 | - $where_relation_condition = "AND gu.relation_type IN ($relation_type) "; |
|
1909 | + if (!empty($relation_type)) { |
|
1910 | + $where_relation_condition = "AND gu.relation_type IN ($relation_type) "; |
|
1911 | + } |
|
1911 | 1912 | } |
1912 | 1913 | |
1913 | 1914 | $sql = "SELECT picture_uri as image, u.id, u.firstname, u.lastname, relation_type |
@@ -3122,8 +3122,9 @@ |
||
3122 | 3122 | global $DaysShort, $course_path; |
3123 | 3123 | //Handle leap year |
3124 | 3124 | $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
3125 | - if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
3126 | - $numberofdays[2] = 29; |
|
3125 | + if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) { |
|
3126 | + $numberofdays[2] = 29; |
|
3127 | + } |
|
3127 | 3128 | //Get the first day of the month |
3128 | 3129 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
3129 | 3130 | //Start the week on monday |
@@ -338,7 +338,7 @@ |
||
338 | 338 | |
339 | 339 | if (empty($certificatesItem) && empty($searchItem)) { |
340 | 340 | return null; |
341 | - }else{ |
|
341 | + } else{ |
|
342 | 342 | $content.= $certificatesItem; |
343 | 343 | $content.= $searchItem; |
344 | 344 | } |
@@ -351,8 +351,9 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | $url = esc_url($url); |
354 | - if ( empty($url) ) |
|
355 | - return $matches[0]; |
|
354 | + if ( empty($url) ) { |
|
355 | + return $matches[0]; |
|
356 | + } |
|
356 | 357 | |
357 | 358 | return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; |
358 | 359 | } |
@@ -377,8 +378,9 @@ discard block |
||
377 | 378 | function esc_url( $url, $protocols = null, $_context = 'display' ) { |
378 | 379 | //$original_url = $url; |
379 | 380 | |
380 | - if ( '' == $url ) |
|
381 | - return $url; |
|
381 | + if ( '' == $url ) { |
|
382 | + return $url; |
|
383 | + } |
|
382 | 384 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); |
383 | 385 | $strip = array('%0d', '%0a', '%0D', '%0A'); |
384 | 386 | $url = _deep_replace($strip, $url); |
@@ -388,8 +390,9 @@ discard block |
||
388 | 390 | * link starting with /, # or ? or a php file). |
389 | 391 | */ |
390 | 392 | if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && |
391 | - ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
392 | - $url = 'http://' . $url; |
|
393 | + ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) { |
|
394 | + $url = 'http://' . $url; |
|
395 | + } |
|
393 | 396 | |
394 | 397 | return Security::remove_XSS($url); |
395 | 398 | |
@@ -466,8 +469,9 @@ discard block |
||
466 | 469 | $dest = $matches[2]; |
467 | 470 | $dest = 'http://' . $dest; |
468 | 471 | $dest = esc_url($dest); |
469 | - if ( empty($dest) ) |
|
470 | - return $matches[0]; |
|
472 | + if ( empty($dest) ) { |
|
473 | + return $matches[0]; |
|
474 | + } |
|
471 | 475 | |
472 | 476 | // removed trailing [.,;:)] from URL |
473 | 477 | if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { |
@@ -511,10 +515,11 @@ discard block |
||
511 | 515 | $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> |
512 | 516 | foreach ( $textarr as $piece ) { |
513 | 517 | |
514 | - if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) |
|
515 | - $nested_code_pre++; |
|
516 | - elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) |
|
517 | - $nested_code_pre--; |
|
518 | + if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) { |
|
519 | + $nested_code_pre++; |
|
520 | + } elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) { |
|
521 | + $nested_code_pre--; |
|
522 | + } |
|
518 | 523 | |
519 | 524 | if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { |
520 | 525 | $r .= $piece; |
@@ -723,15 +728,13 @@ discard block |
||
723 | 728 | if($length>$maxchar) |
724 | 729 | { |
725 | 730 | break; |
726 | - } |
|
727 | - else |
|
731 | + } else |
|
728 | 732 | { |
729 | 733 | $output = $output." ".$words[$i]; |
730 | 734 | $i++; |
731 | 735 | }; |
732 | 736 | }; |
733 | - } |
|
734 | - else |
|
737 | + } else |
|
735 | 738 | { |
736 | 739 | $output = $text; |
737 | 740 | return $output; |
@@ -782,13 +785,21 @@ discard block |
||
782 | 785 | if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
783 | 786 | $year = $array['Y']; |
784 | 787 | $month = isset($array['F'])?$array['F']:$array['M']; |
785 | - if (intval($month) < 10 ) $month = '0'.$month; |
|
788 | + if (intval($month) < 10 ) { |
|
789 | + $month = '0'.$month; |
|
790 | + } |
|
786 | 791 | $day = $array['d']; |
787 | - if (intval($day) < 10 ) $day = '0'.$day; |
|
792 | + if (intval($day) < 10 ) { |
|
793 | + $day = '0'.$day; |
|
794 | + } |
|
788 | 795 | $hours = $array['H']; |
789 | - if (intval($hours) < 10 ) $hours = '0'.$hours; |
|
796 | + if (intval($hours) < 10 ) { |
|
797 | + $hours = '0'.$hours; |
|
798 | + } |
|
790 | 799 | $minutes = $array['i']; |
791 | - if (intval($minutes) < 10 ) $minutes = '0'.$minutes; |
|
800 | + if (intval($minutes) < 10 ) { |
|
801 | + $minutes = '0'.$minutes; |
|
802 | + } |
|
792 | 803 | } |
793 | 804 | if (checkdate($month,$day,$year)) { |
794 | 805 | $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds; |