@@ -95,30 +95,43 @@ |
||
95 | 95 | * */ |
96 | 96 | function external_add_user($u) { |
97 | 97 | //Setting default |
98 | - if (empty($u['password'])) |
|
99 | - $u['password'] = null; |
|
100 | - if (empty($u['status'])) |
|
101 | - $u['status'] = 5; |
|
102 | - if (!isset($u['official_code'])) |
|
103 | - $u['official_code'] = ''; |
|
104 | - if (!isset($u['language'])) |
|
105 | - $u['language'] = ''; |
|
106 | - if (!isset($u['phone'])) |
|
107 | - $u['phone'] = ''; |
|
108 | - if (!isset($u['picture_uri'])) |
|
109 | - $u['picture_uri'] = ''; |
|
110 | - if (!isset($u['auth_source'])) |
|
111 | - $u['auth_source'] = PLATFORM_AUTH_SOURCE; |
|
112 | - if (!isset($u['expiration_date'])) |
|
113 | - $u['expiration_date'] = ''; |
|
114 | - if (!isset($u['active'])) |
|
115 | - $u['active'] = 1; |
|
116 | - if (!isset($u['hr_dept_id'])) |
|
117 | - $u['hr_dept_id'] = 0; //id of responsible HR |
|
118 | - if (!isset($u['extra'])) |
|
119 | - $u['extra'] = null; |
|
120 | - if (!isset($u['encrypt_method'])) |
|
121 | - $u['encrypt_method'] = ''; |
|
98 | + if (empty($u['password'])) { |
|
99 | + $u['password'] = null; |
|
100 | + } |
|
101 | + if (empty($u['status'])) { |
|
102 | + $u['status'] = 5; |
|
103 | + } |
|
104 | + if (!isset($u['official_code'])) { |
|
105 | + $u['official_code'] = ''; |
|
106 | + } |
|
107 | + if (!isset($u['language'])) { |
|
108 | + $u['language'] = ''; |
|
109 | + } |
|
110 | + if (!isset($u['phone'])) { |
|
111 | + $u['phone'] = ''; |
|
112 | + } |
|
113 | + if (!isset($u['picture_uri'])) { |
|
114 | + $u['picture_uri'] = ''; |
|
115 | + } |
|
116 | + if (!isset($u['auth_source'])) { |
|
117 | + $u['auth_source'] = PLATFORM_AUTH_SOURCE; |
|
118 | + } |
|
119 | + if (!isset($u['expiration_date'])) { |
|
120 | + $u['expiration_date'] = ''; |
|
121 | + } |
|
122 | + if (!isset($u['active'])) { |
|
123 | + $u['active'] = 1; |
|
124 | + } |
|
125 | + if (!isset($u['hr_dept_id'])) { |
|
126 | + $u['hr_dept_id'] = 0; |
|
127 | + } |
|
128 | + //id of responsible HR |
|
129 | + if (!isset($u['extra'])) { |
|
130 | + $u['extra'] = null; |
|
131 | + } |
|
132 | + if (!isset($u['encrypt_method'])) { |
|
133 | + $u['encrypt_method'] = ''; |
|
134 | + } |
|
122 | 135 | |
123 | 136 | $chamilo_uid = UserManager::create_user($u['firstname'], $u['lastname'], $u['status'], $u['email'], $u['username'], $u['password'], $u['official_code'], $u['language'], $u['phone'], $u['picture_uri'], $u['auth_source'], $u['expiration_date'], $u['active'], $u['hr_dept_id'], $u['extra'], $u['encrypt_method']); |
124 | 137 | return $chamilo_uid; |
@@ -65,8 +65,7 @@ |
||
65 | 65 | if (strpos($filename, "svg")){ |
66 | 66 | $new_sizes['width'] = 60; |
67 | 67 | $new_sizes['height'] = 60; |
68 | - } |
|
69 | - else { |
|
68 | + } else { |
|
70 | 69 | $new_sizes = api_resize_image($image, 60, 60); |
71 | 70 | } |
72 | 71 |
@@ -1701,7 +1701,9 @@ discard block |
||
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | global $_course; |
1704 | - if ($_course == '-1') $_course = array(); |
|
1704 | + if ($_course == '-1') { |
|
1705 | + $_course = array(); |
|
1706 | + } |
|
1705 | 1707 | return $_course; |
1706 | 1708 | } |
1707 | 1709 | |
@@ -4154,18 +4156,21 @@ discard block |
||
4154 | 4156 | switch ($lang_type) { |
4155 | 4157 | case 'platform_lang': |
4156 | 4158 | $temp_lang = api_get_setting('platformLanguage'); |
4157 | - if (!empty($temp_lang)) |
|
4158 | - $return = $temp_lang; |
|
4159 | + if (!empty($temp_lang)) { |
|
4160 | + $return = $temp_lang; |
|
4161 | + } |
|
4159 | 4162 | break; |
4160 | 4163 | case 'user_profil_lang': |
4161 | 4164 | $_user = api_get_user_info(); |
4162 | 4165 | |
4163 | - if (isset($_user['language']) && !empty($_user['language'])) |
|
4164 | - $return = $_user['language']; |
|
4166 | + if (isset($_user['language']) && !empty($_user['language'])) { |
|
4167 | + $return = $_user['language']; |
|
4168 | + } |
|
4165 | 4169 | break; |
4166 | 4170 | case 'user_selected_lang': |
4167 | - if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) |
|
4168 | - $return = $_SESSION['user_language_choice']; |
|
4171 | + if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) { |
|
4172 | + $return = $_SESSION['user_language_choice']; |
|
4173 | + } |
|
4169 | 4174 | break; |
4170 | 4175 | case 'course_lang': |
4171 | 4176 | global $_course; |
@@ -5434,8 +5439,7 @@ discard block |
||
5434 | 5439 | $is_courseAdmin = false; |
5435 | 5440 | $is_courseCoach = true; |
5436 | 5441 | $is_sessionAdmin = false; |
5437 | - } |
|
5438 | - elseif ($row[0]['session_admin_id'] == $userid) { |
|
5442 | + } elseif ($row[0]['session_admin_id'] == $userid) { |
|
5439 | 5443 | $is_courseMember = false; |
5440 | 5444 | $is_courseTutor = false; |
5441 | 5445 | $is_courseAdmin = false; |
@@ -5778,8 +5782,7 @@ discard block |
||
5778 | 5782 | elseif (isset($_ENV['OS'])) { |
5779 | 5783 | // Sometimes $_ENV['OS'] may not be present (bugs?) |
5780 | 5784 | $os = $_ENV['OS']; |
5781 | - } |
|
5782 | - elseif (defined('PHP_OS')) { |
|
5785 | + } elseif (defined('PHP_OS')) { |
|
5783 | 5786 | // PHP_OS means on which OS PHP was compiled, this is why |
5784 | 5787 | // using PHP_OS is the last choice for detection. |
5785 | 5788 | $os = PHP_OS; |
@@ -5843,12 +5846,10 @@ discard block |
||
5843 | 5846 | if ($delta_width > $delta_height) { |
5844 | 5847 | $result['width'] = ceil($image_width * $resize_factor_height); |
5845 | 5848 | $result['height'] = ceil($image_height * $resize_factor_height); |
5846 | - } |
|
5847 | - elseif ($delta_width < $delta_height) { |
|
5849 | + } elseif ($delta_width < $delta_height) { |
|
5848 | 5850 | $result['width'] = ceil($image_width * $resize_factor_width); |
5849 | 5851 | $result['height'] = ceil($image_height * $resize_factor_width); |
5850 | - } |
|
5851 | - else { |
|
5852 | + } else { |
|
5852 | 5853 | $result['width'] = ceil($target_width); |
5853 | 5854 | $result['height'] = ceil($target_height); |
5854 | 5855 | } |
@@ -6629,7 +6630,9 @@ discard block |
||
6629 | 6630 | } |
6630 | 6631 | $ip = trim($ip1); |
6631 | 6632 | } |
6632 | - if (!empty($debug)) error_log('Real IP: '.$ip); |
|
6633 | + if (!empty($debug)) { |
|
6634 | + error_log('Real IP: '.$ip); |
|
6635 | + } |
|
6633 | 6636 | return $ip; |
6634 | 6637 | } |
6635 | 6638 |
@@ -1644,11 +1644,11 @@ discard block |
||
1644 | 1644 | |
1645 | 1645 | if ($size == IMAGE_WALL_SMALL) { |
1646 | 1646 | $name = IMAGE_WALL_SMALL. '_' . $array[2]; |
1647 | - }else if($size == IMAGE_WALL_MEDIUM){ |
|
1647 | + } else if($size == IMAGE_WALL_MEDIUM){ |
|
1648 | 1648 | $name = IMAGE_WALL_MEDIUM. '_' . $array[2]; |
1649 | - }else if($size == IMAGE_WALL_BIG){ |
|
1649 | + } else if($size == IMAGE_WALL_BIG){ |
|
1650 | 1650 | $name = IMAGE_WALL_BIG. '_' . $array[2]; |
1651 | - }else { |
|
1651 | + } else { |
|
1652 | 1652 | $name = IMAGE_WALL_SMALL. '_' . $array[2]; |
1653 | 1653 | } |
1654 | 1654 | $lessImage = str_replace($array[2], '', $path); |
@@ -1772,7 +1772,9 @@ discard block |
||
1772 | 1772 | $friendHtml.= '<ul class="nav nav-list">'; |
1773 | 1773 | $j = 1; |
1774 | 1774 | for ($k=0; $k < $number_friends; $k++) { |
1775 | - if ($j > $number_of_images) break; |
|
1775 | + if ($j > $number_of_images) { |
|
1776 | + break; |
|
1777 | + } |
|
1776 | 1778 | |
1777 | 1779 | if (isset($friends[$k])) { |
1778 | 1780 | $friend = $friends[$k]; |
@@ -289,8 +289,9 @@ |
||
289 | 289 | |
290 | 290 | if ($start_date != '' || $end_date != '') { |
291 | 291 | $sql .= " HAVING "; |
292 | - if ($start_date != '') |
|
293 | - $sql .= " access_date >= '$start_date' "; |
|
292 | + if ($start_date != '') { |
|
293 | + $sql .= " access_date >= '$start_date' "; |
|
294 | + } |
|
294 | 295 | if ($end_date != '') { |
295 | 296 | $sql = ($start_date == '') ? $sql : ($sql . " AND "); |
296 | 297 | $sql .= " access_date <= '$end_date' "; |
@@ -527,14 +527,15 @@ |
||
527 | 527 | // Mark folders to import which are not selected by the user to import, |
528 | 528 | // but in which a document was selected. |
529 | 529 | $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
530 | - if (!empty($resources) && is_array($resources)) |
|
531 | - foreach ($resources as $id => $obj) { |
|
530 | + if (!empty($resources) && is_array($resources)) { |
|
531 | + foreach ($resources as $id => $obj) { |
|
532 | 532 | if (isset($obj->file_type) && $obj->file_type == 'folder' && |
533 | 533 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
534 | 534 | is_array($documents) |
535 | 535 | ) { |
536 | 536 | foreach ($documents as $id_to_check => $post_value) { |
537 | 537 | $obj_to_check = $resources[$id_to_check]; |
538 | + } |
|
538 | 539 | $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
539 | 540 | if ($id_to_check != $id && $obj->path == $shared_path_part) { |
540 | 541 | $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
@@ -1143,10 +1143,11 @@ |
||
1143 | 1143 | $result_last_attempt = Database::query($sql); |
1144 | 1144 | if (Database :: num_rows($result_last_attempt) > 0) { |
1145 | 1145 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
1146 | - if ($count_attempts > 0) |
|
1147 | - echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1146 | + if ($count_attempts > 0) { |
|
1147 | + echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1148 | 1148 | '.Display::return_icon('quiz.gif').' |
1149 | 1149 | </a>'; |
1150 | + } |
|
1150 | 1151 | } |
1151 | 1152 | echo '</td>'; |
1152 | 1153 |
@@ -250,8 +250,7 @@ |
||
250 | 250 | case RESULT_DISABLE_SHOW_SCORE_ONLY: |
251 | 251 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) { |
252 | 252 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')); |
253 | - } |
|
254 | - else { |
|
253 | + } else { |
|
255 | 254 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details')); |
256 | 255 | } |
257 | 256 | break; |
@@ -362,9 +362,10 @@ |
||
362 | 362 | |
363 | 363 | if ($inATest) { |
364 | 364 | echo '<div class="actions">'; |
365 | - if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) |
|
366 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'. |
|
365 | + if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) { |
|
366 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'. |
|
367 | 367 | Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
368 | + } |
|
368 | 369 | |
369 | 370 | if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { |
370 | 371 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'">'. |