Passed
Push — 1.10.x ( f38c8d...0458c3 )
by
unknown
144:03 queued 91:39
created
main/inc/lib/api.lib.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
 define('PLATFORM_ADMIN', 11);
40 40
 define('SESSION_COURSE_COACH', 12);
41 41
 define('SESSION_GENERAL_COACH', 13);
42
-define('COURSE_STUDENT', 14);   //student subscribed in a course
43
-define('SESSION_STUDENT', 15);  //student subscribed in a session course
42
+define('COURSE_STUDENT', 14); //student subscribed in a course
43
+define('SESSION_STUDENT', 15); //student subscribed in a session course
44 44
 define('COURSE_TUTOR', 16); // student is tutor of a course (NOT in session)
45 45
 define('STUDENT_BOSS', 17); // student is boss
46 46
 define('INVITEE', 20);
47 47
 
48 48
 // Table of status
49
-$_status_list[COURSEMANAGER] = 'teacher';        // 1
50
-$_status_list[SESSIONADMIN] = 'session_admin';  // 3
51
-$_status_list[DRH] = 'drh';            // 4
52
-$_status_list[STUDENT] = 'user';           // 5
53
-$_status_list[ANONYMOUS] = 'anonymous';      // 6
54
-$_status_list[INVITEE] = 'invited';        // 20
49
+$_status_list[COURSEMANAGER] = 'teacher'; // 1
50
+$_status_list[SESSIONADMIN] = 'session_admin'; // 3
51
+$_status_list[DRH] = 'drh'; // 4
52
+$_status_list[STUDENT] = 'user'; // 5
53
+$_status_list[ANONYMOUS] = 'anonymous'; // 6
54
+$_status_list[INVITEE] = 'invited'; // 20
55 55
 
56 56
 // COURSE VISIBILITY CONSTANTS
57 57
 /** only visible for course admin */
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
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
 define('WEB_PATH', 'WEB_PATH');
@@ -375,19 +375,19 @@  discard block
 block discarded – undo
375 375
 define('LINK_HOTPOTATOES', 9);
376 376
 
377 377
 // Score display types constants
378
-define('SCORE_DIV', 1);    // X / Y
379
-define('SCORE_PERCENT', 2);    // XX %
380
-define('SCORE_DIV_PERCENT', 3);    // X / Y (XX %)
381
-define('SCORE_AVERAGE', 4);    // XX %
382
-define('SCORE_DECIMAL', 5);    // 0.50  (X/Y)
383
-define('SCORE_BAR', 6);    // Uses the Display::bar_progress function
384
-define('SCORE_SIMPLE', 7);    // X
385
-define('SCORE_IGNORE_SPLIT', 8);    //  ??
386
-define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9);    // X / Y (XX %) - Good!
387
-define('SCORE_CUSTOM', 10);    // Good!
388
-define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11);    // X - Good!
389
-define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12);    // X - Good!
390
-define('SCORE_ONLY_SCORE', 13);    // X - Good!
378
+define('SCORE_DIV', 1); // X / Y
379
+define('SCORE_PERCENT', 2); // XX %
380
+define('SCORE_DIV_PERCENT', 3); // X / Y (XX %)
381
+define('SCORE_AVERAGE', 4); // XX %
382
+define('SCORE_DECIMAL', 5); // 0.50  (X/Y)
383
+define('SCORE_BAR', 6); // Uses the Display::bar_progress function
384
+define('SCORE_SIMPLE', 7); // X
385
+define('SCORE_IGNORE_SPLIT', 8); //  ??
386
+define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good!
387
+define('SCORE_CUSTOM', 10); // Good!
388
+define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good!
389
+define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good!
390
+define('SCORE_ONLY_SCORE', 13); // X - Good!
391 391
 
392 392
 define('SCORE_BOTH', 1);
393 393
 define('SCORE_ONLY_DEFAULT', 2);
@@ -555,8 +555,8 @@  discard block
 block discarded – undo
555 555
 define('TIMELINE_STATUS_INACTIVE', '2');
556 556
 
557 557
 // Event email template class
558
-define ('EVENT_EMAIL_TEMPLATE_ACTIVE',  1);
559
-define ('EVENT_EMAIL_TEMPLATE_INACTIVE', 0);
558
+define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1);
559
+define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0);
560 560
 
561 561
 // Course home
562 562
 define('SHORTCUTS_HORIZONTAL', 0);
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 
733 733
     // To avoid that the api_get_access_url() function fails since global.inc.php also calls the main_api.lib.php
734 734
     if ($path_type == WEB_PATH) {
735
-        if (isset($_configuration['access_url']) &&  $_configuration['access_url'] != 1) {
735
+        if (isset($_configuration['access_url']) && $_configuration['access_url'] != 1) {
736 736
             //we look into the DB the function api_get_access_url
737 737
             $url_info = api_get_access_url($_configuration['access_url']);
738 738
             $root_web = $url_info['active'] == 1 ? $url_info['url'] : $_configuration['root_web'];
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
                     : 'localhost')));
763 763
                 if (isset($_SERVER['SERVER_PORT']) && !strpos($server_name, ':')
764 764
                     && (($server_protocol == 'http'
765
-                    && $_SERVER['SERVER_PORT'] != 80 ) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443 ))) {
766
-                    $server_name .= ":" . $_SERVER['SERVER_PORT'];
765
+                    && $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))) {
766
+                    $server_name .= ":".$_SERVER['SERVER_PORT'];
767 767
                 }
768 768
                 $root_web = $server_protocol.'://'.$server_name.$root_rel;
769 769
                 $root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/';
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
                 $sys_course_code =
938 938
                     isset($_SESSION['_course']['sysCode'])  // User is inside a course?
939 939
                         ? $_SESSION['_course']['sysCode']   // Yes, then use course's directory name.
940
-                        : '{SYS_COURSE_CODE}';              // No, then use a fake code, it may be processed later.
940
+                        : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later.
941 941
                 $path = $matches[1].'courses/'.$sys_course_code.'/document/'.str_replace('//', '/', $matches[3].'/'.$matches[2]);
942 942
             }
943 943
         }
@@ -981,15 +981,15 @@  discard block
 block discarded – undo
