@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | { |
16 | 16 | } |
17 | 17 | |
18 | - /** |
|
19 | - * Add a new Term and Condition |
|
20 | - * @param int $language language id |
|
21 | - * @param string $content content |
|
22 | - * @param int $type term and condition type (0 or 1) |
|
23 | - * @param string $changes explain changes |
|
24 | - * @return boolean success |
|
25 | - */ |
|
26 | - public static function add($language, $content, $type, $changes) |
|
18 | + /** |
|
19 | + * Add a new Term and Condition |
|
20 | + * @param int $language language id |
|
21 | + * @param string $content content |
|
22 | + * @param int $type term and condition type (0 or 1) |
|
23 | + * @param string $changes explain changes |
|
24 | + * @return boolean success |
|
25 | + */ |
|
26 | + public static function add($language, $content, $type, $changes) |
|
27 | 27 | { |
28 | 28 | $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
29 | 29 | $last = self::get_last_condition($language); |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - /** |
|
100 | - * Gets the data of a Term and condition by language |
|
101 | - * @param int $language language id |
|
102 | - * @return array all the info of a Term and condition |
|
103 | - */ |
|
104 | - public static function get_last_condition($language) |
|
99 | + /** |
|
100 | + * Gets the data of a Term and condition by language |
|
101 | + * @param int $language language id |
|
102 | + * @return array all the info of a Term and condition |
|
103 | + */ |
|
104 | + public static function get_last_condition($language) |
|
105 | 105 | { |
106 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
107 | - $language= Database::escape_string($language); |
|
108 | - $sql = "SELECT * FROM $legal_conditions_table |
|
106 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
107 | + $language= Database::escape_string($language); |
|
108 | + $sql = "SELECT * FROM $legal_conditions_table |
|
109 | 109 | WHERE language_id = '".$language."' |
110 | 110 | ORDER BY version DESC |
111 | 111 | LIMIT 1 "; |
112 | - $result = Database::query($sql); |
|
113 | - $result = Database::fetch_array($result, 'ASSOC'); |
|
112 | + $result = Database::query($sql); |
|
113 | + $result = Database::fetch_array($result, 'ASSOC'); |
|
114 | 114 | |
115 | 115 | if (isset($result['content'])) { |
116 | 116 | $result['content'] = self::replaceTags($result['content']); |
117 | 117 | } |
118 | 118 | return $result; |
119 | - } |
|
119 | + } |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * @param string $content |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | return $content; |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Gets the last version of a Term and condition by language |
|
145 | - * @param int $language language id |
|
146 | - * @return boolean | int the version or false if does not exist |
|
147 | - */ |
|
148 | - public static function get_last_version($language) |
|
143 | + /** |
|
144 | + * Gets the last version of a Term and condition by language |
|
145 | + * @param int $language language id |
|
146 | + * @return boolean | int the version or false if does not exist |
|
147 | + */ |
|
148 | + public static function get_last_version($language) |
|
149 | 149 | { |
150 | 150 | $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
151 | 151 | $language = intval($language); |
@@ -163,15 +163,15 @@ discard block |
||
163 | 163 | |
164 | 164 | return false; |
165 | 165 | } |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * Show the last condition |
|
170 | - * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
168 | + /** |
|
169 | + * Show the last condition |
|
170 | + * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
171 | 171 | * |
172 | - * @return string html preview |
|
173 | - */ |
|
174 | - public static function show_last_condition($term_preview) |
|
172 | + * @return string html preview |
|
173 | + */ |
|
174 | + public static function show_last_condition($term_preview) |
|
175 | 175 | { |
176 | 176 | $preview = ''; |
177 | 177 | switch ($term_preview['type']) { |
@@ -201,37 +201,37 @@ discard block |
||
201 | 201 | default: |
202 | 202 | break; |
203 | 203 | } |
204 | - return $preview; |
|
205 | - } |
|
204 | + return $preview; |
|
205 | + } |
|
206 | 206 | |
207 | - /** |
|
208 | - * Get the terms and condition table (only for maintenance) |
|
209 | - * @param int $from |
|
210 | - * @param int $number_of_items |
|
211 | - * @param int $column |
|
212 | - * @return array |
|
213 | - */ |
|
214 | - public static function get_legal_data($from, $number_of_items, $column) |
|
207 | + /** |
|
208 | + * Get the terms and condition table (only for maintenance) |
|
209 | + * @param int $from |
|
210 | + * @param int $number_of_items |
|
211 | + * @param int $column |
|
212 | + * @return array |
|
213 | + */ |
|
214 | + public static function get_legal_data($from, $number_of_items, $column) |
|
215 | 215 | { |
216 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
217 | - $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
218 | - $from = intval($from); |
|
219 | - $number_of_items = intval($number_of_items); |
|
220 | - $column = intval($column); |
|
216 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
217 | + $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
218 | + $from = intval($from); |
|
219 | + $number_of_items = intval($number_of_items); |
|
220 | + $column = intval($column); |
|
221 | 221 | |
222 | - $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
222 | + $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
223 | 223 | FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) "; |
224 | - $sql .= "ORDER BY language, version ASC "; |
|
225 | - $sql .= "LIMIT $from, $number_of_items "; |
|
224 | + $sql .= "ORDER BY language, version ASC "; |
|
225 | + $sql .= "LIMIT $from, $number_of_items "; |
|
226 | 226 | |
227 | - $result = Database::query($sql); |
|
228 | - $legals = array(); |
|
229 | - $versions = array(); |
|
230 | - while ($legal = Database::fetch_array($result)) { |
|
231 | - // max 2000 chars |
|
232 | - //echo strlen($legal[1]); echo '<br>'; |
|
233 | - $versions[] = $legal[0]; |
|
234 | - $languages[] = $legal[1]; |
|
227 | + $result = Database::query($sql); |
|
228 | + $legals = array(); |
|
229 | + $versions = array(); |
|
230 | + while ($legal = Database::fetch_array($result)) { |
|
231 | + // max 2000 chars |
|
232 | + //echo strlen($legal[1]); echo '<br>'; |
|
233 | + $versions[] = $legal[0]; |
|
234 | + $languages[] = $legal[1]; |
|
235 | 235 | if (strlen($legal[2]) > 2000) { |
236 | 236 | $legal[2] = substr($legal[2], 0, 2000).' ... '; |
237 | 237 | } |
@@ -240,50 +240,50 @@ discard block |
||
240 | 240 | } elseif ($legal[4] == 1) { |
241 | 241 | $legal[4] = get_lang('PageLink'); |
242 | 242 | } |
243 | - $legals[] = $legal; |
|
244 | - } |
|
245 | - return $legals; |
|
246 | - } |
|
243 | + $legals[] = $legal; |
|
244 | + } |
|
245 | + return $legals; |
|
246 | + } |
|
247 | 247 | |
248 | - /** |
|
249 | - * Gets the number of terms and conditions available |
|
250 | - * @return int |
|
251 | - */ |
|
252 | - public static function count() |
|
248 | + /** |
|
249 | + * Gets the number of terms and conditions available |
|
250 | + * @return int |
|
251 | + */ |
|
252 | + public static function count() |
|
253 | 253 | { |
254 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
255 | - $sql = "SELECT count(*) as count_result |
|
254 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
255 | + $sql = "SELECT count(*) as count_result |
|
256 | 256 | FROM $legal_conditions_table |
257 | 257 | ORDER BY id DESC "; |
258 | - $result = Database::query($sql); |
|
259 | - $url = Database::fetch_array($result,'ASSOC'); |
|
260 | - $result = $url['count_result']; |
|
258 | + $result = Database::query($sql); |
|
259 | + $url = Database::fetch_array($result,'ASSOC'); |
|
260 | + $result = $url['count_result']; |
|
261 | 261 | |
262 | - return $result; |
|
263 | - } |
|
262 | + return $result; |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * Get type of terms and conditions |
|
267 | - * @param int $legal_id |
|
268 | - * @param int $language_id |
|
269 | - * @return int The current type of terms and conditions |
|
270 | - */ |
|
271 | - public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
265 | + /** |
|
266 | + * Get type of terms and conditions |
|
267 | + * @param int $legal_id |
|
268 | + * @param int $language_id |
|
269 | + * @return int The current type of terms and conditions |
|
270 | + */ |
|
271 | + public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
272 | 272 | { |
273 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
274 | - $legal_id = intval($legal_id); |
|
275 | - $language_id = intval($language_id); |
|
276 | - $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
273 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
274 | + $legal_id = intval($legal_id); |
|
275 | + $language_id = intval($language_id); |
|
276 | + $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
277 | 277 | WHERE id = "'.$legal_id.'" AND language_id="'.$language_id.'"'; |
278 | - $rs = Database::query($sql); |
|
278 | + $rs = Database::query($sql); |
|
279 | 279 | |
280 | - return Database::result($rs,0,'type'); |
|
281 | - } |
|
280 | + return Database::result($rs,0,'type'); |
|
281 | + } |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * @param int $userId |
285 | 285 | */ |
286 | - public static function sendLegal($userId) |
|
286 | + public static function sendLegal($userId) |
|
287 | 287 | { |
288 | 288 | $subject = get_lang('SendTermsSubject'); |
289 | 289 | $content = sprintf( |
@@ -607,7 +607,7 @@ |
||
607 | 607 | .' width="40px">'; |
608 | 608 | $userInfo = api_get_user_info($user_invitation_id); |
609 | 609 | $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">' |
610 | - .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>'; |
|
610 | + .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>'; |
|
611 | 611 | |
612 | 612 | $invitations .='<div class="pull-right">'; |
613 | 613 | $invitations .= '<a title="'.get_lang('SocialAddToFriends').'" id="btn_accepted_'.$user_invitation_id.'" class="btn btn-default btn-sm" onclick="register_friend(this)" href="javascript:void(0)">' |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | - * provides a side connection to a vchamilo database |
|
141 | - * @param array $_configuration |
|
140 | + * provides a side connection to a vchamilo database |
|
141 | + * @param array $_configuration |
|
142 | 142 | * |
143 | - * @return \Doctrine\DBAL\Driver\Connection |
|
144 | - */ |
|
143 | + * @return \Doctrine\DBAL\Driver\Connection |
|
144 | + */ |
|
145 | 145 | public static function bootConnection(&$_configuration) |
146 | 146 | { |
147 | 147 | $dbParams = array( |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
252 | - * drop a vchamilo instance databases using the physical connection |
|
253 | - * @param stdClass $params |
|
254 | - * return an array of errors or false if ok |
|
255 | - */ |
|
252 | + * drop a vchamilo instance databases using the physical connection |
|
253 | + * @param stdClass $params |
|
254 | + * return an array of errors or false if ok |
|
255 | + */ |
|
256 | 256 | public static function dropDatabase($params) |
257 | 257 | { |
258 | 258 | $params = clone $params; |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
305 | - * get a proper SQLdump command |
|
306 | - * @param object $vmoodledata the complete new host information |
|
307 | - * @return string the shell command |
|
308 | - */ |
|
305 | + * get a proper SQLdump command |
|
306 | + * @param object $vmoodledata the complete new host information |
|
307 | + * @return string the shell command |
|
308 | + */ |
|
309 | 309 | public static function getDatabaseDumpCmd($vchamilodata) |
310 | 310 | { |
311 | 311 | $pgm = self::getConfig('vchamilo', 'mysql_cmd'); |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | } |
470 | 470 | |
471 | 471 | /** |
472 | - * read manifest values in vchamilo template. |
|
473 | - */ |
|
472 | + * read manifest values in vchamilo template. |
|
473 | + */ |
|
474 | 474 | public static function getVmanifest($version) |
475 | 475 | { |
476 | 476 | $file = api_get_path(SYS_PATH).'/plugin/vchamilo/templates/'.$version.'/manifest.php'; |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
493 | - * make a fake vchamilo that represents the current host |
|
494 | - */ |
|
493 | + * make a fake vchamilo that represents the current host |
|
494 | + */ |
|
495 | 495 | public static function makeThis() |
496 | 496 | { |
497 | 497 | global $_configuration; |
@@ -556,11 +556,11 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
559 | - * this function set will map standard moodle API calls to chamilo |
|
560 | - * internal primitives. This avoids too many changes to do in imported |
|
561 | - * code |
|
562 | - * |
|
563 | - */ |
|
559 | + * this function set will map standard moodle API calls to chamilo |
|
560 | + * internal primitives. This avoids too many changes to do in imported |
|
561 | + * code |
|
562 | + * |
|
563 | + */ |
|
564 | 564 | public static function getConfig($module, $key, $isplugin = true) |
565 | 565 | { |
566 | 566 | if ($isplugin) { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $event = $agenda->get_event($id); |
44 | 44 | |
45 | 45 | if (!empty($event)) { |
46 | - define('ICAL_LANG', api_get_language_isocode()); |
|
46 | + define('ICAL_LANG', api_get_language_isocode()); |
|
47 | 47 | |
48 | 48 | $ical = new vcalendar(); |
49 | 49 | $ical->setConfig('unique_id',api_get_path(WEB_PATH)); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | // Login as ... |
21 | 21 | if ($action == "login_as" && !empty ($login_as_user_id)) |
22 | 22 | { |
23 | - login_user($login_as_user_id); |
|
23 | + login_user($login_as_user_id); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | //if we already have a session id and a user... |
@@ -37,150 +37,150 @@ discard block |
||
37 | 37 | |
38 | 38 | if (isset ($_GET['action'])) |
39 | 39 | { |
40 | - $check = Security::check_token('get'); |
|
41 | - if($check) |
|
42 | - { |
|
43 | - switch ($_GET['action']) |
|
44 | - { |
|
45 | - case 'show_message' : |
|
46 | - Display :: display_header($tool_name); |
|
47 | - Display :: display_normal_message($_GET['message']); |
|
48 | - break; |
|
49 | - case 'delete_user' : |
|
50 | - Display :: display_header($tool_name); |
|
51 | - if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) |
|
52 | - { |
|
53 | - Display :: display_normal_message(get_lang('UserDeleted')); |
|
54 | - } |
|
55 | - else |
|
56 | - { |
|
57 | - Display :: display_error_message(get_lang('CannotDeleteUser')); |
|
58 | - } |
|
59 | - break; |
|
60 | - case 'lock' : |
|
61 | - Display :: display_header($tool_name); |
|
62 | - $message=lock_unlock_user('lock',$_GET['user_id']); |
|
63 | - Display :: display_normal_message($message); |
|
64 | - break; |
|
65 | - case 'unlock'; |
|
66 | - Display :: display_header($tool_name); |
|
67 | - $message=lock_unlock_user('unlock',$_GET['user_id']); |
|
68 | - Display :: display_normal_message($message); |
|
69 | - break; |
|
70 | - case 'add_user'; |
|
71 | - $id=$_GET['id']; |
|
72 | - $UserList=array(); |
|
73 | - $userid_match_login = array(); |
|
74 | - foreach ($id as $user_id) { |
|
75 | - $tmp = ldap_add_user($user_id); |
|
76 | - $UserList[]= $tmp; |
|
77 | - $userid_match_login[$tmp] = $user_id; |
|
78 | - } |
|
79 | - if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) { |
|
80 | - ldap_add_user_to_session($UserList, $_GET['id_session']); |
|
81 | - header('Location: resume_session.php?id_session='.intval($_GET['id_session'])); |
|
82 | - } else { |
|
83 | - Display :: display_header($tool_name); |
|
84 | - if(count($userid_match_login)>0) |
|
85 | - { |
|
86 | - $message=get_lang('LDAPUsersAddedOrUpdated').':<br />'; |
|
87 | - foreach($userid_match_login as $user_id => $login) |
|
88 | - { |
|
89 | - $message .= '- '.$login.'<br />'; |
|
90 | - } |
|
91 | - } |
|
92 | - else |
|
93 | - { |
|
94 | - $message=get_lang('NoUserAdded'); |
|
95 | - } |
|
96 | - Display :: display_normal_message($message,false); |
|
97 | - } |
|
98 | - break; |
|
99 | - default : |
|
100 | - Display :: display_header($tool_name); |
|
101 | - } |
|
102 | - Security::clear_token(); |
|
103 | - } |
|
104 | - else |
|
105 | - { |
|
106 | - Display::display_header($tool_name); |
|
107 | - } |
|
40 | + $check = Security::check_token('get'); |
|
41 | + if($check) |
|
42 | + { |
|
43 | + switch ($_GET['action']) |
|
44 | + { |
|
45 | + case 'show_message' : |
|
46 | + Display :: display_header($tool_name); |
|
47 | + Display :: display_normal_message($_GET['message']); |
|
48 | + break; |
|
49 | + case 'delete_user' : |
|
50 | + Display :: display_header($tool_name); |
|
51 | + if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) |
|
52 | + { |
|
53 | + Display :: display_normal_message(get_lang('UserDeleted')); |
|
54 | + } |
|
55 | + else |
|
56 | + { |
|
57 | + Display :: display_error_message(get_lang('CannotDeleteUser')); |
|
58 | + } |
|
59 | + break; |
|
60 | + case 'lock' : |
|
61 | + Display :: display_header($tool_name); |
|
62 | + $message=lock_unlock_user('lock',$_GET['user_id']); |
|
63 | + Display :: display_normal_message($message); |
|
64 | + break; |
|
65 | + case 'unlock'; |
|
66 | + Display :: display_header($tool_name); |
|
67 | + $message=lock_unlock_user('unlock',$_GET['user_id']); |
|
68 | + Display :: display_normal_message($message); |
|
69 | + break; |
|
70 | + case 'add_user'; |
|
71 | + $id=$_GET['id']; |
|
72 | + $UserList=array(); |
|
73 | + $userid_match_login = array(); |
|
74 | + foreach ($id as $user_id) { |
|
75 | + $tmp = ldap_add_user($user_id); |
|
76 | + $UserList[]= $tmp; |
|
77 | + $userid_match_login[$tmp] = $user_id; |
|
78 | + } |
|
79 | + if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) { |
|
80 | + ldap_add_user_to_session($UserList, $_GET['id_session']); |
|
81 | + header('Location: resume_session.php?id_session='.intval($_GET['id_session'])); |
|
82 | + } else { |
|
83 | + Display :: display_header($tool_name); |
|
84 | + if(count($userid_match_login)>0) |
|
85 | + { |
|
86 | + $message=get_lang('LDAPUsersAddedOrUpdated').':<br />'; |
|
87 | + foreach($userid_match_login as $user_id => $login) |
|
88 | + { |
|
89 | + $message .= '- '.$login.'<br />'; |
|
90 | + } |
|
91 | + } |
|
92 | + else |
|
93 | + { |
|
94 | + $message=get_lang('NoUserAdded'); |
|
95 | + } |
|
96 | + Display :: display_normal_message($message,false); |
|
97 | + } |
|
98 | + break; |
|
99 | + default : |
|
100 | + Display :: display_header($tool_name); |
|
101 | + } |
|
102 | + Security::clear_token(); |
|
103 | + } |
|
104 | + else |
|
105 | + { |
|
106 | + Display::display_header($tool_name); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | else |
110 | 110 | { |
111 | - Display::display_header($tool_name); |
|
111 | + Display::display_header($tool_name); |
|
112 | 112 | } |
113 | 113 | if (isset ($_POST['action'])) |
114 | 114 | { |
115 | - $check = Security::check_token('get'); |
|
116 | - if($check) |
|
117 | - { |
|
118 | - switch ($_POST['action']) |
|
119 | - { |
|
120 | - case 'delete' : |
|
121 | - $number_of_selected_users = count($_POST['id']); |
|
122 | - $number_of_deleted_users = 0; |
|
123 | - foreach ($_POST['id'] as $index => $user_id) |
|
124 | - { |
|
125 | - if($user_id != $_user['user_id']) |
|
126 | - { |
|
127 | - if(UserManager :: delete_user($user_id)) |
|
128 | - { |
|
129 | - $number_of_deleted_users++; |
|
130 | - } |
|
131 | - } |
|
132 | - } |
|
133 | - if($number_of_selected_users == $number_of_deleted_users) |
|
134 | - { |
|
135 | - Display :: display_normal_message(get_lang('SelectedUsersDeleted')); |
|
136 | - } |
|
137 | - else |
|
138 | - { |
|
139 | - Display :: display_error_message(get_lang('SomeUsersNotDeleted')); |
|
140 | - } |
|
141 | - break; |
|
142 | - case 'add_user' : |
|
143 | - $number_of_selected_users = count($_POST['id']); |
|
144 | - $number_of_added_users = 0; |
|
145 | - $UserList=array(); |
|
146 | - foreach ($_POST['id'] as $index => $user_id) |
|
147 | - { |
|
148 | - if($user_id != $_user['user_id']) |
|
149 | - { |
|
150 | - $UserList[] = ldap_add_user($user_id); |
|
151 | - } |
|
152 | - } |
|
153 | - if (isset($_GET['id_session']) && (trim($_GET['id_session'])!="")) |
|
154 | - addUserToSession($UserList, $_GET['id_session']); |
|
155 | - if(count($UserList)>0) |
|
156 | - { |
|
157 | - Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded')); |
|
158 | - } |
|
159 | - else |
|
160 | - { |
|
161 | - Display :: display_normal_message(get_lang('NoUserAdded')); |
|
162 | - } |
|
163 | - break; |
|
115 | + $check = Security::check_token('get'); |
|
116 | + if($check) |
|
117 | + { |
|
118 | + switch ($_POST['action']) |
|
119 | + { |
|
120 | + case 'delete' : |
|
121 | + $number_of_selected_users = count($_POST['id']); |
|
122 | + $number_of_deleted_users = 0; |
|
123 | + foreach ($_POST['id'] as $index => $user_id) |
|
124 | + { |
|
125 | + if($user_id != $_user['user_id']) |
|
126 | + { |
|
127 | + if(UserManager :: delete_user($user_id)) |
|
128 | + { |
|
129 | + $number_of_deleted_users++; |
|
130 | + } |
|
131 | + } |
|
132 | + } |
|
133 | + if($number_of_selected_users == $number_of_deleted_users) |
|
134 | + { |
|
135 | + Display :: display_normal_message(get_lang('SelectedUsersDeleted')); |
|
136 | + } |
|
137 | + else |
|
138 | + { |
|
139 | + Display :: display_error_message(get_lang('SomeUsersNotDeleted')); |
|
140 | + } |
|
141 | + break; |
|
142 | + case 'add_user' : |
|
143 | + $number_of_selected_users = count($_POST['id']); |
|
144 | + $number_of_added_users = 0; |
|
145 | + $UserList=array(); |
|
146 | + foreach ($_POST['id'] as $index => $user_id) |
|
147 | + { |
|
148 | + if($user_id != $_user['user_id']) |
|
149 | + { |
|
150 | + $UserList[] = ldap_add_user($user_id); |
|
151 | + } |
|
152 | + } |
|
153 | + if (isset($_GET['id_session']) && (trim($_GET['id_session'])!="")) |
|
154 | + addUserToSession($UserList, $_GET['id_session']); |
|
155 | + if(count($UserList)>0) |
|
156 | + { |
|
157 | + Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded')); |
|
158 | + } |
|
159 | + else |
|
160 | + { |
|
161 | + Display :: display_normal_message(get_lang('NoUserAdded')); |
|
162 | + } |
|
163 | + break; |
|
164 | 164 | |
165 | - } |
|
166 | - Security::clear_token(); |
|
167 | - } |
|
165 | + } |
|
166 | + Security::clear_token(); |
|
167 | + } |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $form = new FormValidator('advanced_search','get'); |
171 | 171 | $form->addText('keyword_username',get_lang('LoginName'),false); |
172 | 172 | if (api_is_western_name_order()) |
173 | 173 | { |
174 | - $form->addText('keyword_firstname', get_lang('FirstName'), false); |
|
175 | - $form->addText('keyword_lastname', get_lang('LastName'), false); |
|
174 | + $form->addText('keyword_firstname', get_lang('FirstName'), false); |
|
175 | + $form->addText('keyword_lastname', get_lang('LastName'), false); |
|
176 | 176 | } |
177 | 177 | else |
178 | 178 | { |
179 | - $form->addText('keyword_lastname',get_lang('LastName'),false); |
|
180 | - $form->addText('keyword_firstname',get_lang('FirstName'),false); |
|
179 | + $form->addText('keyword_lastname',get_lang('LastName'),false); |
|
180 | + $form->addText('keyword_firstname',get_lang('FirstName'),false); |
|
181 | 181 | } |
182 | 182 | if (isset($_GET['id_session'])) |
183 | - $form->addElement('hidden','id_session',$_GET['id_session']); |
|
183 | + $form->addElement('hidden','id_session',$_GET['id_session']); |
|
184 | 184 | |
185 | 185 | $type = array(); |
186 | 186 | $type["all"] = get_lang('All'); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $parameters['keyword_lastname'] = @$_GET['keyword_lastname'] ?: null; |
203 | 203 | $parameters['keyword_email'] = @$_GET['keyword_email'] ?: null; |
204 | 204 | if (isset($_GET['id_session'])) |
205 | - $parameters['id_session'] = $_GET['id_session']; |
|
205 | + $parameters['id_session'] = $_GET['id_session']; |
|
206 | 206 | // Create a sortable table with user-data |
207 | 207 | |
208 | 208 | $parameters['sec_token'] = Security::get_token(); |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | $table->set_header(1, get_lang('LoginName')); |
213 | 213 | if (api_is_western_name_order()) |
214 | 214 | { |
215 | - $table->set_header(2, get_lang('FirstName')); |
|
216 | - $table->set_header(3, get_lang('LastName')); |
|
215 | + $table->set_header(2, get_lang('FirstName')); |
|
216 | + $table->set_header(3, get_lang('LastName')); |
|
217 | 217 | } |
218 | 218 | else |
219 | 219 | { |
220 | - $table->set_header(2, get_lang('LastName')); |
|
221 | - $table->set_header(3, get_lang('FirstName')); |
|
220 | + $table->set_header(2, get_lang('LastName')); |
|
221 | + $table->set_header(3, get_lang('FirstName')); |
|
222 | 222 | } |
223 | 223 | $table->set_header(4, get_lang('Email')); |
224 | 224 | $table->set_header(5, get_lang('Actions')); |
@@ -6,47 +6,47 @@ discard block |
||
6 | 6 | */ |
7 | 7 | class AddCourseToSession |
8 | 8 | { |
9 | - /** |
|
10 | - * Searches a course, given a search string and a type of search box |
|
11 | - * @param string $needle Search string |
|
12 | - * @param string $type Type of search box ('single' or anything else) |
|
13 | - * @return xajaxResponse XajaxResponse |
|
14 | - * @assert ('abc', 'single') !== null |
|
15 | - * @assert ('abc', 'multiple') !== null |
|
16 | - */ |
|
17 | - public static function search_courses($needle, $type) |
|
18 | - { |
|
19 | - global $tbl_session_rel_course, $id_session; |
|
9 | + /** |
|
10 | + * Searches a course, given a search string and a type of search box |
|
11 | + * @param string $needle Search string |
|
12 | + * @param string $type Type of search box ('single' or anything else) |
|
13 | + * @return xajaxResponse XajaxResponse |
|
14 | + * @assert ('abc', 'single') !== null |
|
15 | + * @assert ('abc', 'multiple') !== null |
|
16 | + */ |
|
17 | + public static function search_courses($needle, $type) |
|
18 | + { |
|
19 | + global $tbl_session_rel_course, $id_session; |
|
20 | 20 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
21 | - $course_title = null; |
|
22 | - $xajax_response = new xajaxResponse(); |
|
23 | - $return = ''; |
|
24 | - if(!empty($needle) && !empty($type)) { |
|
25 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
26 | - $charset = api_get_system_encoding(); |
|
27 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
21 | + $course_title = null; |
|
22 | + $xajax_response = new xajaxResponse(); |
|
23 | + $return = ''; |
|
24 | + if(!empty($needle) && !empty($type)) { |
|
25 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
26 | + $charset = api_get_system_encoding(); |
|
27 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
28 | 28 | |
29 | - $cond_course_code = ''; |
|
30 | - if (!empty($id_session)) { |
|
31 | - $id_session = intval($id_session); |
|
32 | - // check course_code from session_rel_course table |
|
33 | - $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
29 | + $cond_course_code = ''; |
|
30 | + if (!empty($id_session)) { |
|
31 | + $id_session = intval($id_session); |
|
32 | + // check course_code from session_rel_course table |
|
33 | + $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
34 | 34 | WHERE session_id = '.$id_session; |
35 | - $res = Database::query($sql); |
|
36 | - $course_codes = ''; |
|
37 | - if (Database::num_rows($res) > 0) { |
|
38 | - while ($row = Database::fetch_row($res)) { |
|
39 | - $course_codes .= '\''.$row[0].'\','; |
|
40 | - } |
|
41 | - $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
35 | + $res = Database::query($sql); |
|
36 | + $course_codes = ''; |
|
37 | + if (Database::num_rows($res) > 0) { |
|
38 | + while ($row = Database::fetch_row($res)) { |
|
39 | + $course_codes .= '\''.$row[0].'\','; |
|
40 | + } |
|
41 | + $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
42 | 42 | |
43 | - $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
44 | - } |
|
45 | - } |
|
43 | + $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | 47 | if ($type == 'single') { |
48 | - // search users where username or firstname or lastname begins likes $needle |
|
49 | - $sql = 'SELECT |
|
48 | + // search users where username or firstname or lastname begins likes $needle |
|
49 | + $sql = 'SELECT |
|
50 | 50 | course.id, |
51 | 51 | course.visual_code, |
52 | 52 | course.title, |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | WHERE |
59 | 59 | course.visual_code LIKE "'.$needle.'%" OR |
60 | 60 | course.title LIKE "'.$needle.'%"'; |
61 | - } else { |
|
61 | + } else { |
|
62 | 62 | $sql = 'SELECT course.id, course.visual_code, course.title |
63 | 63 | FROM '.$tbl_course.' course |
64 | 64 | WHERE |
65 | 65 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
66 | 66 | ORDER BY course.code '; |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - if (api_is_multiple_url_enabled()) { |
|
70 | - $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
71 | - $access_url_id = api_get_current_access_url_id(); |
|
72 | - if ($access_url_id != -1){ |
|
69 | + if (api_is_multiple_url_enabled()) { |
|
70 | + $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
71 | + $access_url_id = api_get_current_access_url_id(); |
|
72 | + if ($access_url_id != -1){ |
|
73 | 73 | |
74 | - if ($type=='single') { |
|
75 | - $sql = 'SELECT |
|
74 | + if ($type=='single') { |
|
75 | + $sql = 'SELECT |
|
76 | 76 | course.id, |
77 | 77 | course.visual_code, |
78 | 78 | course.title, |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | access_url_id = '.$access_url_id.' AND |
88 | 88 | (course.visual_code LIKE "'.$needle.'%" OR |
89 | 89 | course.title LIKE "'.$needle.'%" )'; |
90 | - } else { |
|
90 | + } else { |
|
91 | 91 | $sql = 'SELECT course.id, course.visual_code, course.title |
92 | 92 | FROM '.$tbl_course.' course, '.$tbl_course_rel_access_url.' url_course |
93 | 93 | WHERE |
@@ -95,32 +95,32 @@ discard block |
||
95 | 95 | access_url_id = '.$access_url_id.' AND |
96 | 96 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
97 | 97 | ORDER BY course.code '; |
98 | - } |
|
99 | - } |
|
100 | - } |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - $rs = Database::query($sql); |
|
103 | - $course_list = array(); |
|
102 | + $rs = Database::query($sql); |
|
103 | + $course_list = array(); |
|
104 | 104 | if ($type == 'single') { |
105 | - while ($course = Database :: fetch_array($rs)) { |
|
106 | - $course_list[] = $course['code']; |
|
107 | - $course_title=str_replace("'","\'",$course_title); |
|
105 | + while ($course = Database :: fetch_array($rs)) { |
|
106 | + $course_list[] = $course['code']; |
|
107 | + $course_title=str_replace("'","\'",$course_title); |
|
108 | 108 | $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['id'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />'; |
109 | - } |
|
110 | - $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | - } else { |
|
112 | - $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
113 | - while($course = Database :: fetch_array($rs)) { |
|
114 | - $course_list[] = $course['code']; |
|
115 | - $course_title=str_replace("'","\'",$course_title); |
|
109 | + } |
|
110 | + $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | + } else { |
|
112 | + $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
113 | + while($course = Database :: fetch_array($rs)) { |
|
114 | + $course_list[] = $course['code']; |
|
115 | + $course_title=str_replace("'","\'",$course_title); |
|
116 | 116 | $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
117 | - } |
|
118 | - $return .= '</select>'; |
|
119 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
120 | - } |
|
121 | - } |
|
122 | - $_SESSION['course_list'] = $course_list; |
|
117 | + } |
|
118 | + $return .= '</select>'; |
|
119 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
120 | + } |
|
121 | + } |
|
122 | + $_SESSION['course_list'] = $course_list; |
|
123 | 123 | |
124 | - return $xajax_response; |
|
125 | - } |
|
124 | + return $xajax_response; |
|
125 | + } |
|
126 | 126 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | if (!$is_allowedToEdit) { |
47 | - // api_not_allowed(); |
|
47 | + // api_not_allowed(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if (!empty($_REQUEST['path'])) { |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | get_lang('Actions') |
190 | 190 | ); |
191 | 191 | |
192 | - // Column config |
|
193 | - // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
|
192 | + // Column config |
|
193 | + // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
|
194 | 194 | $column_model = array( |
195 | 195 | array('name' => 'firstname', 'index' => 'firstname', 'width' => '50', 'align' => 'left', 'search' => 'false'), |
196 | 196 | array( |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | $sublanguage_folder_error = false; |
67 | 67 | |
68 | 68 | if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) { |
69 | - $language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['id']); |
|
70 | - $sub_language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']); |
|
71 | - $all_data_of_language = SubLanguageManager::get_all_information_of_language($_GET['id']); |
|
72 | - $all_data_of_sublanguage = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']); |
|
73 | - $sub_language_file = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder']; |
|
69 | + $language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['id']); |
|
70 | + $sub_language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']); |
|
71 | + $all_data_of_language = SubLanguageManager::get_all_information_of_language($_GET['id']); |
|
72 | + $all_data_of_sublanguage = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']); |
|
73 | + $sub_language_file = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder']; |
|
74 | 74 | |
75 | - if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) { |
|
76 | - $sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable'); |
|
77 | - } |
|
78 | - if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) { |
|
79 | - $language_id_exist = true; |
|
80 | - } else { |
|
81 | - $language_id_exist = false; |
|
82 | - } |
|
75 | + if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) { |
|
76 | + $sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable'); |
|
77 | + } |
|
78 | + if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) { |
|
79 | + $language_id_exist = true; |
|
80 | + } else { |
|
81 | + $language_id_exist = false; |
|
82 | + } |
|
83 | 83 | } else { |
84 | - $language_name=''; |
|
85 | - $language_id_exist=false; |
|
84 | + $language_name=''; |
|
85 | + $language_id_exist=false; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $intro = sprintf(get_lang('RegisterTermsOfSubLanguageForX'), strtolower($sub_language_name)); |
89 | 89 | $path_folder = api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder']; |
90 | 90 | |
91 | 91 | if (!is_dir($path_folder) || strlen($all_data_of_language['dokeos_folder'])==0) { |
92 | - api_not_allowed(true); |
|
92 | + api_not_allowed(true); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | Display :: display_header($language_name); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | echo $html; |
115 | 115 | echo '<br /><br /><br />'; |
116 | 116 | if (!empty($sublanguage_folder_error)) { |
117 | - Display::display_warning_message($sublanguage_folder_error); |
|
117 | + Display::display_warning_message($sublanguage_folder_error); |
|
118 | 118 | } |
119 | 119 | echo '<div id="div_message_information_id"> </div>'; |
120 | 120 | |
@@ -128,186 +128,186 @@ discard block |
||
128 | 128 | * @return array |
129 | 129 | */ |
130 | 130 | function search_language_term( |
131 | - $term, |
|
132 | - $search_in_variable = true, |
|
133 | - $search_in_english = true, |
|
134 | - $search_in_parent = true, |
|
135 | - $search_in_sub_language = true |
|
131 | + $term, |
|
132 | + $search_in_variable = true, |
|
133 | + $search_in_english = true, |
|
134 | + $search_in_parent = true, |
|
135 | + $search_in_sub_language = true |
|
136 | 136 | ) { |
137 | - //These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION) |
|
138 | - /* |
|
137 | + //These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION) |
|
138 | + /* |
|
139 | 139 | These 4 arrays are set in global.inc.php with the condition that will be load from sub_language.php or sub_language_ajax.inc.php |
140 | 140 | $english_language_array |
141 | 141 | $parent_language_array |
142 | 142 | $sub_language_array |
143 | 143 | $language_files_to_load |
144 | 144 | */ |
145 | - global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array; |
|
146 | - $language_files_to_load_keys = array_flip($language_files_to_load); |
|
147 | - $array_to_search = $parent_language_array; |
|
148 | - $list_info = array(); |
|
149 | - $term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i'; |
|
150 | - //@todo optimize this foreach |
|
151 | - foreach ($language_files_to_load as $lang_file) { |
|
152 | - //searching in parent language of the sub language |
|
153 | - if ($search_in_parent) { |
|
154 | - $variables = $parent_language_array[$lang_file]; |
|
155 | - foreach ($variables as $parent_name_variable =>$parent_variable_value) { |
|
156 | - //arrays are avoided |
|
157 | - if (is_array($parent_variable_value)) { |
|
158 | - continue; |
|
159 | - } |
|
160 | - $founded = false; |
|
161 | - // searching the item in the parent tool |
|
162 | - if (preg_match($term,$parent_variable_value)!==0) { |
|
163 | - $founded = true; |
|
164 | - } |
|
165 | - if ($founded) { |
|
166 | - //loading variable from the english array |
|
167 | - $sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable]; |
|
168 | - //loading variable from the english array |
|
169 | - $english_name_variable = $english_language_array[$lang_file][$parent_name_variable]; |
|
145 | + global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array; |
|
146 | + $language_files_to_load_keys = array_flip($language_files_to_load); |
|
147 | + $array_to_search = $parent_language_array; |
|
148 | + $list_info = array(); |
|
149 | + $term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i'; |
|
150 | + //@todo optimize this foreach |
|
151 | + foreach ($language_files_to_load as $lang_file) { |
|
152 | + //searching in parent language of the sub language |
|
153 | + if ($search_in_parent) { |
|
154 | + $variables = $parent_language_array[$lang_file]; |
|
155 | + foreach ($variables as $parent_name_variable =>$parent_variable_value) { |
|
156 | + //arrays are avoided |
|
157 | + if (is_array($parent_variable_value)) { |
|
158 | + continue; |
|
159 | + } |
|
160 | + $founded = false; |
|
161 | + // searching the item in the parent tool |
|
162 | + if (preg_match($term,$parent_variable_value)!==0) { |
|
163 | + $founded = true; |
|
164 | + } |
|
165 | + if ($founded) { |
|
166 | + //loading variable from the english array |
|
167 | + $sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable]; |
|
168 | + //loading variable from the english array |
|
169 | + $english_name_variable = $english_language_array[$lang_file][$parent_name_variable]; |
|
170 | 170 | |
171 | - //config buttons |
|
172 | - /*if (strlen($english_name_variable)>1500) { |
|
171 | + //config buttons |
|
172 | + /*if (strlen($english_name_variable)>1500) { |
|
173 | 173 | $size =20; |
174 | 174 | } else { |
175 | 175 | $size =4; |
176 | 176 | }*/ |
177 | 177 | |
178 | - $obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
179 | - $obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'" />'.get_lang('Save').'</button>'; |
|
178 | + $obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
179 | + $obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'" />'.get_lang('Save').'</button>'; |
|
180 | 180 | |
181 | - $list_info[] = array( |
|
182 | - $lang_file . '.inc.php', |
|
183 | - $parent_name_variable, |
|
184 | - $english_name_variable, |
|
185 | - $parent_variable_value, |
|
186 | - $obj_text, |
|
187 | - $obj_button |
|
188 | - ); |
|
189 | - } |
|
190 | - } |
|
191 | - } |
|
181 | + $list_info[] = array( |
|
182 | + $lang_file . '.inc.php', |
|
183 | + $parent_name_variable, |
|
184 | + $english_name_variable, |
|
185 | + $parent_variable_value, |
|
186 | + $obj_text, |
|
187 | + $obj_button |
|
188 | + ); |
|
189 | + } |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | - //search in english |
|
194 | - if ($search_in_english || $search_in_variable) { |
|
195 | - $variables = $english_language_array[$lang_file]; |
|
196 | - foreach ($variables as $name_variable =>$variable_value) { |
|
197 | - if (is_array($variable_value)) { |
|
198 | - continue; |
|
199 | - } |
|
193 | + //search in english |
|
194 | + if ($search_in_english || $search_in_variable) { |
|
195 | + $variables = $english_language_array[$lang_file]; |
|
196 | + foreach ($variables as $name_variable =>$variable_value) { |
|
197 | + if (is_array($variable_value)) { |
|
198 | + continue; |
|
199 | + } |
|
200 | 200 | |
201 | - if (is_array($variable_value)) |
|
202 | - echo $lang_file; |
|
203 | - $founded = false; |
|
204 | - if ($search_in_english && $search_in_variable) { |
|
205 | - // searching the item in the parent tool |
|
206 | - if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) { |
|
207 | - $founded = true; |
|
208 | - } |
|
209 | - } else { |
|
210 | - if ($search_in_english) { |
|
211 | - if (preg_match($term,$variable_value)!==0) { |
|
212 | - $founded = true; |
|
213 | - } |
|
214 | - } else { |
|
215 | - if (preg_match($term,$name_variable)!==0) { |
|
216 | - $founded = true; |
|
217 | - } |
|
218 | - } |
|
219 | - } |
|
201 | + if (is_array($variable_value)) |
|
202 | + echo $lang_file; |
|
203 | + $founded = false; |
|
204 | + if ($search_in_english && $search_in_variable) { |
|
205 | + // searching the item in the parent tool |
|
206 | + if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) { |
|
207 | + $founded = true; |
|
208 | + } |
|
209 | + } else { |
|
210 | + if ($search_in_english) { |
|
211 | + if (preg_match($term,$variable_value)!==0) { |
|
212 | + $founded = true; |
|
213 | + } |
|
214 | + } else { |
|
215 | + if (preg_match($term,$name_variable)!==0) { |
|
216 | + $founded = true; |
|
217 | + } |
|
218 | + } |
|
219 | + } |
|
220 | 220 | |
221 | - if ($founded) { |
|
222 | - //loading variable from the english array |
|
223 | - $sub_language_name_variable = null; |
|
224 | - if (isset($sub_language_array[$lang_file][$name_variable])) { |
|
225 | - $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
226 | - } |
|
227 | - $parent_variable_value = null; |
|
228 | - if (isset($parent_language_array[$lang_file][$name_variable])) { |
|
229 | - $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
230 | - } |
|
231 | - //config buttons |
|
232 | - $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'. |
|
233 | - $sub_language_name_variable.' |
|
221 | + if ($founded) { |
|
222 | + //loading variable from the english array |
|
223 | + $sub_language_name_variable = null; |
|
224 | + if (isset($sub_language_array[$lang_file][$name_variable])) { |
|
225 | + $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
226 | + } |
|
227 | + $parent_variable_value = null; |
|
228 | + if (isset($parent_language_array[$lang_file][$name_variable])) { |
|
229 | + $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
230 | + } |
|
231 | + //config buttons |
|
232 | + $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'. |
|
233 | + $sub_language_name_variable.' |
|
234 | 234 | </textarea>'; |
235 | - $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
235 | + $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
236 | 236 | |
237 | - //loading variable from the english array |
|
238 | - $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
237 | + //loading variable from the english array |
|
238 | + $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
239 | 239 | |
240 | - $list_info[] = array( |
|
241 | - $lang_file . '.inc.php', |
|
242 | - $name_variable, |
|
243 | - $english_name_variable, |
|
244 | - $parent_variable_value, |
|
245 | - $obj_text, |
|
246 | - $obj_button |
|
247 | - ); |
|
248 | - } |
|
249 | - } |
|
250 | - } |
|
240 | + $list_info[] = array( |
|
241 | + $lang_file . '.inc.php', |
|
242 | + $name_variable, |
|
243 | + $english_name_variable, |
|
244 | + $parent_variable_value, |
|
245 | + $obj_text, |
|
246 | + $obj_button |
|
247 | + ); |
|
248 | + } |
|
249 | + } |
|
250 | + } |
|
251 | 251 | |
252 | - // Search in sub language |
|
253 | - if ($search_in_sub_language) { |
|
254 | - $variables = $sub_language_array[$lang_file]; |
|
255 | - foreach ($variables as $name_variable =>$variable_value) { |
|
256 | - if (is_array($parent_variable_value)) { |
|
257 | - continue; |
|
258 | - } |
|
252 | + // Search in sub language |
|
253 | + if ($search_in_sub_language) { |
|
254 | + $variables = $sub_language_array[$lang_file]; |
|
255 | + foreach ($variables as $name_variable =>$variable_value) { |
|
256 | + if (is_array($parent_variable_value)) { |
|
257 | + continue; |
|
258 | + } |
|
259 | 259 | |
260 | - if (is_array($variable_value)) { |
|
261 | - continue; |
|
262 | - } |
|
260 | + if (is_array($variable_value)) { |
|
261 | + continue; |
|
262 | + } |
|
263 | 263 | |
264 | - $founded = false; |
|
265 | - // searching the item in the parent tool |
|
266 | - if (preg_match($term,$variable_value)!==0) { |
|
267 | - $founded = true; |
|
268 | - } |
|
269 | - if ($founded) { |
|
270 | - //loading variable from the english array |
|
271 | - $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
272 | - $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
273 | - //config buttons |
|
274 | - $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
275 | - $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
264 | + $founded = false; |
|
265 | + // searching the item in the parent tool |
|
266 | + if (preg_match($term,$variable_value)!==0) { |
|
267 | + $founded = true; |
|
268 | + } |
|
269 | + if ($founded) { |
|
270 | + //loading variable from the english array |
|
271 | + $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
272 | + $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
273 | + //config buttons |
|
274 | + $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
275 | + $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
276 | 276 | |
277 | - //loading variable from the english array |
|
278 | - $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
279 | - $list_info[]=array($lang_file.'.inc.php', |
|
280 | - $name_variable, |
|
281 | - $english_name_variable, |
|
282 | - $parent_variable_value,$obj_text,$obj_button); |
|
283 | - } |
|
284 | - } |
|
285 | - } |
|
286 | - } |
|
277 | + //loading variable from the english array |
|
278 | + $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
279 | + $list_info[]=array($lang_file.'.inc.php', |
|
280 | + $name_variable, |
|
281 | + $english_name_variable, |
|
282 | + $parent_variable_value,$obj_text,$obj_button); |
|
283 | + } |
|
284 | + } |
|
285 | + } |
|
286 | + } |
|
287 | 287 | |
288 | - $list_info = array_unique_dimensional($list_info); |
|
289 | - return $list_info; |
|
288 | + $list_info = array_unique_dimensional($list_info); |
|
289 | + return $list_info; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | // Allow see data in sort table |
293 | 293 | $list_info = array(); |
294 | 294 | if (isset($_REQUEST['txt_search_word'])) { |
295 | - //@todo fix to accept a char with 1 char |
|
296 | - if (strlen(trim($_REQUEST['txt_search_word']))>2) { |
|
297 | - $list_info = search_language_term( |
|
298 | - $_REQUEST['txt_search_word'], |
|
299 | - true, |
|
300 | - true, |
|
301 | - true, |
|
302 | - true |
|
303 | - ); |
|
304 | - } |
|
295 | + //@todo fix to accept a char with 1 char |
|
296 | + if (strlen(trim($_REQUEST['txt_search_word']))>2) { |
|
297 | + $list_info = search_language_term( |
|
298 | + $_REQUEST['txt_search_word'], |
|
299 | + true, |
|
300 | + true, |
|
301 | + true, |
|
302 | + true |
|
303 | + ); |
|
304 | + } |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | $parameters = array( |
308 | - 'id' => intval($_GET['id']), |
|
309 | - 'sub_language_id' => intval($_GET['sub_language_id']), |
|
310 | - 'txt_search_word' => $txt_search_word |
|
308 | + 'id' => intval($_GET['id']), |
|
309 | + 'sub_language_id' => intval($_GET['sub_language_id']), |
|
310 | + 'txt_search_word' => $txt_search_word |
|
311 | 311 | ); |
312 | 312 | $table = new SortableTableFromArrayConfig($list_info, 1,20,'data_info'); |
313 | 313 | $table->set_additional_parameters($parameters); |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | $form = new FormValidator('user_add'); |
100 | 100 | $form->addElement('header', '', $tool_name); |
101 | 101 | if (api_is_western_name_order()) { |
102 | - // Firstname |
|
103 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
104 | - $form->applyFilter('firstname', 'html_filter'); |
|
105 | - $form->applyFilter('firstname', 'trim'); |
|
106 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
107 | - // Lastname |
|
108 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
109 | - $form->applyFilter('lastname', 'html_filter'); |
|
110 | - $form->applyFilter('lastname', 'trim'); |
|
111 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
102 | + // Firstname |
|
103 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
104 | + $form->applyFilter('firstname', 'html_filter'); |
|
105 | + $form->applyFilter('firstname', 'trim'); |
|
106 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
107 | + // Lastname |
|
108 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
109 | + $form->applyFilter('lastname', 'html_filter'); |
|
110 | + $form->applyFilter('lastname', 'trim'); |
|
111 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
112 | 112 | } else { |
113 | - // Lastname |
|
114 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
115 | - $form->applyFilter('lastname', 'html_filter'); |
|
116 | - $form->applyFilter('lastname', 'trim'); |
|
117 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
118 | - // Firstname |
|
119 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
120 | - $form->applyFilter('firstname', 'html_filter'); |
|
121 | - $form->applyFilter('firstname', 'trim'); |
|
122 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
113 | + // Lastname |
|
114 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
115 | + $form->applyFilter('lastname', 'html_filter'); |
|
116 | + $form->applyFilter('lastname', 'trim'); |
|
117 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
118 | + // Firstname |
|
119 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
120 | + $form->applyFilter('firstname', 'html_filter'); |
|
121 | + $form->applyFilter('firstname', 'trim'); |
|
122 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
123 | 123 | } |
124 | 124 | // Official code |
125 | 125 | $form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40')); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $auth_sources = 0; //make available wider as we need it in case of form reset (see below) |
164 | 164 | $nb_ext_auth_source_added = 0; |
165 | 165 | if (isset($extAuthSource) && count($extAuthSource) > 0) { |
166 | - $auth_sources = array(); |
|
166 | + $auth_sources = array(); |
|
167 | 167 | foreach ($extAuthSource as $key => $info) { |
168 | 168 | // @todo : make uniform external authentification configuration (ex : cas and external_login ldap) |
169 | 169 | // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $nb_ext_auth_source_added++; |
175 | 175 | } |
176 | 176 | } |
177 | - if ($nb_ext_auth_source_added > 0) { |
|
178 | - $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2); |
|
179 | - $group[] = $form->createElement('select', 'auth_source', null, $auth_sources); |
|
180 | - $group[] = $form->createElement('static', '', '', '<br />'); |
|
177 | + if ($nb_ext_auth_source_added > 0) { |
|
178 | + $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2); |
|
179 | + $group[] = $form->createElement('select', 'auth_source', null, $auth_sources); |
|
180 | + $group[] = $form->createElement('static', '', '', '<br />'); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">'); |
247 | 247 | |
248 | 248 | if (isset($drh_list) && is_array($drh_list)) { |
249 | - foreach ($drh_list as $drh) { |
|
249 | + foreach ($drh_list as $drh) { |
|
250 | 250 | $drh_select->addOption( |
251 | 251 | api_get_person_name($drh['firstname'], $drh['lastname']), |
252 | 252 | $drh['user_id'] |
253 | 253 | ); |
254 | - } |
|
254 | + } |
|
255 | 255 | } |
256 | 256 | $form->addElement('html', '</div>'); |
257 | 257 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | // Validate form |
327 | 327 | if ($form->validate()) { |
328 | - $check = Security::check_token('post'); |
|
328 | + $check = Security::check_token('post'); |
|
329 | 329 | if ($check) { |
330 | 330 | $user = $form->exportValues(); |
331 | 331 | $lastname = $user['lastname']; |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | $send_mail = intval($user['mail']['send_mail']); |
342 | 342 | $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : 0; |
343 | 343 | |
344 | - if (isset($extAuthSource) && count($extAuthSource) > 0 && |
|
344 | + if (isset($extAuthSource) && count($extAuthSource) > 0 && |
|
345 | 345 | $user['password']['password_auto'] == '2' |
346 | 346 | ) { |
347 | - $auth_source = $user['password']['auth_source']; |
|
348 | - $password = 'PLACEHOLDER'; |
|
349 | - } else { |
|
350 | - $auth_source = PLATFORM_AUTH_SOURCE; |
|
351 | - $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
352 | - } |
|
347 | + $auth_source = $user['password']['auth_source']; |
|
348 | + $password = 'PLACEHOLDER'; |
|
349 | + } else { |
|
350 | + $auth_source = PLATFORM_AUTH_SOURCE; |
|
351 | + $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
352 | + } |
|
353 | 353 | |
354 | 354 | if ($user['radio_expiration_date'] == '1') { |
355 | 355 | $expiration_date = $user['expiration_date']; |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $expiration_date = null; |
358 | 358 | } |
359 | 359 | |
360 | - $active = intval($user['active']); |
|
360 | + $active = intval($user['active']); |
|
361 | 361 | |
362 | 362 | if (api_get_setting('login_is_email') == 'true') { |
363 | 363 | $username = $email; |
@@ -388,12 +388,12 @@ discard block |
||
388 | 388 | $extra, |
389 | 389 | null, |
390 | 390 | $send_mail, |
391 | - $platform_admin |
|
391 | + $platform_admin |
|
392 | 392 | ); |
393 | 393 | |
394 | - Security::clear_token(); |
|
395 | - $tok = Security::get_token(); |
|
396 | - if (!empty($user_id)) { |
|
394 | + Security::clear_token(); |
|
395 | + $tok = Security::get_token(); |
|
396 | + if (!empty($user_id)) { |
|
397 | 397 | if (!empty($picture['name'])) { |
398 | 398 | $picture_uri = UserManager::update_user_picture( |
399 | 399 | $user_id, |
@@ -420,37 +420,37 @@ discard block |
||
420 | 420 | null, |
421 | 421 | $language |
422 | 422 | ); |
423 | - } |
|
423 | + } |
|
424 | 424 | |
425 | 425 | $extraFieldValues = new ExtraFieldValue('user'); |
426 | 426 | $user['item_id'] = $user_id; |
427 | 427 | $extraFieldValues->saveFieldValues($user); |
428 | - $message = get_lang('UserAdded'); |
|
429 | - } |
|
428 | + $message = get_lang('UserAdded'); |
|
429 | + } |
|
430 | 430 | |
431 | - if (isset($user['submit_plus'])) { |
|
432 | - //we want to add more. Prepare report message and redirect to the same page (to clean the form) |
|
431 | + if (isset($user['submit_plus'])) { |
|
432 | + //we want to add more. Prepare report message and redirect to the same page (to clean the form) |
|
433 | 433 | Display::addFlash(Display::return_message($message)); |
434 | - header('Location: user_add.php?sec_token='.$tok); |
|
435 | - exit; |
|
436 | - } else { |
|
437 | - $tok = Security::get_token(); |
|
434 | + header('Location: user_add.php?sec_token='.$tok); |
|
435 | + exit; |
|
436 | + } else { |
|
437 | + $tok = Security::get_token(); |
|
438 | 438 | Display::addFlash(Display::return_message($message)); |
439 | - header('Location: user_list.php?sec_token='.$tok); |
|
440 | - exit; |
|
441 | - } |
|
442 | - } |
|
439 | + header('Location: user_list.php?sec_token='.$tok); |
|
440 | + exit; |
|
441 | + } |
|
442 | + } |
|
443 | 443 | } else { |
444 | - if (isset($_POST['submit'])) { |
|
445 | - Security::clear_token(); |
|
446 | - } |
|
447 | - $token = Security::get_token(); |
|
448 | - $form->addElement('hidden', 'sec_token'); |
|
449 | - $form->setConstants(array('sec_token' => $token)); |
|
444 | + if (isset($_POST['submit'])) { |
|
445 | + Security::clear_token(); |
|
446 | + } |
|
447 | + $token = Security::get_token(); |
|
448 | + $form->addElement('hidden', 'sec_token'); |
|
449 | + $form->setConstants(array('sec_token' => $token)); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | if (!empty($message)){ |
453 | - $message = Display::return_message(stripslashes($message)); |
|
453 | + $message = Display::return_message(stripslashes($message)); |
|
454 | 454 | } |
455 | 455 | $content = $form->returnForm(); |
456 | 456 |