@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | define('PLATFORM_ADMIN', 11); |
39 | 39 | define('SESSION_COURSE_COACH', 12); |
40 | 40 | define('SESSION_GENERAL_COACH', 13); |
41 | -define('COURSE_STUDENT', 14); //student subscribed in a course |
|
42 | -define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
41 | +define('COURSE_STUDENT', 14); //student subscribed in a course |
|
42 | +define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
43 | 43 | define('COURSE_TUTOR', 16); // student is tutor of a course (NOT in session) |
44 | 44 | define('STUDENT_BOSS', 17); // student is boss |
45 | 45 | define('INVITEE', 20); |
46 | 46 | |
47 | 47 | // Table of status |
48 | -$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
49 | -$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
50 | -$_status_list[DRH] = 'drh'; // 4 |
|
51 | -$_status_list[STUDENT] = 'user'; // 5 |
|
52 | -$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
53 | -$_status_list[INVITEE] = 'invited'; // 20 |
|
48 | +$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
49 | +$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
50 | +$_status_list[DRH] = 'drh'; // 4 |
|
51 | +$_status_list[STUDENT] = 'user'; // 5 |
|
52 | +$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
53 | +$_status_list[INVITEE] = 'invited'; // 20 |
|
54 | 54 | |
55 | 55 | // COURSE VISIBILITY CONSTANTS |
56 | 56 | /** only visible for course admin */ |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | define('IS_WINDOWS_OS', api_is_windows_os()); |
265 | 265 | |
266 | 266 | // Checks for installed optional php-extensions. |
267 | -define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
268 | -define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
269 | -define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
267 | +define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
268 | +define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
269 | +define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
270 | 270 | |
271 | 271 | // Patterns for processing paths. // Examples: |
272 | -define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
273 | -define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
274 | -define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
272 | +define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
273 | +define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
274 | +define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
275 | 275 | |
276 | 276 | // Constants for api_get_path() and api_get_path_type(), etc. - registered path types. |
277 | 277 | // basic (leaf elements) |
@@ -364,19 +364,19 @@ discard block |
||
364 | 364 | define('LINK_HOTPOTATOES', 9); |
365 | 365 | |
366 | 366 | // Score display types constants |
367 | -define('SCORE_DIV', 1); // X / Y |
|
368 | -define('SCORE_PERCENT', 2); // XX % |
|
369 | -define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
370 | -define('SCORE_AVERAGE', 4); // XX % |
|
371 | -define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
372 | -define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
373 | -define('SCORE_SIMPLE', 7); // X |
|
374 | -define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
375 | -define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
376 | -define('SCORE_CUSTOM', 10); // Good! |
|
377 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
378 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
379 | -define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
367 | +define('SCORE_DIV', 1); // X / Y |
|
368 | +define('SCORE_PERCENT', 2); // XX % |
|
369 | +define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
370 | +define('SCORE_AVERAGE', 4); // XX % |
|
371 | +define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
372 | +define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
373 | +define('SCORE_SIMPLE', 7); // X |
|
374 | +define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
375 | +define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
376 | +define('SCORE_CUSTOM', 10); // Good! |
|
377 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
378 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
379 | +define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
380 | 380 | |
381 | 381 | define('SCORE_BOTH', 1); |
382 | 382 | define('SCORE_ONLY_DEFAULT', 2); |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | define('TIMELINE_STATUS_INACTIVE', '2'); |
562 | 562 | |
563 | 563 | // Event email template class |
564 | -define ('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
565 | -define ('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
564 | +define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
565 | +define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
566 | 566 | |
567 | 567 | // Course home |
568 | 568 | define('SHORTCUTS_HORIZONTAL', 0); |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | : 'localhost'))); |
636 | 636 | if (isset($_SERVER['SERVER_PORT']) && !strpos($server_name, ':') |
637 | 637 | && (($server_protocol == 'http' |
638 | - && $_SERVER['SERVER_PORT'] != 80 ) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443 ))) { |
|
639 | - $server_name .= ":" . $_SERVER['SERVER_PORT']; |
|
638 | + && $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))) { |
|
639 | + $server_name .= ":".$_SERVER['SERVER_PORT']; |
|
640 | 640 | } |
641 | 641 | $root_web = $server_protocol.'://'.$server_name.$root_rel; |
642 | 642 | $root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $sys_course_code = |
821 | 821 | isset($_SESSION['_course']['sysCode']) // User is inside a course? |
822 | 822 | ? $_SESSION['_course']['sysCode'] // Yes, then use course's directory name. |
823 | - : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
823 | + : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
824 | 824 | $path = $matches[1].'courses/'.$sys_course_code.'/document/'.str_replace('//', '/', $matches[3].'/'.$matches[2]); |
825 | 825 | } |
826 | 826 | } |
@@ -846,15 +846,15 @@ discard block |
||
846 | 846 | { |
847 | 847 | global $_configuration; |
848 | 848 | $web_root = api_get_path(WEB_PATH); |
849 | - $ext = substr($web_path,strrpos($web_path,'.')); |
|
849 | + $ext = substr($web_path, strrpos($web_path, '.')); |
|
850 | 850 | if (isset($ext[2])) { // faster version of strlen to check if len>2 |
851 | 851 | // Check for CDN definitions |
852 | 852 | if (!empty($_configuration['cdn_enable']) && !empty($ext)) { |
853 | 853 | foreach ($_configuration['cdn'] as $host => $exts) { |
854 | - if (in_array($ext,$exts)) { |
|
854 | + if (in_array($ext, $exts)) { |
|
855 | 855 | //Use host as defined in $_configuration['cdn'], without |
856 | 856 | // trailing slash |
857 | - return str_replace($web_root,$host.'/',$web_path); |
|
857 | + return str_replace($web_root, $host.'/', $web_path); |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | } |
@@ -1295,10 +1295,10 @@ discard block |
||
1295 | 1295 | |
1296 | 1296 | if (isset($user['email'])) { |
1297 | 1297 | $result['mail'] = isset($user['email']) ? $user['email'] : null; |
1298 | - $result['email'] = isset($user['email'])? $user['email'] : null; |
|
1298 | + $result['email'] = isset($user['email']) ? $user['email'] : null; |
|
1299 | 1299 | } else { |
1300 | 1300 | $result['mail'] = isset($user['mail']) ? $user['mail'] : null; |
1301 | - $result['email'] = isset($user['mail'])? $user['mail'] : null; |
|
1301 | + $result['email'] = isset($user['mail']) ? $user['mail'] : null; |
|
1302 | 1302 | } |
1303 | 1303 | $user_id = intval($user['user_id']); |
1304 | 1304 | // Maintain the user_id index for backwards compatibility |
@@ -1801,7 +1801,7 @@ discard block |
||
1801 | 1801 | foreach ($param_list1 as $key => $enreg) { |
1802 | 1802 | list ($param_list1_keys[$key], $param_list1_vals[$key]) = explode('=', $enreg); |
1803 | 1803 | } |
1804 | - $param_list1 = array ('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1804 | + $param_list1 = array('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1805 | 1805 | foreach ($param_list2 as $enreg) { |
1806 | 1806 | $enreg = explode('=', $enreg); |
1807 | 1807 | $key = array_search($enreg[0], $param_list1['keys']); |
@@ -1831,7 +1831,7 @@ discard block |
||
1831 | 1831 | $length = 2; |
1832 | 1832 | } |
1833 | 1833 | $password = ''; |
1834 | - for ($i = 0; $i < $length; $i ++) { |
|
1834 | + for ($i = 0; $i < $length; $i++) { |
|
1835 | 1835 | $password .= $characters[rand() % strlen($characters)]; |
1836 | 1836 | } |
1837 | 1837 | return $password; |
@@ -1858,10 +1858,10 @@ discard block |
||
1858 | 1858 | $digits = 0; |
1859 | 1859 | $consequent_characters = 0; |
1860 | 1860 | $previous_character_code = 0; |
1861 | - for ($i = 0; $i < $password_length; $i ++) { |
|
1861 | + for ($i = 0; $i < $password_length; $i++) { |
|
1862 | 1862 | $current_character_code = api_ord(api_substr($password, $i, 1)); |
1863 | 1863 | if ($i && abs($current_character_code - $previous_character_code) <= 1) { |
1864 | - $consequent_characters ++; |
|
1864 | + $consequent_characters++; |
|
1865 | 1865 | if ($consequent_characters == 3) { |
1866 | 1866 | return false; |
1867 | 1867 | } |
@@ -1869,9 +1869,9 @@ discard block |
||
1869 | 1869 | $consequent_characters = 1; |
1870 | 1870 | } |
1871 | 1871 | if ($current_character_code >= 97 && $current_character_code <= 122) { |
1872 | - $letters ++; |
|
1872 | + $letters++; |
|
1873 | 1873 | } elseif ($current_character_code >= 48 && $current_character_code <= 57) { |
1874 | - $digits ++; |
|
1874 | + $digits++; |
|
1875 | 1875 | } else { |
1876 | 1876 | return false; |
1877 | 1877 | } |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | if (empty($session_id)) { return null; } |
2067 | 2067 | } |
2068 | 2068 | $t = Database::get_main_table(TABLE_MAIN_SESSION); |
2069 | - $s = "SELECT name FROM $t WHERE id = ".(int)$session_id; |
|
2069 | + $s = "SELECT name FROM $t WHERE id = ".(int) $session_id; |
|
2070 | 2070 | $r = Database::query($s); |
2071 | 2071 | $c = Database::num_rows($r); |
2072 | 2072 | if ($c > 0) { |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | $sql = "SELECT * FROM $tbl_session WHERE id = $session_id"; |
2092 | 2092 | $result = Database::query($sql); |
2093 | 2093 | |
2094 | - if (Database::num_rows($result)>0) { |
|
2094 | + if (Database::num_rows($result) > 0) { |
|
2095 | 2095 | $data = Database::fetch_array($result, 'ASSOC'); |
2096 | 2096 | } |
2097 | 2097 | } |
@@ -2251,9 +2251,9 @@ discard block |
||
2251 | 2251 | */ |
2252 | 2252 | function api_get_session_image($session_id, $status_id) |
2253 | 2253 | { |
2254 | - $session_id = (int)$session_id; |
|
2254 | + $session_id = (int) $session_id; |
|
2255 | 2255 | $session_img = ''; |
2256 | - if ((int)$status_id != 5) { //check whether is not a student |
|
2256 | + if ((int) $status_id != 5) { //check whether is not a student |
|
2257 | 2257 | if ($session_id > 0) { |
2258 | 2258 | $session_img = " ".Display::return_icon( |
2259 | 2259 | 'star.png', |
@@ -2318,7 +2318,7 @@ discard block |
||
2318 | 2318 | $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt'; |
2319 | 2319 | if (file_exists($filename)) { |
2320 | 2320 | $value = file_get_contents($filename); |
2321 | - return $value ; |
|
2321 | + return $value; |
|
2322 | 2322 | } else { |
2323 | 2323 | return ''; |
2324 | 2324 | } |
@@ -2327,7 +2327,7 @@ discard block |
||
2327 | 2327 | $filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt'; |
2328 | 2328 | if (file_exists($filename)) { |
2329 | 2329 | $value = file_get_contents($filename); |
2330 | - return $value ; |
|
2330 | + return $value; |
|
2331 | 2331 | } else { |
2332 | 2332 | return ''; |
2333 | 2333 | } |
@@ -2521,7 +2521,7 @@ discard block |
||
2521 | 2521 | } |
2522 | 2522 | $group_id = api_get_group_id(); |
2523 | 2523 | $course_id = api_get_course_int_id(); |
2524 | - $course_code= api_get_course_id(); |
|
2524 | + $course_code = api_get_course_id(); |
|
2525 | 2525 | $session_id = api_get_session_id(); |
2526 | 2526 | |
2527 | 2527 | //Group (in course) |
@@ -2529,7 +2529,7 @@ discard block |
||
2529 | 2529 | $group_status = array(); |
2530 | 2530 | $is_subscribed = GroupManager::is_subscribed($user_id, $group_id); |
2531 | 2531 | if ($is_subscribed) { |
2532 | - $group_status = array('id'=> $group_id , 'status' => 'student'); |
|
2532 | + $group_status = array('id'=> $group_id, 'status' => 'student'); |
|
2533 | 2533 | $is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id); |
2534 | 2534 | if ($is_tutor) { |
2535 | 2535 | $group_status['status'] = 'tutor'; |
@@ -2563,7 +2563,7 @@ discard block |
||
2563 | 2563 | } |
2564 | 2564 | $status['session'] = $session_status; |
2565 | 2565 | |
2566 | - } elseif($course_id) { |
|
2566 | + } elseif ($course_id) { |
|
2567 | 2567 | //Course |
2568 | 2568 | $course_status = array(); |
2569 | 2569 | if ($course_id) { |
@@ -2571,7 +2571,7 @@ discard block |
||
2571 | 2571 | |
2572 | 2572 | if ($user_course_status) { |
2573 | 2573 | $course_status = array('id'=> $course_id); |
2574 | - switch($user_course_status) { |
|
2574 | + switch ($user_course_status) { |
|
2575 | 2575 | case 1; |
2576 | 2576 | $course_status['status'] = 'teacher'; |
2577 | 2577 | break; |
@@ -2601,7 +2601,7 @@ discard block |
||
2601 | 2601 | function api_is_course_session_coach($user_id, $courseId, $session_id) |
2602 | 2602 | { |
2603 | 2603 | $session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
2604 | - $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2604 | + $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2605 | 2605 | |
2606 | 2606 | $user_id = intval($user_id); |
2607 | 2607 | $session_id = intval($session_id); |
@@ -2675,7 +2675,7 @@ discard block |
||
2675 | 2675 | ORDER BY access_start_date, access_end_date, name"; |
2676 | 2676 | $result = Database::query($sql); |
2677 | 2677 | if (!empty($sessionIsCoach)) { |
2678 | - $sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result)); |
|
2678 | + $sessionIsCoach = array_merge($sessionIsCoach, Database::store_result($result)); |
|
2679 | 2679 | } else { |
2680 | 2680 | $sessionIsCoach = Database::store_result($result); |
2681 | 2681 | } |
@@ -2852,7 +2852,7 @@ discard block |
||
2852 | 2852 | return ''; |
2853 | 2853 | } |
2854 | 2854 | $sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')); |
2855 | - $sourceurl = str_replace('newscorm/lp_header.php', 'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview']=='studentview' ? 'false' : 'true'), $sourceurl); |
|
2855 | + $sourceurl = str_replace('newscorm/lp_header.php', 'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview'] == 'studentview' ? 'false' : 'true'), $sourceurl); |
|
2856 | 2856 | //showinframes doesn't handle student view anyway... |
2857 | 2857 | //return ''; |
2858 | 2858 | $is_framed = true; |
@@ -3254,7 +3254,7 @@ discard block |
||
3254 | 3254 | } |
3255 | 3255 | $content .= '<div class="well_login">'; |
3256 | 3256 | $content .= $form->return_form(); |
3257 | - $content .='</div>'; |
|
3257 | + $content .= '</div>'; |
|
3258 | 3258 | if (api_is_cas_activated()) { |
3259 | 3259 | $content .= "</div>"; |
3260 | 3260 | } |
@@ -3273,7 +3273,7 @@ discard block |
||
3273 | 3273 | exit; |
3274 | 3274 | } |
3275 | 3275 | |
3276 | - if ($user_id !=0 && !api_is_anonymous()) { |
|
3276 | + if ($user_id != 0 && !api_is_anonymous()) { |
|
3277 | 3277 | $tpl->display_one_col_template(); |
3278 | 3278 | exit; |
3279 | 3279 | } |
@@ -3304,7 +3304,7 @@ discard block |
||
3304 | 3304 | } |
3305 | 3305 | $msg .= '<div class="well">'; |
3306 | 3306 | $msg .= $form->return_form(); |
3307 | - $msg .='</div>'; |
|
3307 | + $msg .= '</div>'; |
|
3308 | 3308 | if (api_is_cas_activated()) { |
3309 | 3309 | $msg .= "</div>"; |
3310 | 3310 | } |
@@ -3340,7 +3340,7 @@ discard block |
||
3340 | 3340 | list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime); |
3341 | 3341 | list ($year, $month, $day) = explode('-', $last_post_date); |
3342 | 3342 | list ($hour, $min, $sec) = explode(':', $last_post_time); |
3343 | - return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year); |
|
3343 | + return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year); |
|
3344 | 3344 | } |
3345 | 3345 | |
3346 | 3346 | /** |
@@ -3796,7 +3796,7 @@ discard block |
||
3796 | 3796 | c_id = $course_id AND |
3797 | 3797 | tool = '$tool' |
3798 | 3798 | $session_condition "; |
3799 | - $rs = Database::query($sql); |
|
3799 | + $rs = Database::query($sql); |
|
3800 | 3800 | $list = array(); |
3801 | 3801 | if (Database::num_rows($rs) > 0) { |
3802 | 3802 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -3876,7 +3876,7 @@ discard block |
||
3876 | 3876 | tool = '$tool' AND |
3877 | 3877 | ref = $ref |
3878 | 3878 | $sessionCondition"; |
3879 | - $rs = Database::query($sql); |
|
3879 | + $rs = Database::query($sql); |
|
3880 | 3880 | $item_property_id = ''; |
3881 | 3881 | if (Database::num_rows($rs) > 0) { |
3882 | 3882 | $row = Database::fetch_array($rs); |
@@ -3934,7 +3934,7 @@ discard block |
||
3934 | 3934 | WHERE item_property_id = $item_property_id AND course_id = $course_id |
3935 | 3935 | ORDER BY lastedit_date DESC"; |
3936 | 3936 | $result = Database::query($sql); |
3937 | - $result = Database::store_result($result,'ASSOC'); |
|
3937 | + $result = Database::store_result($result, 'ASSOC'); |
|
3938 | 3938 | |
3939 | 3939 | return $result; |
3940 | 3940 | } |
@@ -3985,7 +3985,7 @@ discard block |
||
3985 | 3985 | $rs = Database::query($sql); |
3986 | 3986 | $row = array(); |
3987 | 3987 | if (Database::num_rows($rs) > 0) { |
3988 | - $row = Database::fetch_array($rs,'ASSOC'); |
|
3988 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
3989 | 3989 | } |
3990 | 3990 | |
3991 | 3991 | return $row; |
@@ -4021,7 +4021,7 @@ discard block |
||
4021 | 4021 | $languages = $language_list['name']; |
4022 | 4022 | $folder = $language_list['folder']; |
4023 | 4023 | |
4024 | - $ret .= '<select name="' . $name . '" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4024 | + $ret .= '<select name="'.$name.'" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4025 | 4025 | foreach ($languages as $key => $value) { |
4026 | 4026 | if ($folder[$key] == $default) { |
4027 | 4027 | $selected = ' selected="selected"'; |
@@ -4074,8 +4074,8 @@ discard block |
||
4074 | 4074 | //--> |
4075 | 4075 | </script>'; |
4076 | 4076 | $html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">'; |
4077 | - $html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>'; |
|
4078 | - $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4077 | + $html .= '<label style="display: none;" for="language_list">'.get_lang('Language').'</label>'; |
|
4078 | + $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4079 | 4079 | |
4080 | 4080 | foreach ($original_languages as $key => $value) { |
4081 | 4081 | if ($folder[$key] == $user_selected_language) { |
@@ -4083,13 +4083,13 @@ discard block |
||
4083 | 4083 | } else { |
4084 | 4084 | $option_end = '>'; |
4085 | 4085 | } |
4086 | - $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4086 | + $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4087 | 4087 | //echo substr($value, 0, 16); // Cut string to keep 800x600 aspect. |
4088 | - $html .= $value.'</option>'; |
|
4088 | + $html .= $value.'</option>'; |
|
4089 | 4089 | } |
4090 | - $html .= '</select>'; |
|
4091 | - $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4092 | - $html .= '</form>'; |
|
4090 | + $html .= '</select>'; |
|
4091 | + $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4092 | + $html .= '</form>'; |
|
4093 | 4093 | return $html; |
4094 | 4094 | } |
4095 | 4095 | |
@@ -4215,7 +4215,7 @@ discard block |
||
4215 | 4215 | $rs = Database::query($sql); |
4216 | 4216 | $language_info = array(); |
4217 | 4217 | if (Database::num_rows($rs)) { |
4218 | - $language_info = Database::fetch_array($rs,'ASSOC'); |
|
4218 | + $language_info = Database::fetch_array($rs, 'ASSOC'); |
|
4219 | 4219 | } |
4220 | 4220 | return $language_info; |
4221 | 4221 | } |
@@ -4293,7 +4293,7 @@ discard block |
||
4293 | 4293 | * Note: Directory names (names of themes) in the file system should contain ASCII-characters only. |
4294 | 4294 | */ |
4295 | 4295 | function api_get_themes() { |
4296 | - $cssdir = api_get_path(SYS_CSS_PATH) . 'themes/'; |
|
4296 | + $cssdir = api_get_path(SYS_CSS_PATH).'themes/'; |
|
4297 | 4297 | $list_dir = array(); |
4298 | 4298 | $list_name = array(); |
4299 | 4299 | |
@@ -4470,7 +4470,7 @@ discard block |
||
4470 | 4470 | if (is_file($dirname) || is_link($dirname)) { |
4471 | 4471 | $res = unlink($dirname); |
4472 | 4472 | if ($res === false) { |
4473 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4473 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4474 | 4474 | } |
4475 | 4475 | return $res; |
4476 | 4476 | } |
@@ -4507,7 +4507,7 @@ discard block |
||
4507 | 4507 | if ($delete_only_content_in_folder == false) { |
4508 | 4508 | $res = rmdir($dirname); |
4509 | 4509 | if ($res === false) { |
4510 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4510 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4511 | 4511 | } |
4512 | 4512 | } |
4513 | 4513 | return $res; |
@@ -4592,7 +4592,7 @@ discard block |
||
4592 | 4592 | |
4593 | 4593 | $course_id = $course_info['real_id']; |
4594 | 4594 | |
4595 | - $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname)); |
|
4595 | + $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname)); |
|
4596 | 4596 | |
4597 | 4597 | $new_pathname = $base_path_document; |
4598 | 4598 | $path = ''; |
@@ -4610,7 +4610,7 @@ discard block |
||
4610 | 4610 | path = '$path' AND |
4611 | 4611 | filetype = 'folder' AND |
4612 | 4612 | session_id = '$session_id'"; |
4613 | - $rs1 = Database::query($sql); |
|
4613 | + $rs1 = Database::query($sql); |
|
4614 | 4614 | $num_rows = Database::num_rows($rs1); |
4615 | 4615 | |
4616 | 4616 | if ($num_rows == 0) { |
@@ -4770,7 +4770,7 @@ discard block |
||
4770 | 4770 | foreach (array('key', 'value1', 'value2', 'value3') as $var) { |
4771 | 4771 | $$var = isset($match[++$i]) ? $match[$i] : ''; |
4772 | 4772 | } |
4773 | - $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; |
|
4773 | + $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3; |
|
4774 | 4774 | |
4775 | 4775 | // Parse array syntax. |
4776 | 4776 | $keys = preg_split('/\]?\[/', rtrim($key, ']')); |
@@ -4810,7 +4810,7 @@ discard block |
||
4810 | 4810 | */ |
4811 | 4811 | function api_get_version() { |
4812 | 4812 | global $_configuration; |
4813 | - return (string)$_configuration['system_version']; |
|
4813 | + return (string) $_configuration['system_version']; |
|
4814 | 4814 | } |
4815 | 4815 | |
4816 | 4816 | /** |
@@ -4937,7 +4937,7 @@ discard block |
||
4937 | 4937 | $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
4938 | 4938 | $var = Database::escape_string($var); |
4939 | 4939 | $value = Database::escape_string($value); |
4940 | - $access_url = (int)$access_url; |
|
4940 | + $access_url = (int) $access_url; |
|
4941 | 4941 | if (empty($access_url)) { $access_url = 1; } |
4942 | 4942 | $select = "SELECT id FROM $t_settings WHERE variable = '$var' "; |
4943 | 4943 | if (!empty($subvar)) { |
@@ -4958,7 +4958,7 @@ discard block |
||
4958 | 4958 | // Found item for this access_url. |
4959 | 4959 | $row = Database::fetch_array($res); |
4960 | 4960 | $sql = "UPDATE $t_settings SET selected_value = '$value' |
4961 | - WHERE id = ".$row['id'] ; |
|
4961 | + WHERE id = ".$row['id']; |
|
4962 | 4962 | Database::query($sql); |
4963 | 4963 | } else { |
4964 | 4964 | // Item not found for this access_url, we have to check if it exist with access_url = 1 |
@@ -4978,11 +4978,11 @@ discard block |
||
4978 | 4978 | $row = Database::fetch_array($res); |
4979 | 4979 | $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url) |
4980 | 4980 | VALUES |
4981 | - ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
4982 | - "'".$row['type']."','".$row['category']."'," . |
|
4983 | - "'$value','".$row['title']."'," . |
|
4984 | - "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
4985 | - "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)"; |
|
4981 | + ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
4982 | + "'".$row['type']."','".$row['category']."',". |
|
4983 | + "'$value','".$row['title']."',". |
|
4984 | + "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
4985 | + "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)"; |
|
4986 | 4986 | Database::query($insert); |
4987 | 4987 | } else { // Such a setting does not exist. |
4988 | 4988 | error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0); |
@@ -5002,16 +5002,16 @@ discard block |
||
5002 | 5002 | if ($row['access_url_changeable'] == 1) { |
5003 | 5003 | $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES |
5004 | 5004 | ('".$row['variable']."',". |
5005 | - (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5006 | - "'".$row['type']."','".$row['category']."'," . |
|
5007 | - "'$value','".$row['title']."'," . |
|
5005 | + (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5006 | + "'".$row['type']."','".$row['category']."',". |
|
5007 | + "'$value','".$row['title']."',". |
|
5008 | 5008 | "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",". |
5009 | - (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5009 | + (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5010 | 5010 | "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; |
5011 | 5011 | Database::query($insert); |
5012 | 5012 | } |
5013 | 5013 | } else { // Such a setting does not exist. |
5014 | - error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0); |
|
5014 | + error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ', 0); |
|
5015 | 5015 | } |
5016 | 5016 | } |
5017 | 5017 | } |
@@ -5039,10 +5039,10 @@ discard block |
||
5039 | 5039 | $value = Database::escape_string($value); |
5040 | 5040 | $sql = "UPDATE $t_s SET selected_value = '$value' |
5041 | 5041 | WHERE category = '$category' AND access_url = $access_url"; |
5042 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5042 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5043 | 5043 | $sql .= " AND ( "; |
5044 | 5044 | $i = 0; |
5045 | - foreach ($fieldtype as $type){ |
|
5045 | + foreach ($fieldtype as $type) { |
|
5046 | 5046 | if ($i > 0) { |
5047 | 5047 | $sql .= ' OR '; |
5048 | 5048 | } |
@@ -5057,10 +5057,10 @@ discard block |
||
5057 | 5057 | } else { |
5058 | 5058 | $sql = "UPDATE $t_s SET selected_value = NULL |
5059 | 5059 | WHERE category = '$category' AND access_url = $access_url"; |
5060 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5060 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5061 | 5061 | $sql .= " AND ( "; |
5062 | 5062 | $i = 0; |
5063 | - foreach ($fieldtype as $type){ |
|
5063 | + foreach ($fieldtype as $type) { |
|
5064 | 5064 | if ($i > 0) { |
5065 | 5065 | $sql .= ' OR '; |
5066 | 5066 | } |
@@ -5205,7 +5205,7 @@ discard block |
||
5205 | 5205 | function & api_get_settings_categories($exceptions = array(), $access_url = 1) { |
5206 | 5206 | $access_url = (int) $access_url; |
5207 | 5207 | $t_cs = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
5208 | - $list = "'".implode("','",$exceptions)."'"; |
|
5208 | + $list = "'".implode("','", $exceptions)."'"; |
|
5209 | 5209 | $sql = "SELECT DISTINCT category FROM $t_cs WHERE category is NOT NULL "; |
5210 | 5210 | if ($list != "'',''" && $list != "''" && !empty($list)) { |
5211 | 5211 | $sql .= " AND category NOT IN ($list) "; |
@@ -5317,12 +5317,12 @@ discard block |
||
5317 | 5317 | |
5318 | 5318 | // Item not found for this access_url, we have to check if the whole thing is missing |
5319 | 5319 | // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1 |
5320 | - $insert = "INSERT INTO $t_settings " . |
|
5321 | - "(variable,selected_value," . |
|
5322 | - "type,category," . |
|
5323 | - "subkey,title," . |
|
5324 | - "comment,scope," . |
|
5325 | - "subkeytext,access_url,access_url_changeable)" . |
|
5320 | + $insert = "INSERT INTO $t_settings ". |
|
5321 | + "(variable,selected_value,". |
|
5322 | + "type,category,". |
|
5323 | + "subkey,title,". |
|
5324 | + "comment,scope,". |
|
5325 | + "subkeytext,access_url,access_url_changeable)". |
|
5326 | 5326 | " VALUES ('$var','$val',"; |
5327 | 5327 | if (isset($type)) { |
5328 | 5328 | $type = Database::escape_string($type); |
@@ -5488,7 +5488,7 @@ discard block |
||
5488 | 5488 | $result = Database::query($sql); |
5489 | 5489 | |
5490 | 5490 | //if ($row = Database::fetch_array($result)) { |
5491 | - if (Database::num_rows($result) > 0 ) { |
|
5491 | + if (Database::num_rows($result) > 0) { |
|
5492 | 5492 | $is_courseMember = true; |
5493 | 5493 | $is_courseTutor = true; |
5494 | 5494 | $is_courseCoach = true; |
@@ -5708,8 +5708,8 @@ discard block |
||
5708 | 5708 | { |
5709 | 5709 | $tbl_rel_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
5710 | 5710 | if (!empty($user_id) && !empty($courseId)) { |
5711 | - $user_id = intval($user_id); |
|
5712 | - $courseId = intval($courseId); |
|
5711 | + $user_id = intval($user_id); |
|
5712 | + $courseId = intval($courseId); |
|
5713 | 5713 | $sql = 'SELECT status |
5714 | 5714 | FROM '.$tbl_rel_course_user.' |
5715 | 5715 | WHERE user_id='.$user_id.' AND c_id = '.$courseId; |
@@ -5821,7 +5821,7 @@ discard block |
||
5821 | 5821 | } else { |
5822 | 5822 | return false; |
5823 | 5823 | } |
5824 | - return strtolower(substr((string)$os, 0, 3 )) == 'win'; |
|
5824 | + return strtolower(substr((string) $os, 0, 3)) == 'win'; |
|
5825 | 5825 | } |
5826 | 5826 | |
5827 | 5827 | /** |
@@ -6349,7 +6349,7 @@ discard block |
||
6349 | 6349 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6350 | 6350 | $libraries = array(); |
6351 | 6351 | if ($include_jqgrid) { |
6352 | - $libraries[]='jqgrid'; |
|
6352 | + $libraries[] = 'jqgrid'; |
|
6353 | 6353 | } |
6354 | 6354 | return api_get_jquery_libraries_js($libraries); |
6355 | 6355 | } |
@@ -6373,12 +6373,12 @@ discard block |
||
6373 | 6373 | |
6374 | 6374 | //jqgrid js and css |
6375 | 6375 | if (in_array('jqgrid', $libraries)) { |
6376 | - $languaje = 'en'; |
|
6376 | + $languaje = 'en'; |
|
6377 | 6377 | $platform_isocode = strtolower(api_get_language_isocode()); |
6378 | 6378 | |
6379 | 6379 | //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
6380 | 6380 | $jqgrid_langs = array( |
6381 | - 'bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua' |
|
6381 | + 'bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua' |
|
6382 | 6382 | ); |
6383 | 6383 | |
6384 | 6384 | if (in_array($platform_isocode, $jqgrid_langs)) { |
@@ -6409,7 +6409,7 @@ discard block |
||
6409 | 6409 | |
6410 | 6410 | // jquery datepicker |
6411 | 6411 | if (in_array('datepicker', $libraries)) { |
6412 | - $languaje = 'en-GB'; |
|
6412 | + $languaje = 'en-GB'; |
|
6413 | 6413 | $platform_isocode = strtolower(api_get_language_isocode()); |
6414 | 6414 | |
6415 | 6415 | // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
@@ -6575,7 +6575,7 @@ discard block |
||
6575 | 6575 | * @return void |
6576 | 6576 | */ |
6577 | 6577 | function api_check_php_version($my_inc_path = null) { |
6578 | - if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6578 | + if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6579 | 6579 | $global_error_code = 1; |
6580 | 6580 | // Incorrect PHP version |
6581 | 6581 | $global_page = $my_inc_path.'global_error_message.inc.php'; |
@@ -6591,7 +6591,7 @@ discard block |
||
6591 | 6591 | */ |
6592 | 6592 | function api_check_archive_dir() { |
6593 | 6593 | if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { |
6594 | - $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); |
|
6594 | + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning'); |
|
6595 | 6595 | api_not_allowed(true, $message); |
6596 | 6596 | } |
6597 | 6597 | } |
@@ -6656,7 +6656,7 @@ discard block |
||
6656 | 6656 | * @author Jorge Frisancho Jibaja <[email protected]>, USIL - Some changes to allow the use of real IP using reverse proxy |
6657 | 6657 | * @version CEV CHANGE 24APR2012 |
6658 | 6658 | */ |
6659 | -function api_get_real_ip(){ |
|
6659 | +function api_get_real_ip() { |
|
6660 | 6660 | // Guess the IP if behind a reverse proxy |
6661 | 6661 | global $debug; |
6662 | 6662 | $ip = trim($_SERVER['REMOTE_ADDR']); |
@@ -6682,23 +6682,23 @@ discard block |
||
6682 | 6682 | * @author Yannick Warnier for improvements and managment of multiple ranges |
6683 | 6683 | * @todo check for IPv6 support |
6684 | 6684 | */ |
6685 | -function api_check_ip_in_range($ip,$range) |
|
6685 | +function api_check_ip_in_range($ip, $range) |
|
6686 | 6686 | { |
6687 | 6687 | if (empty($ip) or empty($range)) { |
6688 | 6688 | return false; |
6689 | 6689 | } |
6690 | - $ip_ip = ip2long ($ip); |
|
6690 | + $ip_ip = ip2long($ip); |
|
6691 | 6691 | // divide range param into array of elements |
6692 | - if (strpos($range,',')!==false) { |
|
6693 | - $ranges = explode(',',$range); |
|
6692 | + if (strpos($range, ',') !== false) { |
|
6693 | + $ranges = explode(',', $range); |
|
6694 | 6694 | } else { |
6695 | 6695 | $ranges = array($range); |
6696 | 6696 | } |
6697 | 6697 | foreach ($ranges as $range) { |
6698 | 6698 | $range = trim($range); |
6699 | 6699 | if (empty($range)) { continue; } |
6700 | - if (strpos($range,'/')===false) { |
|
6701 | - if (strcmp($ip,$range)===0) { |
|
6700 | + if (strpos($range, '/') === false) { |
|
6701 | + if (strcmp($ip, $range) === 0) { |
|
6702 | 6702 | return true; // there is a direct IP match, return OK |
6703 | 6703 | } |
6704 | 6704 | continue; //otherwise, get to the next range |
@@ -6706,7 +6706,7 @@ discard block |
||
6706 | 6706 | // the range contains a "/", so analyse completely |
6707 | 6707 | list ($net, $mask) = explode("/", $range); |
6708 | 6708 | |
6709 | - $ip_net = ip2long ($net); |
|
6709 | + $ip_net = ip2long($net); |
|
6710 | 6710 | // mask binary magic |
6711 | 6711 | $ip_mask = ~((1 << (32 - $mask)) - 1); |
6712 | 6712 | |
@@ -7068,14 +7068,14 @@ discard block |
||
7068 | 7068 | * @assert (0) === true |
7069 | 7069 | * @assert ('1G') === true |
7070 | 7070 | */ |
7071 | -function api_set_memory_limit($mem){ |
|
7071 | +function api_set_memory_limit($mem) { |
|
7072 | 7072 | //if ini_set() not available, this function is useless |
7073 | 7073 | if (!function_exists('ini_set') || is_null($mem) || $mem == -1) { |
7074 | 7074 | return false; |
7075 | 7075 | } |
7076 | 7076 | |
7077 | 7077 | $memory_limit = ini_get('memory_limit'); |
7078 | - if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){ |
|
7078 | + if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) { |
|
7079 | 7079 | ini_set('memory_limit', $mem); |
7080 | 7080 | return true; |
7081 | 7081 | } |
@@ -7092,21 +7092,21 @@ discard block |
||
7092 | 7092 | * @assert ('1m') === 1048576 |
7093 | 7093 | * @assert ('100k') === 102400 |
7094 | 7094 | */ |
7095 | -function api_get_bytes_memory_limit($mem){ |
|
7096 | - $size = strtolower(substr($mem,-1)); |
|
7095 | +function api_get_bytes_memory_limit($mem) { |
|
7096 | + $size = strtolower(substr($mem, -1)); |
|
7097 | 7097 | |
7098 | 7098 | switch ($size) { |
7099 | 7099 | case 't': |
7100 | - $mem = intval(substr($mem,-1))*1024*1024*1024*1024; |
|
7100 | + $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024; |
|
7101 | 7101 | break; |
7102 | 7102 | case 'g': |
7103 | - $mem = intval(substr($mem,0,-1))*1024*1024*1024; |
|
7103 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024; |
|
7104 | 7104 | break; |
7105 | 7105 | case 'm': |
7106 | - $mem = intval(substr($mem,0,-1))*1024*1024; |
|
7106 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024; |
|
7107 | 7107 | break; |
7108 | 7108 | case 'k': |
7109 | - $mem = intval(substr($mem,0,-1))*1024; |
|
7109 | + $mem = intval(substr($mem, 0, -1)) * 1024; |
|
7110 | 7110 | break; |
7111 | 7111 | default: |
7112 | 7112 | // we assume it's integer only |
@@ -7159,7 +7159,7 @@ discard block |
||
7159 | 7159 | get_lang('PasswordVeryStrong'), |
7160 | 7160 | ); |
7161 | 7161 | $js = api_get_js('strength/strength.js'); |
7162 | - $js .= "<script> |
|
7162 | + $js .= "<script> |
|
7163 | 7163 | |
7164 | 7164 | var verdicts = ['".implode("','", $verdicts)."']; |
7165 | 7165 | var errorMessages = { |
@@ -7215,7 +7215,7 @@ discard block |
||
7215 | 7215 | return false; |
7216 | 7216 | } |
7217 | 7217 | $minutesToBlock = api_get_setting('captcha_time_to_block'); |
7218 | - $time = time() + $minutesToBlock*60; |
|
7218 | + $time = time() + $minutesToBlock * 60; |
|
7219 | 7219 | UserManager::update_extra_field_value( |
7220 | 7220 | $userInfo['user_id'], |
7221 | 7221 | 'captcha_blocked_until_date', |
@@ -7289,7 +7289,7 @@ discard block |
||
7289 | 7289 | $out_res = str_replace('"', "''", $out_res); |
7290 | 7290 | } |
7291 | 7291 | // avoid text stuck together when tags are removed, adding a space after > |
7292 | - $out_res = str_replace (">", "> ", $out_res); |
|
7292 | + $out_res = str_replace(">", "> ", $out_res); |
|
7293 | 7293 | $out_res = strip_tags($out_res); |
7294 | 7294 | |
7295 | 7295 | return $out_res; |
@@ -7399,12 +7399,12 @@ discard block |
||
7399 | 7399 | { |
7400 | 7400 | // Clean query |
7401 | 7401 | $bt = debug_backtrace(); |
7402 | - $caller = array_shift($bt);; |
|
7402 | + $caller = array_shift($bt); ; |
|
7403 | 7403 | if ($dump == 1) { |
7404 | 7404 | $string = print_r($string, 1); |
7405 | 7405 | } else { |
7406 | 7406 | $string = str_replace(array("\r", "\n", "\t", "\10"), '', $string); |
7407 | - $string = str_replace(' ',' ', $string); |
|
7407 | + $string = str_replace(' ', ' ', $string); |
|
7408 | 7408 | } |
7409 | 7409 | |
7410 | 7410 | error_log("-------------------------------------"); |
@@ -7514,7 +7514,7 @@ discard block |
||
7514 | 7514 | $body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n "; |
7515 | 7515 | $body .= get_lang('PortalLimitType').': '.$limitName." \n "; |
7516 | 7516 | if (isset($hostingParams[$limitName])) { |
7517 | - $body .= get_lang('Value') . ': ' . $hostingParams[$limitName]; |
|
7517 | + $body .= get_lang('Value').': '.$hostingParams[$limitName]; |
|
7518 | 7518 | } |
7519 | 7519 | api_mail_html(null, $email, $subject, $body); |
7520 | 7520 | } |
@@ -7642,7 +7642,7 @@ discard block |
||
7642 | 7642 | */ |
7643 | 7643 | function api_set_site_use_cookie_warning_cookie() |
7644 | 7644 | { |
7645 | - setcookie("ChamiloUsesCookies", "ok", time()+31556926); |
|
7645 | + setcookie("ChamiloUsesCookies", "ok", time() + 31556926); |
|
7646 | 7646 | } |
7647 | 7647 | |
7648 | 7648 | /** |
@@ -7690,10 +7690,10 @@ discard block |
||
7690 | 7690 | return false; |
7691 | 7691 | } |
7692 | 7692 | |
7693 | - $fullPath = $parentDirectory . api_replace_dangerous_char($name); |
|
7693 | + $fullPath = $parentDirectory.api_replace_dangerous_char($name); |
|
7694 | 7694 | |
7695 | 7695 | if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) { |
7696 | - $fp = fopen($fullPath . '/index.html', 'w'); |
|
7696 | + $fp = fopen($fullPath.'/index.html', 'w'); |
|
7697 | 7697 | |
7698 | 7698 | if ($fp) { |
7699 | 7699 | if (fwrite($fp, '<html><head></head><body></body></html>')) { |
@@ -7758,7 +7758,7 @@ discard block |
||
7758 | 7758 | $mail->SMTPSecure = $platform_email['SMTP_SECURE']; |
7759 | 7759 | } |
7760 | 7760 | } |
7761 | - $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG'])?$platform_email['SMTP_DEBUG']:0; |
|
7761 | + $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG']) ? $platform_email['SMTP_DEBUG'] : 0; |
|
7762 | 7762 | |
7763 | 7763 | // 5 = low, 1 = high |
7764 | 7764 | $mail->Priority = 3; |
@@ -7910,11 +7910,11 @@ discard block |
||
7910 | 7910 | error_log('ERROR: mail not sent to '.$recipient_name.' ('.$recipient_email.') because of '.$mail->ErrorInfo.'<br />'); |
7911 | 7911 | if ($mail->SMTPDebug) { |
7912 | 7912 | error_log( |
7913 | - "Connection details :: " . |
|
7914 | - "Protocol: " . $mail->Mailer . ' :: ' . |
|
7915 | - "Host/Port: " . $mail->Host . ':' . $mail->Port . ' :: ' . |
|
7916 | - "Authent/Open: " . ($mail->SMTPAuth?'Authent':'Open') . ' :: ' . |
|
7917 | - ($mail->SMTPAuth?" User/Pass: " . $mail->Username . ':' . $mail->Password:'') |
|
7913 | + "Connection details :: ". |
|
7914 | + "Protocol: ".$mail->Mailer.' :: '. |
|
7915 | + "Host/Port: ".$mail->Host.':'.$mail->Port.' :: '. |
|
7916 | + "Authent/Open: ".($mail->SMTPAuth ? 'Authent' : 'Open').' :: '. |
|
7917 | + ($mail->SMTPAuth ? " User/Pass: ".$mail->Username.':'.$mail->Password : '') |
|
7918 | 7918 | ); |
7919 | 7919 | } |
7920 | 7920 | return 0; |
@@ -7964,7 +7964,7 @@ discard block |
||
7964 | 7964 | * @param datetime $currentDate |
7965 | 7965 | * @return bool true if date is in rage, false otherwise |
7966 | 7966 | */ |
7967 | -function apiIsDateInDateRange ($startDate, $endDate, $currentDate = null) |
|
7967 | +function apiIsDateInDateRange($startDate, $endDate, $currentDate = null) |
|
7968 | 7968 | { |
7969 | 7969 | $startDate = strtotime(api_get_local_time($startDate)); |
7970 | 7970 | $endDate = strtotime(api_get_local_time($endDate)); |
@@ -7985,13 +7985,13 @@ discard block |
||
7985 | 7985 | * @return array |
7986 | 7986 | * |
7987 | 7987 | */ |
7988 | -function api_unique_multidim_array($array, $key){ |
|
7988 | +function api_unique_multidim_array($array, $key) { |
|
7989 | 7989 | $temp_array = []; |
7990 | 7990 | $i = 0; |
7991 | 7991 | $key_array = []; |
7992 | 7992 | |
7993 | - foreach($array as $val){ |
|
7994 | - if(!in_array($val[$key],$key_array)){ |
|
7993 | + foreach ($array as $val) { |
|
7994 | + if (!in_array($val[$key], $key_array)) { |
|
7995 | 7995 | $key_array[$i] = $val[$key]; |
7996 | 7996 | $temp_array[$i] = $val; |
7997 | 7997 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | if (!empty($gradebook) && $gradebook == 'view') { |
66 | 66 | $interbreadcrumb[] = array( |
67 | - 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], |
|
67 | + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
|
68 | 68 | 'name' => get_lang('ToolGradebook'), |
69 | 69 | ); |
70 | 70 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | switch ($_GET['content']) { |
80 | 80 | case 'forum': |
81 | 81 | $interbreadcrumb[] = array( |
82 | - 'url' => 'index.php?search=' . $search_forum . '&' . api_get_cidreq(), |
|
82 | + 'url' => 'index.php?search='.$search_forum.'&'.api_get_cidreq(), |
|
83 | 83 | 'name' => get_lang('Forum'), |
84 | 84 | ); |
85 | 85 | $interbreadcrumb[] = array( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | break; |
90 | 90 | case 'forumcategory': |
91 | 91 | $interbreadcrumb[] = array( |
92 | - 'url' => 'index.php?search=' . $search_forum . '&' . api_get_cidreq(), |
|
92 | + 'url' => 'index.php?search='.$search_forum.'&'.api_get_cidreq(), |
|
93 | 93 | 'name' => get_lang('Forum'), |
94 | 94 | ); |
95 | 95 | $interbreadcrumb[] = array( |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | . "&gradebook=&action=add_item&type=step&lp_id=$lp_id#resource_tab-5\">" |
186 | 186 | . Display::return_icon( |
187 | 187 | 'back.png', |
188 | - get_lang("BackTo") . ' ' . get_lang("LearningPaths"), |
|
188 | + get_lang("BackTo").' '.get_lang("LearningPaths"), |
|
189 | 189 | '', |
190 | 190 | ICON_SIZE_MEDIUM |
191 | 191 | ) |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | |
198 | 198 | if (api_is_allowed_to_edit(false, true)) { |
199 | 199 | echo '<a href="' |
200 | - . api_get_self() . '?' . api_get_cidreq() |
|
201 | - . '&action=add&content=forumcategory&lp_id=' . $lp_id . '"> ' . |
|
200 | + . api_get_self().'?'.api_get_cidreq() |
|
201 | + . '&action=add&content=forumcategory&lp_id='.$lp_id.'"> '. |
|
202 | 202 | Display::return_icon( |
203 | 203 | 'new_folder.png', get_lang('AddForumCategory'), '', ICON_SIZE_MEDIUM |
204 | 204 | ) |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | ); |
249 | 249 | |
250 | 250 | if (empty($sessionId) && !empty($forumCategory['session_name'])) { |
251 | - $session_displayed = ' (' . Security::remove_XSS($forumCategory['session_name']) . ')'; |
|
251 | + $session_displayed = ' ('.Security::remove_XSS($forumCategory['session_name']).')'; |
|
252 | 252 | } else { |
253 | 253 | $session_displayed = ''; |
254 | 254 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $html = ''; |
261 | 261 | $iconsEdit = ''; |
262 | 262 | $idCategory = $forumCategory['cat_id']; |
263 | - $urlCategory = 'viewforumcategory.php?' . api_get_cidreq() . '&forumcategory=' . intval($idCategory); |
|
263 | + $urlCategory = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.intval($idCategory); |
|
264 | 264 | $titleCategory = Display::tag( |
265 | 265 | 'a', |
266 | 266 | $forumCategory['cat_title'], |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | !($forumCategory['session_id'] == 0 && |
279 | 279 | intval($sessionId) != 0) |
280 | 280 | ) { |
281 | - $iconsEdit .= '<a href="' . api_get_self() . '?' . api_get_cidreq() |
|
282 | - . '&action=edit&content=forumcategory&id=' . intval($idCategory) |
|
283 | - . '">' . Display::return_icon( |
|
281 | + $iconsEdit .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
282 | + . '&action=edit&content=forumcategory&id='.intval($idCategory) |
|
283 | + . '">'.Display::return_icon( |
|
284 | 284 | 'edit.png', |
285 | 285 | get_lang('Edit'), |
286 | 286 | array(), |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | ) |
289 | 289 | . '</a>'; |
290 | 290 | |
291 | - $iconsEdit .='<a href="' . api_get_self() . '?' . api_get_cidreq() |
|
292 | - . '&action=delete&content=forumcategory&id=' . intval($idCategory) |
|
291 | + $iconsEdit .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
292 | + . '&action=delete&content=forumcategory&id='.intval($idCategory) |
|
293 | 293 | . "\" onclick=\"javascript:if(!confirm('" |
294 | 294 | . addslashes(api_htmlentities( |
295 | 295 | get_lang('DeleteForumCategory'), |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | ICON_SIZE_SMALL |
304 | 304 | ) |
305 | 305 | . '</a>'; |
306 | - $iconsEdit .= return_visible_invisible_icon( |
|
306 | + $iconsEdit .= return_visible_invisible_icon( |
|
307 | 307 | 'forumcategory', |
308 | 308 | strval(intval($idCategory)), |
309 | 309 | strval(intval($forumCategory['visibility'])) |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | array(), |
338 | 338 | ICON_SIZE_MEDIUM |
339 | 339 | ); |
340 | - $html .= '<h3>' . $icoCategory . $titleCategory . '</h3>'; |
|
340 | + $html .= '<h3>'.$icoCategory.$titleCategory.'</h3>'; |
|
341 | 341 | |
342 | 342 | if ($descriptionCategory != '' && trim($descriptionCategory) != ' ') { |
343 | 343 | $html .= '<div class="forum-description">'.$descriptionCategory.'</div>'; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | // Showing the image |
409 | 409 | if (!empty($forum['forum_image'])) { |
410 | 410 | |
411 | - $image_path = api_get_path(WEB_COURSE_PATH). api_get_course_path(). '/upload/forum/images/'. $forum['forum_image']; |
|
411 | + $image_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/forum/images/'.$forum['forum_image']; |
|
412 | 412 | $image_size = api_getimagesize($image_path); |
413 | 413 | $img_attributes = ''; |
414 | 414 | if (!empty($image_size)) { |
@@ -455,15 +455,15 @@ discard block |
||
455 | 455 | 30 |
456 | 456 | ); |
457 | 457 | $forum_title_group_addition = ' (<a href="../group/group_space.php?' |
458 | - . api_get_cidreq() . '&gidReq=' . $forum['forum_of_group'] |
|
459 | - . '" class="forum_group_link">' . get_lang('GoTo') . ' ' . $group_title . '</a>)' |
|
458 | + . api_get_cidreq().'&gidReq='.$forum['forum_of_group'] |
|
459 | + . '" class="forum_group_link">'.get_lang('GoTo').' '.$group_title.'</a>)' |
|
460 | 460 | . $session_img; |
461 | 461 | } else { |
462 | 462 | $forum_title_group_addition = ''; |
463 | 463 | } |
464 | 464 | |
465 | 465 | if (empty($sessionId) && !empty($forum['session_name'])) { |
466 | - $session_displayed = ' (' . $forum['session_name'] . ')'; |
|
466 | + $session_displayed = ' ('.$forum['session_name'].')'; |
|
467 | 467 | } else { |
468 | 468 | $session_displayed = ''; |
469 | 469 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $html .= '<div class="row">'; |
476 | 476 | $html .= '<div class="col-md-6">'; |
477 | 477 | $html .= '<div class="col-md-3">'; |
478 | - $html .= '<div class="number-post">'.$forum_image.'<p>'.$number_threads.' ' . get_lang('ForumThreads') . '</p>' |
|
478 | + $html .= '<div class="number-post">'.$forum_image.'<p>'.$number_threads.' '.get_lang('ForumThreads').'</p>' |
|
479 | 479 | . '</div>'; |
480 | 480 | $html .= '</div>'; |
481 | 481 | |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | 'a', |
492 | 492 | $forum['forum_title'], |
493 | 493 | [ |
494 | - 'href' => 'viewforum.php?' . api_get_cidreq() |
|
495 | - . '&gidReq=' . intval($groupid) |
|
496 | - . '&forum=' . intval($forum['forum_id']), |
|
494 | + 'href' => 'viewforum.php?'.api_get_cidreq() |
|
495 | + . '&gidReq='.intval($groupid) |
|
496 | + . '&forum='.intval($forum['forum_id']), |
|
497 | 497 | 'class' => return_visible_invisible(strval(intval($forum['visibility']))) |
498 | 498 | ] |
499 | 499 | ); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | } |
506 | 506 | } |
507 | 507 | |
508 | - $html .= '<h3 class="title">' . $iconForum . $linkForum . '</h3>'; |
|
508 | + $html .= '<h3 class="title">'.$iconForum.$linkForum.'</h3>'; |
|
509 | 509 | $html .= Display::tag( |
510 | 510 | 'p', |
511 | 511 | Security::remove_XSS($forum['forum_comment']), |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | |
521 | 521 | // The number of topics and posts. |
522 | 522 | if ($forum['forum_of_group'] !== '0') { |
523 | - $newPost=''; |
|
523 | + $newPost = ''; |
|
524 | 524 | if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) { |
525 | - $newPost = ' ' . Display::return_icon( |
|
525 | + $newPost = ' '.Display::return_icon( |
|
526 | 526 | 'alert.png', |
527 | 527 | get_lang('Forum'), |
528 | 528 | null, |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } else { |
535 | 535 | if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) { |
536 | - $newPost = ' ' . Display::return_icon( |
|
536 | + $newPost = ' '.Display::return_icon( |
|
537 | 537 | 'alert.png', |
538 | 538 | get_lang('Forum'), |
539 | 539 | null, |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | null, |
576 | 576 | ICON_SIZE_TINY |
577 | 577 | ) |
578 | - . ' ' . |
|
578 | + . ' '. |
|
579 | 579 | api_convert_and_format_date($forum['last_post_date']) |
580 | - . '<br /> ' . get_lang('By') . ' ' . |
|
580 | + . '<br /> '.get_lang('By').' '. |
|
581 | 581 | display_user_link( |
582 | 582 | $poster_id, |
583 | 583 | $name, |
@@ -591,13 +591,13 @@ discard block |
||
591 | 591 | if (api_is_allowed_to_edit(false, true) && |
592 | 592 | !($forum['session_id'] == 0 && intval($sessionId) != 0) |
593 | 593 | ) { |
594 | - $html .= '<a href="'.api_get_self() . '?' . api_get_cidreq() |
|
595 | - . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' |
|
594 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
595 | + . '&action=edit&content=forum&id='.$forum['forum_id'].'">' |
|
596 | 596 | . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) |
597 | 597 | . '</a>'; |
598 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() |
|
599 | - . '&action=delete&content=forum&id=' . $forum['forum_id'] |
|
600 | - . "\" onclick=\"javascript:if(!confirm('" . addslashes( |
|
598 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
599 | + . '&action=delete&content=forum&id='.$forum['forum_id'] |
|
600 | + . "\" onclick=\"javascript:if(!confirm('".addslashes( |
|
601 | 601 | api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES) |
602 | 602 | ) |
603 | 603 | . "')) return false;\">" |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | !api_is_anonymous() && |
639 | 639 | api_is_allowed_to_session_edit(false, true) |
640 | 640 | ) { |
641 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() |
|
642 | - . '&action=notify&content=forum&id=' . $forum['forum_id'] . '">' |
|
641 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
642 | + . '&action=notify&content=forum&id='.$forum['forum_id'].'">' |
|
643 | 643 | . Display::return_icon($iconnotify, get_lang('NotifyMe'), null, ICON_SIZE_SMALL) |
644 | 644 | . '</a>'; |
645 | 645 | } |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | } |
657 | 657 | } |
658 | 658 | } else { |
659 | - echo '<div class="alert alert-warning">' . get_lang('NoForumInThisCategory') . '</div>' |
|
659 | + echo '<div class="alert alert-warning">'.get_lang('NoForumInThisCategory').'</div>' |
|
660 | 660 | . (api_is_allowed_to_edit(false, true) ? '<div>' : '</div>') |
661 | 661 | . '</div>'; |
662 | 662 | } |