981 981
 {
982 982
     global $_configuration;
983 983
     $web_root = api_get_path(WEB_PATH);
984
-    $ext = substr($web_path,strrpos($web_path,'.'));
984
+    $ext = substr($web_path, strrpos($web_path, '.'));
985 985
     if (isset($ext[2])) { // faster version of strlen to check if len>2
986 986
         // Check for CDN definitions
987 987
         if (!empty($_configuration['cdn_enable']) && !empty($ext)) {
988 988
             foreach ($_configuration['cdn'] as $host => $exts) {
989
-                if (in_array($ext,$exts)) {
989
+                if (in_array($ext, $exts)) {
990 990
                     //Use host as defined in $_configuration['cdn'], without
991 991
                     // trailing slash
992
-                    return str_replace($web_root,$host.'/',$web_path);
992
+                    return str_replace($web_root, $host.'/', $web_path);
993 993
                 }
994 994
             }
995 995
         }
@@ -1438,10 +1438,10 @@  discard block
 block discarded – undo
1438 1438
 
1439 1439
     if (isset($user['email'])) {
1440 1440
         $result['mail'] = isset($user['email']) ? $user['email'] : null;
1441
-        $result['email'] = isset($user['email'])? $user['email'] : null;
1441
+        $result['email'] = isset($user['email']) ? $user['email'] : null;
1442 1442
     } else {
1443 1443
         $result['mail'] = isset($user['mail']) ? $user['mail'] : null;
1444
-        $result['email'] = isset($user['mail'])? $user['mail'] : null;
1444
+        $result['email'] = isset($user['mail']) ? $user['mail'] : null;
1445 1445
     }
1446 1446
     $user_id = intval($user['user_id']);
1447 1447
     // Maintain the user_id index for backwards compatibility
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
         foreach ($param_list1 as $key => $enreg) {
1919 1919
             list ($param_list1_keys[$key], $param_list1_vals[$key]) = explode('=', $enreg);
1920 1920
         }
1921
-        $param_list1 = array ('keys' => $param_list1_keys, 'vals' => $param_list1_vals);
1921
+        $param_list1 = array('keys' => $param_list1_keys, 'vals' => $param_list1_vals);
1922 1922
         foreach ($param_list2 as $enreg) {
1923 1923
             $enreg = explode('=', $enreg);
1924 1924
             $key = array_search($enreg[0], $param_list1['keys']);
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
         $length = 2;
1949 1949
     }
1950 1950
     $password = '';
1951
-    for ($i = 0; $i < $length; $i ++) {
1951
+    for ($i = 0; $i < $length; $i++) {
1952 1952
         $password .= $characters[rand() % strlen($characters)];
1953 1953
     }
1954 1954
     return $password;
@@ -1975,10 +1975,10 @@  discard block
 block discarded – undo
1975 1975
     $digits = 0;
1976 1976
     $consequent_characters = 0;
1977 1977
     $previous_character_code = 0;
1978
-    for ($i = 0; $i < $password_length; $i ++) {
1978
+    for ($i = 0; $i < $password_length; $i++) {
1979 1979
         $current_character_code = api_ord(api_substr($password, $i, 1));
1980 1980
         if ($i && abs($current_character_code - $previous_character_code) <= 1) {
1981
-            $consequent_characters ++;
1981
+            $consequent_characters++;
1982 1982
             if ($consequent_characters == 3) {
1983 1983
                 return false;
1984 1984
             }
@@ -1986,9 +1986,9 @@  discard block
 block discarded – undo
1986 1986
             $consequent_characters = 1;
1987 1987
         }
1988 1988
         if ($current_character_code >= 97 && $current_character_code <= 122) {
1989
-            $letters ++;
1989
+            $letters++;
1990 1990
         } elseif ($current_character_code >= 48 && $current_character_code <= 57) {
1991
-            $digits ++;
1991
+            $digits++;
1992 1992
         } else {
1993 1993
             return false;
1994 1994
         }
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
         if (empty($session_id)) { return null; }
2185 2185
     }
2186 2186
     $t = Database::get_main_table(TABLE_MAIN_SESSION);
2187
-    $s = "SELECT name FROM $t WHERE id = ".(int)$session_id;
2187
+    $s = "SELECT name FROM $t WHERE id = ".(int) $session_id;
2188 2188
     $r = Database::query($s);
2189 2189
     $c = Database::num_rows($r);
2190 2190
     if ($c > 0) {
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
         $sql = "SELECT * FROM $tbl_session WHERE id = $session_id";
2210 2210
         $result = Database::query($sql);
2211 2211
 
2212
-        if (Database::num_rows($result)>0) {
2212
+        if (Database::num_rows($result) > 0) {
2213 2213
             $data = Database::fetch_array($result, 'ASSOC');
2214 2214
         }
2215 2215
     }
@@ -2369,9 +2369,9 @@  discard block
 block discarded – undo
2369 2369
  */
2370 2370
 function api_get_session_image($session_id, $status_id)
2371 2371
 {
2372
-    $session_id = (int)$session_id;
2372
+    $session_id = (int) $session_id;
2373 2373
     $session_img = '';
2374
-    if ((int)$status_id != 5) { //check whether is not a student
2374
+    if ((int) $status_id != 5) { //check whether is not a student
2375 2375
         if ($session_id > 0) {
2376 2376
             $session_img = "&nbsp;&nbsp;".Display::return_icon(
2377 2377
                 'star.png',
@@ -2486,7 +2486,7 @@  discard block
 block discarded – undo
2486 2486
         $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt';
2487 2487
         if (file_exists($filename)) {
2488 2488
             $value = file_get_contents($filename);
2489
-            return $value ;
2489
+            return $value;
2490 2490
         } else {
2491 2491
             return '';
2492 2492
         }
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
         $filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
2496 2496
         if (file_exists($filename)) {
2497 2497
             $value = file_get_contents($filename);
2498
-            return $value ;
2498
+            return $value;
2499 2499
         } else {
2500 2500
             return '';
2501 2501
         }
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
     }
2690 2690
     $group_id   = api_get_group_id();
2691 2691
     $course_id  = api_get_course_int_id();
2692
-    $course_code= api_get_course_id();
2692
+    $course_code = api_get_course_id();
2693 2693
     $session_id = api_get_session_id();
2694 2694
 
2695 2695
     //Group (in course)
@@ -2697,7 +2697,7 @@  discard block
 block discarded – undo
2697 2697
         $group_status = array();
2698 2698
         $is_subscribed = GroupManager::is_subscribed($user_id, $group_id);
2699 2699
         if ($is_subscribed) {
2700
-            $group_status = array('id'=> $group_id , 'status' => 'student');
2700
+            $group_status = array('id'=> $group_id, 'status' => 'student');
2701 2701
             $is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id);
2702 2702
             if ($is_tutor) {
2703 2703
                 $group_status['status'] = 'tutor';
@@ -2731,7 +2731,7 @@  discard block
 block discarded – undo
2731 2731
         }
2732 2732
         $status['session'] = $session_status;
2733 2733
 
2734
-    } elseif($course_id) {
2734
+    } elseif ($course_id) {
2735 2735
         //Course
2736 2736
         $course_status = array();
2737 2737
         if ($course_id) {
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
 
2740 2740
             if ($user_course_status) {
2741 2741
                 $course_status = array('id'=> $course_id);
2742
-                switch($user_course_status) {
2742
+                switch ($user_course_status) {
2743 2743
                     case 1;
2744 2744
                         $course_status['status'] = 'teacher';
2745 2745
                     break;
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
 function api_is_course_session_coach($user_id, $courseId, $session_id)
2770 2770
 {
2771 2771
     $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
2772
-    $session_rel_course_rel_user_table  = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
2772
+    $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
2773 2773
 
2774 2774
     $user_id = intval($user_id);
2775 2775
     $session_id = intval($session_id);
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
                 ORDER BY access_start_date, access_end_date, name";
2844 2844
         $result = Database::query($sql);
2845 2845
         if (!empty($sessionIsCoach)) {
2846
-            $sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result));
2846
+            $sessionIsCoach = array_merge($sessionIsCoach, Database::store_result($result));
2847 2847
         } else {
2848 2848
             $sessionIsCoach = Database::store_result($result);
2849 2849
         }
@@ -3020,7 +3020,7 @@  discard block
 block discarded – undo
3020 3020
             return '';
3021 3021
         }
3022 3022
         $sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
3023
-        $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);
3023
+        $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);
3024 3024
         //showinframes doesn't handle student view anyway...
3025 3025
         //return '';
3026 3026
         $is_framed = true;
@@ -3419,7 +3419,7 @@  discard block
 block discarded – undo
3419 3419
         }
3420 3420
         $content .= '<div class="well_login">';
3421 3421
         $content .= $form->return_form();
3422
-        $content .='</div>';
3422
+        $content .= '</div>';
3423 3423
         if (api_is_cas_activated()) {
3424 3424
             $content .= "</div>";
3425 3425
         }
@@ -3438,7 +3438,7 @@  discard block
 block discarded – undo
3438 3438
         exit;
3439 3439
     }
3440 3440
 
3441
-    if ($user_id !=0 && !api_is_anonymous()) {
3441
+    if ($user_id != 0 && !api_is_anonymous()) {
3442 3442
         $tpl->display_one_col_template();
3443 3443
         exit;
3444 3444
     }
@@ -3469,7 +3469,7 @@  discard block
 block discarded – undo
3469 3469
         }
3470 3470
         $msg .= '<div class="well">';
3471 3471
         $msg .= $form->return_form();
3472
-        $msg .='</div>';
3472
+        $msg .= '</div>';
3473 3473
         if (api_is_cas_activated()) {
3474 3474
             $msg .= "</div>";
3475 3475
         }
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
     list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime);
3506 3506
     list ($year, $month, $day) = explode('-', $last_post_date);
3507 3507
     list ($hour, $min, $sec) = explode(':', $last_post_time);
3508
-    return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year);
3508
+    return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year);
3509 3509
 }
3510 3510
 
3511 3511
 /**
@@ -3956,7 +3956,7 @@  discard block
 block discarded – undo
3956 3956
                 c_id = $course_id AND
3957 3957
                 tool = '$tool'
3958 3958
                 $session_condition ";
3959
-    $rs  = Database::query($sql);
3959
+    $rs = Database::query($sql);
3960 3960
     $list = array();
3961 3961
     if (Database::num_rows($rs) > 0) {
3962 3962
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -4036,7 +4036,7 @@  discard block
 block discarded – undo
4036 4036
                 tool = '$tool' AND
4037 4037
                 ref = $ref
4038 4038
                 $sessionCondition";
4039
-    $rs  = Database::query($sql);
4039
+    $rs = Database::query($sql);
4040 4040
     $item_property_id = '';
4041 4041
     if (Database::num_rows($rs) > 0) {
4042 4042
         $row = Database::fetch_array($rs);
@@ -4094,7 +4094,7 @@  discard block
 block discarded – undo
4094 4094
             WHERE item_property_id = $item_property_id AND course_id = $course_id
4095 4095
             ORDER BY lastedit_date DESC";
4096 4096
     $result = Database::query($sql);
4097
-    $result = Database::store_result($result,'ASSOC');
4097
+    $result = Database::store_result($result, 'ASSOC');
4098 4098
     return $result;
4099 4099
 }
4100 4100
 
@@ -4137,7 +4137,7 @@  discard block
 block discarded – undo
4137 4137
     $rs  = Database::query($sql);
4138 4138
     $row = array();
4139 4139
     if (Database::num_rows($rs) > 0) {
4140
-        $row = Database::fetch_array($rs,'ASSOC');
4140
+        $row = Database::fetch_array($rs, 'ASSOC');
4141 4141
     }
4142 4142
 
4143 4143
     return $row;
@@ -4172,7 +4172,7 @@  discard block
 block discarded – undo
4172 4172
     $languages  = $language_list['name'];
4173 4173
     $folder     = $language_list['folder'];
4174 4174
 
4175
-    $ret .= '<select name="' . $name . '" id="language_chosen">';
4175
+    $ret .= '<select name="'.$name.'" id="language_chosen">';
4176 4176
     foreach ($languages as $key => $value) {
4177 4177
         if ($folder[$key] == $default) {
4178 4178
             $selected = ' selected="selected"';
@@ -4225,8 +4225,8 @@  discard block
 block discarded – undo
4225 4225
     //-->
4226 4226
     </script>';
4227 4227
     $html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">';
4228
-    $html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>';
4229
-    $html .=  '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >';
4228
+    $html .= '<label style="display: none;" for="language_list">'.get_lang('Language').'</label>';
4229
+    $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >';
4230 4230
 
4231 4231
     foreach ($original_languages as $key => $value) {
4232 4232
         if ($folder[$key] == $user_selected_language) {
@@ -4234,13 +4234,13 @@  discard block
 block discarded – undo
4234 4234
         } else {
4235 4235
             $option_end = '>';
4236 4236
         }
4237
-        $html .=  '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end;
4237
+        $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end;
4238 4238
         //echo substr($value, 0, 16); // Cut string to keep 800x600 aspect.
4239
-        $html .=  $value.'</option>';
4239
+        $html .= $value.'</option>';
4240 4240
     }
4241
-    $html .=  '</select>';
4242
-    $html .=  '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>';
4243
-    $html .=  '</form>';
4241
+    $html .= '</select>';
4242
+    $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>';
4243
+    $html .= '</form>';
4244 4244
     return $html;
4245 4245
 }
4246 4246
 
@@ -4357,7 +4357,7 @@  discard block
 block discarded – undo
4357 4357
     $rs = Database::query($sql);
4358 4358
     $language_info = array();
4359 4359
     if (Database::num_rows($rs)) {
4360
-        $language_info = Database::fetch_array($rs,'ASSOC');
4360
+        $language_info = Database::fetch_array($rs, 'ASSOC');
4361 4361
     }
4362 4362
     return $language_info;
4363 4363
 }
@@ -4435,7 +4435,7 @@  discard block
 block discarded – undo
4435 4435
  * Note: Directory names (names of themes) in the file system should contain ASCII-characters only.
4436 4436
  */
4437 4437
 function api_get_themes() {
4438
-    $cssdir = api_get_path(SYS_CSS_PATH) . 'themes/';
4438
+    $cssdir = api_get_path(SYS_CSS_PATH).'themes/';
4439 4439
     $list_dir = array();
4440 4440
     $list_name = array();
4441 4441
 
@@ -4626,7 +4626,7 @@  discard block
 block discarded – undo
4626 4626
     if (is_file($dirname) || is_link($dirname)) {
4627 4627
         $res = unlink($dirname);
4628 4628
         if ($res === false) {
4629
-            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);
4629
+            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);
4630 4630
         }
4631 4631
         return $res;
4632 4632
     }
@@ -4663,7 +4663,7 @@  discard block
 block discarded – undo
4663 4663
     if ($delete_only_content_in_folder == false) {
4664 4664
         $res = rmdir($dirname);
4665 4665
         if ($res === false) {
4666
-            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);
4666
+            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);
4667 4667
         }
4668 4668
     }
4669 4669
     return $res;
@@ -4741,7 +4741,7 @@  discard block
 block discarded – undo
4741 4741
 
4742 4742
     $course_id = $course_info['real_id'];
4743 4743
 
4744
-    $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname));
4744
+    $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname));
4745 4745
 
