@@ -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); |
@@ -93,27 +93,27 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - /** |
|
97 | - * Gets the data of a Term and condition by language |
|
98 | - * @param int $language language id |
|
99 | - * @return array all the info of a Term and condition |
|
100 | - */ |
|
101 | - public static function get_last_condition($language) |
|
96 | + /** |
|
97 | + * Gets the data of a Term and condition by language |
|
98 | + * @param int $language language id |
|
99 | + * @return array all the info of a Term and condition |
|
100 | + */ |
|
101 | + public static function get_last_condition($language) |
|
102 | 102 | { |
103 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
104 | - $language= Database::escape_string($language); |
|
105 | - $sql = "SELECT * FROM $legal_conditions_table |
|
103 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
104 | + $language= Database::escape_string($language); |
|
105 | + $sql = "SELECT * FROM $legal_conditions_table |
|
106 | 106 | WHERE language_id = '".$language."' |
107 | 107 | ORDER BY version DESC |
108 | 108 | LIMIT 1 "; |
109 | - $result = Database::query($sql); |
|
110 | - $result = Database::fetch_array($result, 'ASSOC'); |
|
109 | + $result = Database::query($sql); |
|
110 | + $result = Database::fetch_array($result, 'ASSOC'); |
|
111 | 111 | |
112 | 112 | if (isset($result['content'])) { |
113 | 113 | $result['content'] = self::replaceTags($result['content']); |
114 | 114 | } |
115 | 115 | return $result; |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * @param string $content |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | return $content; |
138 | 138 | } |
139 | 139 | |
140 | - /** |
|
141 | - * Gets the last version of a Term and condition by language |
|
142 | - * @param int $language language id |
|
143 | - * @return boolean | int the version or false if does not exist |
|
144 | - */ |
|
145 | - public static function get_last_version($language) |
|
140 | + /** |
|
141 | + * Gets the last version of a Term and condition by language |
|
142 | + * @param int $language language id |
|
143 | + * @return boolean | int the version or false if does not exist |
|
144 | + */ |
|
145 | + public static function get_last_version($language) |
|
146 | 146 | { |
147 | 147 | $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
148 | 148 | $language = intval($language); |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | |
161 | 161 | return false; |
162 | 162 | } |
163 | - } |
|
163 | + } |
|
164 | 164 | |
165 | - /** |
|
166 | - * Show the last condition |
|
167 | - * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
165 | + /** |
|
166 | + * Show the last condition |
|
167 | + * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
168 | 168 | * |
169 | - * @return string html preview |
|
170 | - */ |
|
171 | - public static function show_last_condition($term_preview) |
|
169 | + * @return string html preview |
|
170 | + */ |
|
171 | + public static function show_last_condition($term_preview) |
|
172 | 172 | { |
173 | 173 | $preview = ''; |
174 | 174 | switch ($term_preview['type']) { |
@@ -199,34 +199,34 @@ discard block |
||
199 | 199 | break; |
200 | 200 | } |
201 | 201 | |
202 | - return $preview; |
|
203 | - } |
|
202 | + return $preview; |
|
203 | + } |
|
204 | 204 | |
205 | - /** |
|
206 | - * Get the terms and condition table (only for maintenance) |
|
207 | - * @param int $from |
|
208 | - * @param int $number_of_items |
|
209 | - * @param int $column |
|
210 | - * @return array |
|
211 | - */ |
|
212 | - public static function get_legal_data($from, $number_of_items, $column) |
|
205 | + /** |
|
206 | + * Get the terms and condition table (only for maintenance) |
|
207 | + * @param int $from |
|
208 | + * @param int $number_of_items |
|
209 | + * @param int $column |
|
210 | + * @return array |
|
211 | + */ |
|
212 | + public static function get_legal_data($from, $number_of_items, $column) |
|
213 | 213 | { |
214 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
215 | - $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
216 | - $from = intval($from); |
|
217 | - $number_of_items = intval($number_of_items); |
|
218 | - $column = intval($column); |
|
214 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
215 | + $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
216 | + $from = intval($from); |
|
217 | + $number_of_items = intval($number_of_items); |
|
218 | + $column = intval($column); |
|
219 | 219 | |
220 | - $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
220 | + $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
221 | 221 | FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) "; |
222 | - $sql .= "ORDER BY language, version ASC "; |
|
223 | - $sql .= "LIMIT $from, $number_of_items "; |
|
222 | + $sql .= "ORDER BY language, version ASC "; |
|
223 | + $sql .= "LIMIT $from, $number_of_items "; |
|
224 | 224 | |
225 | - $result = Database::query($sql); |
|
226 | - $legals = array(); |
|
227 | - while ($legal = Database::fetch_array($result)) { |
|
228 | - // max 2000 chars |
|
229 | - $languages[] = $legal[1]; |
|
225 | + $result = Database::query($sql); |
|
226 | + $legals = array(); |
|
227 | + while ($legal = Database::fetch_array($result)) { |
|
228 | + // max 2000 chars |
|
229 | + $languages[] = $legal[1]; |
|
230 | 230 | if (strlen($legal[2]) > 2000) { |
231 | 231 | $legal[2] = substr($legal[2], 0, 2000).' ... '; |
232 | 232 | } |
@@ -235,51 +235,51 @@ discard block |
||
235 | 235 | } elseif ($legal[4] == 1) { |
236 | 236 | $legal[4] = get_lang('PageLink'); |
237 | 237 | } |
238 | - $legals[] = $legal; |
|
239 | - } |
|
238 | + $legals[] = $legal; |
|
239 | + } |
|
240 | 240 | |
241 | - return $legals; |
|
242 | - } |
|
241 | + return $legals; |
|
242 | + } |
|
243 | 243 | |
244 | - /** |
|
245 | - * Gets the number of terms and conditions available |
|
246 | - * @return int |
|
247 | - */ |
|
248 | - public static function count() |
|
244 | + /** |
|
245 | + * Gets the number of terms and conditions available |
|
246 | + * @return int |
|
247 | + */ |
|
248 | + public static function count() |
|
249 | 249 | { |
250 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
251 | - $sql = "SELECT count(*) as count_result |
|
250 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
251 | + $sql = "SELECT count(*) as count_result |
|
252 | 252 | FROM $legal_conditions_table |
253 | 253 | ORDER BY id DESC "; |
254 | - $result = Database::query($sql); |
|
255 | - $url = Database::fetch_array($result,'ASSOC'); |
|
256 | - $result = $url['count_result']; |
|
254 | + $result = Database::query($sql); |
|
255 | + $url = Database::fetch_array($result,'ASSOC'); |
|
256 | + $result = $url['count_result']; |
|
257 | 257 | |
258 | - return $result; |
|
259 | - } |
|
258 | + return $result; |
|
259 | + } |
|
260 | 260 | |
261 | - /** |
|
262 | - * Get type of terms and conditions |
|
263 | - * @param int $legal_id |
|
264 | - * @param int $language_id |
|
265 | - * @return int The current type of terms and conditions |
|
266 | - */ |
|
267 | - public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
261 | + /** |
|
262 | + * Get type of terms and conditions |
|
263 | + * @param int $legal_id |
|
264 | + * @param int $language_id |
|
265 | + * @return int The current type of terms and conditions |
|
266 | + */ |
|
267 | + public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
268 | 268 | { |
269 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
270 | - $legal_id = intval($legal_id); |
|
271 | - $language_id = intval($language_id); |
|
272 | - $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
269 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
270 | + $legal_id = intval($legal_id); |
|
271 | + $language_id = intval($language_id); |
|
272 | + $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
273 | 273 | WHERE id = "'.$legal_id.'" AND language_id="'.$language_id.'"'; |
274 | - $rs = Database::query($sql); |
|
274 | + $rs = Database::query($sql); |
|
275 | 275 | |
276 | - return Database::result($rs,0,'type'); |
|
277 | - } |
|
276 | + return Database::result($rs,0,'type'); |
|
277 | + } |
|
278 | 278 | |
279 | 279 | /** |
280 | 280 | * @param int $userId |
281 | 281 | */ |
282 | - public static function sendLegal($userId) |
|
282 | + public static function sendLegal($userId) |
|
283 | 283 | { |
284 | 284 | $subject = get_lang('SendTermsSubject'); |
285 | 285 | $content = sprintf( |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | $this_section = SECTION_COURSES; |
12 | 12 | |
13 | 13 | if (isset($_GET['session']) && $_GET['session']) { |
14 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
15 | - $_cid = true; |
|
16 | - $is_courseAdmin = true; |
|
14 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
15 | + $_cid = true; |
|
16 | + $is_courseAdmin = true; |
|
17 | 17 | } else { |
18 | - $archive_path = CourseArchiver::getBackupDir(); |
|
18 | + $archive_path = CourseArchiver::getBackupDir(); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $archive_file = isset($_GET['archive']) ? $_GET['archive'] : null; |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | $content_type = ''; |
32 | 32 | |
33 | 33 | if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) { |
34 | - $content_type = 'application/force-download'; |
|
34 | + $content_type = 'application/force-download'; |
|
35 | 35 | } elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) { |
36 | - $content_type = 'application/force-download'; |
|
36 | + $content_type = 'application/force-download'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if (empty($content_type)) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || |
46 | 46 | (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'full_backup') |
47 | 47 | ) { |
48 | - $export = false; |
|
48 | + $export = false; |
|
49 | 49 | if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') { |
50 | 50 | $FileZip = create_zip(); |
51 | 51 | $to_group_id = 0; |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | $query_session_doc = Database::query($sql_session_doc); |
289 | 289 | while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) { |
290 | 290 | $zip_folder->add($FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'], |
291 | - PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$rows_session['name'], |
|
292 | - PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE'] |
|
293 | - ); |
|
291 | + PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$rows_session['name'], |
|
292 | + PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE'] |
|
293 | + ); |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $javascript .= "'".$dropbox_person->sentWork[$i]->title."'"; |
217 | 217 | } |
218 | 218 | } |
219 | - $javascript .= "); |
|
219 | + $javascript .= "); |
|
220 | 220 | |
221 | 221 | function checkfile(str) |
222 | 222 | { |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(), |
327 | 327 | 'name' => get_lang('Dropbox', ''), |
328 | 328 | ); |
329 | - $nameTools = get_lang('ReceivedFiles'); |
|
329 | + $nameTools = get_lang('ReceivedFiles'); |
|
330 | 330 | |
331 | - if ($action == 'addreceivedcategory') { |
|
331 | + if ($action == 'addreceivedcategory') { |
|
332 | 332 | $interbreadcrumb[] = array( |
333 | 333 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=received&'.api_get_cidreq(), |
334 | 334 | 'name' => get_lang('ReceivedFiles'), |
335 | 335 | ); |
336 | - $nameTools = get_lang('AddNewCategory'); |
|
337 | - } |
|
336 | + $nameTools = get_lang('AddNewCategory'); |
|
337 | + } |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | if ($view == 'sent' || empty($view)) { |
@@ -6,7 +6,6 @@ discard block |
||
6 | 6 | * |
7 | 7 | * Contains several functions dealing with displaying, |
8 | 8 | * editing,... of a blog |
9 | - |
|
10 | 9 | * @package chamilo.blogs |
11 | 10 | * @author Toon Keppens <[email protected]> |
12 | 11 | * @author Julio Montoya - Cleaning code |
@@ -335,7 +334,7 @@ discard block |
||
335 | 334 | // Storing the attachments if any |
336 | 335 | if ($result) { |
337 | 336 | $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '. |
338 | - "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )"; |
|
337 | + "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )"; |
|
339 | 338 | Database::query($sql); |
340 | 339 | $id = Database::insert_id(); |
341 | 340 | if ($id) { |
@@ -479,7 +478,7 @@ discard block |
||
479 | 478 | // Storing the attachments if any |
480 | 479 | if ($result) { |
481 | 480 | $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
482 | - "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
|
481 | + "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
|
483 | 482 | Database::query($sql); |
484 | 483 | |
485 | 484 | $id = Database::insert_id(); |
@@ -1398,10 +1397,10 @@ discard block |
||
1398 | 1397 | echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />'; |
1399 | 1398 | echo "<table class=\"data_table\">"; |
1400 | 1399 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
1401 | - "<th width='240'><b>",get_lang('Title'),"</b></th>", |
|
1402 | - "<th><b>",get_lang('Description'),"</b></th>", |
|
1403 | - "<th><b>",get_lang('Color'),"</b></th>", |
|
1404 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1400 | + "<th width='240'><b>",get_lang('Title'),"</b></th>", |
|
1401 | + "<th><b>",get_lang('Description'),"</b></th>", |
|
1402 | + "<th><b>",get_lang('Color'),"</b></th>", |
|
1403 | + "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1405 | 1404 | "</tr>"; |
1406 | 1405 | |
1407 | 1406 | |
@@ -1433,14 +1432,14 @@ discard block |
||
1433 | 1432 | echo '<td width="50">'; |
1434 | 1433 | echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=edit&task_id='.$task['task_id'].'">'; |
1435 | 1434 | echo Display::return_icon('edit.png', get_lang('EditTask')); |
1436 | - echo "</a>"; |
|
1437 | - echo '<a href="'.$delete_link.'"'; |
|
1438 | - echo $delete_confirm; |
|
1439 | - echo '>'; |
|
1435 | + echo "</a>"; |
|
1436 | + echo '<a href="'.$delete_link.'"'; |
|
1437 | + echo $delete_confirm; |
|
1438 | + echo '>'; |
|
1440 | 1439 | echo Display::return_icon($delete_icon, $delete_title); |
1441 | - echo "</a>"; |
|
1442 | - echo '</td>'; |
|
1443 | - echo '</tr>'; |
|
1440 | + echo "</a>"; |
|
1441 | + echo '</td>'; |
|
1442 | + echo '</tr>'; |
|
1444 | 1443 | } |
1445 | 1444 | echo "</table>"; |
1446 | 1445 | } |
@@ -1464,11 +1463,11 @@ discard block |
||
1464 | 1463 | echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />'; |
1465 | 1464 | echo "<table class=\"data_table\">"; |
1466 | 1465 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
1467 | - "<th width='240'><b>",get_lang('Member'),"</b></th>", |
|
1468 | - "<th><b>",get_lang('Task'),"</b></th>", |
|
1469 | - "<th><b>",get_lang('Description'),"</b></th>", |
|
1470 | - "<th><b>",get_lang('TargetDate'),"</b></th>", |
|
1471 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1466 | + "<th width='240'><b>",get_lang('Member'),"</b></th>", |
|
1467 | + "<th><b>",get_lang('Task'),"</b></th>", |
|
1468 | + "<th><b>",get_lang('Description'),"</b></th>", |
|
1469 | + "<th><b>",get_lang('TargetDate'),"</b></th>", |
|
1470 | + "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1472 | 1471 | "</tr>"; |
1473 | 1472 | |
1474 | 1473 | $course_id = api_get_course_int_id(); |
@@ -2316,7 +2315,7 @@ discard block |
||
2316 | 2315 | * @param Integer $year: the 4-digit year indication e.g. 2005 |
2317 | 2316 | * |
2318 | 2317 | * @return html code |
2319 | - */ |
|
2318 | + */ |
|
2320 | 2319 | public static function display_minimonthcalendar($month, $year, $blog_id) |
2321 | 2320 | { |
2322 | 2321 | // Init |
@@ -2609,34 +2608,34 @@ discard block |
||
2609 | 2608 | */ |
2610 | 2609 | function get_blog_attachment($blog_id, $post_id=null,$comment_id=null) |
2611 | 2610 | { |
2612 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2613 | - |
|
2614 | - $blog_id = intval($blog_id); |
|
2615 | - $comment_id = intval($comment_id); |
|
2616 | - $post_id = intval($post_id); |
|
2617 | - $row=array(); |
|
2618 | - $where=''; |
|
2619 | - if (!empty ($post_id) && is_numeric($post_id)) { |
|
2620 | - $where.=' AND post_id ="'.$post_id.'" '; |
|
2621 | - } |
|
2622 | - |
|
2623 | - if (!empty ($comment_id) && is_numeric($comment_id)) { |
|
2624 | - if (!empty ($post_id)) { |
|
2625 | - $where.= ' AND '; |
|
2626 | - } |
|
2627 | - $where.=' comment_id ="'.$comment_id.'" '; |
|
2628 | - } |
|
2611 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2612 | + |
|
2613 | + $blog_id = intval($blog_id); |
|
2614 | + $comment_id = intval($comment_id); |
|
2615 | + $post_id = intval($post_id); |
|
2616 | + $row=array(); |
|
2617 | + $where=''; |
|
2618 | + if (!empty ($post_id) && is_numeric($post_id)) { |
|
2619 | + $where.=' AND post_id ="'.$post_id.'" '; |
|
2620 | + } |
|
2621 | + |
|
2622 | + if (!empty ($comment_id) && is_numeric($comment_id)) { |
|
2623 | + if (!empty ($post_id)) { |
|
2624 | + $where.= ' AND '; |
|
2625 | + } |
|
2626 | + $where.=' comment_id ="'.$comment_id.'" '; |
|
2627 | + } |
|
2629 | 2628 | |
2630 | 2629 | $course_id = api_get_course_int_id(); |
2631 | 2630 | |
2632 | - $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
2631 | + $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
2633 | 2632 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2634 | 2633 | |
2635 | - $result=Database::query($sql); |
|
2636 | - if (Database::num_rows($result)!=0) { |
|
2637 | - $row=Database::fetch_array($result); |
|
2638 | - } |
|
2639 | - return $row; |
|
2634 | + $result=Database::query($sql); |
|
2635 | + if (Database::num_rows($result)!=0) { |
|
2636 | + $row=Database::fetch_array($result); |
|
2637 | + } |
|
2638 | + return $row; |
|
2640 | 2639 | } |
2641 | 2640 | |
2642 | 2641 | /** |
@@ -2652,16 +2651,16 @@ discard block |
||
2652 | 2651 | $post_id = null, |
2653 | 2652 | $comment_id = null |
2654 | 2653 | ) { |
2655 | - $_course = api_get_course_info(); |
|
2656 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2657 | - $blog_id = intval($blog_id); |
|
2658 | - $comment_id = intval($comment_id); |
|
2659 | - $post_id = intval($post_id); |
|
2654 | + $_course = api_get_course_info(); |
|
2655 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2656 | + $blog_id = intval($blog_id); |
|
2657 | + $comment_id = intval($comment_id); |
|
2658 | + $post_id = intval($post_id); |
|
2660 | 2659 | |
2661 | 2660 | $course_id = api_get_course_int_id(); |
2662 | - $where = null; |
|
2661 | + $where = null; |
|
2663 | 2662 | |
2664 | - // delete files in DB |
|
2663 | + // delete files in DB |
|
2665 | 2664 | if (!empty ($post_id) && is_numeric($post_id)) { |
2666 | 2665 | $where .= ' AND post_id ="'.$post_id.'" '; |
2667 | 2666 | } |
@@ -2673,25 +2672,25 @@ discard block |
||
2673 | 2672 | $where .= ' comment_id ="'.$comment_id.'" '; |
2674 | 2673 | } |
2675 | 2674 | |
2676 | - // delete all files in directory |
|
2677 | - $courseDir = $_course['path'].'/upload/blog'; |
|
2678 | - $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
2679 | - $updir = $sys_course_path.$courseDir; |
|
2675 | + // delete all files in directory |
|
2676 | + $courseDir = $_course['path'].'/upload/blog'; |
|
2677 | + $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
2678 | + $updir = $sys_course_path.$courseDir; |
|
2680 | 2679 | |
2681 | - $sql = 'SELECT path FROM '.$blog_table_attachment.' |
|
2680 | + $sql = 'SELECT path FROM '.$blog_table_attachment.' |
|
2682 | 2681 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2683 | - $result=Database::query($sql); |
|
2684 | - |
|
2685 | - while ($row=Database::fetch_row($result)) { |
|
2686 | - $file=$updir.'/'.$row[0]; |
|
2687 | - if (Security::check_abs_path($file,$updir) ) |
|
2688 | - { |
|
2689 | - @ unlink($file); |
|
2690 | - } |
|
2691 | - } |
|
2692 | - $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
2682 | + $result=Database::query($sql); |
|
2683 | + |
|
2684 | + while ($row=Database::fetch_row($result)) { |
|
2685 | + $file=$updir.'/'.$row[0]; |
|
2686 | + if (Security::check_abs_path($file,$updir) ) |
|
2687 | + { |
|
2688 | + @ unlink($file); |
|
2689 | + } |
|
2690 | + } |
|
2691 | + $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
2693 | 2692 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2694 | - Database::query($sql); |
|
2693 | + Database::query($sql); |
|
2695 | 2694 | } |
2696 | 2695 | |
2697 | 2696 | /** |
@@ -2707,7 +2706,7 @@ discard block |
||
2707 | 2706 | $course_id = $course_info['real_id']; |
2708 | 2707 | $user_id = intval($user_id); |
2709 | 2708 | |
2710 | - $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation |
|
2709 | + $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation |
|
2711 | 2710 | FROM $tbl_blogs blog |
2712 | 2711 | INNER JOIN $tbl_blog_post post |
2713 | 2712 | ON (blog.blog_id = post.blog_id) |
@@ -2716,19 +2715,19 @@ discard block |
||
2716 | 2715 | post.c_id = $course_id AND |
2717 | 2716 | author_id = $user_id AND visibility = 1 |
2718 | 2717 | ORDER BY post.date_creation DESC "; |
2719 | - $result = Database::query($sql); |
|
2720 | - $return_data = ''; |
|
2721 | - |
|
2722 | - if (Database::num_rows($result)!=0) { |
|
2723 | - while ($row=Database::fetch_array($result)) { |
|
2724 | - $return_data.= '<div class="clear"></div><br />'; |
|
2725 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2726 | - $return_data.= '<br / >'; |
|
2727 | - $return_data.= $row['full_text']; |
|
2728 | - $return_data.= '<br /><br />'; |
|
2729 | - } |
|
2730 | - } |
|
2731 | - return $return_data; |
|
2718 | + $result = Database::query($sql); |
|
2719 | + $return_data = ''; |
|
2720 | + |
|
2721 | + if (Database::num_rows($result)!=0) { |
|
2722 | + while ($row=Database::fetch_array($result)) { |
|
2723 | + $return_data.= '<div class="clear"></div><br />'; |
|
2724 | + $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2725 | + $return_data.= '<br / >'; |
|
2726 | + $return_data.= $row['full_text']; |
|
2727 | + $return_data.= '<br /><br />'; |
|
2728 | + } |
|
2729 | + } |
|
2730 | + return $return_data; |
|
2732 | 2731 | } |
2733 | 2732 | |
2734 | 2733 | /** |
@@ -2745,7 +2744,7 @@ discard block |
||
2745 | 2744 | $course_info = api_get_course_info($course_code); |
2746 | 2745 | $course_id = $course_info['real_id']; |
2747 | 2746 | |
2748 | - $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation |
|
2747 | + $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation |
|
2749 | 2748 | FROM $tbl_blogs blog INNER JOIN $tbl_blog_comment comment |
2750 | 2749 | ON (blog.blog_id = comment.blog_id) |
2751 | 2750 | WHERE blog.c_id = $course_id AND |
@@ -2753,17 +2752,17 @@ discard block |
||
2753 | 2752 | author_id = $user_id AND |
2754 | 2753 | visibility = 1 |
2755 | 2754 | ORDER BY blog_name"; |
2756 | - $result = Database::query($sql); |
|
2757 | - $return_data = ''; |
|
2758 | - if (Database::num_rows($result)!=0) { |
|
2759 | - while ($row=Database::fetch_array($result)) { |
|
2760 | - $return_data.= '<div class="clear"></div><br />'; |
|
2761 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2762 | - $return_data.= '<br / >'; |
|
2763 | - $return_data.= $row['comment']; |
|
2764 | - $return_data.= '<br />'; |
|
2765 | - } |
|
2766 | - } |
|
2767 | - return $return_data; |
|
2755 | + $result = Database::query($sql); |
|
2756 | + $return_data = ''; |
|
2757 | + if (Database::num_rows($result)!=0) { |
|
2758 | + while ($row=Database::fetch_array($result)) { |
|
2759 | + $return_data.= '<div class="clear"></div><br />'; |
|
2760 | + $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2761 | + $return_data.= '<br / >'; |
|
2762 | + $return_data.= $row['comment']; |
|
2763 | + $return_data.= '<br />'; |
|
2764 | + } |
|
2765 | + } |
|
2766 | + return $return_data; |
|
2768 | 2767 | } |
2769 | 2768 |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | ); |
481 | 481 | |
482 | 482 | if (($counter % $batchSize) === 0) { |
483 | - $em->flush(); |
|
484 | - $em->clear(); |
|
483 | + $em->flush(); |
|
484 | + $em->clear(); |
|
485 | 485 | } |
486 | 486 | $counter++; |
487 | 487 | } |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | ); |
503 | 503 | |
504 | 504 | if (($counter % $batchSize) === 0) { |
505 | - $em->flush(); |
|
506 | - $em->clear(); |
|
505 | + $em->flush(); |
|
506 | + $em->clear(); |
|
507 | 507 | } |
508 | 508 | $counter++; |
509 | 509 | } |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) |
1407 | 1407 | ) "; |
1408 | 1408 | } else { |
1409 | - $cond_user_id = " AND ( |
|
1409 | + $cond_user_id = " AND ( |
|
1410 | 1410 | ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".$group_id.")) |
1411 | 1411 | )"; |
1412 | 1412 | } |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | $firstname = $userInfo['firstname']; |
373 | 373 | $lastname = $userInfo['lastname']; |
374 | 374 | |
375 | - if (api_is_western_name_order()) { |
|
376 | - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
377 | - } else { |
|
378 | - $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
379 | - } |
|
375 | + if (api_is_western_name_order()) { |
|
376 | + $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
377 | + } else { |
|
378 | + $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
379 | + } |
|
380 | 380 | |
381 | - if ($userId) { |
|
381 | + if ($userId) { |
|
382 | 382 | |
383 | 383 | // Logout the current user |
384 | 384 | LoginDelete(api_get_user_id()); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | { |
442 | 442 | $sql = prepare_user_sql_query(false); |
443 | 443 | if (!in_array($direction, array('ASC','DESC'))) { |
444 | - $direction = 'ASC'; |
|
444 | + $direction = 'ASC'; |
|
445 | 445 | } |
446 | 446 | $column = intval($column); |
447 | 447 | $from = intval($from); |
@@ -452,23 +452,23 @@ discard block |
||
452 | 452 | $sql .= " WHERE u.creator_id = ".api_get_user_id(); |
453 | 453 | } |
454 | 454 | |
455 | - $sql .= " ORDER BY col$column $direction "; |
|
456 | - $sql .= " LIMIT $from,$number_of_items"; |
|
455 | + $sql .= " ORDER BY col$column $direction "; |
|
456 | + $sql .= " LIMIT $from,$number_of_items"; |
|
457 | 457 | |
458 | - $res = Database::query($sql); |
|
458 | + $res = Database::query($sql); |
|
459 | 459 | |
460 | - $users = array (); |
|
460 | + $users = array (); |
|
461 | 461 | $t = time(); |
462 | - while ($user = Database::fetch_row($res)) { |
|
463 | - $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
464 | - $photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; |
|
462 | + while ($user = Database::fetch_row($res)) { |
|
463 | + $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
464 | + $photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; |
|
465 | 465 | |
466 | 466 | if ($user[7] == 1 && !empty($user[10])) { |
467 | 467 | // check expiration date |
468 | 468 | $expiration_time = convert_sql_date($user[10]); |
469 | 469 | // if expiration date is passed, store a special value for active field |
470 | 470 | if ($expiration_time < $t) { |
471 | - $user[7] = '-1'; |
|
471 | + $user[7] = '-1'; |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | */ |
499 | 499 | function email_filter($email) |
500 | 500 | { |
501 | - return Display :: encrypted_mailto_link($email, $email); |
|
501 | + return Display :: encrypted_mailto_link($email, $email); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | /** |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | */ |
509 | 509 | function user_filter($name, $params, $row) |
510 | 510 | { |
511 | - return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
511 | + return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | /** |
@@ -526,17 +526,17 @@ discard block |
||
526 | 526 | $user_is_anonymous = false; |
527 | 527 | $current_user_status_label = $row['7']; |
528 | 528 | |
529 | - if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
530 | - $user_is_anonymous = true; |
|
531 | - } |
|
532 | - $result = ''; |
|
533 | - if (!$user_is_anonymous) { |
|
529 | + if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
530 | + $user_is_anonymous = true; |
|
531 | + } |
|
532 | + $result = ''; |
|
533 | + if (!$user_is_anonymous) { |
|
534 | 534 | $icon = Display::return_icon( |
535 | 535 | 'course.png', |
536 | 536 | get_lang('Courses'), |
537 | 537 | array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')') |
538 | 538 | ); |
539 | - $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
539 | + $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
540 | 540 | '.$icon.' |
541 | 541 | <div class="blackboard_hide" id="div_'.$user_id.'"> </div> |
542 | 542 | </a>'; |
@@ -546,14 +546,14 @@ discard block |
||
546 | 546 | get_lang('Sessions'), |
547 | 547 | array('onmouseout' => 'clear_session_list (\'div_s_'.$user_id.'\')') |
548 | 548 | ); |
549 | - $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
549 | + $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
550 | 550 | '.$icon.' |
551 | 551 | <div class="blackboard_hide" id="div_s_'.$user_id.'"> </div> |
552 | 552 | </a>'; |
553 | - } else { |
|
554 | - $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
555 | - $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
556 | - } |
|
553 | + } else { |
|
554 | + $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
555 | + $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
556 | + } |
|
557 | 557 | |
558 | 558 | if (api_is_platform_admin()) { |
559 | 559 | if (!$user_is_anonymous) { |
@@ -602,18 +602,18 @@ discard block |
||
602 | 602 | ); |
603 | 603 | } |
604 | 604 | |
605 | - if ($is_admin) { |
|
605 | + if ($is_admin) { |
|
606 | 606 | $result .= Display::return_icon( |
607 | 607 | 'admin_star.png', |
608 | 608 | get_lang('IsAdministrator'), |
609 | 609 | array('width' => ICON_SIZE_SMALL, 'heigth' => ICON_SIZE_SMALL) |
610 | 610 | ); |
611 | - } else { |
|
612 | - $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
613 | - } |
|
611 | + } else { |
|
612 | + $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
613 | + } |
|
614 | 614 | |
615 | - // actions for assigning sessions, courses or users |
|
616 | - if (!api_is_session_admin()) { |
|
615 | + // actions for assigning sessions, courses or users |
|
616 | + if (!api_is_session_admin()) { |
|
617 | 617 | if ($current_user_status_label == $statusname[SESSIONADMIN]) { |
618 | 618 | $result .= Display::url( |
619 | 619 | Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')), |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | ); |
644 | 644 | } |
645 | 645 | } |
646 | - } |
|
646 | + } |
|
647 | 647 | |
648 | 648 | if (api_is_platform_admin()) { |
649 | 649 | $result .= ' <a data-title="'.get_lang('FreeBusyCalendar').'" href="'.api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?a=get_user_agenda&user_id='.$user_id.'&modal_size=lg" class="agenda_opener ajax">'. |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | } |
663 | 663 | } |
664 | 664 | |
665 | - return $result; |
|
665 | + return $result; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | /** |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | if ($action === 'edit') { |
695 | 695 | $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16); |
696 | 696 | } elseif ($row['0'] <> $_user['user_id']) { |
697 | - // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
|
697 | + // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
|
698 | 698 | $result = Display::return_icon( |
699 | 699 | $image.'.png', |
700 | 700 | get_lang(ucfirst($action)), |
701 | 701 | array('onclick' => 'active_user(this);', 'id' => 'img_'.$row['0']), |
702 | 702 | 16 |
703 | 703 | ); |
704 | - } |
|
704 | + } |
|
705 | 705 | |
706 | - return $result; |
|
706 | + return $result; |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
@@ -716,8 +716,8 @@ discard block |
||
716 | 716 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
717 | 717 | */ |
718 | 718 | function status_filter($status) { |
719 | - $statusname = api_get_status_langvars(); |
|
720 | - return $statusname[$status]; |
|
719 | + $statusname = api_get_status_langvars(); |
|
720 | + return $statusname[$status]; |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | |
734 | 734 | if (!empty($action)) { |
735 | 735 | $check = Security::check_token('get'); |
736 | - if ($check) { |
|
737 | - switch ($action) { |
|
736 | + if ($check) { |
|
737 | + switch ($action) { |
|
738 | 738 | case 'add_user_to_my_url': |
739 | 739 | $user_id = $_REQUEST["user_id"]; |
740 | 740 | $result = UrlManager::add_user_to_url($user_id, $current_access_url_id); |
@@ -744,52 +744,52 @@ discard block |
||
744 | 744 | $message = Display::return_message($message, 'confirmation'); |
745 | 745 | } |
746 | 746 | break; |
747 | - case 'delete_user': |
|
748 | - if (api_is_platform_admin()) { |
|
747 | + case 'delete_user': |
|
748 | + if (api_is_platform_admin()) { |
|
749 | 749 | $user_to_delete = $_GET['user_id']; |
750 | 750 | $userToDeleteInfo = api_get_user_info($user_to_delete); |
751 | 751 | $current_user_id = api_get_user_id(); |
752 | 752 | |
753 | - if ($userToDeleteInfo && $deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
754 | - if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
755 | - $message = Display :: return_message( |
|
756 | - get_lang('UserDeleted').': '.$userToDeleteInfo['complete_name_with_username'], |
|
753 | + if ($userToDeleteInfo && $deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
754 | + if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
755 | + $message = Display :: return_message( |
|
756 | + get_lang('UserDeleted').': '.$userToDeleteInfo['complete_name_with_username'], |
|
757 | 757 | 'confirmation' |
758 | 758 | ); |
759 | - } else { |
|
760 | - $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
761 | - } |
|
762 | - } else { |
|
763 | - $message = Display :: return_message(get_lang('CannotDeleteUser'), 'error'); |
|
764 | - } |
|
765 | - Display::addFlash($message); |
|
766 | - header('Location: '.api_get_self()); |
|
759 | + } else { |
|
760 | + $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
761 | + } |
|
762 | + } else { |
|
763 | + $message = Display :: return_message(get_lang('CannotDeleteUser'), 'error'); |
|
764 | + } |
|
765 | + Display::addFlash($message); |
|
766 | + header('Location: '.api_get_self()); |
|
767 | 767 | exit; |
768 | - } |
|
769 | - break; |
|
768 | + } |
|
769 | + break; |
|
770 | 770 | case 'delete': |
771 | - if (api_is_platform_admin()) { |
|
772 | - $number_of_selected_users = count($_POST['id']); |
|
773 | - $number_of_deleted_users = 0; |
|
774 | - if (is_array($_POST['id'])) { |
|
775 | - foreach ($_POST['id'] as $index => $user_id) { |
|
776 | - if ($user_id != $_user['user_id']) { |
|
777 | - if (UserManager::delete_user($user_id)) { |
|
778 | - $number_of_deleted_users++; |
|
779 | - } |
|
780 | - } |
|
781 | - } |
|
782 | - } |
|
783 | - if ($number_of_selected_users == $number_of_deleted_users) { |
|
771 | + if (api_is_platform_admin()) { |
|
772 | + $number_of_selected_users = count($_POST['id']); |
|
773 | + $number_of_deleted_users = 0; |
|
774 | + if (is_array($_POST['id'])) { |
|
775 | + foreach ($_POST['id'] as $index => $user_id) { |
|
776 | + if ($user_id != $_user['user_id']) { |
|
777 | + if (UserManager::delete_user($user_id)) { |
|
778 | + $number_of_deleted_users++; |
|
779 | + } |
|
780 | + } |
|
781 | + } |
|
782 | + } |
|
783 | + if ($number_of_selected_users == $number_of_deleted_users) { |
|
784 | 784 | $message = Display :: return_message(get_lang('SelectedUsersDeleted'), 'confirmation'); |
785 | - } else { |
|
785 | + } else { |
|
786 | 786 | $message = Display :: return_message(get_lang('SomeUsersNotDeleted'), 'error'); |
787 | - } |
|
788 | - } |
|
789 | - break; |
|
790 | - } |
|
791 | - Security::clear_token(); |
|
792 | - } |
|
787 | + } |
|
788 | + } |
|
789 | + break; |
|
790 | + } |
|
791 | + Security::clear_token(); |
|
792 | + } |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | // Create a search-box |
@@ -807,15 +807,15 @@ discard block |
||
807 | 807 | $actionsCenter = ''; |
808 | 808 | $actionsRight = ''; |
809 | 809 | if (api_is_platform_admin()) { |
810 | - $actionsRight .= '<a class="pull-right" href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
811 | - Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
810 | + $actionsRight .= '<a class="pull-right" href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
811 | + Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | $actionsLeft .= $form->returnForm(); |
815 | 815 | $actionsCenter .= $searchAdvanced; |
816 | 816 | |
817 | 817 | if (isset($_GET['keyword'])) { |
818 | - $parameters = array('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
818 | + $parameters = array('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
819 | 819 | } elseif (isset ($_GET['keyword_firstname'])) { |
820 | 820 | $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
821 | 821 | $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | $table->set_header(2, get_lang('OfficialCode')); |
890 | 890 | |
891 | 891 | if (api_is_western_name_order()) { |
892 | - $table->set_header(3, get_lang('FirstName')); |
|
893 | - $table->set_header(4, get_lang('LastName')); |
|
892 | + $table->set_header(3, get_lang('FirstName')); |
|
893 | + $table->set_header(4, get_lang('LastName')); |
|
894 | 894 | } else { |
895 | - $table->set_header(3, get_lang('LastName')); |
|
896 | - $table->set_header(4, get_lang('FirstName')); |
|
895 | + $table->set_header(3, get_lang('LastName')); |
|
896 | + $table->set_header(4, get_lang('FirstName')); |
|
897 | 897 | } |
898 | 898 | $table->set_header(5, get_lang('LoginName')); |
899 | 899 | $table->set_header(6, get_lang('Email')); |
@@ -132,38 +132,38 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function my_rename($file_path, $new_file_name) { |
134 | 134 | |
135 | - $save_dir = getcwd(); |
|
136 | - $path = dirname($file_path); |
|
137 | - $old_file_name = basename($file_path); |
|
138 | - $new_file_name = api_replace_dangerous_char($new_file_name); |
|
135 | + $save_dir = getcwd(); |
|
136 | + $path = dirname($file_path); |
|
137 | + $old_file_name = basename($file_path); |
|
138 | + $new_file_name = api_replace_dangerous_char($new_file_name); |
|
139 | 139 | |
140 | - // If no extension, take the old one |
|
141 | - if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | - $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | - } |
|
140 | + // If no extension, take the old one |
|
141 | + if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | + $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | + } |
|
144 | 144 | |
145 | - // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | - // This is useful for folder names, where otherwise '.' would be sticky |
|
145 | + // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | + // This is useful for folder names, where otherwise '.' would be sticky |
|
147 | 147 | |
148 | - // Extension PHP is not allowed, change to PHPS |
|
149 | - $new_file_name = php2phps($new_file_name); |
|
148 | + // Extension PHP is not allowed, change to PHPS |
|
149 | + $new_file_name = php2phps($new_file_name); |
|
150 | 150 | |
151 | - if ($new_file_name == $old_file_name) { |
|
152 | - return $old_file_name; |
|
153 | - } |
|
151 | + if ($new_file_name == $old_file_name) { |
|
152 | + return $old_file_name; |
|
153 | + } |
|
154 | 154 | |
155 | - if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | - return false; |
|
157 | - } |
|
158 | - // On a Windows server, it would be better not to do the above check |
|
159 | - // because it succeeds for some new names resembling the old name. |
|
160 | - // But on Unix/Linux the check must be done because rename overwrites. |
|
155 | + if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | + return false; |
|
157 | + } |
|
158 | + // On a Windows server, it would be better not to do the above check |
|
159 | + // because it succeeds for some new names resembling the old name. |
|
160 | + // But on Unix/Linux the check must be done because rename overwrites. |
|
161 | 161 | |
162 | - chdir($path); |
|
163 | - $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | - chdir($save_dir); |
|
162 | + chdir($path); |
|
163 | + $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | + chdir($save_dir); |
|
165 | 165 | |
166 | - return $res; |
|
166 | + return $res; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $file_name = basename($source); |
186 | 186 | // move onto self illegal: mv a/b/c a/b/c or mv a/b/c a/b |
187 | 187 | if (strcasecmp($target, dirname($source)) === 0) { |
188 | - return false; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | $isWindowsOS = api_is_windows_os(); |
191 | 191 | $canExec = function_exists('exec'); |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function getextension($filename) |
267 | 267 | { |
268 | - $bouts = explode('.', $filename); |
|
269 | - return array(array_pop($bouts), implode('.', $bouts)); |
|
268 | + $bouts = explode('.', $filename); |
|
269 | + return array(array_pop($bouts), implode('.', $bouts)); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | * @param boolean $recursive if true , include subdirectory in total |
278 | 278 | */ |
279 | 279 | function dirsize($root, $recursive = true) { |
280 | - $dir = @opendir($root); |
|
281 | - $size = 0; |
|
282 | - while ($file = @readdir($dir)) { |
|
283 | - if (!in_array($file, array('.', '..'))) { |
|
284 | - if (is_dir($root.'/'.$file)) { |
|
285 | - $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | - } else { |
|
287 | - $size += @filesize($root.'/'.$file); |
|
288 | - } |
|
289 | - } |
|
290 | - } |
|
291 | - @closedir($dir); |
|
292 | - return $size; |
|
280 | + $dir = @opendir($root); |
|
281 | + $size = 0; |
|
282 | + while ($file = @readdir($dir)) { |
|
283 | + if (!in_array($file, array('.', '..'))) { |
|
284 | + if (is_dir($root.'/'.$file)) { |
|
285 | + $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | + } else { |
|
287 | + $size += @filesize($root.'/'.$file); |
|
288 | + } |
|
289 | + } |
|
290 | + } |
|
291 | + @closedir($dir); |
|
292 | + return $size; |
|
293 | 293 | } |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | $media .= '<div class="col-md-2 col-xs-2 social-post-answers">'; |
1409 | 1409 | $media .= '<div class="user-image pull-right">'; |
1410 | 1410 | $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] . |
1411 | - '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1411 | + '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1412 | 1412 | $media .= '</div>'; |
1413 | 1413 | $media .= '</div>'; |
1414 | 1414 | $media .= '<div class="col-md-9 col-xs-9 social-post-answers">'; |
@@ -1623,10 +1623,10 @@ discard block |
||
1623 | 1623 | } |
1624 | 1624 | |
1625 | 1625 | /** |
1626 | - * Delete messages delete logic |
|
1627 | - * @param int $id id message to delete. |
|
1628 | - * @return bool status query |
|
1629 | - */ |
|
1626 | + * Delete messages delete logic |
|
1627 | + * @param int $id id message to delete. |
|
1628 | + * @return bool status query |
|
1629 | + */ |
|
1630 | 1630 | public static function deleteMessage($id) |
1631 | 1631 | { |
1632 | 1632 | $id = intval($id); |