@@ -14,27 +14,21 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | // storing all the permission for a given role when the checkbox approach is used |
17 | -if ($_POST['StoreRolePermissions']) |
|
18 | -{ |
|
19 | - if (!empty($_POST['role_name'])) |
|
20 | - { |
|
17 | +if ($_POST['StoreRolePermissions']) { |
|
18 | + if (!empty($_POST['role_name'])) { |
|
21 | 19 | $table_role = Database::get_course_table(TABLE_ROLE); |
22 | 20 | $sql = "INSERT INTO $table_role (role_name, role_comment, default_role) |
23 | 21 | VALUES ('".Database::escape_string($_POST['role_name'])."','".Database::escape_string($_POST['role_comment'])."','".Database::escape_string($_POST['default_role'])."')"; |
24 | 22 | $result = Database::query($sql); |
25 | 23 | $role_id = Database::insert_id(); |
26 | 24 | $result_message = store_permissions('role', $role_id); |
27 | - } |
|
28 | - else |
|
29 | - { |
|
25 | + } else { |
|
30 | 26 | $result_message = get_lang('ErrorPleaseGiveRoleName'); |
31 | 27 | } |
32 | 28 | } |
33 | 29 | // storing a permission for a given role when the image approach is used |
34 | -if (isset($_GET['action']) AND isset($_GET['permission']) AND isset($_GET['tool'])) |
|
35 | -{ |
|
36 | - if ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke') |
|
37 | - { |
|
30 | +if (isset($_GET['action']) AND isset($_GET['permission']) AND isset($_GET['tool'])) { |
|
31 | + if ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke') { |
|
38 | 32 | $result_message = store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']); |
39 | 33 | } |
40 | 34 | } |
@@ -71,8 +65,7 @@ discard block |
||
71 | 65 | // ADDING A NEW ROLE (FORM AND LINK) |
72 | 66 | echo '<img src="../img/add.png" /> <a href="roles.php?action=add">'.get_lang('AddRole').'</a>'; |
73 | 67 | |
74 | -if ($_GET['action'] == 'add') |
|
75 | -{ |
|
68 | +if ($_GET['action'] == 'add') { |
|
76 | 69 | echo "<form method=\"post\" action=\"".api_get_self()."\">"; |
77 | 70 | echo "\n<table>"; |
78 | 71 | echo "\n\t<tr>"; |
@@ -117,9 +110,11 @@ discard block |
||
117 | 110 | echo "\t</tr>\n"; |
118 | 111 | |
119 | 112 | // the main area with the checkboxes or images |
120 | - foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
113 | + foreach ($tool_rights as $tool=>$rights) { |
|
114 | + // $tool_rights contains all the possible tools and their rights |
|
121 | 115 | { |
122 | 116 | echo "\t<tr>\n"; |
117 | + } |
|
123 | 118 | echo "\t\t<td>\n"; |
124 | 119 | echo get_lang($tool); |
125 | 120 | echo "\t\t</td>\n"; |
@@ -140,12 +135,10 @@ discard block |
||
140 | 135 | // DISPLAYING THE EXISTING ROLES |
141 | 136 | // platform roles |
142 | 137 | $all_roles = get_all_roles('platform'); |
143 | -foreach ($all_roles as $role) |
|
144 | -{ |
|
138 | +foreach ($all_roles as $role) { |
|
145 | 139 | echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'&scope=platform">'.$role['role_name'].'</a></div>'; |
146 | 140 | echo '<div>'.$role['role_comment'].'</div><br />'; |
147 | - if ($role['role_id'] == $_GET['role_id']) |
|
148 | - { |
|
141 | + if ($role['role_id'] == $_GET['role_id']) { |
|
149 | 142 | $current_role_info = $role; |
150 | 143 | } |
151 | 144 | } |
@@ -154,8 +147,7 @@ discard block |
||
154 | 147 | foreach ($all_roles as $role) { |
155 | 148 | echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'">'.$role['role_name'].'</a><a href="roles.php?action=delete&role_id='.$role['role_id'].'"><img src="../img/delete.gif" /></a></div>'; |
156 | 149 | echo '<div>'.$role['role_comment'].'</div><br />'; |
157 | - if ($role['role_id'] == $_GET['role_id']) |
|
158 | - { |
|
150 | + if ($role['role_id'] == $_GET['role_id']) { |
|
159 | 151 | $current_role_info = $role; |
160 | 152 | } |
161 | 153 | } |
@@ -165,12 +157,10 @@ discard block |
||
165 | 157 | $current_role_permissions = get_permissions('role', $_GET['role_id']); |
166 | 158 | // LIMITED OR FULL |
167 | 159 | $current_role_permissions = limited_or_full($current_role_permissions); |
168 | - if (api_get_setting('permissions') == 'limited') |
|
169 | - { |
|
160 | + if (api_get_setting('permissions') == 'limited') { |
|
170 | 161 | $header_array = $rights_limited; |
171 | 162 | } |
172 | - if (api_get_setting('permissions') == 'full') |
|
173 | - { |
|
163 | + if (api_get_setting('permissions') == 'full') { |
|
174 | 164 | $header_array = $rights_full; |
175 | 165 | } |
176 | 166 | // --------------------------------------------------- |
@@ -180,8 +170,7 @@ discard block |
||
180 | 170 | |
181 | 171 | // the list of the roles for the user |
182 | 172 | echo get_lang('PermissionsOfRole').':'.$current_role_info['role_name'].'<br />'; |
183 | - if ($_GET['scope'] == 'platform') |
|
184 | - { |
|
173 | + if ($_GET['scope'] == 'platform') { |
|
185 | 174 | echo get_lang('IsPlatformRoleNotEditable').'<br />'; |
186 | 175 | } |
187 | 176 | |
@@ -196,9 +185,11 @@ discard block |
||
196 | 185 | echo "\t</tr>\n"; |
197 | 186 | |
198 | 187 | // the main area with the checkboxes or images |
199 | - foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
188 | + foreach ($tool_rights as $tool=>$rights) { |
|
189 | + // $tool_rights contains all the possible tools and their rights |
|
200 | 190 | { |
201 | 191 | echo "\t<tr>\n"; |
192 | + } |
|
202 | 193 | echo "\t\t<td>\n"; |
203 | 194 | echo get_lang($tool); |
204 | 195 | echo "\t\t</td>\n"; |
@@ -31,16 +31,16 @@ |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | // storing a permission for a given role when the image approach is used |
34 | -if (isset($_GET['action']) AND isset($_GET['permission']) AND isset($_GET['tool'])) |
|
34 | +if (isset($_GET['action']) and isset($_GET['permission']) and isset($_GET['tool'])) |
|
35 | 35 | { |
36 | - if ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke') |
|
36 | + if ($_GET['action'] == 'grant' or $_GET['action'] == 'revoke') |
|
37 | 37 | { |
38 | 38 | $result_message = store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']); |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | 42 | // deleting a role |
43 | -if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action'] == 'delete') { |
|
43 | +if (isset($_GET['action']) and isset($_GET['role_id']) and $_GET['action'] == 'delete') { |
|
44 | 44 | //deleting the assignments fo this role: users |
45 | 45 | $table = Database::get_course_table(TABLE_ROLE_USER); |
46 | 46 | $sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
@@ -18,10 +18,10 @@ |
||
18 | 18 | $file = file(api_get_path(SYS_LANG_PATH).'english/hotspot.inc.php'); |
19 | 19 | |
20 | 20 | foreach ($file as &$value) { |
21 | - $variable = explode('=', $value, 2); |
|
22 | - if (count($variable) > 1) { |
|
23 | - $variable = substr(trim($variable[0]), 1); |
|
24 | - $variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' '; |
|
25 | - echo $variable; |
|
26 | - } |
|
21 | + $variable = explode('=', $value, 2); |
|
22 | + if (count($variable) > 1) { |
|
23 | + $variable = substr(trim($variable[0]), 1); |
|
24 | + $variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' '; |
|
25 | + echo $variable; |
|
26 | + } |
|
27 | 27 | } |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | /** |
343 | - * This function shows the content of a table in a grid. |
|
344 | - * Should not be use to edit information (edit/delete rows) only. |
|
345 | - **/ |
|
343 | + * This function shows the content of a table in a grid. |
|
344 | + * Should not be use to edit information (edit/delete rows) only. |
|
345 | + **/ |
|
346 | 346 | public function display_grid() |
347 | 347 | { |
348 | 348 | $empty_table = false; |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; |
801 | 801 | $my_get_direction = $_GET[$tablename.'_direction']; |
802 | 802 | if (!in_array($my_get_direction, array('ASC', 'DESC'))) { |
803 | - $param[$tablename.'_direction'] = 'ASC'; |
|
803 | + $param[$tablename.'_direction'] = 'ASC'; |
|
804 | 804 | } else { |
805 | 805 | $param[$tablename.'_direction'] = $my_get_direction; |
806 | 806 | } |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | if (is_array($row)) { |
930 | 930 | foreach ($row as & $value) { |
931 | 931 | if (empty($value)) { |
932 | - $value = '-'; |
|
932 | + $value = '-'; |
|
933 | 933 | } |
934 | 934 | } |
935 | 935 | } |
@@ -443,6 +443,7 @@ |
||
443 | 443 | * @param bool hide navigation optionally |
444 | 444 | * @param int content per page when show navigation (optional) |
445 | 445 | * @param bool sort data optionally |
446 | + * @param boolean $visibility_options |
|
446 | 447 | * @return string grid html |
447 | 448 | */ |
448 | 449 | public function display_simple_grid( |
@@ -20,16 +20,16 @@ |
||
20 | 20 | $users = Database::get_main_table(TABLE_MAIN_USER); |
21 | 21 | $string = ''; |
22 | 22 | foreach ($list as $mail) { |
23 | - $mail = trim($mail); |
|
24 | - $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n"; |
|
25 | - $res = Database::query($sql); |
|
26 | - if ($res === false) { die(mysql_error()); } |
|
27 | - if (Database::num_rows($res) == 0) { |
|
23 | + $mail = trim($mail); |
|
24 | + $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n"; |
|
25 | + $res = Database::query($sql); |
|
26 | + if ($res === false) { die(mysql_error()); } |
|
27 | + if (Database::num_rows($res) == 0) { |
|
28 | 28 | $string .= 'No encontrado;'.$row['email']; |
29 | - } else { |
|
29 | + } else { |
|
30 | 30 | $row = Database::fetch_assoc($res); |
31 | - $string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n"; |
|
32 | - } |
|
31 | + $string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n"; |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | echo $string; |
35 | 35 | file_put_contents('/tmp/list.txt', $string); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * Searches for a node in the given array. |
262 | 262 | * @param array $array Reference to the array to search |
263 | 263 | * @param string $node Node we are looking for in the array |
264 | - * @return mixed Node name or false if not found |
|
264 | + * @return false|string Node name or false if not found |
|
265 | 265 | */ |
266 | 266 | function myarraysearch(&$array, $node) |
267 | 267 | { |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * Searches an image name into an array. |
283 | 283 | * @param array $imgparams Reference to an array to search |
284 | 284 | * @param string $string String to look for |
285 | - * @return mixed String given if found, false otherwise |
|
285 | + * @return false|string String given if found, false otherwise |
|
286 | 286 | * @uses myarraysearch This function is just an additional layer on the myarraysearch() function |
287 | 287 | */ |
288 | 288 | function CheckImageName(&$imgparams, $string) |
@@ -103,7 +103,7 @@ |
||
103 | 103 | $path = Database::escape_string($path); |
104 | 104 | $comment = Database::escape_string($comment); |
105 | 105 | $course_id = api_get_course_int_id(); |
106 | - $query = "UPDATE $dbTable SET comment = '$comment' |
|
106 | + $query = "update $dbTable SET comment = '$comment' |
|
107 | 107 | WHERE $course_id AND path = '$path'"; |
108 | 108 | $result = Database::query($query); |
109 | 109 |
@@ -663,7 +663,7 @@ |
||
663 | 663 | $answer_list |
664 | 664 | </td> |
665 | 665 | <tr> |
666 | -HTML; |
|
666 | +html; |
|
667 | 667 | $html .= '</table></td></tr>'; |
668 | 668 | |
669 | 669 | // currently the free answers cannot be displayed, so ignore the textarea |
@@ -1743,7 +1743,6 @@ discard block |
||
1743 | 1743 | |
1744 | 1744 | /** |
1745 | 1745 | * Return true a date is valid |
1746 | - |
|
1747 | 1746 | * @param string $date example: 2014-06-30 13:05:05 |
1748 | 1747 | * @param string $format example: "Y-m-d H:i:s" |
1749 | 1748 | * |
@@ -2016,15 +2015,15 @@ discard block |
||
2016 | 2015 | { |
2017 | 2016 | if ($showTime) { |
2018 | 2017 | if ($humanForm) { |
2019 | - return $date->format('j M Y H:i:s'); |
|
2018 | + return $date->format('j M Y H:i:s'); |
|
2020 | 2019 | } else { |
2021 | - return $date->format('Y-m-d H:i:s'); |
|
2020 | + return $date->format('Y-m-d H:i:s'); |
|
2022 | 2021 | } |
2023 | 2022 | } else { |
2024 | 2023 | if ($humanForm) { |
2025 | - return $date->format('j M Y'); |
|
2024 | + return $date->format('j M Y'); |
|
2026 | 2025 | } else { |
2027 | - return $date->format('Y-m-d'); |
|
2026 | + return $date->format('Y-m-d'); |
|
2028 | 2027 | } |
2029 | 2028 | } |
2030 | 2029 | } |
@@ -448,6 +448,7 @@ discard block |
||
448 | 448 | * If null, the timezone will be determined based on user preference, |
449 | 449 | * or timezone chosen by the admin for the platform. |
450 | 450 | * @param string The timezone to be converted from. If null, UTC will be assumed. |
451 | + * @param string $to_timezone |
|
451 | 452 | * @return string The converted time formatted as Y-m-d H:i:s |
452 | 453 | * |
453 | 454 | * @author Guillaume Viguier <[email protected]> |
@@ -719,6 +720,8 @@ discard block |
||
719 | 720 | * @param mixed The time to be converted |
720 | 721 | * @param mixed Format to be used (TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG) |
721 | 722 | * @param string Timezone to be converted from. If null, UTC will be assumed. |
723 | + * @param integer $format |
|
724 | + * @param string $from_timezone |
|
722 | 725 | * @return string Converted and localized date |
723 | 726 | * |
724 | 727 | * @author Guillaume Viguier <[email protected]> |
@@ -805,7 +808,7 @@ discard block |
||
805 | 808 | * This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only. |
806 | 809 | * @param string $encoding (optional) The used internally by this function |
807 | 810 | * character encoding. If it is omitted, the platform character set will be used by default. |
808 | - * @return bool The result is sort of full name of the person. |
|
811 | + * @return string The result is sort of full name of the person. |
|
809 | 812 | * Sample results: |
810 | 813 | * Peter Ustinoff or Dr. Peter Ustinoff - the Western order |
811 | 814 | * Ustinoff Peter or Dr. Ustinoff Peter - the Eastern order |
@@ -1148,8 +1151,8 @@ discard block |
||
1148 | 1151 | /** |
1149 | 1152 | * This function returns a string or an array with all occurrences of search |
1150 | 1153 | * in subject (ignoring case) replaced with the given replace value. |
1151 | - * @param mixed $search String or array of strings to be found. |
|
1152 | - * @param mixed $replace String or array of strings used for replacement. |
|
1154 | + * @param string $search String or array of strings to be found. |
|
1155 | + * @param string $replace String or array of strings used for replacement. |
|
1153 | 1156 | * @param mixed $subject String or array of strings being searched. |
1154 | 1157 | * @param int $count (optional) The number of matched and replaced needles |
1155 | 1158 | * will be returned in count, which is passed by reference. |
@@ -1219,12 +1222,12 @@ discard block |
||
1219 | 1222 | /** |
1220 | 1223 | * Finds first occurrence of a string within another, case insensitive. |
1221 | 1224 | * @param string $haystack The string from which to get the first occurrence. |
1222 | - * @param mixed $needle The string to be found. |
|
1225 | + * @param string $needle The string to be found. |
|
1223 | 1226 | * @param bool $before_needle (optional) Determines which portion of $haystack |
1224 | 1227 | * this function returns. The default value is FALSE. |
1225 | 1228 | * @param string $encoding (optional) The used internally by this function |
1226 | 1229 | * character encoding. If it is omitted, the platform character set will be used by default. |
1227 | - * @return mixed Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1230 | + * @return false|string Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1228 | 1231 | * Notes: |
1229 | 1232 | * If $needle is not a string, it is converted to an integer and applied as the |
1230 | 1233 | * ordinal value (codepoint if the encoding is UTF-8) of a character. |
@@ -1283,7 +1286,7 @@ discard block |
||
1283 | 1286 | * @param mixed $needle The string which first character is to be found. |
1284 | 1287 | * @param bool $before_needle (optional) Determines which portion of $haystack this function returns. The default value is FALSE. |
1285 | 1288 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
1286 | - * @return mixed Returns the portion of $haystack, or FALSE if the first character from $needle is not found. |
|
1289 | + * @return false|string Returns the portion of $haystack, or FALSE if the first character from $needle is not found. |
|
1287 | 1290 | * Notes: |
1288 | 1291 | * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character. |
1289 | 1292 | * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence. |
@@ -1350,7 +1353,7 @@ discard block |
||
1350 | 1353 | * @param mixed $needle The string to be found. |
1351 | 1354 | * @param bool $before_needle (optional) Determines which portion of $haystack this function returns. The default value is FALSE. |
1352 | 1355 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
1353 | - * @return mixed Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1356 | + * @return false|string Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1354 | 1357 | * Notes: |
1355 | 1358 | * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character. |
1356 | 1359 | * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence of $needle. |
@@ -1540,8 +1543,8 @@ discard block |
||
1540 | 1543 | |
1541 | 1544 | /** |
1542 | 1545 | * Performs a regular expression search and replace, UTF-8 aware when it is applicable. |
1543 | - * @param string|array $pattern The pattern to search for. It can be either a string or an array with strings. |
|
1544 | - * @param string|array $replacement The string or an array with strings to replace. |
|
1546 | + * @param string $pattern The pattern to search for. It can be either a string or an array with strings. |
|
1547 | + * @param string $replacement The string or an array with strings to replace. |
|
1545 | 1548 | * @param string|array $subject The string or an array with strings to search and replace. |
1546 | 1549 | * @param int $limit The maximum possible replacements for each pattern in each subject string. Defaults to -1 (no limit). |
1547 | 1550 | * @param int &$count If specified, this variable will be filled with the number of replacements done. |
@@ -1692,7 +1695,7 @@ discard block |
||
1692 | 1695 | |
1693 | 1696 | /** |
1694 | 1697 | * This function checks whether two $encoding are equal (same, equvalent). |
1695 | - * @param string|array $encoding1 The first encoding |
|
1698 | + * @param string $encoding1 The first encoding |
|
1696 | 1699 | * @param string|array $encoding2 The second encoding |
1697 | 1700 | * @param bool $strict When this parameter is TRUE the comparison ignores aliases of encodings. |
1698 | 1701 | * When the parameter is FALSE, aliases are taken into account. |
@@ -1800,7 +1803,7 @@ discard block |
||
1800 | 1803 | * Checks a string for UTF-8 validity. |
1801 | 1804 | * @param string $string |
1802 | 1805 | * |
1803 | - * @return string |
|
1806 | + * @return boolean |
|
1804 | 1807 | */ |
1805 | 1808 | function api_is_valid_utf8($string) |
1806 | 1809 | { |
@@ -1974,7 +1977,7 @@ discard block |
||
1974 | 1977 | /** |
1975 | 1978 | * Replaces non-valid formats for person names with the default (English) format. |
1976 | 1979 | * @param string $format The input format to be verified. |
1977 | - * @return bool Returns the same format if is is valid, otherwise returns a valid English format. |
|
1980 | + * @return string Returns the same format if is is valid, otherwise returns a valid English format. |
|
1978 | 1981 | */ |
1979 | 1982 | function _api_validate_person_name_format($format) |
1980 | 1983 | { |
@@ -2106,6 +2109,9 @@ discard block |
||
2106 | 2109 | |
2107 | 2110 | // This function checks whether the function _api_convert_encoding() (the php- |
2108 | 2111 | // implementation) is able to convert from/to a given encoding. |
2112 | +/** |
|
2113 | + * @param string $encoding |
|
2114 | + */ |
|
2109 | 2115 | function _api_convert_encoding_supports($encoding) |
2110 | 2116 | { |
2111 | 2117 | static $supports = array(); |
@@ -2117,7 +2123,7 @@ discard block |
||
2117 | 2123 | |
2118 | 2124 | /** |
2119 | 2125 | * Given a date object, return a human or ISO format, with or without h:m:s |
2120 | - * @param object $date The Date object |
|
2126 | + * @param DateTime $date The Date object |
|
2121 | 2127 | * @param bool $showTime Whether to show the time and date (true) or only the date (false) |
2122 | 2128 | * @param bool $humanForm Whether to show day-month-year (true) or year-month-day (false) |
2123 | 2129 | * @return string Formatted date |
@@ -166,7 +166,8 @@ discard block |
||
166 | 166 | $purified = false, |
167 | 167 | $check_sub_language = false, |
168 | 168 | $setParentLanguageName = true |
169 | -) { |
|
169 | +) |
|
170 | +{ |
|
170 | 171 | global $language_interface; |
171 | 172 | |
172 | 173 | if (empty($language_interface)) { |
@@ -408,7 +409,8 @@ discard block |
||
408 | 409 | $time = null, |
409 | 410 | $return_null_if_invalid_date = false, |
410 | 411 | $returnObj = false |
411 | -) { |
|
412 | +) |
|
413 | +{ |
|
412 | 414 | $from_timezone = api_get_timezone(); |
413 | 415 | $to_timezone = 'UTC'; |
414 | 416 | if (is_null($time) || empty($time) || $time === '0000-00-00 00:00:00') { |
@@ -459,7 +461,8 @@ discard block |
||
459 | 461 | $return_null_if_invalid_date = false, |
460 | 462 | $showTime = true, |
461 | 463 | $humanForm = false |
462 | -) { |
|
464 | +) |
|
465 | +{ |
|
463 | 466 | // Determining the timezone to be converted from |
464 | 467 | if (is_null($from_timezone)) { |
465 | 468 | $from_timezone = 'UTC'; |
@@ -823,7 +826,8 @@ discard block |
||
823 | 826 | $language = null, |
824 | 827 | $encoding = null, |
825 | 828 | $username = null |
826 | -) { |
|
829 | +) |
|
830 | +{ |
|
827 | 831 | static $valid = array(); |
828 | 832 | if (empty($format)) { |
829 | 833 | $format = PERSON_NAME_COMMON_CONVENTION; |
@@ -1505,7 +1509,8 @@ discard block |
||
1505 | 1509 | $flags = 0, |
1506 | 1510 | $offset = 0, |
1507 | 1511 | $encoding = null |
1508 | -) { |
|
1512 | +) |
|
1513 | +{ |
|
1509 | 1514 | if (empty($encoding)) { |
1510 | 1515 | $encoding = _api_mb_internal_encoding(); |
1511 | 1516 | } |
@@ -1528,7 +1533,8 @@ discard block |
||
1528 | 1533 | * @return int|boolean Returns the number of full pattern matches (which might be zero), or FALSE if an error occurred. |
1529 | 1534 | * @link http://php.net/preg_match_all |
1530 | 1535 | */ |
1531 | -function api_preg_match_all($pattern, $subject, &$matches, $flags = PREG_PATTERN_ORDER, $offset = 0, $encoding = null) { |
|
1536 | +function api_preg_match_all($pattern, $subject, &$matches, $flags = PREG_PATTERN_ORDER, $offset = 0, $encoding = null) |
|
1537 | +{ |
|
1532 | 1538 | if (empty($encoding)) { |
1533 | 1539 | $encoding = _api_mb_internal_encoding(); |
1534 | 1540 | } |
@@ -1581,7 +1587,8 @@ discard block |
||
1581 | 1587 | * @return array Returns an array containing substrings of $subject split along boundaries matched by $pattern. |
1582 | 1588 | * @link http://php.net/preg_split |
1583 | 1589 | */ |
1584 | -function api_preg_split($pattern, $subject, $limit = -1, $flags = 0, $encoding = null) { |
|
1590 | +function api_preg_split($pattern, $subject, $limit = -1, $flags = 0, $encoding = null) |
|
1591 | +{ |
|
1585 | 1592 | if (empty($encoding)) { |
1586 | 1593 | $encoding = _api_mb_internal_encoding(); |
1587 | 1594 | } |
@@ -1708,8 +1715,7 @@ discard block |
||
1708 | 1715 | } |
1709 | 1716 | } |
1710 | 1717 | return false; |
1711 | - } |
|
1712 | - elseif (is_array($encoding2)) { |
|
1718 | + } elseif (is_array($encoding2)) { |
|
1713 | 1719 | foreach ($encoding2 as $encoding) { |
1714 | 1720 | if (api_equal_encodings($encoding1, $encoding, $strict)) { |
1715 | 1721 | return true; |
@@ -1838,7 +1844,8 @@ discard block |
||
1838 | 1844 | * @param string $pluginName the Plugin name |
1839 | 1845 | * @return string the variable translated |
1840 | 1846 | */ |
1841 | -function get_plugin_lang($variable, $pluginName) { |
|
1847 | +function get_plugin_lang($variable, $pluginName) |
|
1848 | +{ |
|
1842 | 1849 | $plugin = $pluginName::create(); |
1843 | 1850 | return $plugin->get_lang($variable); |
1844 | 1851 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $id = Database::insert($tbl_wiki, $params); |
373 | 373 | |
374 | 374 | if ($id > 0) { |
375 | - $sql = "UPDATE $tbl_wiki SET id = iid WHERE iid = $id"; |
|
375 | + $sql = "update $tbl_wiki SET id = iid WHERE iid = $id"; |
|
376 | 376 | Database::query($sql); |
377 | 377 | |
378 | 378 | // insert into item_property |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $id = Database::insert($tbl_wiki, $params); |
494 | 494 | |
495 | 495 | if ($id) { |
496 | - $sql = "UPDATE $tbl_wiki SET id = iid WHERE iid = $id"; |
|
496 | + $sql = "update $tbl_wiki SET id = iid WHERE iid = $id"; |
|
497 | 497 | Database::query($sql); |
498 | 498 | |
499 | 499 | api_item_property_update( |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | ]; |
683 | 683 | $id = Database::insert($tbl_wiki, $params); |
684 | 684 | if ($id > 0) { |
685 | - $sql = "UPDATE $tbl_wiki SET id = iid WHERE iid = $id"; |
|
685 | + $sql = "update $tbl_wiki SET id = iid WHERE iid = $id"; |
|
686 | 686 | Database::query($sql); |
687 | 687 | |
688 | 688 | //insert into item_property |
@@ -3386,7 +3386,7 @@ discard block |
||
3386 | 3386 | ]; |
3387 | 3387 | $discussId = Database::insert($tbl_wiki_discuss, $params); |
3388 | 3388 | if ($discussId) { |
3389 | - $sql = "UPDATE $tbl_wiki_discuss SET id = iid WHERE iid = $discussId"; |
|
3389 | + $sql = "update $tbl_wiki_discuss SET id = iid WHERE iid = $discussId"; |
|
3390 | 3390 | Database::query($sql); |
3391 | 3391 | } |
3392 | 3392 |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * This function saves a change in a wiki page |
293 | 293 | * @author Patrick Cool <[email protected]>, Ghent University |
294 | 294 | * @param array $values |
295 | - * @return language string saying that the changes are stored |
|
295 | + * @return string string saying that the changes are stored |
|
296 | 296 | **/ |
297 | 297 | public function save_wiki($values) |
298 | 298 | { |
@@ -1503,6 +1503,7 @@ discard block |
||
1503 | 1503 | * Checks if this navigation tab has to be set to active |
1504 | 1504 | * @author Patrick Cool <[email protected]>, Ghent University |
1505 | 1505 | * |
1506 | + * @param string $paramwk |
|
1506 | 1507 | * @return string html code |
1507 | 1508 | */ |
1508 | 1509 | public function is_active_navigation_tab($paramwk) |
@@ -2034,6 +2035,7 @@ discard block |
||
2034 | 2035 | |
2035 | 2036 | /** |
2036 | 2037 | * Sends pending e-mails |
2038 | + * @param string $type |
|
2037 | 2039 | */ |
2038 | 2040 | public function check_emailcue( |
2039 | 2041 | $id_or_ref, |
@@ -2258,7 +2260,7 @@ discard block |
||
2258 | 2260 | /** |
2259 | 2261 | * Function export last wiki page version to document area |
2260 | 2262 | * @param int $doc_id wiki page id |
2261 | - * @return mixed |
|
2263 | + * @return false|string |
|
2262 | 2264 | * @author Juan Carlos Raña <[email protected]> |
2263 | 2265 | */ |
2264 | 2266 | public function export2doc($doc_id) |
@@ -2411,6 +2413,7 @@ discard block |
||
2411 | 2413 | |
2412 | 2414 | /** |
2413 | 2415 | * Exports the wiki page to PDF |
2416 | + * @param string $course_code |
|
2414 | 2417 | */ |
2415 | 2418 | public function export_to_pdf($id, $course_code) |
2416 | 2419 | { |
@@ -3084,6 +3087,7 @@ discard block |
||
3084 | 3087 | /** |
3085 | 3088 | * Draws an HTML form select with the given options |
3086 | 3089 | * |
3090 | + * @param string $name |
|
3087 | 3091 | */ |
3088 | 3092 | public function make_select($name, $values, $checked = '') |
3089 | 3093 | { |
@@ -3122,7 +3126,7 @@ discard block |
||
3122 | 3126 | /** |
3123 | 3127 | * Get wiki information |
3124 | 3128 | * @param int|bool wiki id |
3125 | - * @return array wiki data |
|
3129 | + * @return string wiki data |
|
3126 | 3130 | */ |
3127 | 3131 | public function getWikiDataFromDb($id) |
3128 | 3132 | { |
@@ -3170,6 +3174,7 @@ discard block |
||
3170 | 3174 | * Get wiki information |
3171 | 3175 | * @param string wiki id |
3172 | 3176 | * @param int $courseId |
3177 | + * @param string $title |
|
3173 | 3178 | * @return array wiki data |
3174 | 3179 | */ |
3175 | 3180 | public function getPageByTitle($title, $courseId = null) |
@@ -3202,6 +3207,8 @@ discard block |
||
3202 | 3207 | * @param int $courseId |
3203 | 3208 | * @param string |
3204 | 3209 | * @param string |
3210 | + * @param string $groupfilter |
|
3211 | + * @param string $condition_session |
|
3205 | 3212 | * @return bool |
3206 | 3213 | */ |
3207 | 3214 | public function deletePage( |
@@ -4553,6 +4560,7 @@ discard block |
||
4553 | 4560 | |
4554 | 4561 | /** |
4555 | 4562 | * Show all pages |
4563 | + * @param string $action |
|
4556 | 4564 | */ |
4557 | 4565 | public function allPages($action) |
4558 | 4566 | { |
@@ -5446,7 +5454,7 @@ discard block |
||
5446 | 5454 | |
5447 | 5455 | /** |
5448 | 5456 | * Restore page |
5449 | - * @return bool |
|
5457 | + * @return false|null |
|
5450 | 5458 | */ |
5451 | 5459 | public function restorePage() |
5452 | 5460 | { |
@@ -5600,7 +5608,7 @@ discard block |
||
5600 | 5608 | } |
5601 | 5609 | |
5602 | 5610 | /** |
5603 | - * @param int|bool $wikiId |
|
5611 | + * @param false|string $wikiId |
|
5604 | 5612 | */ |
5605 | 5613 | public function setWikiData($wikiId) |
5606 | 5614 | { |
@@ -5618,7 +5626,7 @@ discard block |
||
5618 | 5626 | /** |
5619 | 5627 | * Check last version |
5620 | 5628 | * @param int $view |
5621 | - * @return bool |
|
5629 | + * @return false|null |
|
5622 | 5630 | */ |
5623 | 5631 | public function checkLastVersion($view) |
5624 | 5632 | { |
@@ -3114,7 +3114,7 @@ |
||
3114 | 3114 | */ |
3115 | 3115 | public function two_digits($number) |
3116 | 3116 | { |
3117 | - $number = (int)$number; |
|
3117 | + $number = (int) $number; |
|
3118 | 3118 | |
3119 | 3119 | return ($number < 10) ? '0'.$number : $number; |
3120 | 3120 | } |
@@ -4577,7 +4577,8 @@ discard block |
||
4577 | 4577 | echo '</div>'; |
4578 | 4578 | |
4579 | 4579 | if (api_is_allowed_to_edit(false, true) || api_is_platform_admin( |
4580 | - )) { //only by professors if page is hidden |
|
4580 | + )) { |
|
4581 | +//only by professors if page is hidden |
|
4581 | 4582 | $sql = 'SELECT * |
4582 | 4583 | FROM '.$tbl_wiki.' s1 |
4583 | 4584 | WHERE s1.c_id = '.$course_id.' AND id=( |
@@ -5364,7 +5365,8 @@ discard block |
||
5364 | 5365 | |
5365 | 5366 | if (api_is_allowed_to_edit(false, true) || |
5366 | 5367 | api_is_platform_admin() |
5367 | - ) { //only by professors if page is hidden |
|
5368 | + ) { |
|
5369 | +//only by professors if page is hidden |
|
5368 | 5370 | $sql = 'SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.' |
5369 | 5371 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
5370 | 5372 | GROUP BY reflink';//TODO:check MAX and group by return last version |
@@ -6029,7 +6031,8 @@ discard block |
||
6029 | 6031 | echo '<div class="actions">'.get_lang('MostVisitedPages').'</div>'; |
6030 | 6032 | |
6031 | 6033 | if (api_is_allowed_to_edit(false, true) || api_is_platform_admin( |
6032 | - )) { //only by professors if page is hidden |
|
6034 | + )) { |
|
6035 | +//only by professors if page is hidden |
|
6033 | 6036 | $sql = 'SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' |
6034 | 6037 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
6035 | 6038 | GROUP BY reflink'; |
@@ -6877,7 +6880,8 @@ discard block |
||
6877 | 6880 | 'ShowDifferences' |
6878 | 6881 | ).' '.get_lang('WordsDiff').'</button>'; |
6879 | 6882 | echo '</ul></form>'; |
6880 | - } else { // We show the differences between two versions |
|
6883 | + } else { |
|
6884 | +// We show the differences between two versions |
|
6881 | 6885 | $version_old = array(); |
6882 | 6886 | if (isset($_POST['old'])) { |
6883 | 6887 | $sql_old = "SELECT * FROM $tbl_wiki |
@@ -7,7 +7,7 @@ |
||
7 | 7 | class MaintenanceModePlugin extends Plugin |
8 | 8 | { |
9 | 9 | /** |
10 | - * @return EditHtaccessPlugin |
|
10 | + * @return MaintenanceModePlugin |
|
11 | 11 | */ |
12 | 12 | public static function create() |
13 | 13 | { |