@@ -758,7 +758,7 @@ |
||
758 | 758 | // $gidReset = true; |
759 | 759 | } // end else |
760 | 760 | |
761 | - // Now check for anonymous user mode |
|
761 | + // Now check for anonymous user mode |
|
762 | 762 | if (isset($use_anonymous) && $use_anonymous) { |
763 | 763 | //if anonymous mode is set, then try to set the current user as anonymous |
764 | 764 | //if he doesn't have a login yet |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | // is necessary verify check |
218 | 218 | if ($legal_type == 1) { |
219 | - if ((isset($_POST['legal_accept']) && $_POST['legal_accept']=='1')) { |
|
219 | + if ((isset($_POST['legal_accept']) && $_POST['legal_accept'] == '1')) { |
|
220 | 220 | $legal_option = true; |
221 | 221 | } else { |
222 | 222 | $legal_option = false; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * Process external authentication |
519 | 519 | * on the basis of the given login name |
520 | 520 | */ |
521 | - $loginFailed = true; // Default initialisation. It could |
|
521 | + $loginFailed = true; // Default initialisation. It could |
|
522 | 522 | // change after the external authentication |
523 | 523 | $key = $uData['auth_source']; //'ldap','shibboleth'... |
524 | 524 | /* >>>>>>>> External authentication modules <<<<<<<<< */ |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | } |
538 | 538 | } else { |
539 | 539 | // login failed, Database::num_rows($result) <= 0 |
540 | - $loginFailed = true; // Default initialisation. It could |
|
540 | + $loginFailed = true; // Default initialisation. It could |
|
541 | 541 | // change after the external authentication |
542 | 542 | |
543 | 543 | /* |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | include_once($thisAuthSource['newUser']); |
564 | 564 | } else { |
565 | 565 | error_log( |
566 | - 'Chamilo Authentication external file' . |
|
566 | + 'Chamilo Authentication external file'. |
|
567 | 567 | ' could not be found - this might prevent your system from using'. |
568 | 568 | ' the authentication process in the user creation process', |
569 | 569 | 0 |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | online_logout(null, false); |
673 | 673 | $osso->logout(); //redirects and exits |
674 | 674 | } |
675 | - } elseif (api_get_setting('openid_authentication')=='true') { |
|
675 | + } elseif (api_get_setting('openid_authentication') == 'true') { |
|
676 | 676 | if (!empty($_POST['openid_url'])) { |
677 | 677 | include api_get_path(SYS_CODE_PATH).'auth/openid/login.php'; |
678 | 678 | openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php'); |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | if ($res['status'] == 'success') { |
686 | 686 | $id1 = Database::escape_string($res['openid.identity']); |
687 | 687 | //have another id with or without the final '/' |
688 | - $id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/'); |
|
688 | + $id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/'); |
|
689 | 689 | //lookup the user in the main database |
690 | 690 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
691 | 691 | $sql = "SELECT user_id, username, password, auth_source, active, expiration_date |
@@ -694,14 +694,14 @@ discard block |
||
694 | 694 | OR openid = '$id2' "; |
695 | 695 | $result = Database::query($sql); |
696 | 696 | if ($result !== false) { |
697 | - if (Database::num_rows($result)>0) { |
|
697 | + if (Database::num_rows($result) > 0) { |
|
698 | 698 | $uData = Database::fetch_array($result); |
699 | 699 | |
700 | 700 | if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) { |
701 | 701 | //the authentification of this user is managed by Chamilo itself |
702 | 702 | |
703 | 703 | // check if the account is active (not locked) |
704 | - if ($uData['active']=='1') { |
|
704 | + if ($uData['active'] == '1') { |
|
705 | 705 | // check if the expiration date has not been reached |
706 | 706 | if ($uData['expiration_date'] > date('Y-m-d H:i:s') |
707 | 707 | || empty($uData['expiration_date']) |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid'])) |
781 | 781 | ) { |
782 | 782 | $cidReset = true; |
783 | - $gidReset = true; // As groups depend from courses, group id is reset |
|
783 | + $gidReset = true; // As groups depend from courses, group id is reset |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | /* USER INIT */ |
@@ -930,8 +930,8 @@ discard block |
||
930 | 930 | $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
931 | 931 | |
932 | 932 | if (!empty($_GET['id_session'])) { |
933 | - $sql = 'SELECT name FROM '.$tbl_session . ' |
|
934 | - WHERE id="'.intval($_GET['id_session']) . '"'; |
|
933 | + $sql = 'SELECT name FROM '.$tbl_session.' |
|
934 | + WHERE id="'.intval($_GET['id_session']).'"'; |
|
935 | 935 | $rs = Database::query($sql); |
936 | 936 | if (Database::num_rows($rs)) { |
937 | 937 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | // Moreover, if we want to track a course with another session it can be usefull |
1020 | 1020 | if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) { |
1021 | 1021 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
1022 | - $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"'; |
|
1022 | + $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"'; |
|
1023 | 1023 | $rs = Database::query($sql); |
1024 | 1024 | if (Database::num_rows($rs)) { |
1025 | 1025 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | } |
1145 | 1145 | } |
1146 | 1146 | $url = api_get_path(WEB_CODE_PATH).'auth/inscription.php'; |
1147 | - header("Location:". $url); |
|
1147 | + header("Location:".$url); |
|
1148 | 1148 | exit; |
1149 | 1149 | } |
1150 | 1150 | } |
@@ -1165,8 +1165,8 @@ discard block |
||
1165 | 1165 | if (Database::num_rows($result) > 0) { // this user have a recorded state for this course |
1166 | 1166 | $cuData = Database::fetch_array($result, 'ASSOC'); |
1167 | 1167 | |
1168 | - $is_courseAdmin = (bool)($cuData['status'] == 1); |
|
1169 | - $is_courseTutor = (bool)($cuData['is_tutor'] == 1); |
|
1168 | + $is_courseAdmin = (bool) ($cuData['status'] == 1); |
|
1169 | + $is_courseTutor = (bool) ($cuData['is_tutor'] == 1); |
|
1170 | 1170 | $is_courseMember = true; |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | // This user has no status related to this course |
1178 | 1178 | // The user is subscribed in a session? The user is a Session coach a Session admin ? |
1179 | 1179 | |
1180 | - $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
1180 | + $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
1181 | 1181 | $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); |
1182 | 1182 | $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1183 | 1183 | |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | |
1291 | 1291 | //If I'm the admin platform i'm a teacher of the course |
1292 | 1292 | if ($is_platformAdmin) { |
1293 | - $is_courseAdmin = true; |
|
1293 | + $is_courseAdmin = true; |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | } else { // keys missing => not anymore in the course - user relation |
@@ -1448,12 +1448,12 @@ discard block |
||
1448 | 1448 | ($logging_in && exist_firstpage_parameter()) |
1449 | 1449 | ) { |
1450 | 1450 | $redirectCourseDir = api_get_firstpage_parameter(); |
1451 | - api_delete_firstpage_parameter(); // delete the cookie |
|
1451 | + api_delete_firstpage_parameter(); // delete the cookie |
|
1452 | 1452 | |
1453 | 1453 | if (!isset($_SESSION['request_uri'])) { |
1454 | 1454 | if (CourseManager::get_course_id_from_path($redirectCourseDir)) { |
1455 | 1455 | $_SESSION['noredirection'] = false; |
1456 | - $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/'; |
|
1456 | + $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/'; |
|
1457 | 1457 | } |
1458 | 1458 | } |
1459 | 1459 | } elseif (api_user_is_login() && exist_firstpage_parameter()) { |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | api_delete_firstpage_parameter(); // delete the cookie |
1462 | 1462 | if (CourseManager::get_course_id_from_path($redirectCourseDir)) { |
1463 | 1463 | $_SESSION['noredirection'] = false; |
1464 | - $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/'; |
|
1464 | + $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/'; |
|
1465 | 1465 | } |
1466 | 1466 | } |
1467 | 1467 |
@@ -196,7 +196,7 @@ |
||
196 | 196 | * |
197 | 197 | * @return array |
198 | 198 | */ |
199 | - public function sender($key = '', $userId = '') |
|
199 | + public function sender($key = '', $userId = '') |
|
200 | 200 | { |
201 | 201 | $_user = api_get_user_info($userId); |
202 | 202 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function path($name = '') |
37 | 37 | { |
38 | - return api_get_path(SYS_PATH) . 'custompages/' . $name; |
|
38 | + return api_get_path(SYS_PATH).'custompages/'.$name; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $file = self::path($page_name . '.php'); |
|
53 | + $file = self::path($page_name.'.php'); |
|
54 | 54 | if (file_exists($file)) { |
55 | 55 | include($file); |
56 | 56 | exit; |
57 | 57 | } else { |
58 | - error_log('CustomPages::displayPage : could not read file ' . $file); |
|
58 | + error_log('CustomPages::displayPage : could not read file '.$file); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | public static function getURLImages($url_id = null) |
70 | 70 | { |
71 | 71 | if (is_null($url_id)) { |
72 | - $url = 'http://' . $_SERVER['HTTP_HOST'] . '/'; |
|
72 | + $url = 'http://'.$_SERVER['HTTP_HOST'].'/'; |
|
73 | 73 | $url_id = UrlManager::get_url_id($url); |
74 | 74 | } |
75 | - $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/'; |
|
75 | + $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/'; |
|
76 | 76 | $images = array(); |
77 | 77 | for ($img_id = 1; $img_id <= 3; $img_id++) { |
78 | - if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) { |
|
79 | - $images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png'; |
|
78 | + if (file_exists($url_images_dir.$url_id.'_url_image_'.$img_id.'.png')) { |
|
79 | + $images[] = api_get_path(WEB_PATH).'custompages/url-images/'.$url_id.'_url_image_'.$img_id.'.png'; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |
@@ -774,10 +774,12 @@ discard block |
||
774 | 774 | public static function update_openid($user_id, $openid) |
775 | 775 | { |
776 | 776 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
777 | - if ($user_id != strval(intval($user_id))) |
|
778 | - return false; |
|
779 | - if ($user_id === false) |
|
780 | - return false; |
|
777 | + if ($user_id != strval(intval($user_id))) { |
|
778 | + return false; |
|
779 | + } |
|
780 | + if ($user_id === false) { |
|
781 | + return false; |
|
782 | + } |
|
781 | 783 | $sql = "UPDATE $table_user SET |
782 | 784 | openid='".Database::escape_string($openid)."'"; |
783 | 785 | $sql .= " WHERE id= $user_id"; |
@@ -2069,8 +2071,9 @@ discard block |
||
2069 | 2071 | if (empty($user_id)) { |
2070 | 2072 | $user_id = 0; |
2071 | 2073 | } else { |
2072 | - if ($user_id != strval(intval($user_id))) |
|
2073 | - return array(); |
|
2074 | + if ($user_id != strval(intval($user_id))) { |
|
2075 | + return array(); |
|
2076 | + } |
|
2074 | 2077 | } |
2075 | 2078 | $extra_data = array(); |
2076 | 2079 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2162,8 +2165,9 @@ discard block |
||
2162 | 2165 | if (empty($user_id)) { |
2163 | 2166 | $user_id = 0; |
2164 | 2167 | } else { |
2165 | - if ($user_id != strval(intval($user_id))) |
|
2166 | - return array(); |
|
2168 | + if ($user_id != strval(intval($user_id))) { |
|
2169 | + return array(); |
|
2170 | + } |
|
2167 | 2171 | } |
2168 | 2172 | $extra_data = array(); |
2169 | 2173 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2880,13 +2884,15 @@ discard block |
||
2880 | 2884 | */ |
2881 | 2885 | public static function get_api_keys($user_id = null, $api_service = 'dokeos') |
2882 | 2886 | { |
2883 | - if ($user_id != strval(intval($user_id))) |
|
2884 | - return false; |
|
2887 | + if ($user_id != strval(intval($user_id))) { |
|
2888 | + return false; |
|
2889 | + } |
|
2885 | 2890 | if (empty($user_id)) { |
2886 | 2891 | $user_id = api_get_user_id(); |
2887 | 2892 | } |
2888 | - if ($user_id === false) |
|
2889 | - return false; |
|
2893 | + if ($user_id === false) { |
|
2894 | + return false; |
|
2895 | + } |
|
2890 | 2896 | $service_name = Database::escape_string($api_service); |
2891 | 2897 | if (is_string($service_name) === false) { |
2892 | 2898 | return false; |
@@ -2894,11 +2900,14 @@ discard block |
||
2894 | 2900 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
2895 | 2901 | $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';"; |
2896 | 2902 | $res = Database::query($sql); |
2897 | - if ($res === false) |
|
2898 | - return false; //error during query |
|
2903 | + if ($res === false) { |
|
2904 | + return false; |
|
2905 | + } |
|
2906 | + //error during query |
|
2899 | 2907 | $num = Database::num_rows($res); |
2900 | - if ($num == 0) |
|
2901 | - return false; |
|
2908 | + if ($num == 0) { |
|
2909 | + return false; |
|
2910 | + } |
|
2902 | 2911 | $list = array(); |
2903 | 2912 | while ($row = Database::fetch_array($res)) { |
2904 | 2913 | $list[$row['id']] = $row['api_key']; |
@@ -2913,13 +2922,15 @@ discard block |
||
2913 | 2922 | */ |
2914 | 2923 | public static function add_api_key($user_id = null, $api_service = 'dokeos') |
2915 | 2924 | { |
2916 | - if ($user_id != strval(intval($user_id))) |
|
2917 | - return false; |
|
2925 | + if ($user_id != strval(intval($user_id))) { |
|
2926 | + return false; |
|
2927 | + } |
|
2918 | 2928 | if (empty($user_id)) { |
2919 | 2929 | $user_id = api_get_user_id(); |
2920 | 2930 | } |
2921 | - if ($user_id === false) |
|
2922 | - return false; |
|
2931 | + if ($user_id === false) { |
|
2932 | + return false; |
|
2933 | + } |
|
2923 | 2934 | $service_name = Database::escape_string($api_service); |
2924 | 2935 | if (is_string($service_name) === false) { |
2925 | 2936 | return false; |
@@ -2928,8 +2939,10 @@ discard block |
||
2928 | 2939 | $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key |
2929 | 2940 | $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')"; |
2930 | 2941 | $res = Database::query($sql); |
2931 | - if ($res === false) |
|
2932 | - return false; //error during query |
|
2942 | + if ($res === false) { |
|
2943 | + return false; |
|
2944 | + } |
|
2945 | + //error during query |
|
2933 | 2946 | $num = Database::insert_id(); |
2934 | 2947 | return ($num == 0) ? false : $num; |
2935 | 2948 | } |
@@ -2941,22 +2954,29 @@ discard block |
||
2941 | 2954 | */ |
2942 | 2955 | public static function delete_api_key($key_id) |
2943 | 2956 | { |
2944 | - if ($key_id != strval(intval($key_id))) |
|
2945 | - return false; |
|
2946 | - if ($key_id === false) |
|
2947 | - return false; |
|
2957 | + if ($key_id != strval(intval($key_id))) { |
|
2958 | + return false; |
|
2959 | + } |
|
2960 | + if ($key_id === false) { |
|
2961 | + return false; |
|
2962 | + } |
|
2948 | 2963 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
2949 | 2964 | $sql = "SELECT * FROM $t_api WHERE id = ".$key_id; |
2950 | 2965 | $res = Database::query($sql); |
2951 | - if ($res === false) |
|
2952 | - return false; //error during query |
|
2966 | + if ($res === false) { |
|
2967 | + return false; |
|
2968 | + } |
|
2969 | + //error during query |
|
2953 | 2970 | $num = Database::num_rows($res); |
2954 | - if ($num !== 1) |
|
2955 | - return false; |
|
2971 | + if ($num !== 1) { |
|
2972 | + return false; |
|
2973 | + } |
|
2956 | 2974 | $sql = "DELETE FROM $t_api WHERE id = ".$key_id; |
2957 | 2975 | $res = Database::query($sql); |
2958 | - if ($res === false) |
|
2959 | - return false; //error during query |
|
2976 | + if ($res === false) { |
|
2977 | + return false; |
|
2978 | + } |
|
2979 | + //error during query |
|
2960 | 2980 | return true; |
2961 | 2981 | } |
2962 | 2982 | |
@@ -2968,10 +2988,12 @@ discard block |
||
2968 | 2988 | */ |
2969 | 2989 | public static function update_api_key($user_id, $api_service) |
2970 | 2990 | { |
2971 | - if ($user_id != strval(intval($user_id))) |
|
2972 | - return false; |
|
2973 | - if ($user_id === false) |
|
2974 | - return false; |
|
2991 | + if ($user_id != strval(intval($user_id))) { |
|
2992 | + return false; |
|
2993 | + } |
|
2994 | + if ($user_id === false) { |
|
2995 | + return false; |
|
2996 | + } |
|
2975 | 2997 | $service_name = Database::escape_string($api_service); |
2976 | 2998 | if (is_string($service_name) === false) { |
2977 | 2999 | return false; |
@@ -2997,12 +3019,15 @@ discard block |
||
2997 | 3019 | */ |
2998 | 3020 | public static function get_api_key_id($user_id, $api_service) |
2999 | 3021 | { |
3000 | - if ($user_id != strval(intval($user_id))) |
|
3001 | - return false; |
|
3002 | - if ($user_id === false) |
|
3003 | - return false; |
|
3004 | - if (empty($api_service)) |
|
3005 | - return false; |
|
3022 | + if ($user_id != strval(intval($user_id))) { |
|
3023 | + return false; |
|
3024 | + } |
|
3025 | + if ($user_id === false) { |
|
3026 | + return false; |
|
3027 | + } |
|
3028 | + if (empty($api_service)) { |
|
3029 | + return false; |
|
3030 | + } |
|
3006 | 3031 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3007 | 3032 | $api_service = Database::escape_string($api_service); |
3008 | 3033 | $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'"; |
@@ -4473,8 +4498,9 @@ discard block |
||
4473 | 4498 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4474 | 4499 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4475 | 4500 | if (!$admin_permissions) { |
4476 | - if ($field_details[7] == 0) |
|
4477 | - $form->freeze('extra_'.$field_details[1]); |
|
4501 | + if ($field_details[7] == 0) { |
|
4502 | + $form->freeze('extra_'.$field_details[1]); |
|
4503 | + } |
|
4478 | 4504 | } |
4479 | 4505 | break; |
4480 | 4506 | case ExtraField::FIELD_TYPE_RADIO: |
@@ -4491,8 +4517,9 @@ discard block |
||
4491 | 4517 | } |
4492 | 4518 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], ''); |
4493 | 4519 | if (!$admin_permissions) { |
4494 | - if ($field_details[7] == 0) |
|
4495 | - $form->freeze('extra_'.$field_details[1]); |
|
4520 | + if ($field_details[7] == 0) { |
|
4521 | + $form->freeze('extra_'.$field_details[1]); |
|
4522 | + } |
|
4496 | 4523 | } |
4497 | 4524 | break; |
4498 | 4525 | case ExtraField::FIELD_TYPE_SELECT: |
@@ -4530,8 +4557,9 @@ discard block |
||
4530 | 4557 | ); |
4531 | 4558 | |
4532 | 4559 | if (!$admin_permissions) { |
4533 | - if ($field_details[7] == 0) |
|
4534 | - $form->freeze('extra_'.$field_details[1]); |
|
4560 | + if ($field_details[7] == 0) { |
|
4561 | + $form->freeze('extra_'.$field_details[1]); |
|
4562 | + } |
|
4535 | 4563 | } |
4536 | 4564 | break; |
4537 | 4565 | case ExtraField::FIELD_TYPE_SELECT_MULTIPLE: |
@@ -4547,8 +4575,9 @@ discard block |
||
4547 | 4575 | array('multiple' => 'multiple') |
4548 | 4576 | ); |
4549 | 4577 | if (!$admin_permissions) { |
4550 | - if ($field_details[7] == 0) |
|
4551 | - $form->freeze('extra_'.$field_details[1]); |
|
4578 | + if ($field_details[7] == 0) { |
|
4579 | + $form->freeze('extra_'.$field_details[1]); |
|
4580 | + } |
|
4552 | 4581 | } |
4553 | 4582 | break; |
4554 | 4583 | case ExtraField::FIELD_TYPE_DATE: |
@@ -4556,8 +4585,9 @@ discard block |
||
4556 | 4585 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4557 | 4586 | $form->setDefaults($defaults); |
4558 | 4587 | if (!$admin_permissions) { |
4559 | - if ($field_details[7] == 0) |
|
4560 | - $form->freeze('extra_'.$field_details[1]); |
|
4588 | + if ($field_details[7] == 0) { |
|
4589 | + $form->freeze('extra_'.$field_details[1]); |
|
4590 | + } |
|
4561 | 4591 | } |
4562 | 4592 | $form->applyFilter('theme', 'trim'); |
4563 | 4593 | break; |
@@ -4566,8 +4596,9 @@ discard block |
||
4566 | 4596 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4567 | 4597 | $form->setDefaults($defaults); |
4568 | 4598 | if (!$admin_permissions) { |
4569 | - if ($field_details[7] == 0) |
|
4570 | - $form->freeze('extra_'.$field_details[1]); |
|
4599 | + if ($field_details[7] == 0) { |
|
4600 | + $form->freeze('extra_'.$field_details[1]); |
|
4601 | + } |
|
4571 | 4602 | } |
4572 | 4603 | $form->applyFilter('theme', 'trim'); |
4573 | 4604 | break; |
@@ -4586,8 +4617,9 @@ discard block |
||
4586 | 4617 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], ' '); |
4587 | 4618 | |
4588 | 4619 | if (!$admin_permissions) { |
4589 | - if ($field_details[7] == 0) |
|
4590 | - $form->freeze('extra_'.$field_details[1]); |
|
4620 | + if ($field_details[7] == 0) { |
|
4621 | + $form->freeze('extra_'.$field_details[1]); |
|
4622 | + } |
|
4591 | 4623 | } |
4592 | 4624 | |
4593 | 4625 | /* Recoding the selected values for double : if the user has |
@@ -4647,8 +4679,9 @@ discard block |
||
4647 | 4679 | break; |
4648 | 4680 | case ExtraField::FIELD_TYPE_TIMEZONE: |
4649 | 4681 | $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), ''); |
4650 | - if ($field_details[7] == 0) |
|
4651 | - $form->freeze('extra_'.$field_details[1]); |
|
4682 | + if ($field_details[7] == 0) { |
|
4683 | + $form->freeze('extra_'.$field_details[1]); |
|
4684 | + } |
|
4652 | 4685 | break; |
4653 | 4686 | case ExtraField::FIELD_TYPE_SOCIAL_PROFILE: |
4654 | 4687 | // get the social network's favicon |
@@ -4673,8 +4706,9 @@ discard block |
||
4673 | 4706 | ); |
4674 | 4707 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4675 | 4708 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4676 | - if ($field_details[7] == 0) |
|
4677 | - $form->freeze('extra_'.$field_details[1]); |
|
4709 | + if ($field_details[7] == 0) { |
|
4710 | + $form->freeze('extra_'.$field_details[1]); |
|
4711 | + } |
|
4678 | 4712 | break; |
4679 | 4713 | case ExtraField::FIELD_TYPE_FILE: |
4680 | 4714 | $extra_field = 'extra_'.$field_details[1]; |
@@ -4991,8 +5025,9 @@ discard block |
||
4991 | 5025 | $url .= "?s=$s&d=$d&r=$r"; |
4992 | 5026 | if ( $img ) { |
4993 | 5027 | $url = '<img src="' . $url . '"'; |
4994 | - foreach ( $atts as $key => $val ) |
|
4995 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
5028 | + foreach ( $atts as $key => $val ) { |
|
5029 | + $url .= ' ' . $key . '="' . $val . '"'; |
|
5030 | + } |
|
4996 | 5031 | $url .= ' />'; |
4997 | 5032 | } |
4998 | 5033 | return $url; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | const USER_FIELD_TYPE_TIMEZONE = 11; |
35 | 35 | const USER_FIELD_TYPE_SOCIAL_PROFILE = 12; |
36 | 36 | const USER_FIELD_TYPE_FILE = 13; |
37 | - const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14; |
|
37 | + const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14; |
|
38 | 38 | |
39 | 39 | private static $encryptionMethod; |
40 | 40 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | $res = Database::query($sql); |
507 | 507 | while ($course = Database::fetch_object($res)) { |
508 | 508 | $sql = "SELECT id FROM $table_course_user |
509 | - WHERE status=1 AND c_id = " . intval($course->c_id); |
|
509 | + WHERE status=1 AND c_id = ".intval($course->c_id); |
|
510 | 510 | $res2 = Database::query($sql); |
511 | 511 | if (Database::num_rows($res2) == 1) { |
512 | 512 | |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | $sql = "UPDATE $table_user SET active = 1 WHERE id IN ($ids)"; |
771 | 771 | $r = Database::query($sql); |
772 | 772 | if ($r !== false) { |
773 | - Event::addEvent(LOG_USER_ENABLE,LOG_USER_ID,$ids); |
|
773 | + Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $ids); |
|
774 | 774 | } |
775 | 775 | return $r; |
776 | 776 | } |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | // 1. Conversion of unacceptable letters (latinian letters with accents for example) into ASCII letters in order they not to be totally removed. |
1177 | 1177 | // 2. Applying the strict purifier. |
1178 | 1178 | // 3. Length limitation. |
1179 | - $return = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH); |
|
1179 | + $return = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH); |
|
1180 | 1180 | $return = URLify::transliterate($return); |
1181 | 1181 | return $return; |
1182 | 1182 | } |
@@ -1268,12 +1268,12 @@ discard block |
||
1268 | 1268 | |
1269 | 1269 | if (!is_null($order)) { |
1270 | 1270 | $order = Database::escape_string($order); |
1271 | - $sql .= ' ORDER BY ' . $order; |
|
1271 | + $sql .= ' ORDER BY '.$order; |
|
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | if (!is_null($limit)) { |
1275 | 1275 | $limit = Database::escape_string($limit); |
1276 | - $sql .= ' LIMIT ' . $limit; |
|
1276 | + $sql .= ' LIMIT '.$limit; |
|
1277 | 1277 | } |
1278 | 1278 | |
1279 | 1279 | $rs = Database::query($sql); |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | // directory might not have been created. Make sure it is before |
1463 | 1463 | // going further. |
1464 | 1464 | |
1465 | - $rootPath = api_get_path(SYS_UPLOAD_PATH) . 'users/' . substr((string) $id, 0, 1); |
|
1465 | + $rootPath = api_get_path(SYS_UPLOAD_PATH).'users/'.substr((string) $id, 0, 1); |
|
1466 | 1466 | if (!is_dir($rootPath)) { |
1467 | 1467 | $perm = api_get_permissions_for_new_directories(); |
1468 | 1468 | try { |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | $path_info = self::get_user_picture_path_by_id($user_id, 'system'); |
1711 | 1711 | $path = $path_info['dir']; |
1712 | 1712 | if (!empty($extra_field)) { |
1713 | - $path .= $extra_field . '/'; |
|
1713 | + $path .= $extra_field.'/'; |
|
1714 | 1714 | } |
1715 | 1715 | // If this directory does not exist - we create it. |
1716 | 1716 | if (!file_exists($path)) { |
@@ -1718,7 +1718,7 @@ discard block |
||
1718 | 1718 | } |
1719 | 1719 | |
1720 | 1720 | if (filter_extension($file)) { |
1721 | - if (@move_uploaded_file($source_file,$path.$file)) { |
|
1721 | + if (@move_uploaded_file($source_file, $path.$file)) { |
|
1722 | 1722 | if ($extra_field) { |
1723 | 1723 | return $extra_field.'/'.$file; |
1724 | 1724 | } else { |
@@ -1971,10 +1971,10 @@ discard block |
||
1971 | 1971 | if (count($extra_files) > 0) { |
1972 | 1972 | $extra_file_list = '<div class="files-production"><ul id="productions">'; |
1973 | 1973 | foreach ($extra_files as $file) { |
1974 | - $filename = substr($file,strlen($extra_field)+1); |
|
1974 | + $filename = substr($file, strlen($extra_field) + 1); |
|
1975 | 1975 | $extra_file_list .= '<li>'.Display::return_icon('archive.png').'<a href="'.$path.$extra_field.'/'.urlencode($filename).'" target="_blank">'.htmlentities($filename).'</a> '; |
1976 | 1976 | if ($showdelete) { |
1977 | - $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_' . $extra_field . '['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>'; |
|
1977 | + $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_'.$extra_field.'['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>'; |
|
1978 | 1978 | } |
1979 | 1979 | } |
1980 | 1980 | $extra_file_list .= '</ul></div>'; |
@@ -2563,7 +2563,7 @@ discard block |
||
2563 | 2563 | |
2564 | 2564 | if (api_is_allowed_to_create_course()) { |
2565 | 2565 | $sessionListFromCourseCoach = array(); |
2566 | - $sql =" SELECT DISTINCT session_id |
|
2566 | + $sql = " SELECT DISTINCT session_id |
|
2567 | 2567 | FROM $tbl_session_course_user |
2568 | 2568 | WHERE user_id = $user_id AND status = 2 "; |
2569 | 2569 | |
@@ -2571,7 +2571,7 @@ discard block |
||
2571 | 2571 | if (Database::num_rows($result)) { |
2572 | 2572 | $result = Database::store_result($result); |
2573 | 2573 | foreach ($result as $session) { |
2574 | - $sessionListFromCourseCoach[]= $session['session_id']; |
|
2574 | + $sessionListFromCourseCoach[] = $session['session_id']; |
|
2575 | 2575 | } |
2576 | 2576 | } |
2577 | 2577 | if (!empty($sessionListFromCourseCoach)) { |
@@ -2594,7 +2594,7 @@ discard block |
||
2594 | 2594 | ORDER BY access_start_date, access_end_date, name"; |
2595 | 2595 | |
2596 | 2596 | $result = Database::query($sql); |
2597 | - if (Database::num_rows($result)>0) { |
|
2597 | + if (Database::num_rows($result) > 0) { |
|
2598 | 2598 | while ($row = Database::fetch_assoc($result)) { |
2599 | 2599 | $sessions[$row['id']] = $row; |
2600 | 2600 | } |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | ORDER BY access_start_date, access_end_date, name"; |
2611 | 2611 | |
2612 | 2612 | $result = Database::query($sql); |
2613 | - if (Database::num_rows($result)>0) { |
|
2613 | + if (Database::num_rows($result) > 0) { |
|
2614 | 2614 | while ($row = Database::fetch_assoc($result)) { |
2615 | 2615 | if (empty($sessions[$row['id']])) { |
2616 | 2616 | $sessions[$row['id']] = $row; |
@@ -3602,13 +3602,13 @@ discard block |
||
3602 | 3602 | $useExtraFields = false; |
3603 | 3603 | $extraFields = UserManager::get_extra_filtrable_fields(); |
3604 | 3604 | $extraFieldResult = array(); |
3605 | - if (is_array($extraFields) && count($extraFields)>0 ) { |
|
3605 | + if (is_array($extraFields) && count($extraFields) > 0) { |
|
3606 | 3606 | foreach ($extraFields as $extraField) { |
3607 | 3607 | $varName = 'field_'.$extraField['variable']; |
3608 | 3608 | if (UserManager::is_extra_field_available($extraField['variable'])) { |
3609 | - if (isset($_GET[$varName]) && $_GET[$varName]!='0') { |
|
3609 | + if (isset($_GET[$varName]) && $_GET[$varName] != '0') { |
|
3610 | 3610 | $useExtraFields = true; |
3611 | - $extraFieldResult[]= UserManager::get_extra_user_data_by_value( |
|
3611 | + $extraFieldResult[] = UserManager::get_extra_user_data_by_value( |
|
3612 | 3612 | $extraField['variable'], |
3613 | 3613 | $_GET[$varName] |
3614 | 3614 | ); |
@@ -3619,17 +3619,17 @@ discard block |
||
3619 | 3619 | |
3620 | 3620 | if ($useExtraFields) { |
3621 | 3621 | $finalResult = array(); |
3622 | - if (count($extraFieldResult)>1) { |
|
3623 | - for ($i=0; $i < count($extraFieldResult) -1; $i++) { |
|
3624 | - if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i+1])) { |
|
3625 | - $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]); |
|
3622 | + if (count($extraFieldResult) > 1) { |
|
3623 | + for ($i = 0; $i < count($extraFieldResult) - 1; $i++) { |
|
3624 | + if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i + 1])) { |
|
3625 | + $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i + 1]); |
|
3626 | 3626 | } |
3627 | 3627 | } |
3628 | 3628 | } else { |
3629 | 3629 | $finalResult = $extraFieldResult[0]; |
3630 | 3630 | } |
3631 | 3631 | |
3632 | - if (is_array($finalResult) && count($finalResult)>0) { |
|
3632 | + if (is_array($finalResult) && count($finalResult) > 0) { |
|
3633 | 3633 | $whereFilter = " AND u.id IN ('".implode("','", $finalResult)."') "; |
3634 | 3634 | } else { |
3635 | 3635 | //no results |
@@ -3806,7 +3806,7 @@ discard block |
||
3806 | 3806 | $sql = 'DELETE FROM '.$tbl_my_friend.' |
3807 | 3807 | WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND friend_user_id='.$friend_id.' '.$extra_condition; |
3808 | 3808 | Database::query($sql); |
3809 | - $sql= 'DELETE FROM '.$tbl_my_friend.' |
|
3809 | + $sql = 'DELETE FROM '.$tbl_my_friend.' |
|
3810 | 3810 | WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND user_id='.$friend_id.' '.$extra_condition; |
3811 | 3811 | Database::query($sql); |
3812 | 3812 | } else { |
@@ -4007,7 +4007,7 @@ discard block |
||
4007 | 4007 | |
4008 | 4008 | if (!empty($lastConnectionDate)) { |
4009 | 4009 | $lastConnectionDate = Database::escape_string($lastConnectionDate); |
4010 | - $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; |
|
4010 | + $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; |
|
4011 | 4011 | } |
4012 | 4012 | |
4013 | 4013 | $courseConditions = null; |
@@ -4074,7 +4074,7 @@ discard block |
||
4074 | 4074 | break; |
4075 | 4075 | case STUDENT_BOSS : |
4076 | 4076 | $drhConditions = " AND friend_user_id = $userId AND " |
4077 | - . "relation_type = " . USER_RELATION_TYPE_BOSS; |
|
4077 | + . "relation_type = ".USER_RELATION_TYPE_BOSS; |
|
4078 | 4078 | break; |
4079 | 4079 | } |
4080 | 4080 | |
@@ -4165,7 +4165,7 @@ discard block |
||
4165 | 4165 | WHERE |
4166 | 4166 | friend_user_id = $userId AND |
4167 | 4167 | relation_type = $relationType AND |
4168 | - access_url_id = " . api_get_current_access_url_id(); |
|
4168 | + access_url_id = ".api_get_current_access_url_id(); |
|
4169 | 4169 | } else { |
4170 | 4170 | $sql = "SELECT user_id FROM $userRelUserTable |
4171 | 4171 | WHERE friend_user_id = $userId |
@@ -4447,7 +4447,7 @@ discard block |
||
4447 | 4447 | if (empty($years)) { |
4448 | 4448 | $years = 1; |
4449 | 4449 | } |
4450 | - $inactive_time = $years * 31536000; //1 year |
|
4450 | + $inactive_time = $years * 31536000; //1 year |
|
4451 | 4451 | $rs = Database::query($sql); |
4452 | 4452 | if (Database::num_rows($rs) > 0) { |
4453 | 4453 | if ($last_login_date = Database::result($rs, 0, 0)) { |
@@ -4580,7 +4580,7 @@ discard block |
||
4580 | 4580 | 'extra_'.$field_details[1], |
4581 | 4581 | $field_details[3], |
4582 | 4582 | $options, |
4583 | - array('id' => 'extra_' . $field_details[1]) |
|
4583 | + array('id' => 'extra_'.$field_details[1]) |
|
4584 | 4584 | ); |
4585 | 4585 | |
4586 | 4586 | if (!$admin_permissions) { |
@@ -4734,7 +4734,7 @@ discard block |
||
4734 | 4734 | $extra_field = 'extra_'.$field_details[1]; |
4735 | 4735 | $form->addElement('file', $extra_field, $field_details[3], null, ''); |
4736 | 4736 | if ($extra_file_list = UserManager::build_user_extra_file_list($user_id, $field_details[1], '', true)) { |
4737 | - $form->addElement('static', $extra_field . '_list', null, $extra_file_list); |
|
4737 | + $form->addElement('static', $extra_field.'_list', null, $extra_file_list); |
|
4738 | 4738 | } |
4739 | 4739 | if ($field_details[7] == 0) { |
4740 | 4740 | $form->freeze($extra_field); |
@@ -4907,7 +4907,7 @@ discard block |
||
4907 | 4907 | $direction = null, |
4908 | 4908 | $active = null, |
4909 | 4909 | $lastConnectionDate = null |
4910 | - ){ |
|
4910 | + ) { |
|
4911 | 4911 | return self::getUsersFollowedByUser( |
4912 | 4912 | $userId, |
4913 | 4913 | $userStatus, |
@@ -5114,12 +5114,12 @@ discard block |
||
5114 | 5114 | if (!empty($_SERVER['HTTPS'])) { |
5115 | 5115 | $url = 'https://secure.gravatar.com/avatar/'; |
5116 | 5116 | } |
5117 | - $url .= md5( strtolower( trim( $email ) ) ); |
|
5117 | + $url .= md5(strtolower(trim($email))); |
|
5118 | 5118 | $url .= "?s=$s&d=$d&r=$r"; |
5119 | - if ( $img ) { |
|
5120 | - $url = '<img src="' . $url . '"'; |
|
5121 | - foreach ( $atts as $key => $val ) |
|
5122 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
5119 | + if ($img) { |
|
5120 | + $url = '<img src="'.$url.'"'; |
|
5121 | + foreach ($atts as $key => $val) |
|
5122 | + $url .= ' '.$key.'="'.$val.'"'; |
|
5123 | 5123 | $url .= ' />'; |
5124 | 5124 | } |
5125 | 5125 | return $url; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | /** |
139 | 139 | * Validates the password |
140 | 140 | * |
141 | - * @param $encoded |
|
141 | + * @param string $encoded |
|
142 | 142 | * @param $raw |
143 | 143 | * @param $salt |
144 | 144 | * @return bool |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param string $raw |
156 | 156 | * @param User $user |
157 | 157 | * |
158 | - * @return bool |
|
158 | + * @return string |
|
159 | 159 | */ |
160 | 160 | public static function encryptPassword($raw, User $user) |
161 | 161 | { |
@@ -1003,6 +1003,7 @@ discard block |
||
1003 | 1003 | * Disables or enables a user |
1004 | 1004 | * @param int user_id |
1005 | 1005 | * @param int Enable or disable |
1006 | + * @param integer $active |
|
1006 | 1007 | * @return void |
1007 | 1008 | * @assert (-1,0) === false |
1008 | 1009 | * @assert (1,1) === true |
@@ -1033,6 +1034,7 @@ discard block |
||
1033 | 1034 | /** |
1034 | 1035 | * Disables a user |
1035 | 1036 | * @param int User id |
1037 | + * @param integer $user_id |
|
1036 | 1038 | * @return bool |
1037 | 1039 | * @uses UserManager::change_active_state() to actually disable the user |
1038 | 1040 | * @assert (0) === false |
@@ -1049,6 +1051,7 @@ discard block |
||
1049 | 1051 | /** |
1050 | 1052 | * Enable a user |
1051 | 1053 | * @param int User id |
1054 | + * @param integer $user_id |
|
1052 | 1055 | * @return bool |
1053 | 1056 | * @uses UserManager::change_active_state() to actually disable the user |
1054 | 1057 | * @assert (0) === false |
@@ -1213,6 +1216,7 @@ discard block |
||
1213 | 1216 | * Checks whether the user id exists in the database |
1214 | 1217 | * |
1215 | 1218 | * @param int User id |
1219 | + * @param integer $userId |
|
1216 | 1220 | * @return bool True if user id was found, false otherwise |
1217 | 1221 | */ |
1218 | 1222 | public static function is_user_id_valid($userId) |
@@ -1410,7 +1414,7 @@ discard block |
||
1410 | 1414 | * @param array $userInfo user information to avoid query the DB |
1411 | 1415 | * returns the /main/img/unknown.jpg image set it at true |
1412 | 1416 | * |
1413 | - * @return array Array of 2 elements: 'dir' and 'file' which contain |
|
1417 | + * @return integer Array of 2 elements: 'dir' and 'file' which contain |
|
1414 | 1418 | * the dir and file as the name implies if image does not exist it will |
1415 | 1419 | * return the unknow image if anonymous parameter is true if not it returns an empty array |
1416 | 1420 | */ |
@@ -1778,7 +1782,7 @@ discard block |
||
1778 | 1782 | * @param int $user_id User id |
1779 | 1783 | * @param $force Optional parameter to force building after a removal request |
1780 | 1784 | * |
1781 | - * @return A string containing the XHTML code to dipslay the production list, or FALSE |
|
1785 | + * @return boolean|string string containing the XHTML code to dipslay the production list, or FALSE |
|
1782 | 1786 | */ |
1783 | 1787 | public static function build_production_list($user_id, $force = false, $showdelete = false) |
1784 | 1788 | { |
@@ -1814,7 +1818,7 @@ discard block |
||
1814 | 1818 | /** |
1815 | 1819 | * Returns an array with the user's productions. |
1816 | 1820 | * |
1817 | - * @param $user_id User id |
|
1821 | + * @param integer $user_id User id |
|
1818 | 1822 | * @return array An array containing the user's productions |
1819 | 1823 | */ |
1820 | 1824 | public static function get_user_productions($user_id) |
@@ -1969,7 +1973,7 @@ discard block |
||
1969 | 1973 | |
1970 | 1974 | /** |
1971 | 1975 | * Build a list of extra file already uploaded in $user_folder/{$extra_field}/ |
1972 | - * @param $user_id |
|
1976 | + * @param integer $user_id |
|
1973 | 1977 | * @param $extra_field |
1974 | 1978 | * @param bool $force |
1975 | 1979 | * @param bool $showdelete |
@@ -2074,7 +2078,7 @@ discard block |
||
2074 | 2078 | * @param int $fieldType Field's type |
2075 | 2079 | * @param string $displayText Field's language var name |
2076 | 2080 | * @param string $default Field's default value |
2077 | - * @return int |
|
2081 | + * @return boolean |
|
2078 | 2082 | */ |
2079 | 2083 | public static function create_extra_field($variable, $fieldType, $displayText, $default) |
2080 | 2084 | { |
@@ -2108,6 +2112,7 @@ discard block |
||
2108 | 2112 | * @param boolean Whether to prefix the fields indexes with "extra_" (might be used by formvalidator) |
2109 | 2113 | * @param boolean Whether to return invisible fields as well |
2110 | 2114 | * @param boolean Whether to split multiple-selection fields or not |
2115 | + * @param boolean $field_filter |
|
2111 | 2116 | * @return array Array of fields => value for the given user |
2112 | 2117 | */ |
2113 | 2118 | public static function get_extra_user_data( |
@@ -2350,6 +2355,7 @@ discard block |
||
2350 | 2355 | /** |
2351 | 2356 | * Get extra user data by field variable |
2352 | 2357 | * @param string field variable |
2358 | + * @param string $field_variable |
|
2353 | 2359 | * @return array data |
2354 | 2360 | */ |
2355 | 2361 | public static function get_extra_user_data_by_field_variable($field_variable) |
@@ -2899,7 +2905,7 @@ discard block |
||
2899 | 2905 | * @param string User ID |
2900 | 2906 | * @param string course directory |
2901 | 2907 | * @param string resourcetype: images, all |
2902 | - * @return int User ID (or false if not found) |
|
2908 | + * @return string User ID (or false if not found) |
|
2903 | 2909 | */ |
2904 | 2910 | public static function get_user_upload_files_by_course($user_id, $course, $resourcetype = 'all') |
2905 | 2911 | { |
@@ -2979,7 +2985,7 @@ discard block |
||
2979 | 2985 | /** |
2980 | 2986 | * Adds a new API key to the users' account |
2981 | 2987 | * @param int Optional user ID (defaults to the results of api_get_user_id()) |
2982 | - * @return boolean True on success, false on failure |
|
2988 | + * @return false|string True on success, false on failure |
|
2983 | 2989 | */ |
2984 | 2990 | public static function add_api_key($user_id = null, $api_service = 'dokeos') |
2985 | 2991 | { |
@@ -3034,6 +3040,7 @@ discard block |
||
3034 | 3040 | * Regenerate an API key from the user's account |
3035 | 3041 | * @param int user ID (defaults to the results of api_get_user_id()) |
3036 | 3042 | * @param string API key's internal ID |
3043 | + * @param string $api_service |
|
3037 | 3044 | * @return int num |
3038 | 3045 | */ |
3039 | 3046 | public static function update_api_key($user_id, $api_service) |
@@ -3063,6 +3070,7 @@ discard block |
||
3063 | 3070 | /** |
3064 | 3071 | * @param int user ID (defaults to the results of api_get_user_id()) |
3065 | 3072 | * @param string API key's internal ID |
3073 | + * @param string $api_service |
|
3066 | 3074 | * @return int row ID, or return false if not found |
3067 | 3075 | */ |
3068 | 3076 | public static function get_api_key_id($user_id, $api_service) |
@@ -3277,7 +3285,7 @@ discard block |
||
3277 | 3285 | * @param int $field_id |
3278 | 3286 | * @param bool $show_links show links or not |
3279 | 3287 | * |
3280 | - * @return array |
|
3288 | + * @return string |
|
3281 | 3289 | */ |
3282 | 3290 | public static function get_user_tags_to_string($user_id, $field_id, $show_links = true) |
3283 | 3291 | { |
@@ -3374,7 +3382,7 @@ discard block |
||
3374 | 3382 | * @param mixed $tag |
3375 | 3383 | * @param int $user_id |
3376 | 3384 | * @param int $field_id field id of the tag |
3377 | - * @return bool |
|
3385 | + * @return boolean|null |
|
3378 | 3386 | */ |
3379 | 3387 | public static function add_tag($tag, $user_id, $field_id) |
3380 | 3388 | { |
@@ -4190,7 +4198,7 @@ discard block |
||
4190 | 4198 | * Add subscribed users to a user by relation type |
4191 | 4199 | * @param int $userId The user id |
4192 | 4200 | * @param array $subscribedUsersId The id of suscribed users |
4193 | - * @param action $relationType The relation type |
|
4201 | + * @param integer $relationType The relation type |
|
4194 | 4202 | */ |
4195 | 4203 | public static function subscribeUsersToUser($userId, $subscribedUsersId, $relationType, $deleteUsersBeforeInsert = false) |
4196 | 4204 | { |
@@ -4255,6 +4263,8 @@ discard block |
||
4255 | 4263 | * This function check if an user is followed by human resources manager |
4256 | 4264 | * @param int User id |
4257 | 4265 | * @param int Human resources manager |
4266 | + * @param integer $user_id |
|
4267 | + * @param integer $hr_dept_id |
|
4258 | 4268 | * @return bool |
4259 | 4269 | */ |
4260 | 4270 | public static function is_user_followed_by_drh($user_id, $hr_dept_id) |
@@ -4327,6 +4337,8 @@ discard block |
||
4327 | 4337 | * Determines if a user is a gradebook certified |
4328 | 4338 | * @param int The category id of gradebook |
4329 | 4339 | * @param int The user id |
4340 | + * @param integer $cat_id |
|
4341 | + * @param integer $user_id |
|
4330 | 4342 | * @return boolean |
4331 | 4343 | */ |
4332 | 4344 | public static function is_user_certified($cat_id, $user_id) |
@@ -4349,6 +4361,8 @@ discard block |
||
4349 | 4361 | * Gets the info about a gradebook certificate for a user by course |
4350 | 4362 | * @param string The course code |
4351 | 4363 | * @param int The user id |
4364 | + * @param integer $course_code |
|
4365 | + * @param integer $user_id |
|
4352 | 4366 | * @return array if there is not information return false |
4353 | 4367 | */ |
4354 | 4368 | public static function get_info_gradebook_certificate($course_code, $user_id) |
@@ -4812,7 +4826,7 @@ discard block |
||
4812 | 4826 | } |
4813 | 4827 | |
4814 | 4828 | /** |
4815 | - * @return array |
|
4829 | + * @return string[] |
|
4816 | 4830 | */ |
4817 | 4831 | static function get_user_field_types() |
4818 | 4832 | { |
@@ -5105,7 +5119,7 @@ discard block |
||
5105 | 5119 | |
5106 | 5120 | /** |
5107 | 5121 | * Get the boss user ID from a followed user id |
5108 | - * @param $userId |
|
5122 | + * @param integer $userId |
|
5109 | 5123 | * @return bool |
5110 | 5124 | */ |
5111 | 5125 | public static function getStudentBossList($userId) |
@@ -5157,7 +5171,7 @@ discard block |
||
5157 | 5171 | * Get either a Gravatar URL or complete image tag for a specified email address. |
5158 | 5172 | * |
5159 | 5173 | * @param string $email The email address |
5160 | - * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ] |
|
5174 | + * @param integer $s Size in pixels, defaults to 80px [ 1 - 2048 ] |
|
5161 | 5175 | * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ] |
5162 | 5176 | * @param string $r Maximum rating (inclusive) [ g | pg | r | x ] |
5163 | 5177 | * @param boole $img True to return a complete IMG tag False for just the URL |
@@ -1267,13 +1267,13 @@ discard block |
||
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | /** |
1270 | - * Get the users by ID |
|
1271 | - * @param array $ids student ids |
|
1272 | - * @param string $active |
|
1273 | - * @param string $order |
|
1274 | - * @param string $limit |
|
1275 | - * @return array $result student information |
|
1276 | - */ |
|
1270 | + * Get the users by ID |
|
1271 | + * @param array $ids student ids |
|
1272 | + * @param string $active |
|
1273 | + * @param string $order |
|
1274 | + * @param string $limit |
|
1275 | + * @return array $result student information |
|
1276 | + */ |
|
1277 | 1277 | public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null) |
1278 | 1278 | { |
1279 | 1279 | if (empty($ids)) { |
@@ -2314,7 +2314,7 @@ discard block |
||
2314 | 2314 | * |
2315 | 2315 | * @return array with extra data info of a user i.e array('field_variable'=>'value'); |
2316 | 2316 | */ |
2317 | - public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true) |
|
2317 | + public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true) |
|
2318 | 2318 | { |
2319 | 2319 | $extraFieldValue = new ExtraFieldValue('user'); |
2320 | 2320 | $extraField = new ExtraField('user'); |
@@ -3409,12 +3409,12 @@ discard block |
||
3409 | 3409 | if ($tag_id == 0) { |
3410 | 3410 | //the tag doesn't exist |
3411 | 3411 | $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)"; |
3412 | - Database::query($sql); |
|
3412 | + Database::query($sql); |
|
3413 | 3413 | $last_insert_id = Database::insert_id(); |
3414 | 3414 | } else { |
3415 | 3415 | //the tag exists we update it |
3416 | 3416 | $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id = $tag_id"; |
3417 | - Database::query($sql); |
|
3417 | + Database::query($sql); |
|
3418 | 3418 | $last_insert_id = $tag_id; |
3419 | 3419 | } |
3420 | 3420 | |
@@ -3610,9 +3610,9 @@ discard block |
||
3610 | 3610 | } |
3611 | 3611 | |
3612 | 3612 | /** |
3613 | - * Get extra filtrable user fields (only type select) |
|
3614 | - * @return array |
|
3615 | - */ |
|
3613 | + * Get extra filtrable user fields (only type select) |
|
3614 | + * @return array |
|
3615 | + */ |
|
3616 | 3616 | public static function get_extra_filtrable_fields() |
3617 | 3617 | { |
3618 | 3618 | $extraFieldList = UserManager::get_extra_fields(); |
@@ -3637,9 +3637,9 @@ discard block |
||
3637 | 3637 | } |
3638 | 3638 | |
3639 | 3639 | /** |
3640 | - * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3641 | - * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3642 | - */ |
|
3640 | + * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3641 | + * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3642 | + */ |
|
3643 | 3643 | public static function get_search_form_where_extra_fields() |
3644 | 3644 | { |
3645 | 3645 | $useExtraFields = false; |
@@ -3958,23 +3958,23 @@ discard block |
||
3958 | 3958 | } |
3959 | 3959 | |
3960 | 3960 | /** |
3961 | - * Get users followed by human resource manager |
|
3962 | - * @param int $userId |
|
3963 | - * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3964 | - * @param bool $getOnlyUserId |
|
3965 | - * @param bool $getSql |
|
3966 | - * @param bool $getCount |
|
3967 | - * @param int $from |
|
3968 | - * @param int $numberItems |
|
3969 | - * @param int $column |
|
3970 | - * @param string $direction |
|
3971 | - * @param int $active |
|
3972 | - * @param string $lastConnectionDate |
|
3973 | - * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3974 | - * @param string $keyword |
|
3961 | + * Get users followed by human resource manager |
|
3962 | + * @param int $userId |
|
3963 | + * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3964 | + * @param bool $getOnlyUserId |
|
3965 | + * @param bool $getSql |
|
3966 | + * @param bool $getCount |
|
3967 | + * @param int $from |
|
3968 | + * @param int $numberItems |
|
3969 | + * @param int $column |
|
3970 | + * @param string $direction |
|
3971 | + * @param int $active |
|
3972 | + * @param string $lastConnectionDate |
|
3973 | + * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3974 | + * @param string $keyword |
|
3975 | 3975 | * |
3976 | - * @return array user list |
|
3977 | - */ |
|
3976 | + * @return array user list |
|
3977 | + */ |
|
3978 | 3978 | public static function getUsersFollowedByUser( |
3979 | 3979 | $userId, |
3980 | 3980 | $userStatus = null, |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | self::navigate($url); |
35 | 35 | } |
36 | 36 | |
37 | - $url = self::www() . $url; |
|
37 | + $url = self::www().$url; |
|
38 | 38 | self::navigate($url); |
39 | 39 | } |
40 | 40 | |
@@ -67,25 +67,25 @@ discard block |
||
67 | 67 | case COURSEMANAGER: |
68 | 68 | $redir = api_get_setting('teacher_page_after_login'); |
69 | 69 | if (!empty($redir)) { |
70 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
70 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
71 | 71 | } |
72 | 72 | break; |
73 | 73 | case STUDENT: |
74 | 74 | $redir = api_get_setting('student_page_after_login'); |
75 | 75 | if (!empty($redir)) { |
76 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
76 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
77 | 77 | } |
78 | 78 | break; |
79 | 79 | case DRH: |
80 | 80 | $redir = api_get_setting('drh_page_after_login'); |
81 | 81 | if (!empty($redir)) { |
82 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
82 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
83 | 83 | } |
84 | 84 | break; |
85 | 85 | case SESSIONADMIN: |
86 | 86 | $redir = api_get_setting('sessionadmin_page_after_login'); |
87 | 87 | if (!empty($redir)) { |
88 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
88 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
89 | 89 | } |
90 | 90 | break; |
91 | 91 | default: |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | $page_after_login = api_get_setting('page_after_login'); |
113 | 113 | if (!empty($page_after_login)) { |
114 | - self::navigate(api_get_path(WEB_PATH) . $page_after_login); |
|
114 | + self::navigate(api_get_path(WEB_PATH).$page_after_login); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | $c_id = $c_id ? intval($c_id) : api_get_course_int_id(); |
59 | - $table = Database::get_course_table(TABLE_TOOL_LIST); |
|
59 | + $table = Database::get_course_table(TABLE_TOOL_LIST); |
|
60 | 60 | $sql = "SELECT * from $table |
61 | 61 | WHERE c_id = $c_id and name='$name' |
62 | 62 | LIMIT 1"; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $clean_gradebook = array(); |
114 | 114 | |
115 | 115 | if (!empty($skill_gradebooks_source)) { |
116 | - foreach($skill_gradebooks_source as $source) { |
|
116 | + foreach ($skill_gradebooks_source as $source) { |
|
117 | 117 | $clean_gradebook[] = $source['skill_id']; |
118 | 118 | } |
119 | 119 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $selected_skills = self::get_skills_by_gradebook($gradebook_id); |
193 | 193 | $clean_selected_skills = array(); |
194 | 194 | if (!empty($selected_skills)) { |
195 | - foreach($selected_skills as $skill) { |
|
195 | + foreach ($selected_skills as $skill) { |
|
196 | 196 | $clean_selected_skills[] = $skill['id']; |
197 | 197 | } |
198 | 198 | } |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public static function getUTCDateTimeTypeClass() |
117 | 117 | { |
118 | - return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : |
|
119 | - 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
118 | + return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
120 | 119 | } |
121 | 120 | |
122 | 121 | /** |
@@ -393,7 +392,7 @@ discard block |
||
393 | 392 | |
394 | 393 | if (!empty($params)) { |
395 | 394 | $sql = 'INSERT INTO '.$table_name.' ('.implode(',', $params).') |
396 | - VALUES (:'.implode(', :' ,$params).')'; |
|
395 | + VALUES (:'.implode(', :', $params).')'; |
|
397 | 396 | |
398 | 397 | $statement = self::getManager()->getConnection()->prepare($sql); |
399 | 398 | $result = $statement->execute($attributes); |
@@ -434,7 +433,7 @@ discard block |
||
434 | 433 | foreach ($attributes as $key => $value) { |
435 | 434 | $update_sql .= "$key = :$key "; |
436 | 435 | if ($count < count($attributes)) { |
437 | - $update_sql.=', '; |
|
436 | + $update_sql .= ', '; |
|
438 | 437 | } |
439 | 438 | $count++; |
440 | 439 | } |
@@ -481,7 +480,7 @@ discard block |
||
481 | 480 | if ($columns == '*') { |
482 | 481 | $clean_columns = '*'; |
483 | 482 | } else { |
484 | - $clean_columns = (string)$columns; |
|
483 | + $clean_columns = (string) $columns; |
|
485 | 484 | } |
486 | 485 | } |
487 | 486 | |
@@ -527,9 +526,9 @@ discard block |
||
527 | 526 | foreach ($condition_data as $condition => $value_array) { |
528 | 527 | if (is_array($value_array)) { |
529 | 528 | $clean_values = array(); |
530 | - foreach($value_array as $item) { |
|
529 | + foreach ($value_array as $item) { |
|
531 | 530 | $item = Database::escape_string($item); |
532 | - $clean_values[]= $item; |
|
531 | + $clean_values[] = $item; |
|
533 | 532 | } |
534 | 533 | } else { |
535 | 534 | $value_array = Database::escape_string($value_array); |
@@ -537,23 +536,23 @@ discard block |
||
537 | 536 | } |
538 | 537 | |
539 | 538 | if (!empty($condition) && $clean_values != '') { |
540 | - $condition = str_replace('%',"'@percentage@'", $condition); //replace "%" |
|
541 | - $condition = str_replace("'?'","%s", $condition); |
|
542 | - $condition = str_replace("?","%s", $condition); |
|
539 | + $condition = str_replace('%', "'@percentage@'", $condition); //replace "%" |
|
540 | + $condition = str_replace("'?'", "%s", $condition); |
|
541 | + $condition = str_replace("?", "%s", $condition); |
|
543 | 542 | |
544 | - $condition = str_replace("@%s@","@-@", $condition); |
|
545 | - $condition = str_replace("%s","'%s'", $condition); |
|
546 | - $condition = str_replace("@-@","@%s@", $condition); |
|
543 | + $condition = str_replace("@%s@", "@-@", $condition); |
|
544 | + $condition = str_replace("%s", "'%s'", $condition); |
|
545 | + $condition = str_replace("@-@", "@%s@", $condition); |
|
547 | 546 | |
548 | 547 | // Treat conditions as string |
549 | 548 | $condition = vsprintf($condition, $clean_values); |
550 | - $condition = str_replace('@percentage@','%', $condition); //replace "%" |
|
549 | + $condition = str_replace('@percentage@', '%', $condition); //replace "%" |
|
551 | 550 | $where_return .= $condition; |
552 | 551 | } |
553 | 552 | } |
554 | 553 | |
555 | 554 | if (!empty($where_return)) { |
556 | - $return_value = " WHERE $where_return" ; |
|
555 | + $return_value = " WHERE $where_return"; |
|
557 | 556 | } |
558 | 557 | break; |
559 | 558 | case 'order': |
@@ -565,7 +564,7 @@ discard block |
||
565 | 564 | $new_order_array = explode(',', $order_array); |
566 | 565 | $temp_value = array(); |
567 | 566 | |
568 | - foreach($new_order_array as $element) { |
|
567 | + foreach ($new_order_array as $element) { |
|
569 | 568 | $element = explode(' ', $element); |
570 | 569 | $element = array_filter($element); |
571 | 570 | $element = array_values($element); |
@@ -576,10 +575,10 @@ discard block |
||
576 | 575 | if (in_array($element[1], array('desc', 'asc'))) { |
577 | 576 | $order = $element[1]; |
578 | 577 | } |
579 | - $temp_value[]= $element[0].' '.$order.' '; |
|
578 | + $temp_value[] = $element[0].' '.$order.' '; |
|
580 | 579 | } else { |
581 | 580 | //by default DESC |
582 | - $temp_value[]= $element[0].' DESC '; |
|
581 | + $temp_value[] = $element[0].' DESC '; |
|
583 | 582 | } |
584 | 583 | } |
585 | 584 | if (!empty($temp_value)) { |
@@ -594,7 +593,7 @@ discard block |
||
594 | 593 | if (!empty($limit_array)) { |
595 | 594 | if (count($limit_array) > 1) { |
596 | 595 | $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]); |
597 | - } else { |
|
596 | + } else { |
|
598 | 597 | $return_value .= ' LIMIT '.intval($limit_array[0]); |
599 | 598 | } |
600 | 599 | } |
@@ -594,7 +594,7 @@ |
||
594 | 594 | if (!empty($limit_array)) { |
595 | 595 | if (count($limit_array) > 1) { |
596 | 596 | $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]); |
597 | - } else { |
|
597 | + } else { |
|
598 | 598 | $return_value .= ' LIMIT '.intval($limit_array[0]); |
599 | 599 | } |
600 | 600 | } |
@@ -720,11 +720,11 @@ discard block |
||
720 | 720 | return false; |
721 | 721 | } |
722 | 722 | |
723 | - /** |
|
724 | - * @param int $itemId |
|
725 | - * @param int $fieldId |
|
726 | - * @return array |
|
727 | - */ |
|
723 | + /** |
|
724 | + * @param int $itemId |
|
725 | + * @param int $fieldId |
|
726 | + * @return array |
|
727 | + */ |
|
728 | 728 | public function getAllValuesByItemAndField($itemId, $fieldId) |
729 | 729 | { |
730 | 730 | $fieldId = intval($fieldId); |
@@ -847,7 +847,6 @@ discard block |
||
847 | 847 | /** |
848 | 848 | * Deletes all values from an item |
849 | 849 | * @param int $itemId (session id, course id, etc) |
850 | - |
|
851 | 850 | * @assert (-1,-1) == null |
852 | 851 | */ |
853 | 852 | public function deleteValuesByItem($itemId) |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | break; |
210 | 210 | } |
211 | 211 | |
212 | - $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE . "_{$params['item_id']}.png"; |
|
212 | + $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE."_{$params['item_id']}.png"; |
|
213 | 213 | |
214 | 214 | if (!file_exists($fileDir)) { |
215 | 215 | mkdir($fileDir, $dirPermissions, true); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | |
218 | 218 | if ($value['error'] == 0) { |
219 | 219 | $imageExtraField = new Image($value['tmp_name']); |
220 | - $imageExtraField->send_image($fileDir . $fileName, -1, 'png'); |
|
220 | + $imageExtraField->send_image($fileDir.$fileName, -1, 'png'); |
|
221 | 221 | $newParams = array( |
222 | 222 | 'item_id' => $params['item_id'], |
223 | 223 | 'field_id' => $extraFieldInfo['id'], |
224 | - 'value' => $fileDirStored . $fileName, |
|
224 | + 'value' => $fileDirStored.$fileName, |
|
225 | 225 | 'comment' => $comment |
226 | 226 | ); |
227 | 227 | |
@@ -247,18 +247,18 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | $cleanedName = api_replace_dangerous_char($value['name']); |
250 | - $fileName = ExtraField::FIELD_TYPE_FILE . "_{$params['item_id']}_$cleanedName"; |
|
250 | + $fileName = ExtraField::FIELD_TYPE_FILE."_{$params['item_id']}_$cleanedName"; |
|
251 | 251 | if (!file_exists($fileDir)) { |
252 | 252 | mkdir($fileDir, $dirPermissions, true); |
253 | 253 | } |
254 | 254 | |
255 | 255 | if ($value['error'] == 0) { |
256 | - moveUploadedFile($value, $fileDir . $fileName); |
|
256 | + moveUploadedFile($value, $fileDir.$fileName); |
|
257 | 257 | |
258 | 258 | $new_params = array( |
259 | 259 | 'item_id' => $params['item_id'], |
260 | 260 | 'field_id' => $extraFieldInfo['id'], |
261 | - 'value' => $fileDirStored . $fileName |
|
261 | + 'value' => $fileDirStored.$fileName |
|
262 | 262 | ); |
263 | 263 | |
264 | 264 | if ($this->type !== 'session' && $this->type !== 'course') { |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | if (false) { |
382 | 382 | global $app; |
383 | - switch($this->type) { |
|
383 | + switch ($this->type) { |
|
384 | 384 | case 'question': |
385 | 385 | $extraFieldValue = new ChamiloLMS\Entity\QuestionFieldValues(); |
386 | 386 | $extraFieldValue->setUserId(api_get_user_id()); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | if (false) { |
444 | 444 | global $app; |
445 | - switch($this->type) { |
|
445 | + switch ($this->type) { |
|
446 | 446 | case 'question': |
447 | 447 | $extraFieldValue = $app['orm.ems']['db_write']->getRepository('ChamiloLMS\Entity\QuestionFieldValues')->find($field_values['id']); |
448 | 448 | $extraFieldValue->setUserId(api_get_user_id()); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * This function is used with $extraField->addElements() |
74 | 74 | * @param array $params array for the insertion into the *_field_values table |
75 | 75 | * |
76 | - * @return mixed false on empty params, void otherwise |
|
76 | + * @return false|null false on empty params, void otherwise |
|
77 | 77 | * @assert (array()) === false |
78 | 78 | */ |
79 | 79 | public function saveFieldValues($params) |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * @param int $item_id Item ID (It could be a session_id, course_id or user_id) |
531 | 531 | * @param int $field_id Field ID (the ID from the *_field table) |
532 | 532 | * @param bool $transform Whether to transform the result to a human readable strings |
533 | - * @return mixed A structured array with the field_id and field_value, or false on error |
|
533 | + * @return string A structured array with the field_id and field_value, or false on error |
|
534 | 534 | * @assert (-1,-1) === false |
535 | 535 | */ |
536 | 536 | public function get_values_by_handler_and_field_id($item_id, $field_id, $transform = false) |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * @param int $item_id Item ID from the original table |
624 | 624 | * @param string $field_variable The name of the field we are looking for |
625 | 625 | * @param bool $transform |
626 | - * @param bool $allVisibility |
|
626 | + * @param bool $visibility |
|
627 | 627 | * |
628 | 628 | * @return mixed Array of results, or false on error or not found |
629 | 629 | * @assert (-1,'') === false |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | foreach ($data as $row) { |
101 | 101 | $string = implode("</td><td>", $row); |
102 | - $string = '<tr><td>' . $string . '</td></tr>'; |
|
102 | + $string = '<tr><td>'.$string.'</td></tr>'; |
|
103 | 103 | if ($encoding != 'utf-8') { |
104 | 104 | $string = api_convert_encoding($string, $encoding, $systemEncoding); |
105 | 105 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | fwrite($handle, '<'.$wrapper_tagname.'>'); |
174 | 174 | } |
175 | 175 | $s = self::_export_complex_table_xml_helper($data); |
176 | - fwrite($handle,$s); |
|
176 | + fwrite($handle, $s); |
|
177 | 177 | if (!is_null($wrapper_tagname)) { |
178 | 178 | fwrite($handle, '</'.$wrapper_tagname.'>'."\n"); |
179 | 179 | } |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | } |
196 | 196 | $string = ''; |
197 | 197 | foreach ($data as $row) { |
198 | - $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
|
198 | + $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>'; |
|
199 | 199 | if (is_array($row['value'])) { |
200 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
201 | - $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
|
200 | + $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n"; |
|
201 | + $string .= str_repeat("\t", $level).'</'.$row['name'].'>'; |
|
202 | 202 | } else { |
203 | 203 | $string .= $row['value']; |
204 | 204 | $string .= '</'.$row['name'].'>'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param array $data |
39 | 39 | * @param string $filename |
40 | 40 | * |
41 | - * @return mixed csv file | false if no data to export |
|
41 | + * @return false|null csv file | false if no data to export |
|
42 | 42 | */ |
43 | 43 | public static function arrayToCsv($data, $filename = 'export') |
44 | 44 | { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string Name of common tag to place each line in |
161 | 161 | * @param string Name of the root element. A root element should always be given. |
162 | 162 | * @param string Encoding in which the data is provided |
163 | - * @return void Prompts the user for a file download |
|
163 | + * @return boolean Prompts the user for a file download |
|
164 | 164 | */ |
165 | 165 | public static function export_complex_table_xml( |
166 | 166 | $data, |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @param string $name |
287 | 287 | * @param string $format |
288 | 288 | * |
289 | - * @return bool |
|
289 | + * @return false|null |
|
290 | 290 | */ |
291 | 291 | public static function htmlToOdt($html, $name, $format = 'odt') |
292 | 292 | { |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Export tabular data to XML-file |
|
119 | - * @param array Simple array of data to put in XML |
|
120 | - * @param string Name of file to be given to the user |
|
121 | - * @param string Name of common tag to place each line in |
|
122 | - * @param string Name of the root element. A root element should always be given. |
|
123 | - * @param string Encoding in which the data is provided |
|
124 | - */ |
|
118 | + * Export tabular data to XML-file |
|
119 | + * @param array Simple array of data to put in XML |
|
120 | + * @param string Name of file to be given to the user |
|
121 | + * @param string Name of common tag to place each line in |
|
122 | + * @param string Name of the root element. A root element should always be given. |
|
123 | + * @param string Encoding in which the data is provided |
|
124 | + */ |
|
125 | 125 | public static function arrayToXml( |
126 | 126 | $data, |
127 | 127 | $filename = 'export', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($data as $row) { |
201 | 201 | $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
202 | 202 | if (is_array($row['value'])) { |
203 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
203 | + $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
204 | 204 | $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
205 | 205 | } else { |
206 | 206 | $string .= $row['value']; |