@@ -229,31 +229,31 @@ discard block |
||
229 | 229 | <td align="center"> |
230 | 230 | <div id="content_source"> |
231 | 231 | <?php |
232 | - if (!($add_type=='multiple')) { |
|
232 | + if (!($add_type=='multiple')) { |
|
233 | 233 | ?> |
234 | 234 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
235 | 235 | <div id="ajax_list_users_single"></div> |
236 | 236 | <?php |
237 | - } else { |
|
238 | - ?> |
|
237 | + } else { |
|
238 | + ?> |
|
239 | 239 | <div id="ajax_list_multiple"> |
240 | 240 | <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?> |
241 | 241 | </div> |
242 | 242 | <?php |
243 | - } |
|
244 | - ?> |
|
243 | + } |
|
244 | + ?> |
|
245 | 245 | </div> |
246 | 246 | </td> |
247 | 247 | <td width="10%" valign="middle" align="center"> |
248 | 248 | <?php |
249 | - if ($ajax_search) { |
|
250 | - ?> |
|
249 | + if ($ajax_search) { |
|
250 | + ?> |
|
251 | 251 | <button class="btn bt-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" > |
252 | 252 | <em class="fa fa-arrow-left"></em> |
253 | 253 | </button> |
254 | 254 | <?php |
255 | - } else { |
|
256 | - ?> |
|
255 | + } else { |
|
256 | + ?> |
|
257 | 257 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))"> |
258 | 258 | <em class="fa fa-arrow-right"></em> |
259 | 259 | </button> |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | <em class="fa fa-arrow-left"></em> |
263 | 263 | </button> |
264 | 264 | <?php |
265 | - } |
|
266 | - ?> |
|
265 | + } |
|
266 | + ?> |
|
267 | 267 | <br /><br /><br /><br /><br /><br /> |
268 | 268 | </td> |
269 | 269 | <td align="center"> |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $courses = $course_list; |
47 | 47 | } |
48 | 48 | |
49 | - if (!empty($courses)) { |
|
49 | + if (!empty($courses)) { |
|
50 | 50 | |
51 | 51 | $archiveFile = 'export_courses_list_'.api_get_local_time(); |
52 | 52 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | Export::arrayToXls($listToExport, $archiveFile); |
99 | 99 | break; |
100 | 100 | } |
101 | - } else { |
|
101 | + } else { |
|
102 | 102 | Display::addFlash( |
103 | 103 | Display::return_message( |
104 | 104 | get_lang('ThereAreNotSelectedCoursesOrCoursesListIsEmpty') |
105 | 105 | ) |
106 | 106 | ); |
107 | - } |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -114,29 +114,29 @@ discard block |
||
114 | 114 | $form->addHeader($tool_name); |
115 | 115 | $form->addHidden('formSent', 1); |
116 | 116 | $form->addElement( |
117 | - 'radio', |
|
118 | - 'select_type', |
|
119 | - get_lang('Option'), |
|
120 | - get_lang('ExportAllCoursesList'), |
|
121 | - '1', |
|
122 | - ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"] |
|
117 | + 'radio', |
|
118 | + 'select_type', |
|
119 | + get_lang('Option'), |
|
120 | + get_lang('ExportAllCoursesList'), |
|
121 | + '1', |
|
122 | + ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"] |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | $form->addElement( |
126 | - 'radio', |
|
127 | - 'select_type', |
|
128 | - '', |
|
129 | - get_lang('ExportSelectedCoursesFromCoursesList'), |
|
130 | - '2', |
|
131 | - ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"] |
|
126 | + 'radio', |
|
127 | + 'select_type', |
|
128 | + '', |
|
129 | + get_lang('ExportSelectedCoursesFromCoursesList'), |
|
130 | + '2', |
|
131 | + ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"] |
|
132 | 132 | ); |
133 | 133 | |
134 | 134 | if (!empty($course_list)) { |
135 | - $form->addHtml('<div id="div-course-list" style="display:none">'); |
|
136 | - $coursesInList = []; |
|
137 | - foreach ($course_list as $course) { |
|
138 | - $coursesInList[$course['code']] = $course['title'].' ('.$course['code'].')'; |
|
139 | - } |
|
135 | + $form->addHtml('<div id="div-course-list" style="display:none">'); |
|
136 | + $coursesInList = []; |
|
137 | + foreach ($course_list as $course) { |
|
138 | + $coursesInList[$course['code']] = $course['title'].' ('.$course['code'].')'; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | $form->addSelect( |
142 | 142 | 'course_code', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ['multiple' => 'multiple'] |
146 | 146 | ); |
147 | 147 | |
148 | - $form->addHtml('</div>'); |
|
148 | + $form->addHtml('</div>'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV' , 'csv', null); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Skill list for management |
|
5 | - * @author Angel Fernando Quiroz Campos <[email protected]> |
|
6 | - * @package chamilo.admin |
|
7 | - */ |
|
4 | + * Skill list for management |
|
5 | + * @author Angel Fernando Quiroz Campos <[email protected]> |
|
6 | + * @package chamilo.admin |
|
7 | + */ |
|
8 | 8 | use ChamiloSession as Session; |
9 | 9 | |
10 | 10 | $cidReset = true; |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | * @package chamilo.admin.cli |
8 | 8 | */ |
9 | 9 | /** |
10 | - * Init section |
|
11 | - */ |
|
10 | + * Init section |
|
11 | + */ |
|
12 | 12 | // we are in the admin area so we do not need a course id |
13 | 13 | $cidReset = true; |
14 | 14 | // include global script |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | // make sure only logged-in admins can execute this |
18 | 18 | api_protect_admin_script(); |
19 | 19 | /** |
20 | - * Main code |
|
21 | - */ |
|
20 | + * Main code |
|
21 | + */ |
|
22 | 22 | // setting the name of the tool |
23 | 23 | $tool_name = get_lang('CommandLineInterpreter'); |
24 | 24 | // setting breadcrumbs |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | switch ($_GET["cmd"]) { |
29 | 29 | case "clear_stapi": |
30 | 30 | echo "Are you sure you are willing to erease all storage api data (no backup)? <a href='cli.php?cmd=clear_stapi_confirm' >Yes</a>"; |
31 | - break; |
|
31 | + break; |
|
32 | 32 | case "clear_stapi_confirm": |
33 | 33 | Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)); |
34 | - Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)); |
|
35 | - echo "Done"; |
|
36 | - break; |
|
34 | + Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)); |
|
35 | + echo "Done"; |
|
36 | + break; |
|
37 | 37 | default: |
38 | 38 | echo "UNKNOWN COMMAND"; |
39 | - break; |
|
39 | + break; |
|
40 | 40 | } |
41 | 41 | /** |
42 | - * Footer |
|
43 | - */ |
|
42 | + * Footer |
|
43 | + */ |
|
44 | 44 | Display :: display_footer(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $add_type = 'multiple'; |
56 | 56 | if (isset($_GET['add_type']) && $_GET['add_type']!='') { |
57 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
57 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!api_is_platform_admin()) { |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | "; |
121 | 121 | } |
122 | 122 | |
123 | - $rs = Database::query($sql); |
|
124 | - $xajax_response->addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
123 | + $rs = Database::query($sql); |
|
124 | + $xajax_response->addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
125 | 125 | |
126 | 126 | if ($type == 'single') { |
127 | 127 | $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $return .= '...<br />'; |
161 | 161 | } |
162 | 162 | } |
163 | - $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
163 | + $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
164 | 164 | } else { |
165 | 165 | $return .= '<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15" ">'; |
166 | 166 | while($user = Database :: fetch_array($rs)) { |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | $return .= '</select>'; |
171 | 171 | $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return)); |
172 | 172 | } |
173 | - } |
|
174 | - return $xajax_response; |
|
173 | + } |
|
174 | + return $xajax_response; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $xajax->processRequests(); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $msg = ''; |
286 | 286 | if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) { |
287 | - $user_list = $_POST['UsersList']; |
|
287 | + $user_list = $_POST['UsersList']; |
|
288 | 288 | |
289 | 289 | switch ($userStatus) { |
290 | 290 | case DRH: |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | $assigned_users_id = array_keys($assigned_users_to_hrm); |
350 | 350 | $without_assigned_users = ''; |
351 | 351 | if (count($assigned_users_id) > 0) { |
352 | - $without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND "; |
|
352 | + $without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND "; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | $search_user = ''; |
356 | 356 | if (!empty($firstLetterUser)) { |
357 | - $needle = Database::escape_string($firstLetterUser); |
|
358 | - $search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
357 | + $needle = Database::escape_string($firstLetterUser); |
|
358 | + $search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $sqlConditions = null; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | if (api_is_multiple_url_enabled()) { |
378 | - $sql = "SELECT user.user_id, username, lastname, firstname |
|
378 | + $sql = "SELECT user.user_id, username, lastname, firstname |
|
379 | 379 | FROM $tbl_user user LEFT JOIN $tbl_access_url_rel_user au ON (au.user_id = user.user_id) |
380 | 380 | WHERE |
381 | 381 | $without_assigned_users |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $sqlConditions |
386 | 386 | ORDER BY firstname"; |
387 | 387 | } else { |
388 | - $sql = "SELECT user_id, username, lastname, firstname |
|
388 | + $sql = "SELECT user_id, username, lastname, firstname |
|
389 | 389 | FROM $tbl_user user |
390 | 390 | WHERE |
391 | 391 | $without_assigned_users |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | <input type="hidden" name="formSent" value="1" /> |
402 | 402 | <?php |
403 | 403 | if(!empty($msg)) { |
404 | - Display::display_normal_message($msg); //main API |
|
404 | + Display::display_normal_message($msg); //main API |
|
405 | 405 | } |
406 | 406 | ?> |
407 | 407 | |
@@ -454,26 +454,26 @@ discard block |
||
454 | 454 | </div> |
455 | 455 | |
456 | 456 | <?php |
457 | - } |
|
458 | - ?> |
|
457 | + } |
|
458 | + ?> |
|
459 | 459 | <div class="separate-action"> |
460 | 460 | <?php |
461 | - echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
461 | + echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
462 | 462 | ?> |
463 | 463 | </div> |
464 | 464 | </div> |
465 | 465 | </div> |
466 | 466 | <div class="col-md-4"> |
467 | 467 | <?php |
468 | - if (UserManager::is_admin($user_id)) { |
|
469 | - echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
468 | + if (UserManager::is_admin($user_id)) { |
|
469 | + echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
470 | 470 | } else if ($user_info['status'] == SESSIONADMIN) { |
471 | 471 | echo get_lang('AssignedUsersListToSessionsAdministrator'); |
472 | 472 | } else if ($user_info['status'] == STUDENT_BOSS) { |
473 | 473 | echo get_lang('AssignedUsersListToStudentBoss'); |
474 | 474 | } else { |
475 | 475 | echo get_lang('AssignedUsersListToHumanResourcesManager'); |
476 | - } |
|
476 | + } |
|
477 | 477 | ?> |
478 | 478 | <div class="form-group"> |
479 | 479 | <div class="col-sm-12"> |
@@ -149,27 +149,27 @@ discard block |
||
149 | 149 | $form = new FormValidator('user_add'); |
150 | 150 | $form->addElement('header', '', $tool_name); |
151 | 151 | if (api_is_western_name_order()) { |
152 | - // Firstname |
|
153 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
154 | - $form->applyFilter('firstname', 'html_filter'); |
|
155 | - $form->applyFilter('firstname', 'trim'); |
|
156 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
157 | - // Lastname |
|
158 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
159 | - $form->applyFilter('lastname', 'html_filter'); |
|
160 | - $form->applyFilter('lastname', 'trim'); |
|
161 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
152 | + // Firstname |
|
153 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
154 | + $form->applyFilter('firstname', 'html_filter'); |
|
155 | + $form->applyFilter('firstname', 'trim'); |
|
156 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
157 | + // Lastname |
|
158 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
159 | + $form->applyFilter('lastname', 'html_filter'); |
|
160 | + $form->applyFilter('lastname', 'trim'); |
|
161 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
162 | 162 | } else { |
163 | - // Lastname |
|
164 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
165 | - $form->applyFilter('lastname', 'html_filter'); |
|
166 | - $form->applyFilter('lastname', 'trim'); |
|
167 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
168 | - // Firstname |
|
169 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
170 | - $form->applyFilter('firstname', 'html_filter'); |
|
171 | - $form->applyFilter('firstname', 'trim'); |
|
172 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
163 | + // Lastname |
|
164 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
165 | + $form->applyFilter('lastname', 'html_filter'); |
|
166 | + $form->applyFilter('lastname', 'trim'); |
|
167 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
168 | + // Firstname |
|
169 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
170 | + $form->applyFilter('firstname', 'html_filter'); |
|
171 | + $form->applyFilter('firstname', 'trim'); |
|
172 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
173 | 173 | } |
174 | 174 | // Official code |
175 | 175 | $form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40')); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $auth_sources = 0; //make available wider as we need it in case of form reset (see below) |
225 | 225 | $nb_ext_auth_source_added = 0; |
226 | 226 | if (isset($extAuthSource) && count($extAuthSource) > 0) { |
227 | - $auth_sources = array(); |
|
227 | + $auth_sources = array(); |
|
228 | 228 | foreach ($extAuthSource as $key => $info) { |
229 | 229 | // @todo : make uniform external authentification configuration (ex : cas and external_login ldap) |
230 | 230 | // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | $nb_ext_auth_source_added++; |
236 | 236 | } |
237 | 237 | } |
238 | - if ($nb_ext_auth_source_added > 0) { |
|
239 | - $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2); |
|
240 | - $group[] = $form->createElement('select', 'auth_source', null, $auth_sources); |
|
241 | - $group[] = $form->createElement('static', '', '', '<br />'); |
|
238 | + if ($nb_ext_auth_source_added > 0) { |
|
239 | + $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2); |
|
240 | + $group[] = $form->createElement('select', 'auth_source', null, $auth_sources); |
|
241 | + $group[] = $form->createElement('static', '', '', '<br />'); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">'); |
308 | 308 | |
309 | 309 | if (isset($drh_list) && is_array($drh_list)) { |
310 | - foreach ($drh_list as $drh) { |
|
310 | + foreach ($drh_list as $drh) { |
|
311 | 311 | $drh_select->addOption( |
312 | 312 | api_get_person_name($drh['firstname'], $drh['lastname']), |
313 | 313 | $drh['user_id'] |
314 | 314 | ); |
315 | - } |
|
315 | + } |
|
316 | 316 | } |
317 | 317 | $form->addElement('html', '</div>'); |
318 | 318 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | // Validate form |
388 | 388 | if ($form->validate()) { |
389 | - $check = Security::check_token('post'); |
|
389 | + $check = Security::check_token('post'); |
|
390 | 390 | if ($check) { |
391 | 391 | $user = $form->exportValues(); |
392 | 392 | $lastname = $user['lastname']; |
@@ -402,15 +402,15 @@ discard block |
||
402 | 402 | $send_mail = intval($user['mail']['send_mail']); |
403 | 403 | $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : 0; |
404 | 404 | |
405 | - if (isset($extAuthSource) && count($extAuthSource) > 0 && |
|
405 | + if (isset($extAuthSource) && count($extAuthSource) > 0 && |
|
406 | 406 | $user['password']['password_auto'] == '2' |
407 | 407 | ) { |
408 | - $auth_source = $user['password']['auth_source']; |
|
409 | - $password = 'PLACEHOLDER'; |
|
410 | - } else { |
|
411 | - $auth_source = PLATFORM_AUTH_SOURCE; |
|
412 | - $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
413 | - } |
|
408 | + $auth_source = $user['password']['auth_source']; |
|
409 | + $password = 'PLACEHOLDER'; |
|
410 | + } else { |
|
411 | + $auth_source = PLATFORM_AUTH_SOURCE; |
|
412 | + $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
413 | + } |
|
414 | 414 | |
415 | 415 | if ($user['radio_expiration_date'] == '1') { |
416 | 416 | $expiration_date = $user['expiration_date']; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $expiration_date = null; |
419 | 419 | } |
420 | 420 | |
421 | - $active = intval($user['active']); |
|
421 | + $active = intval($user['active']); |
|
422 | 422 | |
423 | 423 | if (api_get_setting('login_is_email') == 'true') { |
424 | 424 | $username = $email; |
@@ -449,21 +449,21 @@ discard block |
||
449 | 449 | $extra, |
450 | 450 | null, |
451 | 451 | $send_mail, |
452 | - $platform_admin |
|
452 | + $platform_admin |
|
453 | 453 | ); |
454 | 454 | |
455 | - Security::clear_token(); |
|
456 | - $tok = Security::get_token(); |
|
457 | - if ($user_id === false) { |
|
458 | - //If any error ocurred during user creation, print it (api_failureList |
|
459 | - // stores values as separate words, so rework it |
|
460 | - $message = ''; |
|
461 | - $message_bits = explode(' ',api_get_last_failure()); |
|
462 | - foreach ($message_bits as $bit) { |
|
463 | - $message .= ucfirst($bit); |
|
464 | - } |
|
465 | - } else { |
|
466 | - if (!empty($picture['name'])) { |
|
455 | + Security::clear_token(); |
|
456 | + $tok = Security::get_token(); |
|
457 | + if ($user_id === false) { |
|
458 | + //If any error ocurred during user creation, print it (api_failureList |
|
459 | + // stores values as separate words, so rework it |
|
460 | + $message = ''; |
|
461 | + $message_bits = explode(' ',api_get_last_failure()); |
|
462 | + foreach ($message_bits as $bit) { |
|
463 | + $message .= ucfirst($bit); |
|
464 | + } |
|
465 | + } else { |
|
466 | + if (!empty($picture['name'])) { |
|
467 | 467 | $picture_uri = UserManager::update_user_picture( |
468 | 468 | $user_id, |
469 | 469 | $_FILES['picture']['name'], |
@@ -489,35 +489,35 @@ discard block |
||
489 | 489 | null, |
490 | 490 | $language |
491 | 491 | ); |
492 | - } |
|
492 | + } |
|
493 | 493 | |
494 | 494 | $extraFieldValues = new ExtraFieldValue('user'); |
495 | 495 | $user['item_id'] = $user_id; |
496 | 496 | $extraFieldValues->saveFieldValues($user); |
497 | 497 | |
498 | - $message = get_lang('UserAdded'); |
|
499 | - } |
|
500 | - if (isset($user['submit_plus'])) { |
|
501 | - //we want to add more. Prepare report message and redirect to the same page (to clean the form) |
|
502 | - header('Location: user_add.php?message='.urlencode($message).'&sec_token='.$tok); |
|
503 | - exit (); |
|
504 | - } else { |
|
505 | - $tok = Security::get_token(); |
|
506 | - header('Location: user_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
|
507 | - exit (); |
|
508 | - } |
|
509 | - } |
|
498 | + $message = get_lang('UserAdded'); |
|
499 | + } |
|
500 | + if (isset($user['submit_plus'])) { |
|
501 | + //we want to add more. Prepare report message and redirect to the same page (to clean the form) |
|
502 | + header('Location: user_add.php?message='.urlencode($message).'&sec_token='.$tok); |
|
503 | + exit (); |
|
504 | + } else { |
|
505 | + $tok = Security::get_token(); |
|
506 | + header('Location: user_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
|
507 | + exit (); |
|
508 | + } |
|
509 | + } |
|
510 | 510 | } else { |
511 | - if (isset($_POST['submit'])) { |
|
512 | - Security::clear_token(); |
|
513 | - } |
|
514 | - $token = Security::get_token(); |
|
515 | - $form->addElement('hidden', 'sec_token'); |
|
516 | - $form->setConstants(array('sec_token' => $token)); |
|
511 | + if (isset($_POST['submit'])) { |
|
512 | + Security::clear_token(); |
|
513 | + } |
|
514 | + $token = Security::get_token(); |
|
515 | + $form->addElement('hidden', 'sec_token'); |
|
516 | + $form->setConstants(array('sec_token' => $token)); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | if (!empty($message)){ |
520 | - $message = Display::return_message(stripslashes($message)); |
|
520 | + $message = Display::return_message(stripslashes($message)); |
|
521 | 521 | } |
522 | 522 | $content = $form->returnForm(); |
523 | 523 |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if (!empty($needle) && !empty($type)) { |
127 | 127 | if ($type == 'single') { |
128 | 128 | // search users where username or firstname or lastname begins likes $needle |
129 | - /* $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user |
|
129 | + /* $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user |
|
130 | 130 | WHERE (username LIKE "'.$needle.'%" |
131 | 131 | OR firstname LIKE "'.$needle.'%" |
132 | 132 | OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'" AND user.status<>'.DRH.''. |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | <option value = "%">--</option> |
232 | 232 | <?php |
233 | 233 | echo Display :: get_alphabet_options(); |
234 | - ?> |
|
234 | + ?> |
|
235 | 235 | </select> |
236 | 236 | <?php echo '<br />'; ?> |
237 | 237 | </td> |
@@ -242,31 +242,31 @@ discard block |
||
242 | 242 | <td align="center"> |
243 | 243 | <div id="content_source"> |
244 | 244 | <?php |
245 | - if (!($add_type=='multiple')) { |
|
245 | + if (!($add_type=='multiple')) { |
|
246 | 246 | ?> |
247 | 247 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
248 | 248 | <div id="ajax_list_users_single"></div> |
249 | 249 | <?php |
250 | - } else { |
|
251 | - ?> |
|
250 | + } else { |
|
251 | + ?> |
|
252 | 252 | <div id="ajax_list_multiple"> |
253 | 253 | <?php echo Display::select('elements_not_in_name',$elements_not_in, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?> |
254 | 254 | </div> |
255 | 255 | <?php |
256 | - } |
|
257 | - ?> |
|
256 | + } |
|
257 | + ?> |
|
258 | 258 | </div> |
259 | 259 | </td> |
260 | 260 | <td width="10%" valign="middle" align="center"> |
261 | 261 | <?php |
262 | - if ($ajax_search) { |
|
263 | - ?> |
|
262 | + if ($ajax_search) { |
|
263 | + ?> |
|
264 | 264 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" > |
265 | 265 | <em class="fa fa-arrow-left"></em> |
266 | 266 | </button> |
267 | 267 | <?php |
268 | - } else { |
|
269 | - ?> |
|
268 | + } else { |
|
269 | + ?> |
|
270 | 270 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))"> |
271 | 271 | <em class="fa fa-arrow-right"></em> |
272 | 272 | </button> |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | <em class="fa fa-arrow-left"></em> |
276 | 276 | </button> |
277 | 277 | <?php |
278 | - } |
|
279 | - ?> |
|
278 | + } |
|
279 | + ?> |
|
280 | 280 | <br /><br /><br /><br /><br /><br /> |
281 | 281 | </td> |
282 | 282 | <td align="center"> |
@@ -62,43 +62,43 @@ discard block |
||
62 | 62 | * inside the add_sub_language function. |
63 | 63 | */ |
64 | 64 | function check_if_language_exist ($original_name, $english_name, $isocode, $sublanguage_available) { |
65 | - $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
|
66 | - $sql_original_name='SELECT count(*) AS count_original_name FROM '.$tbl_admin_languages.' WHERE original_name="'.Database::escape_string($original_name).'" '; |
|
67 | - $sql_english_name='SELECT count(*) AS count_english_name FROM '.$tbl_admin_languages.' WHERE english_name="'.Database::escape_string($english_name).'" '; |
|
68 | - //$sql_isocode='SELECT count(*) AS count_isocode FROM '.$tbl_admin_languages.' WHERE isocode="'.Database::escape_string($isocode).'" '; |
|
69 | - $rs_original_name=Database::query($sql_original_name); |
|
70 | - $rs_english_name=Database::query($sql_english_name); |
|
71 | - //$rs_isocode=Database::query($sql_isocode); |
|
72 | - $count_original_name=Database::result($rs_original_name,0,'count_original_name'); |
|
73 | - $count_english_name=Database::result($rs_english_name,0,'count_english_name'); |
|
74 | - //$count_isocode=Database::result($rs_isocode,0,'count_isocode'); |
|
75 | - $has_error=false; |
|
76 | - $message_information=array(); |
|
65 | + $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
|
66 | + $sql_original_name='SELECT count(*) AS count_original_name FROM '.$tbl_admin_languages.' WHERE original_name="'.Database::escape_string($original_name).'" '; |
|
67 | + $sql_english_name='SELECT count(*) AS count_english_name FROM '.$tbl_admin_languages.' WHERE english_name="'.Database::escape_string($english_name).'" '; |
|
68 | + //$sql_isocode='SELECT count(*) AS count_isocode FROM '.$tbl_admin_languages.' WHERE isocode="'.Database::escape_string($isocode).'" '; |
|
69 | + $rs_original_name=Database::query($sql_original_name); |
|
70 | + $rs_english_name=Database::query($sql_english_name); |
|
71 | + //$rs_isocode=Database::query($sql_isocode); |
|
72 | + $count_original_name=Database::result($rs_original_name,0,'count_original_name'); |
|
73 | + $count_english_name=Database::result($rs_english_name,0,'count_english_name'); |
|
74 | + //$count_isocode=Database::result($rs_isocode,0,'count_isocode'); |
|
75 | + $has_error=false; |
|
76 | + $message_information=array(); |
|
77 | 77 | |
78 | - if ($count_original_name==1) { |
|
79 | - $has_error=true; |
|
80 | - $message_information['original_name']=true; |
|
81 | - } |
|
82 | - if ($count_english_name==1) { |
|
83 | - $has_error=true; |
|
84 | - $message_information['english_name']=true; |
|
85 | - } |
|
78 | + if ($count_original_name==1) { |
|
79 | + $has_error=true; |
|
80 | + $message_information['original_name']=true; |
|
81 | + } |
|
82 | + if ($count_english_name==1) { |
|
83 | + $has_error=true; |
|
84 | + $message_information['english_name']=true; |
|
85 | + } |
|
86 | 86 | |
87 | - $iso_list = api_get_platform_isocodes(); |
|
88 | - $iso_list = array_values($iso_list); |
|
87 | + $iso_list = api_get_platform_isocodes(); |
|
88 | + $iso_list = array_values($iso_list); |
|
89 | 89 | |
90 | - if (!in_array($isocode, $iso_list)) { |
|
91 | - $has_error=true; |
|
92 | - $message_information['isocode']=true; |
|
93 | - } |
|
94 | - if ($has_error===true) { |
|
95 | - $message_information['execute_add']=false; |
|
96 | - } |
|
97 | - if ($has_error===false) { |
|
98 | - $message_information['execute_add']=true; |
|
99 | - } |
|
90 | + if (!in_array($isocode, $iso_list)) { |
|
91 | + $has_error=true; |
|
92 | + $message_information['isocode']=true; |
|
93 | + } |
|
94 | + if ($has_error===true) { |
|
95 | + $message_information['execute_add']=false; |
|
96 | + } |
|
97 | + if ($has_error===false) { |
|
98 | + $message_information['execute_add']=true; |
|
99 | + } |
|
100 | 100 | |
101 | - return $message_information; |
|
101 | + return $message_information; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -109,50 +109,50 @@ discard block |
||
109 | 109 | * @todo deprecate this function and use the static method directly |
110 | 110 | */ |
111 | 111 | function check_if_exist_language_by_id ($language_id) { |
112 | - return SubLanguageManager::check_if_exist_language_by_id($language_id); |
|
112 | + return SubLanguageManager::check_if_exist_language_by_id($language_id); |
|
113 | 113 | } |
114 | 114 | /** |
115 | - * Check if the given language is a parent of any sub-language |
|
116 | - * @param int Language ID of the presumed parent |
|
117 | - * @return bool True if this language has children, false otherwise |
|
118 | - */ |
|
115 | + * Check if the given language is a parent of any sub-language |
|
116 | + * @param int Language ID of the presumed parent |
|
117 | + * @return bool True if this language has children, false otherwise |
|
118 | + */ |
|
119 | 119 | function ckeck_if_is_parent_of_sub_language ($parent_id) { |
120 | - $sql='SELECT count(*) AS count FROM language WHERE parent_id= '.intval($parent_id).''; |
|
121 | - $rs=Database::query($sql); |
|
122 | - if (Database::num_rows($rs)>0 && Database::result($rs,0,'count')==1) { |
|
123 | - return true; |
|
124 | - } else { |
|
125 | - return false; |
|
126 | - } |
|
120 | + $sql='SELECT count(*) AS count FROM language WHERE parent_id= '.intval($parent_id).''; |
|
121 | + $rs=Database::query($sql); |
|
122 | + if (Database::num_rows($rs)>0 && Database::result($rs,0,'count')==1) { |
|
123 | + return true; |
|
124 | + } else { |
|
125 | + return false; |
|
126 | + } |
|
127 | 127 | } |
128 | 128 | /** |
129 | - * Get all information of sub-language |
|
130 | - * @param int Parent language ID |
|
131 | - * @param int Child language ID |
|
132 | - * @return array |
|
133 | - */ |
|
129 | + * Get all information of sub-language |
|
130 | + * @param int Parent language ID |
|
131 | + * @param int Child language ID |
|
132 | + * @return array |
|
133 | + */ |
|
134 | 134 | function allow_get_all_information_of_sub_language ($parent_id,$sub_language_id) { |
135 | - return SubLanguageManager::get_all_information_of_sub_language($parent_id,$sub_language_id); |
|
135 | + return SubLanguageManager::get_all_information_of_sub_language($parent_id,$sub_language_id); |
|
136 | 136 | } |
137 | 137 | /*end declare functions*/ |
138 | 138 | |
139 | 139 | //add data |
140 | 140 | |
141 | 141 | if (isset($_GET['sub_language_id']) && $_GET['sub_language_id']==strval(intval($_GET['sub_language_id']))) { |
142 | - $language_name=SubLanguageManager::get_name_of_language_by_id($_GET['sub_language_id']); |
|
143 | - if (check_if_exist_language_by_id ($_GET['sub_language_id'])===true) { |
|
144 | - $sub_language_id=$_GET['sub_language_id']; |
|
145 | - $sub_language_id_exist=true; |
|
146 | - } else { |
|
147 | - $sub_language_id_exist=false; |
|
148 | - } |
|
142 | + $language_name=SubLanguageManager::get_name_of_language_by_id($_GET['sub_language_id']); |
|
143 | + if (check_if_exist_language_by_id ($_GET['sub_language_id'])===true) { |
|
144 | + $sub_language_id=$_GET['sub_language_id']; |
|
145 | + $sub_language_id_exist=true; |
|
146 | + } else { |
|
147 | + $sub_language_id_exist=false; |
|
148 | + } |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | $language_details = array(); |
152 | 152 | $language_name=''; |
153 | 153 | if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) { |
154 | 154 | $language_details = SubLanguageManager::get_all_information_of_language($_GET['id']); |
155 | - $language_name = $language_details['original_name']; |
|
155 | + $language_name = $language_details['original_name']; |
|
156 | 156 | if (check_if_exist_language_by_id ($_GET['id'])===true) { |
157 | 157 | $parent_id=$_GET['id']; |
158 | 158 | $language_id_exist=true; |
@@ -160,67 +160,67 @@ discard block |
||
160 | 160 | $language_id_exist=false; |
161 | 161 | } |
162 | 162 | } else { |
163 | - $language_id_exist=false; |
|
163 | + $language_id_exist=false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | //removed and register |
167 | 167 | |
168 | 168 | if ((isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) && (isset($_GET['sub_language_id']) && $_GET['sub_language_id']==strval(intval($_GET['sub_language_id'])))) { |
169 | - if (check_if_exist_language_by_id($_GET['id'])===true && check_if_exist_language_by_id($_GET['sub_language_id'])===true) { |
|
170 | - $get_all_information=allow_get_all_information_of_sub_language ($_GET['id'],$_GET['sub_language_id']); |
|
171 | - $original_name=$get_all_information['original_name']; |
|
172 | - $english_name=$get_all_information['english_name']; |
|
173 | - $isocode=$get_all_information['isocode']; |
|
169 | + if (check_if_exist_language_by_id($_GET['id'])===true && check_if_exist_language_by_id($_GET['sub_language_id'])===true) { |
|
170 | + $get_all_information=allow_get_all_information_of_sub_language ($_GET['id'],$_GET['sub_language_id']); |
|
171 | + $original_name=$get_all_information['original_name']; |
|
172 | + $english_name=$get_all_information['english_name']; |
|
173 | + $isocode=$get_all_information['isocode']; |
|
174 | 174 | |
175 | - } |
|
175 | + } |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | $language_name=get_lang('CreateSubLanguageForLanguage').' ( '.strtolower($language_name).' )'; |
179 | 179 | |
180 | 180 | if (ckeck_if_is_parent_of_sub_language($parent_id)===true && isset($_GET['action']) && $_GET['action']=='deletesublanguage') { |
181 | - $language_name=get_lang('DeleteSubLanguage'); |
|
181 | + $language_name=get_lang('DeleteSubLanguage'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | $msg = ''; |
185 | 185 | |
186 | 186 | if (isset($_POST['SubmitAddNewLanguage'])) { |
187 | - $original_name=$_POST['original_name']; |
|
188 | - $english_name=$_POST['english_name']; |
|
189 | - $isocode=$_POST['isocode']; |
|
190 | - $english_name=str_replace(' ','_',$english_name); |
|
191 | - $isocode=str_replace(' ','_',$isocode); |
|
187 | + $original_name=$_POST['original_name']; |
|
188 | + $english_name=$_POST['english_name']; |
|
189 | + $isocode=$_POST['isocode']; |
|
190 | + $english_name=str_replace(' ','_',$english_name); |
|
191 | + $isocode=str_replace(' ','_',$isocode); |
|
192 | 192 | |
193 | - $sublanguage_available=$_POST['sub_language_is_visible']; |
|
194 | - $check_information=array(); |
|
195 | - $check_information=check_if_language_exist($original_name,$english_name,$isocode,$sublanguage_available); |
|
196 | - foreach ($check_information as $index_information => $value_information) { |
|
197 | - $allow_insert_info=false; |
|
198 | - if ($index_information=='original_name') { |
|
199 | - $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('OriginalName').'" '.'('.$original_name.')','error'); |
|
200 | - } |
|
201 | - if ($index_information=='english_name') { |
|
202 | - $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('EnglishName').'" '.'('.$english_name.')','error'); |
|
203 | - } |
|
204 | - if ($index_information=='isocode') { |
|
205 | - $msg .= Display::return_message(get_lang('CodeDoesNotExists').': '.$isocode.'','error'); |
|
206 | - } |
|
207 | - if ($index_information=='execute_add' && $value_information===true) { |
|
208 | - $allow_insert_info=true; |
|
209 | - } |
|
210 | - } |
|
193 | + $sublanguage_available=$_POST['sub_language_is_visible']; |
|
194 | + $check_information=array(); |
|
195 | + $check_information=check_if_language_exist($original_name,$english_name,$isocode,$sublanguage_available); |
|
196 | + foreach ($check_information as $index_information => $value_information) { |
|
197 | + $allow_insert_info=false; |
|
198 | + if ($index_information=='original_name') { |
|
199 | + $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('OriginalName').'" '.'('.$original_name.')','error'); |
|
200 | + } |
|
201 | + if ($index_information=='english_name') { |
|
202 | + $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('EnglishName').'" '.'('.$english_name.')','error'); |
|
203 | + } |
|
204 | + if ($index_information=='isocode') { |
|
205 | + $msg .= Display::return_message(get_lang('CodeDoesNotExists').': '.$isocode.'','error'); |
|
206 | + } |
|
207 | + if ($index_information=='execute_add' && $value_information===true) { |
|
208 | + $allow_insert_info=true; |
|
209 | + } |
|
210 | + } |
|
211 | 211 | |
212 | - if (strlen($original_name)>0 && strlen($english_name)>0 && strlen($isocode)>0) { |
|
213 | - if ($allow_insert_info===true && $language_id_exist===true) { |
|
214 | - $english_name=str_replace(' ','_',$english_name); |
|
212 | + if (strlen($original_name)>0 && strlen($english_name)>0 && strlen($isocode)>0) { |
|
213 | + if ($allow_insert_info===true && $language_id_exist===true) { |
|
214 | + $english_name=str_replace(' ','_',$english_name); |
|
215 | 215 | //Fixes BT#1636 |
216 | 216 | $english_name=api_strtolower($english_name); |
217 | 217 | |
218 | - $isocode=str_replace(' ','_',$isocode); |
|
219 | - $str_info='<br/>'.get_lang('OriginalName').' : '.$original_name.'<br/>'.get_lang('EnglishName').' : '.$english_name.'<br/>'.get_lang('PlatformCharsetTitle').' : '.$isocode; |
|
218 | + $isocode=str_replace(' ','_',$isocode); |
|
219 | + $str_info='<br/>'.get_lang('OriginalName').' : '.$original_name.'<br/>'.get_lang('EnglishName').' : '.$english_name.'<br/>'.get_lang('PlatformCharsetTitle').' : '.$isocode; |
|
220 | 220 | |
221 | - $mkdir_result=SubLanguageManager::add_language_directory($english_name); |
|
222 | - if ($mkdir_result) { |
|
223 | - $sl_id = add_sub_language($original_name,$english_name,$isocode,$sublanguage_available,$parent_id); |
|
221 | + $mkdir_result=SubLanguageManager::add_language_directory($english_name); |
|
222 | + if ($mkdir_result) { |
|
223 | + $sl_id = add_sub_language($original_name,$english_name,$isocode,$sublanguage_available,$parent_id); |
|
224 | 224 | if ($sl_id === false) { |
225 | 225 | SubLanguageManager::remove_language_directory($english_name); |
226 | 226 | $msg .= Display::return_message(get_lang('LanguageDirectoryNotWriteableContactAdmin'),'error'); |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | require 'sub_language.php'; |
233 | 233 | exit(); |
234 | 234 | } |
235 | - } else { |
|
236 | - $msg .= Display::return_message(get_lang('LanguageDirectoryNotWriteableContactAdmin'),'error'); |
|
237 | - } |
|
238 | - } else { |
|
239 | - if ($language_id_exist===false) { |
|
240 | - $msg .= Display::return_message(get_lang('LanguageParentNotExist'),'error'); |
|
241 | - } |
|
242 | - } |
|
243 | - } else { |
|
235 | + } else { |
|
236 | + $msg .= Display::return_message(get_lang('LanguageDirectoryNotWriteableContactAdmin'),'error'); |
|
237 | + } |
|
238 | + } else { |
|
239 | + if ($language_id_exist===false) { |
|
240 | + $msg .= Display::return_message(get_lang('LanguageParentNotExist'),'error'); |
|
241 | + } |
|
242 | + } |
|
243 | + } else { |
|
244 | 244 | $msg .= Display::return_message(get_lang('FormHasErrorsPleaseComplete'),'error'); |
245 | - } |
|
245 | + } |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | Display :: display_header($language_name); |
@@ -250,51 +250,51 @@ discard block |
||
250 | 250 | echo $msg; |
251 | 251 | |
252 | 252 | if (isset($_POST['SubmitAddDeleteLanguage'])) { |
253 | - $rs = SubLanguageManager::remove_sub_language($_GET['id'], $_GET['sub_language_id']); |
|
254 | - if ($rs===true) { |
|
255 | - Display::display_confirmation_message(get_lang('TheSubLanguageHasBeenRemoved')); |
|
256 | - } else { |
|
257 | - Display::display_error_message(get_lang('TheSubLanguageHasNotBeenRemoved')); |
|
258 | - } |
|
253 | + $rs = SubLanguageManager::remove_sub_language($_GET['id'], $_GET['sub_language_id']); |
|
254 | + if ($rs===true) { |
|
255 | + Display::display_confirmation_message(get_lang('TheSubLanguageHasBeenRemoved')); |
|
256 | + } else { |
|
257 | + Display::display_error_message(get_lang('TheSubLanguageHasNotBeenRemoved')); |
|
258 | + } |
|
259 | 259 | } |
260 | 260 | // ckeck_if_is_parent_of_sub_language($parent_id)===false |
261 | 261 | // |
262 | 262 | if (isset($_GET['action']) && $_GET['action']=='definenewsublanguage') { |
263 | - $text = $language_name; |
|
264 | - $form = new FormValidator('addsublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&action=definenewsublanguage'); |
|
265 | - $class='add'; |
|
266 | - $form->addElement('header', '', $text); |
|
267 | - $form->addElement('text', 'original_name', get_lang('OriginalName'),'class="input_titles"'); |
|
268 | - $form->addRule('original_name', get_lang('ThisFieldIsRequired'), 'required'); |
|
269 | - $form->addElement('text', 'english_name', get_lang('EnglishName'),'class="input_titles"'); |
|
270 | - $form->addRule('english_name', get_lang('ThisFieldIsRequired'), 'required'); |
|
271 | - $form->addElement('text', 'isocode', get_lang('ISOCode'), 'class="input_titles"'); |
|
272 | - $form->addRule('isocode', get_lang('ThisFieldIsRequired'), 'required'); |
|
273 | - $form->addElement('static', null, ' ', '<i>en, es, fr</i>'); |
|
274 | - $form->addElement('checkbox', 'sub_language_is_visible', '', get_lang('Visibility')); |
|
275 | - $form->addButtonCreate(get_lang('CreateSubLanguage'), 'SubmitAddNewLanguage'); |
|
263 | + $text = $language_name; |
|
264 | + $form = new FormValidator('addsublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&action=definenewsublanguage'); |
|
265 | + $class='add'; |
|
266 | + $form->addElement('header', '', $text); |
|
267 | + $form->addElement('text', 'original_name', get_lang('OriginalName'),'class="input_titles"'); |
|
268 | + $form->addRule('original_name', get_lang('ThisFieldIsRequired'), 'required'); |
|
269 | + $form->addElement('text', 'english_name', get_lang('EnglishName'),'class="input_titles"'); |
|
270 | + $form->addRule('english_name', get_lang('ThisFieldIsRequired'), 'required'); |
|
271 | + $form->addElement('text', 'isocode', get_lang('ISOCode'), 'class="input_titles"'); |
|
272 | + $form->addRule('isocode', get_lang('ThisFieldIsRequired'), 'required'); |
|
273 | + $form->addElement('static', null, ' ', '<i>en, es, fr</i>'); |
|
274 | + $form->addElement('checkbox', 'sub_language_is_visible', '', get_lang('Visibility')); |
|
275 | + $form->addButtonCreate(get_lang('CreateSubLanguage'), 'SubmitAddNewLanguage'); |
|
276 | 276 | //$values['original_name'] = $language_details['original_name'].'...'; -> cannot be used because of quickform filtering (freeze) |
277 | 277 | $values['english_name'] = $language_details['english_name'].'2'; |
278 | 278 | $values['isocode'] = $language_details['isocode']; |
279 | 279 | $form->setDefaults($values); |
280 | - $form->display(); |
|
280 | + $form->display(); |
|
281 | 281 | } else { |
282 | - if (isset($_GET['action']) && $_GET['action']=='deletesublanguage') { |
|
283 | - $text=$language_name; |
|
284 | - $form = new FormValidator('deletesublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&sub_language_id='.Security::remove_XSS($_GET['sub_language_id'])); |
|
285 | - $class='minus'; |
|
286 | - $form->addElement('header', '', $text); |
|
287 | - $form->addElement('static', '', get_lang('OriginalName'),$original_name); |
|
288 | - $form->addElement('static', '', get_lang('EnglishName'),$english_name); |
|
289 | - $form->addElement('static', '', get_lang('PlatformCharsetTitle'),$isocode); |
|
290 | - $form->addButtonCreate(get_lang('DeleteSubLanguage'), 'SubmitAddDeleteLanguage'); |
|
291 | - $form->display(); |
|
292 | - } |
|
293 | - if (isset($_GET['action']) && $_GET['action']=='definenewsublanguage') { |
|
294 | - Display::display_normal_message(get_lang('TheSubLanguageForThisLanguageHasBeenAdded')); |
|
295 | - } |
|
282 | + if (isset($_GET['action']) && $_GET['action']=='deletesublanguage') { |
|
283 | + $text=$language_name; |
|
284 | + $form = new FormValidator('deletesublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&sub_language_id='.Security::remove_XSS($_GET['sub_language_id'])); |
|
285 | + $class='minus'; |
|
286 | + $form->addElement('header', '', $text); |
|
287 | + $form->addElement('static', '', get_lang('OriginalName'),$original_name); |
|
288 | + $form->addElement('static', '', get_lang('EnglishName'),$english_name); |
|
289 | + $form->addElement('static', '', get_lang('PlatformCharsetTitle'),$isocode); |
|
290 | + $form->addButtonCreate(get_lang('DeleteSubLanguage'), 'SubmitAddDeleteLanguage'); |
|
291 | + $form->display(); |
|
292 | + } |
|
293 | + if (isset($_GET['action']) && $_GET['action']=='definenewsublanguage') { |
|
294 | + Display::display_normal_message(get_lang('TheSubLanguageForThisLanguageHasBeenAdded')); |
|
295 | + } |
|
296 | 296 | } |
297 | 297 | /** |
298 | - * Footer |
|
299 | - */ |
|
298 | + * Footer |
|
299 | + */ |
|
300 | 300 | Display :: display_footer(); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $sql = "SELECT * FROM $table_group WHERE id = '".$group_id."'"; |
36 | 36 | $res = Database::query($sql); |
37 | 37 | if (Database::num_rows($res) != 1) { |
38 | - header('Location: group_list.php'); |
|
39 | - exit; |
|
38 | + header('Location: group_list.php'); |
|
39 | + exit; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $group_data = Database::fetch_array($res, 'ASSOC'); |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | |
55 | 55 | // Description |
56 | 56 | $form->addElement( |
57 | - 'textarea', |
|
58 | - 'description', |
|
59 | - get_lang('Description'), |
|
60 | - array( |
|
61 | - 'rows' => 3, |
|
62 | - 'cols' => 58, |
|
63 | - 'onKeyDown' => "text_longitud()", |
|
64 | - 'onKeyUp' => "text_longitud()", |
|
65 | - ) |
|
57 | + 'textarea', |
|
58 | + 'description', |
|
59 | + get_lang('Description'), |
|
60 | + array( |
|
61 | + 'rows' => 3, |
|
62 | + 'cols' => 58, |
|
63 | + 'onKeyDown' => "text_longitud()", |
|
64 | + 'onKeyUp' => "text_longitud()", |
|
65 | + ) |
|
66 | 66 | ); |
67 | 67 | $form->applyFilter('description', 'html_filter'); |
68 | 68 | $form->applyFilter('description', 'trim'); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
77 | 77 | $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); |
78 | 78 | if (strlen($group_data['picture_uri']) > 0) { |
79 | - $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage')); |
|
79 | + $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage')); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Group parent |
@@ -101,28 +101,28 @@ discard block |
||
101 | 101 | |
102 | 102 | // Validate form |
103 | 103 | if ( $form->validate()) { |
104 | - $group = $form->exportValues(); |
|
104 | + $group = $form->exportValues(); |
|
105 | 105 | |
106 | - $picture_element = $form->getElement('picture'); |
|
107 | - $picture = $picture_element->getValue(); |
|
106 | + $picture_element = $form->getElement('picture'); |
|
107 | + $picture = $picture_element->getValue(); |
|
108 | 108 | |
109 | - $picture_uri = $group_data['picture_uri']; |
|
110 | - if ($group['delete_picture']) { |
|
111 | - $picture_uri = GroupPortalManager::delete_group_picture($group_id); |
|
112 | - } |
|
113 | - elseif (!empty($picture['name'])) { |
|
109 | + $picture_uri = $group_data['picture_uri']; |
|
110 | + if ($group['delete_picture']) { |
|
111 | + $picture_uri = GroupPortalManager::delete_group_picture($group_id); |
|
112 | + } |
|
113 | + elseif (!empty($picture['name'])) { |
|
114 | 114 | $picture_uri = GroupPortalManager::update_group_picture( |
115 | 115 | $group_id, |
116 | 116 | $_FILES['picture']['name'], |
117 | 117 | $_FILES['picture']['tmp_name'] |
118 | 118 | ); |
119 | - } |
|
119 | + } |
|
120 | 120 | |
121 | - $name = $group['name']; |
|
122 | - $description = $group['description']; |
|
123 | - $url = $group['url']; |
|
124 | - $status = intval($group['visibility']); |
|
125 | - $parent_group_id = intval($group['parent_group']); |
|
121 | + $name = $group['name']; |
|
122 | + $description = $group['description']; |
|
123 | + $url = $group['url']; |
|
124 | + $status = intval($group['visibility']); |
|
125 | + $parent_group_id = intval($group['parent_group']); |
|
126 | 126 | |
127 | 127 | GroupPortalManager::update( |
128 | 128 | $group_id, |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | ); |
135 | 135 | GroupPortalManager::set_parent_group($group_id, $parent_group_id); |
136 | 136 | |
137 | - $tok = Security::get_token(); |
|
138 | - header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok); |
|
139 | - exit(); |
|
137 | + $tok = Security::get_token(); |
|
138 | + header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok); |
|
139 | + exit(); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | Display::display_header($tool_name); |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $image_size = api_getimagesize($image_file); |
150 | 150 | |
151 | 151 | $img_attributes = 'src="'.$image_file.'?rand='.time().'" ' |
152 | - .'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; padding:5px;" '; |
|
152 | + .'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; padding:5px;" '; |
|
153 | 153 | |
154 | 154 | if ($image_size['width'] > 300) { |
155 | 155 | // limit display width to 300px |
156 | - $img_attributes .= 'width="300" '; |
|
156 | + $img_attributes .= 'width="300" '; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // get the path,width and height from original picture |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | $url_big_image = $big_image.'?rnd='.time(); |
165 | 165 | |
166 | 166 | if ($image == '') { |
167 | - echo '<img '.$img_attributes.' />'; |
|
167 | + echo '<img '.$img_attributes.' />'; |
|
168 | 168 | } else { |
169 | - echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>'; |
|
169 | + echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // Display form |