4746 4746
     $new_pathname = $base_path_document;
4747 4747
     $path = '';
@@ -4759,7 +4759,7 @@  discard block
 block discarded – undo
4759 4759
                         path = '$path' AND
4760 4760
                         filetype = 'folder' AND
4761 4761
                         session_id = '$session_id'";
4762
-            $rs1  = Database::query($sql);
4762
+            $rs1 = Database::query($sql);
4763 4763
             $num_rows = Database::num_rows($rs1);
4764 4764
 
4765 4765
             if ($num_rows == 0) {
@@ -4916,7 +4916,7 @@  discard block
 block discarded – undo
4916 4916
             foreach (array('key', 'value1', 'value2', 'value3') as $var) {
4917 4917
                 $$var = isset($match[++$i]) ? $match[$i] : '';
4918 4918
             }
4919
-            $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3;
4919
+            $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3;
4920 4920
 
4921 4921
             // Parse array syntax.
4922 4922
             $keys = preg_split('/\]?\[/', rtrim($key, ']'));
@@ -4956,7 +4956,7 @@  discard block
 block discarded – undo
4956 4956
  */
4957 4957
 function api_get_version() {
4958 4958
     global $_configuration;
4959
-    return (string)$_configuration['system_version'];
4959
+    return (string) $_configuration['system_version'];
4960 4960
 }
4961 4961
 
4962 4962
 /**
@@ -5082,7 +5082,7 @@  discard block
 block discarded – undo
5082 5082
     $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
5083 5083
     $var = Database::escape_string($var);
5084 5084
     $value = Database::escape_string($value);
5085
-    $access_url = (int)$access_url;
5085
+    $access_url = (int) $access_url;
5086 5086
     if (empty($access_url)) { $access_url = 1; }
5087 5087
     $select = "SELECT id FROM $t_settings WHERE variable = '$var' ";
5088 5088
     if (!empty($subvar)) {
@@ -5104,7 +5104,7 @@  discard block
 block discarded – undo
5104 5104
         // Found item for this access_url.
5105 5105
         $row = Database::fetch_array($res);
5106 5106
         $sql = "UPDATE $t_settings SET selected_value = '$value'
5107
-                WHERE id = ".$row['id'] ;
5107
+                WHERE id = ".$row['id'];
5108 5108
         Database::query($sql);
5109 5109
     } else {
5110 5110
         // Item not found for this access_url, we have to check if it exist with access_url = 1
@@ -5125,11 +5125,11 @@  discard block
 block discarded – undo
5125 5125
                 $row = Database::fetch_array($res);
5126 5126
                 $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url)
5127 5127
                         VALUES
5128
-                        ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," .
5129
-                        "'".$row['type']."','".$row['category']."'," .
5130
-                        "'$value','".$row['title']."'," .
5131
-                        "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," .
5132
-                        "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)";
5128
+                        ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",".
5129
+                        "'".$row['type']."','".$row['category']."',".
5130
+                        "'$value','".$row['title']."',".
5131
+                        "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",".
5132
+                        "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)";
5133 5133
                 Database::query($insert);
5134 5134
             } else { // Such a setting does not exist.
5135 5135
                 error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0);
@@ -5149,16 +5149,16 @@  discard block
 block discarded – undo
5149 5149
                 if ($row['access_url_changeable'] == 1) {
5150 5150
                     $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES
5151 5151
                             ('".$row['variable']."',".
5152
-                            (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," .
5153
-                            "'".$row['type']."','".$row['category']."'," .
5154
-                            "'$value','".$row['title']."'," .
5152
+                            (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",".
5153
+                            "'".$row['type']."','".$row['category']."',".
5154
+                            "'$value','".$row['title']."',".
5155 5155
                             "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".
5156
-                            (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," .
5156
+                            (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",".
5157 5157
                             "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")";
5158 5158
                     Database::query($insert);
5159 5159
                 }
5160 5160
             } else { // Such a setting does not exist.
5161
-                error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0);
5161
+                error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ', 0);
5162 5162
             }
5163 5163
         }
5164 5164
     }
@@ -5184,10 +5184,10 @@  discard block
 block discarded – undo
5184 5184
         $value = Database::escape_string($value);
5185 5185
         $sql = "UPDATE $t_s SET selected_value = '$value'
5186 5186
                 WHERE category = '$category' AND access_url = $access_url";
5187
-        if (is_array($fieldtype) && count($fieldtype)>0) {
5187
+        if (is_array($fieldtype) && count($fieldtype) > 0) {
5188 5188
             $sql .= " AND ( ";
5189 5189
             $i = 0;
5190
-            foreach ($fieldtype as $type){
5190
+            foreach ($fieldtype as $type) {
5191 5191
                 if ($i > 0) {
5192 5192
                     $sql .= ' OR ';
5193 5193
                 }
@@ -5202,10 +5202,10 @@  discard block
 block discarded – undo
5202 5202
     } else {
5203 5203
         $sql = "UPDATE $t_s SET selected_value = NULL
5204 5204
                 WHERE category = '$category' AND access_url = $access_url";
5205
-        if (is_array($fieldtype) && count($fieldtype)>0) {
5205
+        if (is_array($fieldtype) && count($fieldtype) > 0) {
5206 5206
             $sql .= " AND ( ";
5207 5207
             $i = 0;
5208
-            foreach ($fieldtype as $type){
5208
+            foreach ($fieldtype as $type) {
5209 5209
                 if ($i > 0) {
5210 5210
                     $sql .= ' OR ';
5211 5211
                 }
@@ -5255,7 +5255,7 @@  discard block
 block discarded – undo
5255 5255
     //$table_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
5256 5256
     $table = 'access_url';
5257 5257
     $database = $_configuration['main_database'];
5258
-    $table_access_url = "" . $database . "." . $table . "";
5258
+    $table_access_url = "".$database.".".$table."";
5259 5259
     $sql = "SELECT url, description, active, created_by, tms
5260 5260
             FROM $table_access_url WHERE id = '$id' ";
5261 5261
     $res = Database::query($sql);
@@ -5353,7 +5353,7 @@  discard block
 block discarded – undo
5353 5353
 function & api_get_settings_categories($exceptions = array(), $access_url = 1) {
5354 5354
     $access_url = (int) $access_url;
5355 5355
     $t_cs = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
5356
-    $list = "'".implode("','",$exceptions)."'";
5356
+    $list = "'".implode("','", $exceptions)."'";
5357 5357
     $sql = "SELECT DISTINCT category FROM $t_cs WHERE category is NOT NULL ";
5358 5358
     if ($list != "'',''" && $list != "''" && !empty($list)) {
5359 5359
         $sql .= " AND category NOT IN ($list) ";
@@ -5449,12 +5449,12 @@  discard block
 block discarded – undo
5449 5449
 
5450 5450
     // Item not found for this access_url, we have to check if the whole thing is missing
5451 5451
     // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1
5452
-    $insert = "INSERT INTO $t_settings " .
5453
-                "(variable,selected_value," .
5454
-                "type,category," .
5455
-                "subkey,title," .
5456
-                "comment,scope," .
5457
-                "subkeytext,access_url,access_url_changeable)" .
5452
+    $insert = "INSERT INTO $t_settings ".
5453
+                "(variable,selected_value,".
5454
+                "type,category,".
5455
+                "subkey,title,".
5456
+                "comment,scope,".
5457
+                "subkeytext,access_url,access_url_changeable)".
5458 5458
                 " VALUES ('$var','$val',";
5459 5459
     if (isset($type)) {
5460 5460
         $type = Database::escape_string($type);
@@ -5620,7 +5620,7 @@  discard block
 block discarded – undo
5620 5620
             $result = Database::query($sql);
5621 5621
 
5622 5622
             //if ($row = Database::fetch_array($result)) {
5623
-            if (Database::num_rows($result) > 0 ) {
5623
+            if (Database::num_rows($result) > 0) {
5624 5624
                 $is_courseMember = true;
5625 5625
                 $is_courseTutor = true;
5626 5626
                 $is_courseCoach = true;
@@ -5841,8 +5841,8 @@  discard block
 block discarded – undo
5841 5841
 {
5842 5842
     $tbl_rel_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
5843 5843
     if (!empty($user_id) && !empty($courseId)) {
5844
-        $user_id        = intval($user_id);
5845
-        $courseId    = intval($courseId);
5844
+        $user_id = intval($user_id);
5845
+        $courseId = intval($courseId);
5846 5846
         $sql = 'SELECT status
5847 5847
                 FROM '.$tbl_rel_course_user.'
5848 5848
                 WHERE user_id='.$user_id.' AND c_id = '.$courseId;
@@ -5948,7 +5948,7 @@  discard block
 block discarded – undo
5948 5948
     } else {
5949 5949
         return false;
5950 5950
     }
5951
-    return strtolower(substr((string)$os, 0, 3 )) == 'win';
5951
+    return strtolower(substr((string) $os, 0, 3)) == 'win';
5952 5952
 }
5953 5953
 
5954 5954
 /**
@@ -6473,7 +6473,7 @@  discard block
 block discarded – undo
6473 6473
 function api_get_jquery_ui_js($include_jqgrid = false) {
6474 6474
     $libraries = array();
6475 6475
     if ($include_jqgrid) {
6476
-       $libraries[]='jqgrid';
6476
+       $libraries[] = 'jqgrid';
6477 6477
     }
6478 6478
     return api_get_jquery_libraries_js($libraries);
6479 6479
 }
@@ -6497,12 +6497,12 @@  discard block
 block discarded – undo
6497 6497
 
6498 6498
     //jqgrid js and css
6499 6499
     if (in_array('jqgrid', $libraries)) {
6500
-        $languaje   = 'en';
6500
+        $languaje = 'en';
6501 6501
         $platform_isocode = strtolower(api_get_language_isocode());
6502 6502
 
6503 6503
         //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
6504 6504
         $jqgrid_langs = array(
6505
-            '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'
6505
+            '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'
6506 6506
         );
6507 6507
 
6508 6508
         if (in_array($platform_isocode, $jqgrid_langs)) {
@@ -6533,7 +6533,7 @@  discard block
 block discarded – undo
6533 6533
 
6534 6534
     // jquery datepicker
6535 6535
     if (in_array('datepicker', $libraries)) {
6536
-        $languaje   = 'en-GB';
6536
+        $languaje = 'en-GB';
6537 6537
         $platform_isocode = strtolower(api_get_language_isocode());
6538 6538
 
6539 6539
         // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
@@ -6635,7 +6635,7 @@  discard block
 block discarded – undo
6635 6635
         $clean_url = str_replace('/', '-', $clean_url);
6636 6636
         $clean_url .= '/';
6637 6637
 
6638
-        $home = 'app/home/' . $clean_url;
6638
+        $home = 'app/home/'.$clean_url;
6639 6639
 
6640 6640
     }
6641 6641
 
@@ -6696,7 +6696,7 @@  discard block
 block discarded – undo
6696 6696
  * @return void
6697 6697
  */
6698 6698
 function api_check_php_version($my_inc_path = null) {
6699
-    if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) {
6699
+    if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) {
6700 6700
         $global_error_code = 1;
6701 6701
         // Incorrect PHP version
6702 6702
         $global_page = $my_inc_path.'global_error_message.inc.php';
@@ -6712,7 +6712,7 @@  discard block
 block discarded – undo
6712 6712
  */
6713 6713
 function api_check_archive_dir() {
6714 6714
     if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
6715
-        $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning');
6715
+        $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning');
6716 6716
         api_not_allowed(true, $message);
6717 6717
     }
6718 6718
 }
@@ -6777,7 +6777,7 @@  discard block
 block discarded – undo
6777 6777
  * @author Jorge Frisancho Jibaja <[email protected]>, USIL - Some changes to allow the use of real IP using reverse proxy
6778 6778
  * @version CEV CHANGE 24APR2012
6779 6779
  */
6780
-function api_get_real_ip(){
6780
+function api_get_real_ip() {
6781 6781
     // Guess the IP if behind a reverse proxy
6782 6782
     global $debug;
6783 6783
     $ip = trim($_SERVER['REMOTE_ADDR']);
@@ -6802,23 +6802,23 @@  discard block
 block discarded – undo
6802 6802
  * @author Yannick Warnier for improvements and managment of multiple ranges
6803 6803
  * @todo check for IPv6 support
6804 6804
  */
6805
-function api_check_ip_in_range($ip,$range)
6805
+function api_check_ip_in_range($ip, $range)
6806 6806
 {
6807 6807
     if (empty($ip) or empty($range)) {
6808 6808
         return false;
6809 6809
     }
6810
-    $ip_ip = ip2long ($ip);
6810
+    $ip_ip = ip2long($ip);
6811 6811
     // divide range param into array of elements
6812
-    if (strpos($range,',')!==false) {
6813
-        $ranges = explode(',',$range);
6812
+    if (strpos($range, ',') !== false) {
6813
+        $ranges = explode(',', $range);
6814 6814
     } else {
6815 6815
         $ranges = array($range);
6816 6816
     }
6817 6817
     foreach ($ranges as $range) {
6818 6818
         $range = trim($range);
6819 6819
         if (empty($range)) { continue; }
6820
-        if (strpos($range,'/')===false) {
6821
-            if (strcmp($ip,$range)===0) {
6820
+        if (strpos($range, '/') === false) {
6821
+            if (strcmp($ip, $range) === 0) {
6822 6822
                 return true; // there is a direct IP match, return OK
6823 6823
             }
6824 6824
             continue; //otherwise, get to the next range
@@ -6826,7 +6826,7 @@  discard block
 block discarded – undo
6826 6826
         // the range contains a "/", so analyse completely
6827 6827
         list ($net, $mask) = explode("/", $range);
6828 6828
 
6829
-        $ip_net = ip2long ($net);
6829
+        $ip_net = ip2long($net);
6830 6830
         // mask binary magic
6831 6831
         $ip_mask = ~((1 << (32 - $mask)) - 1);
6832 6832
 
@@ -7186,14 +7186,14 @@  discard block
 block discarded – undo
7186 7186
  * @assert (0) === true
7187 7187
  * @assert ('1G') === true
7188 7188
  */
7189
-function api_set_memory_limit($mem){
7189
+function api_set_memory_limit($mem) {
7190 7190
     //if ini_set() not available, this function is useless
7191 7191
     if (!function_exists('ini_set') || is_null($mem) || $mem == -1) {
7192 7192
         return false;
7193 7193
     }
7194 7194
 
7195 7195
     $memory_limit = ini_get('memory_limit');
7196
-    if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){
7196
+    if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) {
7197 7197
         ini_set('memory_limit', $mem);
7198 7198
         return true;
7199 7199
     }
@@ -7210,21 +7210,21 @@  discard block
 block discarded – undo
7210 7210
  * @assert ('1m')  === 1048576
7211 7211
  * @assert ('100k') === 102400
7212 7212
  */
7213
-function api_get_bytes_memory_limit($mem){
7214
-    $size = strtolower(substr($mem,-1));
7213
+function api_get_bytes_memory_limit($mem) {
7214
+    $size = strtolower(substr($mem, -1));
7215 7215
 
7216 7216
     switch ($size) {
7217 7217
         case 't':
7218
-            $mem = intval(substr($mem,-1))*1024*1024*1024*1024;
7218
+            $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024;
7219 7219
             break;
7220 7220
         case 'g':
7221
-            $mem = intval(substr($mem,0,-1))*1024*1024*1024;
7221
+            $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024;
7222 7222
             break;
7223 7223
         case 'm':
7224
-            $mem = intval(substr($mem,0,-1))*1024*1024;
7224
+            $mem = intval(substr($mem, 0, -1)) * 1024 * 1024;
7225 7225
             break;
7226 7226
         case 'k':
7227
-            $mem = intval(substr($mem,0,-1))*1024;
7227
+            $mem = intval(substr($mem, 0, -1)) * 1024;
7228 7228
             break;
7229 7229
         default:
7230 7230
             // we assume it's integer only
@@ -7279,7 +7279,7 @@  discard block
 block discarded – undo
7279 7279
         get_lang('PasswordVeryStrong'),
7280 7280
     );
7281 7281
     $js = api_get_js('strength/strength.js');
7282
-    $js .=  "<script>
7282
+    $js .= "<script>
7283 7283
 
7284 7284
     var verdicts = ['".implode("','", $verdicts)."'];
7285 7285
     var errorMessages = {
@@ -7335,7 +7335,7 @@  discard block
 block discarded – undo
7335 7335
         return false;
7336 7336
     }
7337 7337
     $minutesToBlock = api_get_setting('captcha_time_to_block');
7338
-    $time = time() + $minutesToBlock*60;
7338
+    $time = time() + $minutesToBlock * 60;
7339 7339
     UserManager::update_extra_field_value(
7340 7340
         $userInfo['user_id'],
7341 7341
         'captcha_blocked_until_date',
@@ -7408,7 +7408,7 @@  discard block
 block discarded – undo
7408 7408
         $out_res = str_replace('"', "''", $out_res);
7409 7409
     }
7410 7410
     // avoid text stuck together when tags are removed, adding a space after >
7411
-    $out_res = str_replace (">", "> ", $out_res);
7411
+    $out_res = str_replace(">", "> ", $out_res);
7412 7412
     $out_res = strip_tags($out_res);
7413 7413
 
7414 7414
     return $out_res;
@@ -7518,12 +7518,12 @@  discard block
 block discarded – undo
7518 7518
 {
7519 7519
     // Clean query
7520 7520
     $bt = debug_backtrace();
7521
-    $caller = array_shift($bt);;
7521
+    $caller = array_shift($bt); ;
7522 7522
     if ($dump == 1) {
7523 7523
         $string = print_r($string, 1);
7524 7524
     } else {
7525 7525
         $string = str_replace(array("\r", "\n", "\t", "\10"), '', $string);
7526
-        $string = str_replace('    ',' ', $string);
7526
+        $string = str_replace('    ', ' ', $string);
7527 7527
     }
7528 7528
 
7529 7529
     error_log("-------------------------------------");
@@ -7633,7 +7633,7 @@  discard block
 block discarded – undo
7633 7633
         $body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n ";
7634 7634
         $body .= get_lang('PortalLimitType').': '.$limitName." \n ";
7635 7635
         if (isset($hostingParams[$limitName])) {
7636
-            $body .= get_lang('Value') . ': ' . $hostingParams[$limitName];
7636
+            $body .= get_lang('Value').': '.$hostingParams[$limitName];
7637 7637
         }
7638 7638
         api_mail_html(null, $email, $subject, $body);
7639 7639
     }
@@ -7761,7 +7761,7 @@  discard block
 block discarded – undo
7761 7761
  */
7762 7762
 function api_set_site_use_cookie_warning_cookie()
7763 7763
 {
7764
-    setcookie("ChamiloUsesCookies", "ok", time()+31556926);
7764
+    setcookie("ChamiloUsesCookies", "ok", time() + 31556926);
7765 7765
 }
7766 7766
 
7767 7767
 /**
@@ -7809,10 +7809,10 @@  discard block
 block discarded – undo
7809 7809
         return false;
7810 7810
     }
7811 7811
 
7812
-    $fullPath = $parentDirectory . api_replace_dangerous_char($name);
7812
+    $fullPath = $parentDirectory.api_replace_dangerous_char($name);
7813 7813
 
7814 7814
     if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) {
7815
-        $fp = fopen($fullPath . '/index.html', 'w');
7815
+        $fp = fopen($fullPath.'/index.html', 'w');
7816 7816
 
7817 7817
         if ($fp) {
7818 7818
             if (fwrite($fp, '<html><head></head><body></body></html>')) {
@@ -8054,13 +8054,13 @@  discard block
 block discarded – undo
8054 8054
  * @param int $key key to find to compare
8055 8055
  *
8056 8056
  */
8057
-function api_unique_multidim_array($array, $key){
8057
+function api_unique_multidim_array($array, $key) {
8058 8058
     $temp_array = array();
8059 8059
     $i = 0;
8060 8060
     $key_array = array();
8061 8061
 
8062
-    foreach($array as $val){
8063
-        if(!in_array($val[$key],$key_array)){
8062
+    foreach ($array as $val) {
8063
+        if (!in_array($val[$key], $key_array)) {
8064 8064
             $key_array[$i] = $val[$key];
8065 8065
             $temp_array[$i] = $val;
8066 8066
         }
Please login to merge, or discard this patch.
main/inc/lib/display.lib.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param string Optional help file name
56 56
      * @param string $page_header
57 57
      */
58
-    public static function display_header($tool_name ='', $help = null, $page_header = null)
58
+    public static function display_header($tool_name = '', $help = null, $page_header = null)
59 59
     {
60 60
         $origin = api_get_origin();
61 61
         $showHeader = true;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $grid_class = array(),
352 352
         $elementCount = 0
353 353
     ) {
354
-        $column =  0;
354
+        $column = 0;
355 355
         $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
356 356
 
357 357
         $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      * @param bool	Filter (true) or not (false)
477 477
      * @return void
478 478
      */
479
-    public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
479
+    public static function display_confirmation_message($message, $filter = true, $returnValue = false)
480 480
     {
481 481
         $message = self::return_message($message, 'confirm', $filter);
482 482
         if ($returnValue) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param bool	Filter (true) or not (false)
494 494
      * @return void
495 495
      */
496
-    public static function display_error_message ($message, $filter = true, $returnValue = false)
496
+    public static function display_error_message($message, $filter = true, $returnValue = false)
497 497
     {
498 498
         $message = self::return_message($message, 'error', $filter);
499 499
         if ($returnValue) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
      * @param string $type
509 509
      * @param bool $filter
510 510
      */
511
-    public static function return_message_and_translate($message, $type='normal', $filter = true)
511
+    public static function return_message_and_translate($message, $type = 'normal', $filter = true)
512 512
     {
513 513
         $message = get_lang($message);
514 514
         echo self::return_message($message, $type, $filter);
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
         }
529 529
 
530 530
         $class = "";
531
-        switch($type) {
531
+        switch ($type) {
532 532
             case 'warning':
533 533
                $class .= 'alert alert-warning';
534 534
                break;
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param string  optional, class from stylesheet
557 557
      * @return string encrypted mailto hyperlink
558 558
      */
559
-    public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '')
559
+    public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '')
560 560
     {
561 561
         if (is_null($clickable_text)) {
562 562
             $clickable_text = $email;
@@ -571,14 +571,14 @@  discard block
 block discarded – undo
571 571
         }
572 572
         // Encrypt email
573 573
         $hmail = '';
574
-        for ($i = 0; $i < strlen($email); $i ++) {
574
+        for ($i = 0; $i < strlen($email); $i++) {
575 575
             $hmail .= '&#'.ord($email {
576 576
             $i }).';';
577 577
         }
578 578
         $hclickable_text = null;
579 579
         // Encrypt clickable text if @ is present
580 580
         if (strpos($clickable_text, '@')) {
581
-            for ($i = 0; $i < strlen($clickable_text); $i ++) {
581
+            for ($i = 0; $i < strlen($clickable_text); $i++) {
582 582
                 $hclickable_text .= '&#'.ord($clickable_text {
583 583
                 $i }).';';
584 584
             }
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
         }
611 611
         // Encrypt email
612 612
         $hmail = '';
613
-        for ($i = 0; $i < strlen($email); $i ++) {
613
+        for ($i = 0; $i < strlen($email); $i++) {
614 614
             $hmail .= '&#'.ord($email {
615 615
             $i }).';';
616 616
         }
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
     public static function get_alphabet_options($selected_letter = '')
644 644
     {
645 645
         $result = '';
646
-        for ($i = 65; $i <= 90; $i ++) {
646
+        for ($i = 65; $i <= 90; $i++) {
647 647
             $letter = chr($i);
648 648
             $result .= '<option value="'.$letter.'"';
649 649
             if ($selected_letter == $letter) {
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
     public static function get_numeric_options($min, $max, $selected_num = 0)
665 665
     {
666 666
         $result = '';
667
-        for ($i = $min; $i <= $max; $i ++) {
667
+        for ($i = $min; $i <= $max; $i++) {
668 668
             $result .= '<option value="'.$i.'"';
669 669
             if (is_int($selected_num))
670 670
                 if ($selected_num == $i) {
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 
726 726
         if (isset($size)) {
727 727
             $size = intval($size);
728
-            $size_extra = $size . '/';
728
+            $size_extra = $size.'/';
729 729
         } else {
730 730
             $size = ICON_SIZE_SMALL;
731 731
         }
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
         $theme = 'themes/chamilo/icons/';
737 737
 
738 738
         if ($loadThemeIcon) {
739
-            $theme = 'themes/' . api_get_visual_theme() . '/icons/';
739
+            $theme = 'themes/'.api_get_visual_theme().'/icons/';
740 740
             // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
741 741
             if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
742 742
                 $icon = $alternateWebCssPath.$theme.$size_extra.$image;
@@ -753,11 +753,11 @@  discard block
 block discarded – undo
753 753
         // ask for the SVG version directly
754 754
         $testServer = api_get_setting('server_type');
755 755
         if ($testServer == 'test' && $return_only_path == false) {
756
-            $svgImage = substr($image, 0, -3) . 'svg';
757
-            if (is_file($code_path . $theme . 'svg/' . $svgImage)) {
758
-                $icon = $w_code_path . $theme . 'svg/' . $svgImage;
759
-            } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) {
760
-                $icon = $w_code_path . 'img/icons/svg/' . $svgImage;
756
+            $svgImage = substr($image, 0, -3).'svg';
757
+            if (is_file($code_path.$theme.'svg/'.$svgImage)) {
758
+                $icon = $w_code_path.$theme.'svg/'.$svgImage;
759
+            } elseif (is_file($code_path.'img/icons/svg/'.$svgImage)) {
760
+                $icon = $w_code_path.'img/icons/svg/'.$svgImage;
761 761
             }
762 762
 
763 763
             if (empty($additional_attributes['height'])) {
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
             }
838 838
         }
839 839
         //some tags don't have this </XXX>
840
-        if (in_array($tag, array('img','input','br'))) {
840
+        if (in_array($tag, array('img', 'input', 'br'))) {
841 841
             $return_value = '<'.$tag.' '.$attribute_list.' />';
842 842
         } else {
843 843
             $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>';
@@ -890,13 +890,13 @@  discard block
 block discarded – undo
890 890
     public static function input($type, $name, $value, $attributes = array())
891 891
     {
892 892
          if (isset($type)) {
893
-             $attributes['type']= $type;
893
+             $attributes['type'] = $type;
894 894
          }
895 895
          if (isset($name)) {
896
-             $attributes['name']= $name;
896
+             $attributes['name'] = $name;
897 897
          }
898 898
          if (isset($value)) {
899
-             $attributes['value']= $value;
899
+             $attributes['value'] = $value;
900 900
         }
901 901
         return self::tag('input', '', $attributes);
902 902
     }
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
     ) {
930 930
         $html = '';
931 931
         $extra = '';
932
-        $default_id = 'id="' . $name . '" ';
932
+        $default_id = 'id="'.$name.'" ';
933 933
         foreach ($extra_attributes as $key => $parameter) {
934 934
             if ($key == 'id') {
935 935
                 $default_id = '';
936 936
             }
937
-            $extra .= $key . '="' . $parameter . '" ';
937
+            $extra .= $key.'="'.$parameter.'" ';
938 938
         }
939
-        $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>';
939
+        $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>';
940 940
 
941 941
         if ($show_blank_item) {
942 942
             if (empty($blank_item_text)) {
@@ -944,14 +944,14 @@  discard block
 block discarded – undo
944 944
             } else {
945 945
                 $blank_item_text = Security::remove_XSS($blank_item_text);
946 946
             }
947
-            $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1'));
947
+            $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1'));
948 948
         }
949 949
         if ($values) {
950 950
             foreach ($values as $key => $value) {
951 951
                 if (is_array($value) && isset($value['name'])) {
952 952
                     $value = $value['name'];
953 953
                 }
954
-                $html .= '<option value="' . $key . '"';
954
+                $html .= '<option value="'.$key.'"';
955 955
 
956 956
                 if (is_array($default)) {
957 957
                     foreach ($default as $item) {
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
                     }
967 967
                 }
968 968
 
969
-                $html .= '>' . $value . '</option>';
969
+                $html .= '>'.$value.'</option>';
970 970
             }
971 971
         }
972 972
         $html .= '</select>';
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
      */
993 993
     public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array())
994 994
     {
995
-        if (empty($header_list) || count($header_list) == 0 ) {
995
+        if (empty($header_list) || count($header_list) == 0) {
996 996
             return '';
997 997
         }
998 998
 
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
         $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes);
1031 1031
 
1032
-        return $main_div ;
1032
+        return $main_div;
1033 1033
     }
1034 1034
 
1035 1035
     /**
@@ -1077,8 +1077,8 @@  discard block
 block discarded – undo
1077 1077
      */
1078 1078
     public static function grid_html($div_id)
1079 1079
     {
1080
-        $table  = self::tag('table','', array('id' => $div_id));
1081
-        $table .= self::tag('div','', array('id' => $div_id.'_pager'));
1080
+        $table  = self::tag('table', '', array('id' => $div_id));
1081
+        $table .= self::tag('div', '', array('id' => $div_id.'_pager'));
1082 1082
         return $table;
1083 1083
     }
1084 1084
 
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
         $obj->colNames      = $column_names;
1140 1140
         $obj->colModel      = $column_model;
1141 1141
         $obj->pager         = '#'.$div_id.'_pager';
1142
-        $obj->datatype  = 'json';
1142
+        $obj->datatype = 'json';
1143 1143
         $obj->viewrecords = 'true';
1144 1144
 
1145 1145
         $all_value = 10000000;
@@ -1200,10 +1200,10 @@  discard block
 block discarded – undo
1200 1200
         // Adding static data.
1201 1201
         if (!empty($data)) {
1202 1202
             $data_var = $div_id.'_data';
1203
-            $json.=' var '.$data_var.' = '.json_encode($data).';';
1203
+            $json .= ' var '.$data_var.' = '.json_encode($data).';';
1204 1204
             $obj->data = $data_var;
1205 1205
             $obj->datatype = 'local';
1206
-            $json.="\n";
1206
+            $json .= "\n";
1207 1207
         }
1208 1208
 
1209 1209
         $obj->end = 'end';
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
         }
1218 1218
 
1219 1219
         // Fixing true/false js values that doesn't need the ""
1220
-        $json_encode = str_replace(':"true"',':true',$json_encode);
1220
+        $json_encode = str_replace(':"true"', ':true', $json_encode);
1221 1221
         // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text
1222 1222
         $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode);
1223
-        $json_encode = str_replace(':"false"',':false',$json_encode);
1223
+        $json_encode = str_replace(':"false"', ':false', $json_encode);
1224 1224
         $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode);
1225
-        $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode);
1225
+        $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode);
1226 1226
 
1227 1227
         // Creating the jqgrid element.
1228 1228
         $json .= '$("#'.$div_id.'").jqGrid({';
@@ -1237,22 +1237,22 @@  discard block
 block discarded – undo
1237 1237
             $groups = '';
1238 1238
             foreach ($extra_params['groupHeaders'] as $group) {
1239 1239
                 //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" },
1240
-                $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText']  . '" },';
1240
+                $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },';
1241 1241
 
1242 1242
             }
1243 1243
             $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", {
1244 1244
                 "useColSpanStyle" : false,
1245 1245
                 "groupHeaders"    : [
1246
-                    ' . $groups . '
1246
+                    ' . $groups.'
1247 1247
                 ]
1248 1248
             });';
1249 1249
         }
1250 1250
 
1251 1251
         $all_text = addslashes(get_lang('All'));
1252 1252
         $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");';
1253
-        $json.= "\n";
1253
+        $json .= "\n";
1254 1254
         // Adding edit/delete icons.
1255
-        $json.= $formatter;
1255
+        $json .= $formatter;
1256 1256
 
1257 1257
         return $json;
1258 1258
     }
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
         }
1284 1284
 
1285 1285
         if (!empty($rows)) {
1286
-	        foreach($rows as $content) {
1286
+	        foreach ($rows as $content) {
1287 1287
 	            $table->setCellContents($row, $column, $content);
1288 1288
                 $row++;
1289 1289
             }
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 
1446 1446
         // Show all tool icons where there is something new.
1447 1447
         $return = '&nbsp;';
1448
-        foreach($notifications as $notification) {
1448
+        foreach ($notifications as $notification) {
1449 1449
             $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date']));
1450 1450
             $type = $notification['lastedit_type'];
1451 1451
             $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)";
@@ -1488,9 +1488,9 @@  discard block
 block discarded – undo
1488 1488
             $tbl_session            = Database :: get_main_table(TABLE_MAIN_SESSION);
1489 1489
             $active = false;
1490 1490
             // Request for the name of the general coach
1491
-            $sql ='SELECT tu.lastname, tu.firstname, ts.*
1491
+            $sql = 'SELECT tu.lastname, tu.firstname, ts.*
1492 1492
                     FROM '.$tbl_session.' ts
1493
-                    LEFT JOIN '.$main_user_table .' tu
1493
+                    LEFT JOIN '.$main_user_table.' tu
1494 1494
                     ON ts.id_coach = tu.user_id
1495 1495
                     WHERE ts.id = '.intval($session_id);
1496 1496
             $rs = Database::query($sql);
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
             $session = array();
1501 1501
             $session['title'] = $session_info['name'];
1502 1502
             $session['coach'] = '';
1503
-            $session['dates'] =  '';
1503
+            $session['dates'] = '';
1504 1504
 
1505 1505
             if (
1506 1506
                 (
@@ -1582,8 +1582,8 @@  discard block
 block discarded – undo
1582 1582
                     );
1583 1583
                 }
1584 1584
 
1585
-                if ( api_get_setting('show_session_coach') === 'true' ) {
1586
-                    $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name(
1585
+                if (api_get_setting('show_session_coach') === 'true') {
1586
+                    $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name(
1587 1587
                         $session_info['firstname'],
1588 1588
                         $session_info['lastname']
1589 1589
                     );
@@ -1635,9 +1635,9 @@  discard block
 block discarded – undo
1635 1635
 		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1636 1636
 
1637 1637
 		if (!empty($percentage)) {
1638
-            $percentage = $percentage*125/100;
1638
+            $percentage = $percentage * 125 / 100;
1639 1639
         }
1640
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1640
+		$accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1641 1641
 
1642 1642
 		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1643 1643
 
@@ -1652,19 +1652,19 @@  discard block
 block discarded – undo
1652 1652
 
1653 1653
 		$labels = array();
1654 1654
 
1655
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1656
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1655
+		$labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1656
+		$labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1657 1657
 		if (!empty($number_of_users_who_voted)) {
1658
-			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1658
+			$labels[] = get_lang('Average').' '.$point_info['point_average_star'].'/5';
1659 1659
 		}
1660 1660
 
1661
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1661
+		$labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] ';
1662 1662
 
1663 1663
 		if (!$add_div_wrapper && api_is_anonymous()) {
1664
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1664
+			$labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1665 1665
 		}
1666 1666
 
1667
-        $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1667
+        $html .= Display::div(implode(' | ', $labels), array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1668 1668
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1669 1669
 
1670 1670
         if ($add_div_wrapper) {
@@ -1742,8 +1742,8 @@  discard block
 block discarded – undo
1742 1742
         if (!empty($list)) {
1743 1743
             $html = '<dl class="dl-horizontal">';
1744 1744
             foreach ($list as $item) {
1745
-                $html .= '<dt>' . $item['title'] . '</dt>';
1746
-                $html .= '<dd>' . $item['content'] . '</dd>';
1745
+                $html .= '<dt>'.$item['title'].'</dt>';
1746
+                $html .= '<dd>'.$item['content'].'</dd>';
1747 1747
             }
1748 1748
             $html .= '</dl>';
1749 1749
         }
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
      * @param string $type
1786 1786
      * @return null|string
1787 1787
      */
1788
-    public static function badge($count, $type ="warning")
1788
+    public static function badge($count, $type = "warning")
1789 1789
     {
1790 1790
         $class = '';
1791 1791
 
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
         if (!empty($content)) {
1862 1862
             $html = '<span class="label '.$class.'">';
1863 1863
             $html .= $content;
1864
-            $html .='</span>';
1864
+            $html .= '</span>';
1865 1865
         }
1866 1866
 
1867 1867
         return $html;
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
                     $class = 'class ="active"';
1883 1883
                 }
1884 1884
 
1885
-                if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) {
1885
+                if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) {
1886 1886
                     $class = 'class ="active"';
1887 1887
                 }
1888 1888
                 $html .= "<li $class >";
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
      */
2099 2099
     public static function getVCardUserLink($userId)
2100 2100
     {
2101
-        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);;
2101
+        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ;
2102 2102
 
2103 2103
         return $vCardUrl;
2104 2104
     }
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
     {
2117 2117
         $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : '';
2118 2118
         $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : '';
2119
-        $styles = ['primary','success','info','warning','danger'];
2119
+        $styles = ['primary', 'success', 'info', 'warning', 'danger'];
2120 2120
         $style = !in_array($style, $styles) ? 'default' : $style;
2121 2121
 
2122 2122
         return '
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
         $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass;
2162 2162
 
2163 2163
         if (!$includeText) {
2164
-            $text = '<span class="sr-only">' . $text . '</span>';
2164
+            $text = '<span class="sr-only">'.$text.'</span>';
2165 2165
         }
2166 2166
 
2167 2167
         return self::url("$icon $text", $url, $attributes);
@@ -2176,19 +2176,19 @@  discard block
 block discarded – undo
2176 2176
      */
2177 2177
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
2178 2178
     {
2179
-        $columns = 12/$col;
2179
+        $columns = 12 / $col;
2180 2180
         $html = '';
2181
-        $html .= '<div id="' . $id . '" class="actions">';
2181
+        $html .= '<div id="'.$id.'" class="actions">';
2182 2182
         $html .= '<div class="row">';
2183 2183
         if ($col > 4) {
2184 2184
             $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>';
2185 2185
         } else {
2186
-            for ( $i = 0; $i < $col; $i++ ) {
2187
-                $html .= '<div class="col-md-' . $columns . '">';
2188
-                if ( $col == 2 && $i == 1 ) {
2186
+            for ($i = 0; $i < $col; $i++) {
2187
+                $html .= '<div class="col-md-'.$columns.'">';
2188
+                if ($col == 2 && $i == 1) {
2189 2189
                     if ($right === true) {
2190 2190
                         $html .= '<div class="pull-right">';
2191
-                        $html .= (isset($content[$i])?$content[$i]:'');
2191
+                        $html .= (isset($content[$i]) ? $content[$i] : '');
2192 2192
                         $html .= '</div>';
2193 2193
                     } else {
2194 2194
                         $html .= $content[$i];
@@ -2300,9 +2300,9 @@  discard block
 block discarded – undo
2300 2300
             $params['class'] = 'panel panel-default';
2301 2301
             $html = null;
2302 2302
             if (!empty($title)) {
2303
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
2303
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
2304 2304
             }
2305
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
2305
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
2306 2306
             $html = Display::div($html, $params);
2307 2307
         }
2308 2308
         return $html;
Please login to merge, or discard this patch.