@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | $message_uid = ''; |
51 | 51 | $message_type = array('inbox','outbox'); |
52 | 52 | if (in_array($_GET['type'],$message_type)) { |
53 | - if ($_GET['type'] == 'inbox') { |
|
54 | - $message_uid = $row_users['user_receiver_id']; |
|
55 | - } else { |
|
56 | - $message_uid = $row_users['user_sender_id']; |
|
57 | - } |
|
53 | + if ($_GET['type'] == 'inbox') { |
|
54 | + $message_uid = $row_users['user_receiver_id']; |
|
55 | + } else { |
|
56 | + $message_uid = $row_users['user_sender_id']; |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // allow to the correct user for download this file |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | $userGroup = new UserGroup(); |
63 | 63 | |
64 | 64 | if (!empty($row_users['group_id'])) { |
65 | - $users_group = $userGroup->get_all_users_by_group($row_users['group_id']); |
|
66 | - if (!in_array($current_uid,array_keys($users_group))) { |
|
67 | - $not_allowed_to_edit = true; |
|
68 | - } |
|
65 | + $users_group = $userGroup->get_all_users_by_group($row_users['group_id']); |
|
66 | + if (!in_array($current_uid,array_keys($users_group))) { |
|
67 | + $not_allowed_to_edit = true; |
|
68 | + } |
|
69 | 69 | } else { |
70 | - if ($current_uid != $message_uid) { |
|
71 | - $not_allowed_to_edit = true; |
|
72 | - } |
|
70 | + if ($current_uid != $message_uid) { |
|
71 | + $not_allowed_to_edit = true; |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($not_allowed_to_edit) { |
76 | - api_not_allowed(true); |
|
77 | - exit; |
|
76 | + api_not_allowed(true); |
|
77 | + exit; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // set the path directory file |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | true |
86 | 86 | ); |
87 | 87 | } else { |
88 | - $path_user_info['dir'] = UserManager::getUserPathById($message_uid, 'system'); |
|
88 | + $path_user_info['dir'] = UserManager::getUserPathById($message_uid, 'system'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $full_file_name = $path_user_info['dir'].'message_attachments/'.$file_url; |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | - //This query will show all registered users. Only for dev purposes. |
|
303 | - /*$query = "SELECT DISTINCT u.id as login_user_id, login_date |
|
302 | + //This query will show all registered users. Only for dev purposes. |
|
303 | + /*$query = "SELECT DISTINCT u.id as login_user_id, login_date |
|
304 | 304 | FROM $track_online_table e, $table_user u |
305 | 305 | GROUP by u.id |
306 | 306 | ORDER BY $column $direction |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | } else { |
328 | 328 | $time_limit = intval($time_limit); |
329 | 329 | } |
330 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
331 | - $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
332 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
333 | - $online_time = time() - $time_limit * 60; |
|
334 | - $current_date = api_get_utc_datetime($online_time); |
|
335 | - |
|
336 | - if ($friends) { |
|
337 | - // who friends from social network is online |
|
338 | - $query = "SELECT DISTINCT count(login_user_id) as count |
|
330 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
331 | + $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
332 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
333 | + $online_time = time() - $time_limit * 60; |
|
334 | + $current_date = api_get_utc_datetime($online_time); |
|
335 | + |
|
336 | + if ($friends) { |
|
337 | + // who friends from social network is online |
|
338 | + $query = "SELECT DISTINCT count(login_user_id) as count |
|
339 | 339 | FROM $track_online_table INNER JOIN $friend_user_table |
340 | 340 | ON (friend_user_id = login_user_id) |
341 | 341 | WHERE |
@@ -343,20 +343,20 @@ discard block |
||
343 | 343 | friend_user_id <> '".api_get_user_id()."' AND |
344 | 344 | relation_type='".USER_RELATION_TYPE_FRIEND."' AND |
345 | 345 | user_id = '".api_get_user_id()."' "; |
346 | - } else { |
|
347 | - // All users online |
|
348 | - $query = "SELECT count(login_id) as count |
|
346 | + } else { |
|
347 | + // All users online |
|
348 | + $query = "SELECT count(login_id) as count |
|
349 | 349 | FROM $track_online_table track INNER JOIN $table_user u |
350 | 350 | ON (u.id=track.login_user_id) |
351 | 351 | WHERE u.status != ".ANONYMOUS." AND login_date >= '$current_date' "; |
352 | - } |
|
353 | - |
|
354 | - if (api_get_multiple_access_url()) { |
|
355 | - $access_url_id = api_get_current_access_url_id(); |
|
356 | - if ($access_url_id != -1) { |
|
357 | - if ($friends) { |
|
358 | - // friends from social network is online |
|
359 | - $query = "SELECT DISTINCT count(login_user_id) as count |
|
352 | + } |
|
353 | + |
|
354 | + if (api_get_multiple_access_url()) { |
|
355 | + $access_url_id = api_get_current_access_url_id(); |
|
356 | + if ($access_url_id != -1) { |
|
357 | + if ($friends) { |
|
358 | + // friends from social network is online |
|
359 | + $query = "SELECT DISTINCT count(login_user_id) as count |
|
360 | 360 | FROM $track_online_table track |
361 | 361 | INNER JOIN $friend_user_table ON (friend_user_id = login_user_id) |
362 | 362 | WHERE |
@@ -364,29 +364,29 @@ discard block |
||
364 | 364 | login_date >= '".$current_date."' AND |
365 | 365 | friend_user_id <> '".api_get_user_id()."' AND |
366 | 366 | relation_type='".USER_RELATION_TYPE_FRIEND."' "; |
367 | - } else { |
|
368 | - // all users online |
|
369 | - $query = "SELECT count(login_id) as count FROM $track_online_table track |
|
367 | + } else { |
|
368 | + // all users online |
|
369 | + $query = "SELECT count(login_id) as count FROM $track_online_table track |
|
370 | 370 | INNER JOIN $table_user u ON (u.id=track.login_user_id) |
371 | 371 | WHERE |
372 | 372 | u.status != ".ANONYMOUS." AND |
373 | 373 | track.access_url_id = $access_url_id AND |
374 | 374 | login_date >= '$current_date' "; |
375 | - } |
|
376 | - } |
|
377 | - } |
|
375 | + } |
|
376 | + } |
|
377 | + } |
|
378 | 378 | |
379 | 379 | // Dev purposes show all users online |
380 | 380 | /*$table_user = Database::get_main_table(TABLE_MAIN_USER); |
381 | 381 | $query = "SELECT count(*) as count FROM ".$table_user;*/ |
382 | 382 | |
383 | - $result = Database::query($query); |
|
384 | - if (Database::num_rows($result) > 0) { |
|
385 | - $row = Database::fetch_array($result); |
|
386 | - return $row['count']; |
|
387 | - } else { |
|
388 | - return false; |
|
389 | - } |
|
383 | + $result = Database::query($query); |
|
384 | + if (Database::num_rows($result) > 0) { |
|
385 | + $row = Database::fetch_array($result); |
|
386 | + return $row['count']; |
|
387 | + } else { |
|
388 | + return false; |
|
389 | + } |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -414,52 +414,52 @@ discard block |
||
414 | 414 | $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
415 | 415 | $course_code = Database::escape_string($course_code); |
416 | 416 | $courseInfo = api_get_course_info($course_code); |
417 | - $courseId = $courseInfo['real_id']; |
|
417 | + $courseId = $courseInfo['real_id']; |
|
418 | 418 | |
419 | 419 | $from = intval($from); |
420 | 420 | $number_of_items = intval($number_of_items); |
421 | 421 | |
422 | - $query = "SELECT login_user_id, login_date FROM $track_online_table |
|
422 | + $query = "SELECT login_user_id, login_date FROM $track_online_table |
|
423 | 423 | WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' |
424 | 424 | LIMIT $from, $number_of_items "; |
425 | 425 | |
426 | - $result = Database::query($query); |
|
427 | - if ($result) { |
|
428 | - $users_online = array(); |
|
426 | + $result = Database::query($query); |
|
427 | + if ($result) { |
|
428 | + $users_online = array(); |
|
429 | 429 | |
430 | - while(list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
430 | + while(list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
431 | 431 | $users_online[] = $login_user_id; |
432 | - } |
|
433 | - return $users_online; |
|
434 | - } else { |
|
435 | - return false; |
|
436 | - } |
|
432 | + } |
|
433 | + return $users_online; |
|
434 | + } else { |
|
435 | + return false; |
|
436 | + } |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null) |
440 | 440 | { |
441 | - if (empty($coursecode)) { |
|
442 | - return false; |
|
443 | - } |
|
444 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
445 | - $time_limit = Database::escape_string($time_limit); |
|
441 | + if (empty($coursecode)) { |
|
442 | + return false; |
|
443 | + } |
|
444 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
445 | + $time_limit = Database::escape_string($time_limit); |
|
446 | 446 | |
447 | 447 | $online_time = time() - $time_limit * 60; |
448 | 448 | $current_date = api_get_utc_datetime($online_time); |
449 | - $courseId = api_get_course_int_id($coursecode); |
|
449 | + $courseId = api_get_course_int_id($coursecode); |
|
450 | 450 | |
451 | - if (empty($courseId)) { |
|
452 | - return false; |
|
453 | - } |
|
451 | + if (empty($courseId)) { |
|
452 | + return false; |
|
453 | + } |
|
454 | 454 | |
455 | - $query = "SELECT count(login_user_id) as count |
|
455 | + $query = "SELECT count(login_user_id) as count |
|
456 | 456 | FROM $track_online_table |
457 | 457 | WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' "; |
458 | - $result = Database::query($query); |
|
459 | - if (Database::num_rows($result) > 0) { |
|
460 | - $row = Database::fetch_array($result); |
|
461 | - return $row['count']; |
|
462 | - } else { |
|
463 | - return false; |
|
464 | - } |
|
458 | + $result = Database::query($query); |
|
459 | + if (Database::num_rows($result) > 0) { |
|
460 | + $row = Database::fetch_array($result); |
|
461 | + return $row['count']; |
|
462 | + } else { |
|
463 | + return false; |
|
464 | + } |
|
465 | 465 | } |
@@ -110,8 +110,8 @@ |
||
110 | 110 | //With this function we can add actions to the jgrid (edit, delete, etc) |
111 | 111 | $action_links = 'function action_formatter(cellvalue, options, rowObject) { |
112 | 112 | return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. |
113 | - ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
114 | - '\'; |
|
113 | + ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
114 | + '\'; |
|
115 | 115 | }'; |
116 | 116 | ?> |
117 | 117 | <script> |
@@ -626,7 +626,6 @@ discard block |
||
626 | 626 | * Also, this function provides conversion between path types, in this case the input path points inside the Chamilo area too. |
627 | 627 | * |
628 | 628 | * See $_configuration['course_folder'] in the configuration.php to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters. |
629 | - |
|
630 | 629 | * @param string $path (optional) A path which type is to be converted. Also, it may be a defined constant for a path. |
631 | 630 | * This parameter has meaning when $type parameter has one of the following values: TO_WEB, TO_SYS, TO_REL. Otherwise it is ignored. |
632 | 631 | * @return string The requested path or the converted path. |
@@ -1733,7 +1732,6 @@ discard block |
||
1733 | 1732 | |
1734 | 1733 | /** |
1735 | 1734 | * Returns the current course info array. |
1736 | - |
|
1737 | 1735 | * Now if the course_code is given, the returned array gives info about that |
1738 | 1736 | * particular course, not specially the current one. |
1739 | 1737 | * @param int $id Numeric ID of the course |
@@ -6210,7 +6208,7 @@ discard block |
||
6210 | 6208 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6211 | 6209 | $libraries = array(); |
6212 | 6210 | if ($include_jqgrid) { |
6213 | - $libraries[]='jqgrid'; |
|
6211 | + $libraries[]='jqgrid'; |
|
6214 | 6212 | } |
6215 | 6213 | return api_get_jquery_libraries_js($libraries); |
6216 | 6214 | } |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | ]; |
1465 | 1465 | Database::update($table, $newParams, ['id = ? ' => $ticketId]); |
1466 | 1466 | |
1467 | - self::sendNotification( |
|
1467 | + self::sendNotification( |
|
1468 | 1468 | $ticketId, |
1469 | 1469 | $userId, |
1470 | 1470 | get_lang('TicketUpdated'), |
@@ -1926,9 +1926,9 @@ discard block |
||
1926 | 1926 | return 0; |
1927 | 1927 | } |
1928 | 1928 | |
1929 | - /** |
|
1930 | - * @return array |
|
1931 | - */ |
|
1929 | + /** |
|
1930 | + * @return array |
|
1931 | + */ |
|
1932 | 1932 | public static function getPriorityList() |
1933 | 1933 | { |
1934 | 1934 | $projects = Database::getManager()->getRepository('ChamiloTicketBundle:Priority')->findAll(); |
@@ -2343,8 +2343,8 @@ discard block |
||
2343 | 2343 | } |
2344 | 2344 | |
2345 | 2345 | /** |
2346 | - * @return array |
|
2347 | - */ |
|
2346 | + * @return array |
|
2347 | + */ |
|
2348 | 2348 | public static function getDefaultPriorityList() { |
2349 | 2349 | return [ |
2350 | 2350 | self::PRIORITY_NORMAL, |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | |
39 | 39 | // Tool name |
40 | 40 | if ($action === 'addnote') { |
41 | - $tool = 'NoteAddNew'; |
|
42 | - $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => get_lang('ToolNotebook')); |
|
41 | + $tool = 'NoteAddNew'; |
|
42 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => get_lang('ToolNotebook')); |
|
43 | 43 | } |
44 | 44 | if ($action === 'editnote') { |
45 | - $tool = 'ModifyNote'; |
|
46 | - $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => get_lang('ToolNotebook')); |
|
45 | + $tool = 'ModifyNote'; |
|
46 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => get_lang('ToolNotebook')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // Displaying the header |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | exit; |
64 | 64 | } |
65 | 65 | |
66 | - $_SESSION['notebook_view'] = 'creation_date'; |
|
66 | + $_SESSION['notebook_view'] = 'creation_date'; |
|
67 | 67 | |
68 | 68 | $form = new FormValidator( |
69 | 69 | 'note', |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'changeable', |
21 | 21 | 'filter', |
22 | 22 | 'extra_field_type', |
23 | - /* Enable this when field_loggeable is introduced as a table field (2.0) |
|
23 | + /* Enable this when field_loggeable is introduced as a table field (2.0) |
|
24 | 24 | 'field_loggeable', |
25 | 25 | */ |
26 | 26 | 'created_at' |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | 'align' => 'left', |
2042 | 2042 | 'sortable' => 'true', |
2043 | 2043 | ), |
2044 | - array( |
|
2044 | + array( |
|
2045 | 2045 | 'name' => 'visible_to_others', |
2046 | 2046 | 'index' => 'visible_to_others', |
2047 | 2047 | 'width' => '40', |
@@ -6038,8 +6038,8 @@ discard block |
||
6038 | 6038 | $course_id = api_get_course_int_id(); |
6039 | 6039 | } |
6040 | 6040 | |
6041 | - $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId; |
|
6042 | - $sessionId = api_get_session_id(); |
|
6041 | + $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId; |
|
6042 | + $sessionId = api_get_session_id(); |
|
6043 | 6043 | |
6044 | 6044 | // Generates folder |
6045 | 6045 | $result = $this->generate_lp_folder($courseInfo); |
@@ -11114,7 +11114,7 @@ discard block |
||
11114 | 11114 | $lpItemId = []; |
11115 | 11115 | $typeListNotToVerify = self::getChapterTypes(); |
11116 | 11116 | |
11117 | - // Using get_toc() function instead $this->items because returns the correct order of the items |
|
11117 | + // Using get_toc() function instead $this->items because returns the correct order of the items |
|
11118 | 11118 | foreach ($this->get_toc() as $item) { |
11119 | 11119 | if (!in_array($item['type'], $typeListNotToVerify)) { |
11120 | 11120 | $lpItemId[] = $item['id']; |
@@ -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( |