Completed
Pull Request — master (#1537)
by José
29:27
created
main/inc/lib/specific_fields_manager.lib.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 /**
102 102
  * @param array $conditions a list of condition (exemple : status=>STUDENT)
103
- * @param array $order_by a list of fields on which sort
103
+ * @param string[] $order_by a list of fields on which sort
104 104
  * @return array An array with all users of the platform.
105 105
  */
106 106
 function get_specific_field_values_list(
@@ -235,6 +235,7 @@  discard block
 block discarded – undo
235 235
  * @param   string  Course code
236 236
  * @param   string  Tool ID
237 237
  * @param   int     Internal ID used in specific tool table
238
+ * @param string $tool_id
238 239
  */
239 240
 function delete_all_values_for_item($course_id, $tool_id, $ref_id) {
240 241
   $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
@@ -248,6 +249,7 @@  discard block
 block discarded – undo
248 249
  * Defaults to the first letter of the name, otherwise iterate through available
249 250
  * letters
250 251
  * @param   string  Name
252
+ * @param string $name
251 253
  * @return  string  One-letter code, upper-case
252 254
  */
253 255
 function get_specific_field_code_from_name($name) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 function delete_specific_field($id)
43 43
 {
44 44
     $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
45
-    $id = (int)$id;
45
+    $id = (int) $id;
46 46
     if (!is_numeric($id)) {
47 47
         return false;
48 48
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 function edit_specific_field($id, $name)
61 61
 {
62 62
     $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
63
-    $id = (int)$id;
63
+    $id = (int) $id;
64 64
     if (!is_numeric($id)) {
65 65
         return false;
66 66
     }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -237,10 +237,10 @@
 block discarded – undo
237 237
  * @param   int     Internal ID used in specific tool table
238 238
  */
239 239
 function delete_all_values_for_item($course_id, $tool_id, $ref_id) {
240
-  $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
241
-  $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s';
242
-  $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id);
243
-  Database::query($sql);
240
+    $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
241
+    $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s';
242
+    $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id);
243
+    Database::query($sql);
244 244
 }
245 245
 
246 246
 /**
Please login to merge, or discard this patch.
main/inc/lib/statsUtils.lib.inc.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -85,6 +85,7 @@
 block discarded – undo
85 85
     /**
86 86
      * @author Sebastien Piraux <[email protected]>
87 87
      * @param sql : a sql query (as a string)
88
+     * @param integer $X
88 89
      * @desc Return many results of a query in a X column tab
89 90
      * in $resu[$i][0], $resu[$i][1],$resu[$i][2],...
90 91
      * this function is more 'standard' but use a little
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,14 +107,14 @@
 block discarded – undo
107 107
         return $resu;
108 108
     }
109 109
 
110
-	/**
111
-	 * @author Sebastien Piraux <[email protected]>
112
-	 * @param sql : a sql query (as a string)
113
-	 * @return hours_array
114
-	 * @desc        Return an assoc array.  Keys are the hours, values are
115
-	 * the number of time this hours was found.
116
-	 * key 'total' return the sum of all number of time hours
117
-	 * appear
110
+    /**
111
+     * @author Sebastien Piraux <[email protected]>
112
+     * @param sql : a sql query (as a string)
113
+     * @return hours_array
114
+     * @desc        Return an assoc array.  Keys are the hours, values are
115
+     * the number of time this hours was found.
116
+     * key 'total' return the sum of all number of time hours
117
+     * appear
118 118
      */
119 119
     public static function hoursTab($sql)
120 120
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $last_day = -1;
156 156
             while ($row = Database::fetch_row($res)) {
157 157
                 $date_array = getdate($row[0]);
158
-                $display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year'];
158
+                $display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
159 159
                 if ($date_array['mday'] == $last_day) {
160 160
                     $days_array[$display_date]++;
161 161
                 } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     &nbsp;
222 222
                 </td>
223 223
                 <td width='10%'>
224
-                    <b>" . get_lang('Hits') . "</b>
224
+                    <b>".get_lang('Hits')."</b>
225 225
                 </td>
226 226
                 <td width='15%'>
227 227
                     <b>%</b>
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     echo "<img src='".Display::returnIconPath('bar_1m.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
250 250
                 }
251 251
                 if ($pourcent != 100) {
252
-                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
252
+                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='".($maxSize - $barwidth)."' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
253 253
                 }
254 254
                 echo "<img src='".Display::returnIconPath('bar_1.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
255 255
                     </td>
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         }
266 266
         echo "<tr bgcolor='#E6E6E6'>
267 267
                 <td width='15%' align='center'>
268
-                    " . get_lang('Total') . "
268
+                    " . get_lang('Total')."
269 269
                 </td>
270 270
                 <td align='right' width='60%'>
271 271
                     &nbsp;
272 272
                 </td>
273 273
                 <td align='center' width='10%'>
274
-                    " . $period_array['total'] . "
274
+                    " . $period_array['total']."
275 275
                 </td>
276 276
                 <td width='15%'>
277 277
                     &nbsp;
Please login to merge, or discard this patch.
main/inc/lib/sub_language.class.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@  discard block
 block discarded – undo
18 18
      * Get all files of lang folder (forum.inc.php,gradebook.inc.php,notebook.inc.php)
19 19
      * @param String The lang path folder  (/var/www/my_lms/main/lang/spanish)
20 20
      * @param bool true if we only want the "subname" trad4all instead of  trad4all.inc.php
21
+     * @param string $path
21 22
      *
22 23
      * @return Array All file of lang folder
23 24
      */
@@ -68,6 +69,7 @@  discard block
 block discarded – undo
68 69
     /**
69 70
      * Get all information of language
70 71
      * @param Integer The parent id(Language father id)
72
+     * @param integer $parent_id
71 73
      * @return Array All information about language
72 74
      */
73 75
     public static function get_all_information_of_language($parent_id)
@@ -86,6 +88,7 @@  discard block
 block discarded – undo
86 88
     /**
87 89
      * Get all information of chamilo file
88 90
      * @param String The chamilo path file (/var/www/chamilo/main/lang/spanish/gradebook.inc.php)
91
+     * @param string $system_path_file
89 92
      * @patam Bool Whether we want to remove the '$' prefix in the results or not
90 93
      * @return Array Contains all information of chamilo file
91 94
      */
@@ -345,7 +348,7 @@  discard block
 block discarded – undo
345 348
     /**
346 349
      * Make available the language
347 350
      * @param Integer The language id
348
-     * @return void
351
+     * @return boolean
349 352
      */
350 353
     public static function make_available_language($language_id)
351 354
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
                 while (($file = readdir($dh)) !== false) {
30 30
                     if ($file[0] <> '.' && substr($file, -4, strlen($file)) == '.php') {
31 31
                         if ($only_main_name) {
32
-                            if ($file != '' && strpos($file, '.inc.php'))
33
-                                $content_dir[] = substr($file, 0, strpos($file, '.inc.php'));
32
+                            if ($file != '' && strpos($file, '.inc.php')) {
33
+                                                            $content_dir[] = substr($file, 0, strpos($file, '.inc.php'));
34
+                            }
34 35
                         } else {
35 36
                             $content_dir[] = $file;
36 37
                         }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public static function getAllLanguages()
22 22
     {
23 23
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
24
-        $sql = 'SELECT * FROM ' . $table;
24
+        $sql = 'SELECT * FROM '.$table;
25 25
         $rs = Database::query($sql);
26 26
         $all_languages = [];
27 27
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
     public static function get_all_information_of_sub_language($parent_id, $sub_language_id)
71 71
     {
72 72
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
73
-        $sql = 'SELECT * FROM ' . $table . '
73
+        $sql = 'SELECT * FROM '.$table.'
74 74
                 WHERE
75 75
                     parent_id= ' . intval($parent_id).' AND
76
-                    id= ' . intval($sub_language_id) . '';
76
+                    id= ' . intval($sub_language_id).'';
77 77
         $rs = Database::query($sql);
78 78
         $all_information = array();
79 79
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public static function get_all_information_of_language($parent_id)
92 92
     {
93 93
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
94
-        $sql = 'SELECT * FROM ' . $table . ' WHERE id = "' . intval($parent_id) . '"';
94
+        $sql = 'SELECT * FROM '.$table.' WHERE id = "'.intval($parent_id).'"';
95 95
         $rs = Database::query($sql);
96 96
         $all_information = array();
97 97
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public static function add_file_in_language_directory($system_path_file)
139 139
     {
140
-        $return_value = @file_put_contents($system_path_file, '<?php' . PHP_EOL);
140
+        $return_value = @file_put_contents($system_path_file, '<?php'.PHP_EOL);
141 141
 
142 142
         return $return_value;
143 143
     }
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
     public static function write_data_in_file($path_file, $new_term, $new_variable)
153 153
     {
154 154
         $return_value = false;
155
-        $new_data = $new_variable . '=' . $new_term;
155
+        $new_data = $new_variable.'='.$new_term;
156 156
         $resource = @fopen($path_file, "a");
157 157
         if (file_exists($path_file) && $resource) {
158
-            if (fwrite($resource, $new_data . PHP_EOL) === false) {
158
+            if (fwrite($resource, $new_data.PHP_EOL) === false) {
159 159
                 //not allow to write
160 160
                 $return_value = false;
161 161
             } else {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         if (empty($sub_language_dir)) {
178 178
             return false;
179 179
         }
180
-        $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir;
180
+        $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir;
181 181
         if (is_dir($dir)) {
182 182
             return true;
183 183
         } //even if the dir already exists, we reach the objective of having the directory there
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
             return false;
202 202
         }
203 203
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
204
-        $sql = 'SELECT dokeos_folder FROM ' . $table . '
205
-                WHERE parent_id = ' . $parent_id . ' and id = ' . $sub_language_id;
204
+        $sql = 'SELECT dokeos_folder FROM '.$table.'
205
+                WHERE parent_id = ' . $parent_id.' and id = '.$sub_language_id;
206 206
         $res = Database::query($sql);
207 207
         if ($res === false or Database::num_rows($res) < 1) {
208 208
             return false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         if ($res === false) {
213 213
             return false;
214 214
         } //can't delete dir, so do not delete language record
215
-        $sql = 'DELETE FROM ' . $table . '
215
+        $sql = 'DELETE FROM '.$table.'
216 216
                 WHERE id= ' . intval($sub_language_id);
217 217
         $res = Database::query($sql);
218 218
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         if (empty($sub_language_dir)) {
230 230
             return false;
231 231
         }
232
-        $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir;
232
+        $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir;
233 233
         if (!is_dir($dir)) {
234 234
             return true;
235 235
         } //even if the dir does not exist, we reach the objective of not having the directory there
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         if (count($content) > 0) {
239 239
             foreach ($content as $value_content) {
240
-                $path_file = $dir . '/' . $value_content;
240
+                $path_file = $dir.'/'.$value_content;
241 241
                 unlink($path_file);
242 242
             }
243 243
             return @rmdir($dir);
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
     {
256 256
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
257 257
         $sql = 'SELECT count(*) as count
258
-                FROM ' . $table . '
259
-                WHERE id="' . intval($language_id) . '"';
258
+                FROM ' . $table.'
259
+                WHERE id="' . intval($language_id).'"';
260 260
         $rs = Database::query($sql);
261 261
         if (Database::num_rows($rs) > 0) {
262 262
             if (Database::result($rs, 0, 'count') == 1) {
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
280 280
         $sql = 'SELECT original_name
281
-                FROM ' . $table . '
282
-                WHERE id= ' . intval($language_id) . '';
281
+                FROM ' . $table.'
282
+                WHERE id= ' . intval($language_id).'';
283 283
         $rs = Database::query($sql);
284 284
         if (Database::num_rows($rs) > 0) {
285 285
             return Database::result($rs, 0, 'original_name');
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
     public static function check_if_language_is_sub_language($language_id)
298 298
     {
299 299
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
300
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
301
-                WHERE id = ' . intval($language_id) . ' AND NOT ISNULL(parent_id)';
300
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
301
+                WHERE id = ' . intval($language_id).' AND NOT ISNULL(parent_id)';
302 302
         $rs = Database::query($sql);
303 303
 
304 304
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $language_info = self::get_all_information_of_language($language_id);
318 318
         $table = Database :: get_main_table(TABLE_MAIN_USER);
319
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
319
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
320 320
                 WHERE language ="' . Database::escape_string($language_info['english_name']).'"';
321 321
         $rs = Database::query($sql);
322 322
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') >= 1) {
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
     public static function check_if_language_is_father($language_id)
335 335
     {
336 336
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
337
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
338
-                WHERE parent_id= ' . intval($language_id) . ' AND NOT ISNULL(parent_id);';
337
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
338
+                WHERE parent_id= ' . intval($language_id).' AND NOT ISNULL(parent_id);';
339 339
         $rs = Database::query($sql);
340 340
 
341 341
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     {
355 355
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
356 356
         $sql = "UPDATE $tbl_admin_languages SET available='0'
357
-                WHERE id = " . intval($language_id) . "";
357
+                WHERE id = ".intval($language_id)."";
358 358
         $result = Database::query($sql);
359 359
 
360 360
         return $result !== false; //only return false on sql error
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     {
370 370
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
371 371
         $sql = "UPDATE $tbl_admin_languages SET available='1'
372
-                WHERE id = " . intval($language_id) . "";
372
+                WHERE id = ".intval($language_id)."";
373 373
         $result = Database::query($sql);
374 374
 
375 375
         return $result !== false; //only return false on sql error
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
         }
388 388
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
389 389
         $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
390
-        $sql = "SELECT english_name FROM " . $tbl_admin_languages . "
391
-                WHERE id= " . intval($language_id) . "";
390
+        $sql = "SELECT english_name FROM ".$tbl_admin_languages."
391
+                WHERE id= " . intval($language_id)."";
392 392
         $result = Database::query($sql);
393 393
         $lang = Database::fetch_array($result);
394
-        $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "'
394
+        $sql_update_2 = "UPDATE ".$tbl_settings_current." SET selected_value='".$lang['english_name']."'
395 395
                          WHERE variable='platformLanguage'";
396 396
         $result_2 = Database::query($sql_update_2);
397 397
         Event::addEvent(
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     {
412 412
         $name = api_get_setting('platformLanguage');
413 413
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
414
-        $sql = "SELECT id FROM " . $tbl_admin_languages . " WHERE english_name ='$name'";
414
+        $sql = "SELECT id FROM ".$tbl_admin_languages." WHERE english_name ='$name'";
415 415
         $res = Database::query($sql);
416 416
         if (Database::num_rows($res) < 1) {
417 417
             return false;
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
     {
431 431
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
432 432
         $sql = "SELECT dokeos_folder
433
-                FROM " . $tbl_admin_languages . "
433
+                FROM " . $tbl_admin_languages."
434 434
                 WHERE id = (
435
-                    SELECT parent_id FROM " . $tbl_admin_languages . "
436
-                    WHERE dokeos_folder = '" . Database::escape_string($language_path) . "'
435
+                    SELECT parent_id FROM " . $tbl_admin_languages."
436
+                    WHERE dokeos_folder = '" . Database::escape_string($language_path)."'
437 437
                 )
438 438
                 ";
439 439
         $result = Database::query($sql);
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         $adminLanguagesTable = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
456 456
         // select language - if case several languages match, get the last (more recent) one
457 457
         $sql = "SELECT english_name
458
-                FROM " . $adminLanguagesTable . "
458
+                FROM " . $adminLanguagesTable."
459 459
                 WHERE
460 460
                     isocode ='$isocode' AND
461 461
                     available = 1
Please login to merge, or discard this patch.
main/inc/lib/system/web/request.class.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -31,6 +31,10 @@
 block discarded – undo
31 31
         return $method == 'GET';
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $key
36
+     * @param string $default
37
+     */
34 38
     public static function post($key, $default = null)
35 39
     {
36 40
         return isset($_POST[$key]) ? $_POST[$key] : $default;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
16 16
     }
17 17
 
18
-    public static function has($key){
18
+    public static function has($key) {
19 19
         return isset($_REQUEST[$key]);
20 20
     }
21 21
 
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
  * @author Patrick Cool
17 17
  * @author René Haentjens, added CSV file import (October 2004)
18 18
  * @package chamilo.link
19
-
20 19
  */
21 20
 
22 21
 // Including libraries
Please login to merge, or discard this patch.
main/inc/lib/table_sort.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 	 * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81 81
 	 * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82 82
 	 * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
-	 * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
83
+	 * @param integer $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84 84
 	 * @return array The sorted dataset
85 85
 	 * @author [email protected]
86 86
 	 */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
                 $new_data_order = array();
159 159
                 if (!empty($docs_to_sort)) {
160
-                    foreach($docs_to_sort as $id => $document) {
160
+                    foreach ($docs_to_sort as $id => $document) {
161 161
                         if (isset($new_data[$id])) {
162 162
                             $new_data_order[] = $new_data[$id];
163 163
                         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 }
166 166
 
167 167
                 if (!empty($folder_to_sort)) {
168
-                    foreach($folder_to_sort as $id => $document) {
168
+                    foreach ($folder_to_sort as $id => $document) {
169 169
                         if (isset($new_data[$id])) {
170 170
                             $new_data_order[] = $new_data[$id];
171 171
                         }
Please login to merge, or discard this patch.
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
 class TableSort
16 16
 {
17 17
     /**
18
-    * Sorts 2-dimensional table.
19
-    * @param array $data The data to be sorted.
20
-    * @param int $column The column on which the data should be sorted (default = 0)
21
-    * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC)
22
-    * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC,
23
-    * SORT_STRING,SORT_DATE,SORT_IMAGE)
24
-    * @return array The sorted dataset
25
-    * @author [email protected]
26
-    */
27
-	public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR)
18
+     * Sorts 2-dimensional table.
19
+     * @param array $data The data to be sorted.
20
+     * @param int $column The column on which the data should be sorted (default = 0)
21
+     * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC)
22
+     * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC,
23
+     * SORT_STRING,SORT_DATE,SORT_IMAGE)
24
+     * @return array The sorted dataset
25
+     * @author [email protected]
26
+     */
27
+    public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR)
28 28
     {
29 29
         if (!is_array($data) || empty($data)) {
30 30
             return array();
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
         usort($data, create_function('$a, $b', $compare_function));
72 72
 
73 73
         return $data;
74
-	}
74
+    }
75 75
 
76
-	/**
77
-	 * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted.
78
-	 * @param array $data The data to be sorted.
79
-	 * @param int $column The column on which the data should be sorted (default = 0)
80
-	 * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81
-	 * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82
-	 * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
-	 * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84
-	 * @return array The sorted dataset
85
-	 * @author [email protected]
86
-	 */
87
-	public static function sort_table_config(
76
+    /**
77
+     * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted.
78
+     * @param array $data The data to be sorted.
79
+     * @param int $column The column on which the data should be sorted (default = 0)
80
+     * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81
+     * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82
+     * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
+     * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84
+     * @return array The sorted dataset
85
+     * @author [email protected]
86
+     */
87
+    public static function sort_table_config(
88 88
         $data,
89 89
         $column = 0,
90 90
         $direction = SORT_ASC,
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
             if (!empty($data)) {
133 133
                 foreach ($data as $document) {
134 134
                     if ($document['type'] == 'folder') {
135
-                      $docs_to_sort[$document['id']]   = api_strtolower($document['name']);
135
+                        $docs_to_sort[$document['id']]   = api_strtolower($document['name']);
136 136
                     } else {
137
-                      $folder_to_sort[$document['id']] = api_strtolower($document['name']);
137
+                        $folder_to_sort[$document['id']] = api_strtolower($document['name']);
138 138
                     }
139 139
                     $new_data[$document['id']] = $document;
140 140
                 }
@@ -196,91 +196,91 @@  discard block
 block discarded – undo
196 196
             usort($data, create_function('$a, $b', $compare_function));
197 197
         }
198 198
 
199
-		if (is_array($column_show) && !empty($column_show)) {
199
+        if (is_array($column_show) && !empty($column_show)) {
200 200
 
201
-			// We show only the columns data that were set up on the $column_show array
202
-			$new_order_data = array();
203
-			$count_data = count($data);
204
-			$count_column_show = count($column_show);
205
-			for ($j = 0; $j < $count_data; $j++) {
206
-				$k = 0;
207
-				for ($i = 0; $i < $count_column_show; $i++) {
208
-					if ($column_show[$i]) {
209
-						$new_order_data[$j][$k] = $data[$j][$i];
210
-					}
211
-					$k++;
212
-				}
213
-			}
214
-			// Replace the multi-arrays
215
-			$data = $new_order_data;
216
-		}
201
+            // We show only the columns data that were set up on the $column_show array
202
+            $new_order_data = array();
203
+            $count_data = count($data);
204
+            $count_column_show = count($column_show);
205
+            for ($j = 0; $j < $count_data; $j++) {
206
+                $k = 0;
207
+                for ($i = 0; $i < $count_column_show; $i++) {
208
+                    if ($column_show[$i]) {
209
+                        $new_order_data[$j][$k] = $data[$j][$i];
210
+                    }
211
+                    $k++;
212
+                }
213
+            }
214
+            // Replace the multi-arrays
215
+            $data = $new_order_data;
216
+        }
217 217
 
218
-		return $data;
219
-	}
218
+        return $data;
219
+    }
220 220
 
221
-	/**
222
-	 * Checks whether a column of a 2D-array contains only numeric values
223
-	 * @param array $data		The data-array
224
-	 * @param int $column		The index of the column to check
225
-	 * @return bool				TRUE if column contains only dates, FALSE otherwise
226
-	 * @todo Take locale into account (eg decimal point or comma ?)
227
-	 * @author [email protected]
228
-	 */
229
-	private static function is_numeric_column(& $data, $column)
221
+    /**
222
+     * Checks whether a column of a 2D-array contains only numeric values
223
+     * @param array $data		The data-array
224
+     * @param int $column		The index of the column to check
225
+     * @return bool				TRUE if column contains only dates, FALSE otherwise
226
+     * @todo Take locale into account (eg decimal point or comma ?)
227
+     * @author [email protected]
228
+     */
229
+    private static function is_numeric_column(& $data, $column)
230 230
     {
231
-		$is_numeric = true;
232
-		foreach ($data as $index => & $row) {
233
-			$is_numeric &= is_numeric(strip_tags($row[$column]));
234
-			if (!$is_numeric) {
235
-				break;
236
-			}
237
-		}
238
-		return $is_numeric;
239
-	}
231
+        $is_numeric = true;
232
+        foreach ($data as $index => & $row) {
233
+            $is_numeric &= is_numeric(strip_tags($row[$column]));
234
+            if (!$is_numeric) {
235
+                break;
236
+            }
237
+        }
238
+        return $is_numeric;
239
+    }
240 240
 
241
-	/**
242
-	 * Checks whether a column of a 2D-array contains only dates (GNU date syntax)
243
-	 * @param array $data		The data-array
244
-	 * @param int $column		The index of the column to check
245
-	 * @return bool				TRUE if column contains only dates, FALSE otherwise
246
-	 * @author [email protected]
247
-	 */
248
-	private static function is_date_column(& $data, $column)
241
+    /**
242
+     * Checks whether a column of a 2D-array contains only dates (GNU date syntax)
243
+     * @param array $data		The data-array
244
+     * @param int $column		The index of the column to check
245
+     * @return bool				TRUE if column contains only dates, FALSE otherwise
246
+     * @author [email protected]
247
+     */
248
+    private static function is_date_column(& $data, $column)
249 249
     {
250
-		$is_date = true;
251
-		foreach ($data as $index => & $row) {
252
-			if (strlen(strip_tags($row[$column])) != 0) {
253
-				$check_date = strtotime(strip_tags($row[$column]));
254
-				// strtotime Returns a timestamp on success, FALSE otherwise.
255
-				// Previous to PHP 5.1.0, this function would return -1 on failure.
256
-				$is_date &= ($check_date != -1 && $check_date);
257
-			} else {
258
-				$is_date &= false;
259
-			}
260
-			if (!$is_date) {
261
-				break;
262
-			}
263
-		}
264
-		return $is_date;
265
-	}
250
+        $is_date = true;
251
+        foreach ($data as $index => & $row) {
252
+            if (strlen(strip_tags($row[$column])) != 0) {
253
+                $check_date = strtotime(strip_tags($row[$column]));
254
+                // strtotime Returns a timestamp on success, FALSE otherwise.
255
+                // Previous to PHP 5.1.0, this function would return -1 on failure.
256
+                $is_date &= ($check_date != -1 && $check_date);
257
+            } else {
258
+                $is_date &= false;
259
+            }
260
+            if (!$is_date) {
261
+                break;
262
+            }
263
+        }
264
+        return $is_date;
265
+    }
266 266
 
267
-	/**
268
-	 * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>)
269
-	 * @param array $data		The data-array
270
-	 * @param int $column		The index of the column to check
271
-	 * @return bool				TRUE if column contains only images, FALSE otherwise
272
-	 * @author [email protected]
273
-	 */
274
-	private static function is_image_column(& $data, $column)
267
+    /**
268
+     * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>)
269
+     * @param array $data		The data-array
270
+     * @param int $column		The index of the column to check
271
+     * @return bool				TRUE if column contains only images, FALSE otherwise
272
+     * @author [email protected]
273
+     */
274
+    private static function is_image_column(& $data, $column)
275 275
     {
276
-		$is_image = true;
277
-		foreach ($data as $index => & $row) {
278
-			$is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag
279
-			$is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values
280
-			if (!$is_image) {
281
-				break;
282
-			}
283
-		}
284
-		return $is_image;
285
-	}
276
+        $is_image = true;
277
+        foreach ($data as $index => & $row) {
278
+            $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag
279
+            $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values
280
+            if (!$is_image) {
281
+                break;
282
+            }
283
+        }
284
+        return $is_image;
285
+    }
286 286
 }
Please login to merge, or discard this patch.
main/inc/lib/template.lib.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -330,6 +330,7 @@  discard block
 block discarded – undo
330 330
     /**
331 331
      * Sets the footer visibility
332 332
      * @param bool true if we show the footer
333
+     * @param boolean $status
333 334
      */
334 335
     public function set_footer($status)
335 336
     {
@@ -370,6 +371,7 @@  discard block
 block discarded – undo
370 371
     /**
371 372
      * Sets the header visibility
372 373
      * @param bool true if we show the header
374
+     * @param boolean $status
373 375
      */
374 376
     public function set_header($status)
375 377
     {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -338,7 +338,7 @@
 block discarded – undo
338 338
 
339 339
         if (empty($certificatesItem) && empty($searchItem)) {
340 340
             return null;
341
-        }else{
341
+        } else{
342 342
             $content.= $certificatesItem;
343 343
             $content.= $searchItem;
344 344
         }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 $content = '<div class="help">';
281 281
                 $content .= Display::url(
282 282
                     Display::return_icon('help.large.png', get_lang('Help')),
283
-                    api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help,
283
+                    api_get_path(WEB_CODE_PATH).'help/help.php?open='.$help,
284 284
                     [
285 285
                         'class' => 'ajax',
286 286
                         'data-title' => get_lang('Help')
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
             'web_course' => api_get_path(WEB_COURSE_PATH),
495 495
             'web_main' => api_get_path(WEB_CODE_PATH),
496 496
             'web_css' => api_get_path(WEB_CSS_PATH),
497
-            'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/',
497
+            'web_css_theme' => api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/',
498 498
             'web_ajax' => api_get_path(WEB_AJAX_PATH),
499 499
             'web_img' => api_get_path(WEB_IMG_PATH),
500 500
             'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
@@ -551,12 +551,12 @@  discard block
 block discarded – undo
551 551
         foreach ($bowerCSSFiles as $file) {
552 552
             $css[] = api_get_path(WEB_PATH).'web/assets/'.$file;
553 553
         }
554
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap-select/css/bootstrap-select.min.css';
555
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css';
556
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css';
554
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap-select/css/bootstrap-select.min.css';
555
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css';
556
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css';
557 557
 
558 558
         if (api_is_global_chat_enabled()) {
559
-            $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css';
559
+            $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css';
560 560
         }
561 561
 
562 562
         //THEME CSS STYLE
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
         if (is_file(api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/editor.css')) {
608 608
             $css[] = api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/editor.css';
609
-        }else{
609
+        } else {
610 610
             $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'editor.css');
611 611
         }
612 612
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
             $style_print = '';
643 643
             if (is_readable(api_get_path(SYS_CSS_PATH).$this->theme.'/print.css')) {
644
-                $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'),
644
+                $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'),
645 645
                     'print');
646 646
             }
647 647
             $this->assign('css_style_print', $style_print);
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
 
665 665
         $isoCode = api_get_language_isocode();
666 666
 
667
-        $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_' . strtoupper($isoCode) . '.min.js';
667
+        $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_'.strtoupper($isoCode).'.min.js';
668 668
 
669 669
         if ($isoCode == 'en') {
670
-            $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_US.min.js';
670
+            $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_US.min.js';
671 671
         }
672 672
         // JS files
673 673
         $js_files = array(
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
         }
721 721
 
722 722
         if ($isoCode != 'en') {
723
-            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-' . $isoCode . '.js';
724
-            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-' . $isoCode . '.min.js';
723
+            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-'.$isoCode.'.js';
724
+            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-'.$isoCode.'.min.js';
725 725
         }
726 726
 
727 727
         foreach ($bowerJsFiles as $file) {
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
         }
805 805
 
806 806
         $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM));
807
-        $this->assign('offline_button',Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
807
+        $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
808 808
 
809 809
         // Get language iso-code for this page - ignore errors
810 810
         $this->assign('document_language', api_get_language_isocode());
@@ -863,14 +863,14 @@  discard block
 block discarded – undo
863 863
         $this->assign('section_name', 'section-'.$this_section);
864 864
 
865 865
         //Defaul root chamilo favicon
866
-        $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />';
866
+        $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />';
867 867
 
868 868
         //Added to verify if in the current Chamilo Theme exist a favicon
869
-        $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/';
869
+        $favicoThemeUrl = api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/images/';
870 870
 
871 871
         //If exist pick the current chamilo theme favicon
872
-        if (is_file($favicoThemeUrl . 'favicon.ico')) {
873
-            $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH). 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />';
872
+        if (is_file($favicoThemeUrl.'favicon.ico')) {
873
+            $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/images/favicon.ico" type="image/x-icon" />';
874 874
         }
875 875
 
876 876
         if (api_is_multiple_url_enabled()) {
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
901 901
             $rightFloatMenu = '<div class="report">
902 902
 		<a href="https://github.com/chamilo/chamilo-lms/wiki/How-to-report-issues" target="_blank">
903
-                    '. $iconBug . '
903
+                    '. $iconBug.'
904 904
                 </a>
905 905
 		</div>';
906 906
         }
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
             $url = api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id=1&'.$courseParams;
917 917
             $rightFloatMenu .= '<div class="report">
918 918
 		        <a href="'.$url.'" target="_blank">
919
-                    '. $iconTicket . '
919
+                    '. $iconTicket.'
920 920
                 </a>
921 921
 		    </div>';
922 922
         }
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 
1024 1024
         // Block Breadcrumb
1025 1025
         //$breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools);
1026
-        $breadcrumb  = '';
1026
+        $breadcrumb = '';
1027 1027
         $this->assign('breadcrumb', $breadcrumb);
1028 1028
 
1029 1029
         //Extra content
@@ -1043,13 +1043,13 @@  discard block
 block discarded – undo
1043 1043
         $socialMeta = '';
1044 1044
         $metaTitle = api_get_setting('meta_title');
1045 1045
         if (!empty($metaTitle)) {
1046
-            $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
1046
+            $socialMeta .= '<meta name="twitter:card" content="summary" />'."\n";
1047 1047
             $metaSite = api_get_setting('meta_twitter_site');
1048 1048
             if (!empty($metaSite)) {
1049
-                $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
1049
+                $socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n";
1050 1050
                 $metaCreator = api_get_setting('meta_twitter_creator');
1051 1051
                 if (!empty($metaCreator)) {
1052
-                    $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
1052
+                    $socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n";
1053 1053
                 }
1054 1054
             }
1055 1055
 
@@ -1061,19 +1061,19 @@  discard block
 block discarded – undo
1061 1061
             if (!$userId && !$skillId) {
1062 1062
                 // no combination of user and skill ID has been defined,
1063 1063
                 // so print the normal OpenGraph meta tags
1064
-                $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
1065
-                $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";
1064
+                $socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n";
1065
+                $socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n";
1066 1066
 
1067 1067
                 $metaDescription = api_get_setting('meta_description');
1068 1068
                 if (!empty($metaDescription)) {
1069
-                    $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
1069
+                    $socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n";
1070 1070
                 }
1071 1071
 
1072 1072
                 $metaImage = api_get_setting('meta_image_path');
1073 1073
                 if (!empty($metaImage)) {
1074
-                    if (is_file(api_get_path(SYS_PATH) . $metaImage)) {
1075
-                        $path = api_get_path(WEB_PATH) . $metaImage;
1076
-                        $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n";
1074
+                    if (is_file(api_get_path(SYS_PATH).$metaImage)) {
1075
+                        $path = api_get_path(WEB_PATH).$metaImage;
1076
+                        $socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n";
1077 1077
                     }
1078 1078
                 }
1079 1079
             }
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
         // Tutor name
1108 1108
         if (api_get_setting('show_tutor_data') == 'true') {
1109 1109
             // Course manager
1110
-            $courseId  = api_get_course_int_id();
1110
+            $courseId = api_get_course_int_id();
1111 1111
             $id_session = api_get_session_id();
1112 1112
             if (!empty($courseId)) {
1113 1113
                 $tutor_data = '';
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
             $courseId = api_get_course_int_id();
1140 1140
             if (!empty($courseId)) {
1141 1141
                 $teacher_data = '';
1142
-                $mail= CourseManager::get_emails_of_tutors_to_course($courseId);
1142
+                $mail = CourseManager::get_emails_of_tutors_to_course($courseId);
1143 1143
                 if (!empty($mail)) {
1144 1144
                     $teachers_parsed = array();
1145 1145
                     foreach ($mail as $value) {
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
                     'sessionVar'   => basename(__FILE__, '.php'),
1408 1408
                     'imageOptions' => array(
1409 1409
                         'font_size' => 20,
1410
-                        'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
1410
+                        'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/',
1411 1411
                         'font_file' => 'OpenSans-Regular.ttf',
1412 1412
                         //'output' => 'gif'
1413 1413
                     )
Please login to merge, or discard this patch.
main/inc/lib/text.lib.php 4 patches
Doc Comments   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,6 +52,7 @@  discard block
 block discarded – undo
52 52
  * Converts the text of a html-document to a given encoding, the meta-tag is changed accordingly.
53 53
  * @param string $string                The input full-html document.
54 54
  * @param string                        The new encoding value to be set.
55
+ * @param string $encoding
55 56
  */
56 57
 function api_set_encoding_html(&$string, $encoding) {
57 58
     $old_encoding = api_detect_encoding_html($string);
@@ -74,7 +75,7 @@  discard block
 block discarded – undo
74 75
  * Returns the title of a html document.
75 76
  * @param string $string                The contents of the input document.
76 77
  * @param string $input_encoding        The encoding of the input document. If the value is not set, it is detected.
77
- * @param string $$output_encoding      The encoding of the retrieved title. If the value is not set, the system encoding is assumend.
78
+ * @param string $output_encoding      The encoding of the retrieved title. If the value is not set, the system encoding is assumend.
78 79
  * @return string                       The retrieved title, html-entities and extra-whitespace between the words are cleaned.
79 80
  */
80 81
 function api_get_title_html(&$string, $output_encoding = null, $input_encoding = null) {
@@ -433,7 +434,7 @@  discard block
 block discarded – undo
433 434
  * @since wordpress  2.8.1
434 435
  * @access private
435 436
  *
436
- * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
437
+ * @param string[] $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
437 438
  * @param string $subject The string being searched and replaced on, otherwise known as the haystack.
438 439
  * @return string The string with the replaced svalues.
439 440
  */
@@ -628,6 +629,7 @@  discard block
 block discarded – undo
628 629
  * @param string    The text to "cut"
629 630
  * @param int       Count of chars
630 631
  * @param bool      Whether to embed in a <span title="...">...</span>
632
+ * @param integer $maxchar
631 633
  * @return string
632 634
  * */
633 635
 function cut($text, $maxchar, $embed = false) {
@@ -645,7 +647,7 @@  discard block
 block discarded – undo
645 647
  *
646 648
  * @param mixed     Number to convert
647 649
  * @param int       Decimal points 0=never, 1=if needed, 2=always
648
- * @return mixed    An integer or a float depends on the parameter
650
+ * @return string|null    An integer or a float depends on the parameter
649 651
  */
650 652
 function float_format($number, $flag = 1) {
651 653
     if (is_numeric($number)) {
@@ -689,7 +691,7 @@  discard block
 block discarded – undo
689 691
 /**
690 692
  * Gets the week from a day
691 693
  * @param   string   Date in UTC (2010-01-01 12:12:12)
692
- * @return  int      Returns an integer with the week number of the year
694
+ * @return  string      Returns an integer with the week number of the year
693 695
  */
694 696
 function get_week_from_day($date) {
695 697
     if (!empty($date)) {
@@ -739,6 +741,9 @@  discard block
 block discarded – undo
739 741
 	return $output.$end;
740 742
 }
741 743
 
744
+/**
745
+ * @param string $glue
746
+ */
742 747
 function implode_with_key($glue, $array) {
743 748
     if (!empty($array)) {
744 749
         $string = '';
@@ -817,7 +822,7 @@  discard block
 block discarded – undo
817 822
 /**
818 823
  * @param string $string
819 824
  * @param bool $capitalizeFirstCharacter
820
- * @return mixed
825
+ * @return string
821 826
  */
822 827
 function underScoreToCamelCase($string, $capitalizeFirstCharacter = true)
823 828
 {
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
     if (@preg_match('/(.*<head.*)(<meta[^>]*content=[^>]*>)(.*<\/head>.*)/si', $string, $matches)) {
59 59
         $meta = $matches[2];
60 60
         if (@preg_match("/(<meta[^>]*charset=)(.*)([\"';][^>]*>)/si", $meta, $matches1)) {
61
-            $meta = $matches1[1] . $encoding . $matches1[3];
62
-            $string = $matches[1] . $meta . $matches[3];
61
+            $meta = $matches1[1].$encoding.$matches1[3];
62
+            $string = $matches[1].$meta.$matches[3];
63 63
         } else {
64
-            $string = $matches[1] . '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>' . $matches[3];
64
+            $string = $matches[1].'<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>'.$matches[3];
65 65
         }
66 66
     } else {
67 67
         $count = 1;
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
     if (!preg_match(_PCRE_XML_ENCODING, $string)) {
169 169
         if (strpos($matches[0], 'standalone') !== false) {
170 170
             // The encoding option should precede the standalone option, othewise DOMDocument fails to load the document.
171
-            $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone' , $matches[0]);
171
+            $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone', $matches[0]);
172 172
         } else {
173
-            $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>' , $matches[0]);
173
+            $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>', $matches[0]);
174 174
         }
175 175
         return api_convert_encoding(str_replace($matches[0], $replace, $string), $to_encoding, $from_encoding);
176 176
     }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 function _make_url_clickable_cb($matches) {
336 336
     $url = $matches[2];
337 337
 
338
-    if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
338
+    if (')' == $matches[3] && strpos($url, '(')) {
339 339
         // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
340 340
         // Then we can let the parenthesis balancer do its thing below.
341 341
         $url .= $matches[3];
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
     }
346 346
 
347 347
     // Include parentheses in the URL only if paired
348
-    while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
349
-        $suffix = strrchr( $url, ')' ) . $suffix;
350
-        $url = substr( $url, 0, strrpos( $url, ')' ) );
348
+    while (substr_count($url, '(') < substr_count($url, ')')) {
349
+        $suffix = strrchr($url, ')').$suffix;
350
+        $url = substr($url, 0, strrpos($url, ')'));
351 351
     }
352 352
 
353 353
     $url = esc_url($url);
354
-    if ( empty($url) )
354
+    if (empty($url))
355 355
         return $matches[0];
356 356
 
357
-    return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
357
+    return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix;
358 358
 }
359 359
 
360 360
 /**
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
  * @param string $_context Private. Use esc_url_raw() for database usage.
375 375
  * @return string The cleaned $url after the 'clean_url' filter is applied.
376 376
  */
377
-function esc_url( $url, $protocols = null, $_context = 'display' ) {
377
+function esc_url($url, $protocols = null, $_context = 'display') {
378 378
     //$original_url = $url;
379 379
 
380
-    if ( '' == $url )
380
+    if ('' == $url)
381 381
         return $url;
382 382
     $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
383 383
     $strip = array('%0d', '%0a', '%0D', '%0A');
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
      * presume it needs http:// appended (unless a relative
388 388
      * link starting with /, # or ? or a php file).
389 389
      */
390
-    if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
391
-        ! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
392
-        $url = 'http://' . $url;
390
+    if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) &&
391
+        !preg_match('/^[a-z0-9-]+?\.php/i', $url))
392
+        $url = 'http://'.$url;
393 393
 
394 394
     return Security::remove_XSS($url);
395 395
 
@@ -437,12 +437,12 @@  discard block
 block discarded – undo
437 437
  * @param string $subject The string being searched and replaced on, otherwise known as the haystack.
438 438
  * @return string The string with the replaced svalues.
439 439
  */
440
-function _deep_replace( $search, $subject ) {
440
+function _deep_replace($search, $subject) {
441 441
     $subject = (string) $subject;
442 442
 
443 443
     $count = 1;
444
-    while ( $count ) {
445
-        $subject = str_replace( $search, '', $subject, $count );
444
+    while ($count) {
445
+        $subject = str_replace($search, '', $subject, $count);
446 446
     }
447 447
 
448 448
     return $subject;
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 function _make_web_ftp_clickable_cb($matches) {
465 465
     $ret = '';
466 466
     $dest = $matches[2];
467
-    $dest = 'http://' . $dest;
467
+    $dest = 'http://'.$dest;
468 468
     $dest = esc_url($dest);
469
-    if ( empty($dest) )
469
+    if (empty($dest))
470 470
         return $matches[0];
471 471
 
472 472
     // removed trailing [.,;:)] from URL
473
-    if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
473
+    if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
474 474
         $ret = substr($dest, -1);
475
-        $dest = substr($dest, 0, strlen($dest)-1);
475
+        $dest = substr($dest, 0, strlen($dest) - 1);
476 476
     }
477
-    return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
477
+    return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
478 478
 }
479 479
 
480 480
 /**
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
  * @return string HTML A element with email address.
491 491
  */
492 492
 function _make_email_clickable_cb($matches) {
493
-    $email = $matches[2] . '@' . $matches[3];
494
-    return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
493
+    $email = $matches[2].'@'.$matches[3];
494
+    return $matches[1]."<a href=\"mailto:$email\">$email</a>";
495 495
 }
496 496
 
497 497
 /**
@@ -505,30 +505,30 @@  discard block
 block discarded – undo
505 505
  * @param string $text Content to convert URIs.
506 506
  * @return string Content with converted URIs.
507 507
  */
508
-function make_clickable( $text ) {
508
+function make_clickable($text) {
509 509
     $r = '';
510
-    $textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
510
+    $textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags
511 511
     $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
512
-    foreach ( $textarr as $piece ) {
512
+    foreach ($textarr as $piece) {
513 513
 
514
-        if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
514
+        if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece))
515 515
             $nested_code_pre++;
516
-        elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
516
+        elseif (('</code>' === strtolower($piece) || '</pre>' === strtolower($piece)) && $nested_code_pre)
517 517
             $nested_code_pre--;
518 518
 
519
-        if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
519
+        if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && !preg_match('|^<\s*[\w]{1,20}+://|', $piece))) {
520 520
             $r .= $piece;
521 521
             continue;
522 522
         }
523 523
 
524 524
         // Long strings might contain expensive edge cases ...
525
-        if ( 10000 < strlen( $piece ) ) {
525
+        if (10000 < strlen($piece)) {
526 526
             // ... break it up
527
-            foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses
528
-                if ( 2101 < strlen( $chunk ) ) {
527
+            foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses
528
+                if (2101 < strlen($chunk)) {
529 529
                     $r .= $chunk; // Too big, no whitespace: bail.
530 530
                 } else {
531
-                    $r .= make_clickable( $chunk );
531
+                    $r .= make_clickable($chunk);
532 532
                 }
533 533
             }
534 534
         } else {
@@ -549,18 +549,18 @@  discard block
 block discarded – undo
549 549
 			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
550 550
             // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
551 551
 
552
-            $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
552
+            $ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret);
553 553
 
554
-            $ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret );
555
-            $ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret );
554
+            $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
555
+            $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
556 556
 
557
-            $ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
557
+            $ret = substr($ret, 1, -1); // Remove our whitespace padding.
558 558
             $r .= $ret;
559 559
         }
560 560
     }
561 561
 
562 562
     // Cleanup of accidental links within links
563
-    $r = preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r );
563
+    $r = preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r);
564 564
     return $r;
565 565
 }
566 566
 
@@ -595,27 +595,27 @@  discard block
 block discarded – undo
595 595
  * @param int $goal The desired chunk length.
596 596
  * @return array Numeric array of chunks.
597 597
  */
598
-function _split_str_by_whitespace( $string, $goal ) {
598
+function _split_str_by_whitespace($string, $goal) {
599 599
     $chunks = array();
600 600
 
601
-    $string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
601
+    $string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000");
602 602
 
603
-    while ( $goal < strlen( $string_nullspace ) ) {
604
-        $pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
603
+    while ($goal < strlen($string_nullspace)) {
604
+        $pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000");
605 605
 
606
-        if ( false === $pos ) {
607
-            $pos = strpos( $string_nullspace, "\000", $goal + 1 );
608
-            if ( false === $pos ) {
606
+        if (false === $pos) {
607
+            $pos = strpos($string_nullspace, "\000", $goal + 1);
608
+            if (false === $pos) {
609 609
                 break;
610 610
             }
611 611
         }
612 612
 
613
-        $chunks[] = substr( $string, 0, $pos + 1 );
614
-        $string = substr( $string, $pos + 1 );
615
-        $string_nullspace = substr( $string_nullspace, $pos + 1 );
613
+        $chunks[] = substr($string, 0, $pos + 1);
614
+        $string = substr($string, $pos + 1);
615
+        $string_nullspace = substr($string_nullspace, $pos + 1);
616 616
     }
617 617
 
618
-    if ( $string ) {
618
+    if ($string) {
619 619
         $chunks[] = $string;
620 620
     }
621 621
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
  */
694 694
 function get_week_from_day($date) {
695 695
     if (!empty($date)) {
696
-       $time = api_strtotime($date,'UTC');
696
+       $time = api_strtotime($date, 'UTC');
697 697
        return date('W', $time);
698 698
     } else {
699 699
         return date('W');
@@ -710,17 +710,17 @@  discard block
 block discarded – undo
710 710
  * @return a reduce string
711 711
  */
712 712
 
713
-function substrwords($text,$maxchar,$end='...')
713
+function substrwords($text, $maxchar, $end = '...')
714 714
 {
715
-	if(strlen($text)>$maxchar)
715
+	if (strlen($text) > $maxchar)
716 716
 	{
717
-		$words=explode(" ",$text);
717
+		$words = explode(" ", $text);
718 718
 		$output = '';
719
-		$i=0;
720
-		while(1)
719
+		$i = 0;
720
+		while (1)
721 721
 		{
722
-			$length = (strlen($output)+strlen($words[$i]));
723
-			if($length>$maxchar)
722
+			$length = (strlen($output) + strlen($words[$i]));
723
+			if ($length > $maxchar)
724 724
 			{
725 725
 				break;
726 726
 			}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 function implode_with_key($glue, $array) {
743 743
     if (!empty($array)) {
744 744
         $string = '';
745
-        foreach($array as $key => $value) {
745
+        foreach ($array as $key => $value) {
746 746
             if (empty($value)) {
747 747
                 $value = 'null';
748 748
             }
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
 {
765 765
     $file_size = intval($file_size);
766 766
     if ($file_size >= 1073741824) {
767
-        $file_size = round($file_size / 1073741824 * 100) / 100 . 'G';
768
-    } elseif($file_size >= 1048576) {
769
-        $file_size = round($file_size / 1048576 * 100) / 100 . 'M';
770
-    } elseif($file_size >= 1024) {
771
-        $file_size = round($file_size / 1024 * 100) / 100 . 'k';
767
+        $file_size = round($file_size / 1073741824 * 100) / 100.'G';
768
+    } elseif ($file_size >= 1048576) {
769
+        $file_size = round($file_size / 1048576 * 100) / 100.'M';
770
+    } elseif ($file_size >= 1024) {
771
+        $file_size = round($file_size / 1024 * 100) / 100.'k';
772 772
     } else {
773
-        $file_size = $file_size . 'B';
773
+        $file_size = $file_size.'B';
774 774
     }
775 775
     return $file_size;
776 776
 }
@@ -779,18 +779,18 @@  discard block
 block discarded – undo
779 779
 {
780 780
     $year	 = '0000';
781 781
     $month = $day = $hours = $minutes = $seconds = '00';
782
-    if (isset($array['Y']) && (isset($array['F']) || isset($array['M']))  && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
782
+    if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
783 783
         $year = $array['Y'];
784
-        $month = isset($array['F'])?$array['F']:$array['M'];
785
-        if (intval($month) < 10 ) $month = '0'.$month;
784
+        $month = isset($array['F']) ? $array['F'] : $array['M'];
785
+        if (intval($month) < 10) $month = '0'.$month;
786 786
         $day = $array['d'];
787
-        if (intval($day) < 10 ) $day = '0'.$day;
787
+        if (intval($day) < 10) $day = '0'.$day;
788 788
         $hours = $array['H'];
789
-        if (intval($hours) < 10 ) $hours = '0'.$hours;
789
+        if (intval($hours) < 10) $hours = '0'.$hours;
790 790
         $minutes = $array['i'];
791
-        if (intval($minutes) < 10 ) $minutes = '0'.$minutes;
791
+        if (intval($minutes) < 10) $minutes = '0'.$minutes;
792 792
     }
793
-    if (checkdate($month,$day,$year)) {
793
+    if (checkdate($month, $day, $year)) {
794 794
         $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds;
795 795
     }
796 796
     return $datetime;
Please login to merge, or discard this patch.
Braces   +31 added lines, -20 removed lines patch added patch discarded remove patch
@@ -351,8 +351,9 @@  discard block
 block discarded – undo
351 351
     }
352 352
 
353 353
     $url = esc_url($url);
354
-    if ( empty($url) )
355
-        return $matches[0];
354
+    if ( empty($url) ) {
355
+            return $matches[0];
356
+    }
356 357
 
357 358
     return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
358 359
 }
@@ -377,8 +378,9 @@  discard block
 block discarded – undo
377 378
 function esc_url( $url, $protocols = null, $_context = 'display' ) {
378 379
     //$original_url = $url;
379 380
 
380
-    if ( '' == $url )
381
-        return $url;
381
+    if ( '' == $url ) {
382
+            return $url;
383
+    }
382 384
     $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
383 385
     $strip = array('%0d', '%0a', '%0D', '%0A');
384 386
     $url = _deep_replace($strip, $url);
@@ -388,8 +390,9 @@  discard block
 block discarded – undo
388 390
      * link starting with /, # or ? or a php file).
389 391
      */
390 392
     if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
391
-        ! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
392
-        $url = 'http://' . $url;
393
+        ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) {
394
+            $url = 'http://' . $url;
395
+    }
393 396
 
394 397
     return Security::remove_XSS($url);
395 398
 
@@ -466,8 +469,9 @@  discard block
 block discarded – undo
466 469
     $dest = $matches[2];
467 470
     $dest = 'http://' . $dest;
468 471
     $dest = esc_url($dest);
469
-    if ( empty($dest) )
470
-        return $matches[0];
472
+    if ( empty($dest) ) {
473
+            return $matches[0];
474
+    }
471 475
 
472 476
     // removed trailing [.,;:)] from URL
473 477
     if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
@@ -511,10 +515,11 @@  discard block
 block discarded – undo
511 515
     $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
512 516
     foreach ( $textarr as $piece ) {
513 517
 
514
-        if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
515
-            $nested_code_pre++;
516
-        elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
517
-            $nested_code_pre--;
518
+        if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) {
519
+                    $nested_code_pre++;
520
+        } elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) {
521
+                    $nested_code_pre--;
522
+        }
518 523
 
519 524
         if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
520 525
             $r .= $piece;
@@ -723,15 +728,13 @@  discard block
 block discarded – undo
723 728
 			if($length>$maxchar)
724 729
 			{
725 730
 				break;
726
-			}
727
-			else
731
+			} else
728 732
 			{
729 733
 				$output = $output." ".$words[$i];
730 734
 				$i++;
731 735
 			};
732 736
 		};
733
-	}
734
-	else
737
+	} else
735 738
 	{
736 739
 		$output = $text;
737 740
 		return $output;
@@ -782,13 +785,21 @@  discard block
 block discarded – undo
782 785
     if (isset($array['Y']) && (isset($array['F']) || isset($array['M']))  && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
783 786
         $year = $array['Y'];
784 787
         $month = isset($array['F'])?$array['F']:$array['M'];
785
-        if (intval($month) < 10 ) $month = '0'.$month;
788
+        if (intval($month) < 10 ) {
789
+            $month = '0'.$month;
790
+        }
786 791
         $day = $array['d'];
787
-        if (intval($day) < 10 ) $day = '0'.$day;
792
+        if (intval($day) < 10 ) {
793
+            $day = '0'.$day;
794
+        }
788 795
         $hours = $array['H'];
789
-        if (intval($hours) < 10 ) $hours = '0'.$hours;
796
+        if (intval($hours) < 10 ) {
797
+            $hours = '0'.$hours;
798
+        }
790 799
         $minutes = $array['i'];
791
-        if (intval($minutes) < 10 ) $minutes = '0'.$minutes;
800
+        if (intval($minutes) < 10 ) {
801
+            $minutes = '0'.$minutes;
802
+        }
792 803
     }
793 804
     if (checkdate($month,$day,$year)) {
794 805
         $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds;
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
  */
694 694
 function get_week_from_day($date) {
695 695
     if (!empty($date)) {
696
-       $time = api_strtotime($date,'UTC');
697
-       return date('W', $time);
696
+        $time = api_strtotime($date,'UTC');
697
+        return date('W', $time);
698 698
     } else {
699 699
         return date('W');
700 700
     }
@@ -712,31 +712,31 @@  discard block
 block discarded – undo
712 712
 
713 713
 function substrwords($text,$maxchar,$end='...')
714 714
 {
715
-	if(strlen($text)>$maxchar)
716
-	{
717
-		$words=explode(" ",$text);
718
-		$output = '';
719
-		$i=0;
720
-		while(1)
721
-		{
722
-			$length = (strlen($output)+strlen($words[$i]));
723
-			if($length>$maxchar)
724
-			{
725
-				break;
726
-			}
727
-			else
728
-			{
729
-				$output = $output." ".$words[$i];
730
-				$i++;
731
-			};
732
-		};
733
-	}
734
-	else
735
-	{
736
-		$output = $text;
737
-		return $output;
738
-	}
739
-	return $output.$end;
715
+    if(strlen($text)>$maxchar)
716
+    {
717
+        $words=explode(" ",$text);
718
+        $output = '';
719
+        $i=0;
720
+        while(1)
721
+        {
722
+            $length = (strlen($output)+strlen($words[$i]));
723
+            if($length>$maxchar)
724
+            {
725
+                break;
726
+            }
727
+            else
728
+            {
729
+                $output = $output." ".$words[$i];
730
+                $i++;
731
+            };
732
+        };
733
+    }
734
+    else
735
+    {
736
+        $output = $text;
737
+        return $output;
738
+    }
739
+    return $output.$end;
740 740
 }
741 741
 
742 742
 function implode_with_key($glue, $array) {
Please login to merge, or discard this patch.
main/inc/lib/usergroup.lib.php 3 patches
Doc Comments   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
      * @param int    $groupId
1014 1014
      * @param string $picture
1015 1015
      *
1016
-     * @return bool|string
1016
+     * @return false|string
1017 1017
      */
1018 1018
     public function manageFileUpload($groupId, $picture)
1019 1019
     {
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
     }
1156 1156
 
1157 1157
     /**
1158
-     * @return mixed
1158
+     * @return integer
1159 1159
      */
1160 1160
     public function getGroupType()
1161 1161
     {
@@ -1359,6 +1359,8 @@  discard block
 block discarded – undo
1359 1359
      * @param string height
1360 1360
      * @param string picture size it can be small_,  medium_  or  big_
1361 1361
      * @param string style css
1362
+     * @param integer $height
1363
+     * @param integer $size_picture
1362 1364
      * @return array with the file and the style of an image i.e $array['file'] $array['style']
1363 1365
      */
1364 1366
     public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM , $style = '')
@@ -1420,7 +1422,7 @@  discard block
 block discarded – undo
1420 1422
      * @param	string	Type of path to return (can be 'none', 'system', 'rel', 'web')
1421 1423
      * @param	bool	Whether we want to have the directory name returned 'as if' there was a file or not (in the case we want to know which directory to create - otherwise no file means no split subdir)
1422 1424
      * @param	bool	If we want that the function returns the /main/img/unknown.jpg image set it at true
1423
-     * @return	array 	Array of 2 elements: 'dir' and 'file' which contain the dir and file as the name implies if image does not exist it will return the unknow image if anonymous parameter is true if not it returns an empty er's
1425
+     * @return	integer 	Array of 2 elements: 'dir' and 'file' which contain the dir and file as the name implies if image does not exist it will return the unknow image if anonymous parameter is true if not it returns an empty er's
1424 1426
      */
1425 1427
     public function get_group_picture_path_by_id($id, $type = 'none', $preview = false, $anonymous = false)
1426 1428
     {
@@ -1470,7 +1472,7 @@  discard block
 block discarded – undo
1470 1472
     }
1471 1473
 
1472 1474
     /**
1473
-     * @return array
1475
+     * @return string[]
1474 1476
      */
1475 1477
     public function getAllowedPictureExtensions()
1476 1478
     {
@@ -1660,7 +1662,7 @@  discard block
 block discarded – undo
1660 1662
      * @author Julio Montoya
1661 1663
      * @param  int  $user_id
1662 1664
      * @param  int $group_id
1663
-     * @return boolean true if success
1665
+     * @return Doctrine\DBAL\Driver\Statement|null true if success
1664 1666
      * */
1665 1667
     public function delete_user_rel_group($user_id, $group_id)
1666 1668
     {
@@ -1872,6 +1874,8 @@  discard block
 block discarded – undo
1872 1874
      * @param int from value
1873 1875
      * @param int limit
1874 1876
      * @param array image configuration, i.e array('height'=>'20px', 'size'=> '20px')
1877
+     * @param integer $from
1878
+     * @param integer $limit
1875 1879
      * @return array list of users in a group
1876 1880
      */
1877 1881
     public function get_users_by_group(
@@ -1970,6 +1974,8 @@  discard block
 block discarded – undo
1970 1974
      * Shows the left column of the group page
1971 1975
      * @param int group id
1972 1976
      * @param int user id
1977
+     * @param integer $group_id
1978
+     * @param integer $user_id
1973 1979
      *
1974 1980
      */
1975 1981
     public function show_group_column_information($group_id, $user_id, $show = '')
@@ -2323,7 +2329,7 @@  discard block
 block discarded – undo
2323 2329
      * @param int $group_id
2324 2330
      * @param int $parent_group_id if 0, we delete the parent_group association
2325 2331
      * @param int $relation_type
2326
-     * @return resource
2332
+     * @return Doctrine\DBAL\Driver\Statement|null
2327 2333
      **/
2328 2334
     public static function set_parent_group($group_id, $parent_group_id, $relation_type = 1)
2329 2335
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1906,8 +1906,9 @@
 block discarded – undo
1906 1906
                 $new_relation_type[] ="'$rel'";
1907 1907
             }
1908 1908
             $relation_type = implode(',', $new_relation_type);
1909
-            if (!empty($relation_type))
1910
-                $where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
1909
+            if (!empty($relation_type)) {
1910
+                            $where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
1911
+            }
1911 1912
         }
1912 1913
 
1913 1914
         $sql = "SELECT picture_uri as image, u.id, u.firstname, u.lastname, relation_type
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             ";
83 83
             $result = Database::query($sql);
84 84
             if (Database::num_rows($result)) {
85
-                $row  = Database::fetch_array($result);
85
+                $row = Database::fetch_array($result);
86 86
 
87 87
                 return $row['count'];
88 88
             }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             ";
103 103
             $result = Database::query($sql);
104 104
             if (Database::num_rows($result)) {
105
-                $row  = Database::fetch_array($result);
105
+                $row = Database::fetch_array($result);
106 106
                 return $row['count'];
107 107
             }
108 108
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             ";
128 128
             $result = Database::query($sql);
129 129
             if (Database::num_rows($result)) {
130
-                $row  = Database::fetch_array($result);
130
+                $row = Database::fetch_array($result);
131 131
                 return $row['count'];
132 132
             }
133 133
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             ";
149 149
             $result = Database::query($sql);
150 150
             if (Database::num_rows($result)) {
151
-                $row  = Database::fetch_array($result);
151
+                $row = Database::fetch_array($result);
152 152
                 return $row['count'];
153 153
             }
154 154
 
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
                 INNER JOIN {$this->table} g
530 530
                 ON (u.usergroup_id = g.id)
531 531
                 ";
532
-            $where =  array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId)));
532
+            $where = array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId)));
533 533
         } else {
534 534
             $from = $this->usergroup_rel_user_table." u
535 535
                 INNER JOIN {$this->table} g
536 536
                 ON (u.usergroup_id = g.id)
537 537
                 ";
538
-            $where =  array('where' => array('user_id = ?' => $userId));
538
+            $where = array('where' => array('user_id = ?' => $userId));
539 539
         }
540 540
 
541 541
         if ($filterByType !== null) {
@@ -568,10 +568,10 @@  discard block
 block discarded – undo
568 568
             $urlId = api_get_current_access_url_id();
569 569
             $from = $this->usergroup_rel_user_table." u
570 570
                     INNER JOIN {$this->access_url_rel_usergroup} a ON (a.usergroup_id AND u.usergroup_id)";
571
-            $where =  array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId)));
571
+            $where = array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId)));
572 572
         } else {
573 573
             $from = $this->usergroup_rel_user_table." u ";
574
-            $where =  array('where' => array('user_id = ?' => $userId));
574
+            $where = array('where' => array('user_id = ?' => $userId));
575 575
         }
576 576
 
577 577
         $results = Database::select(
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
             }
859 859
             $result = $new_result;
860 860
         }
861
-        $columns = array('name', 'users', 'courses','sessions', 'group_type');
861
+        $columns = array('name', 'users', 'courses', 'sessions', 'group_type');
862 862
 
863 863
         if (!in_array($sidx, $columns)) {
864 864
             $sidx = 'name';
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
                 }
1264 1264
             }
1265 1265
         }
1266
-        $response->addAssign('ajax_list_courses','innerHTML', api_utf8_encode($return));
1266
+        $response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
1267 1267
 
1268 1268
         return $response;
1269 1269
     }
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
      * @param string style css
1372 1372
      * @return array with the file and the style of an image i.e $array['file'] $array['style']
1373 1373
      */
1374
-    public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM , $style = '')
1374
+    public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM, $style = '')
1375 1375
     {
1376 1376
         $picture = array();
1377 1377
         //$picture['style'] = $style;
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
             if (file_exists($file) && !is_dir($file)) {
1415 1415
                 $picture['file'] = $image_array['dir'].$picture_file;
1416 1416
             } else {
1417
-                $picture['file'] = Display::returnIconPath('group_na.png',64);
1417
+                $picture['file'] = Display::returnIconPath('group_na.png', 64);
1418 1418
             }
1419 1419
         }
1420 1420
         return $picture;
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
         if (empty($user_id)) {
1519 1519
             $user_id = api_get_user_id();
1520 1520
         }
1521
-        $user_role	= $this->get_user_group_role($user_id, $group_id);
1521
+        $user_role = $this->get_user_group_role($user_id, $group_id);
1522 1522
         if (in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN))) {
1523 1523
             return true;
1524 1524
         } else {
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
         if (empty($user_id)) {
1537 1537
             $user_id = api_get_user_id();
1538 1538
         }
1539
-        $user_role	= $this->get_user_group_role($user_id, $group_id);
1539
+        $user_role = $this->get_user_group_role($user_id, $group_id);
1540 1540
         if (in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
1541 1541
             return true;
1542 1542
         } else {
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
             GROUP_USER_PERMISSION_READER,
1564 1564
             GROUP_USER_PERMISSION_HRM,
1565 1565
         );
1566
-        $user_role	= self::get_user_group_role($user_id, $group_id);
1566
+        $user_role = self::get_user_group_role($user_id, $group_id);
1567 1567
         if (in_array($user_role, $roles)) {
1568 1568
             return true;
1569 1569
         } else {
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
      * */
1581 1581
     public function get_user_group_role($user_id, $group_id)
1582 1582
     {
1583
-        $table_group_rel_user= $this->usergroup_rel_user_table;
1583
+        $table_group_rel_user = $this->usergroup_rel_user_table;
1584 1584
         $return_value = 0;
1585 1585
         if (!empty($user_id) && !empty($group_id)) {
1586 1586
             $sql = "SELECT relation_type FROM $table_group_rel_user
@@ -1588,8 +1588,8 @@  discard block
 block discarded – undo
1588 1588
                         usergroup_id = ".intval($group_id)." AND
1589 1589
                         user_id = ".intval($user_id)." ";
1590 1590
             $result = Database::query($sql);
1591
-            if (Database::num_rows($result)>0) {
1592
-                $row = Database::fetch_array($result,'ASSOC');
1591
+            if (Database::num_rows($result) > 0) {
1592
+                $row = Database::fetch_array($result, 'ASSOC');
1593 1593
                 $return_value = $row['relation_type'];
1594 1594
             }
1595 1595
         }
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
         if (is_array($user_list) && is_array($group_list)) {
1645 1645
             foreach ($group_list as $group_id) {
1646 1646
                 foreach ($user_list as $user_id) {
1647
-                    $role = self::get_user_group_role($user_id,$group_id);
1647
+                    $role = self::get_user_group_role($user_id, $group_id);
1648 1648
                     if ($role == 0) {
1649 1649
                         $sql = "INSERT INTO $table_url_rel_group
1650 1650
 		               			SET
@@ -1675,7 +1675,7 @@  discard block
 block discarded – undo
1675 1675
     public function delete_user_rel_group($user_id, $group_id)
1676 1676
     {
1677 1677
         $table = $this->usergroup_rel_user_table;
1678
-        $sql= "DELETE FROM $table
1678
+        $sql = "DELETE FROM $table
1679 1679
                WHERE
1680 1680
                 user_id = ".intval($user_id)." AND
1681 1681
                 usergroup_id = ".intval($group_id)."  ";
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 
1732 1732
         $sql = "UPDATE $table_group_rel_user
1733 1733
    				SET relation_type = ".intval($relation_type)."
1734
-                WHERE user_id = $user_id AND usergroup_id = $group_id" ;
1734
+                WHERE user_id = $user_id AND usergroup_id = $group_id";
1735 1735
         Database::query($sql);
1736 1736
     }
1737 1737
 
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
         if (Database::num_rows($result) > 0) {
1774 1774
             while ($row = Database::fetch_array($result, 'ASSOC')) {
1775 1775
                 if ($with_image) {
1776
-                    $picture = self::get_picture_group($row['id'], $row['picture'],80);
1776
+                    $picture = self::get_picture_group($row['id'], $row['picture'], 80);
1777 1777
                     $img = '<img src="'.$picture['file'].'" />';
1778 1778
                     $row['picture'] = $img;
1779 1779
                 }
@@ -1809,11 +1809,11 @@  discard block
 block discarded – undo
1809 1809
 				ORDER BY count DESC
1810 1810
 				LIMIT $num";
1811 1811
 
1812
-        $result=Database::query($sql);
1812
+        $result = Database::query($sql);
1813 1813
         $array = array();
1814 1814
         while ($row = Database::fetch_array($result, 'ASSOC')) {
1815 1815
             if ($with_image) {
1816
-                $picture = self::get_picture_group($row['id'], $row['picture'],80);
1816
+                $picture = self::get_picture_group($row['id'], $row['picture'], 80);
1817 1817
                 $img = '<img src="'.$picture['file'].'" />';
1818 1818
                 $row['picture'] = $img;
1819 1819
             }
@@ -1858,11 +1858,11 @@  discard block
 block discarded – undo
1858 1858
                 ORDER BY created_at DESC
1859 1859
                 LIMIT $num ";
1860 1860
 
1861
-        $result=Database::query($sql);
1861
+        $result = Database::query($sql);
1862 1862
         $array = array();
1863 1863
         while ($row = Database::fetch_array($result, 'ASSOC')) {
1864 1864
             if ($with_image) {
1865
-                $picture = self::get_picture_group($row['id'], $row['picture'],80);
1865
+                $picture = self::get_picture_group($row['id'], $row['picture'], 80);
1866 1866
                 $img = '<img src="'.$picture['file'].'" />';
1867 1867
                 $row['picture'] = $img;
1868 1868
             }
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
1897 1897
         $group_id = intval($group_id);
1898 1898
 
1899
-        if (empty($group_id)){
1899
+        if (empty($group_id)) {
1900 1900
             return array();
1901 1901
         }
1902 1902
 
@@ -1911,9 +1911,9 @@  discard block
 block discarded – undo
1911 1911
             $where_relation_condition = '';
1912 1912
         } else {
1913 1913
             $new_relation_type = array();
1914
-            foreach($relation_type as $rel) {
1914
+            foreach ($relation_type as $rel) {
1915 1915
                 $rel = intval($rel);
1916
-                $new_relation_type[] ="'$rel'";
1916
+                $new_relation_type[] = "'$rel'";
1917 1917
             }
1918 1918
             $relation_type = implode(',', $new_relation_type);
1919 1919
             if (!empty($relation_type))
@@ -1957,7 +1957,7 @@  discard block
 block discarded – undo
1957 1957
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
1958 1958
         $group_id = intval($group_id);
1959 1959
 
1960
-        if (empty($group_id)){
1960
+        if (empty($group_id)) {
1961 1961
             return array();
1962 1962
         }
1963 1963
 
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 			    WHERE gu.usergroup_id= $group_id
1969 1969
 			    ORDER BY relation_type, firstname";
1970 1970
 
1971
-        $result=Database::query($sql);
1971
+        $result = Database::query($sql);
1972 1972
         $array = array();
1973 1973
         while ($row = Database::fetch_array($result, 'ASSOC')) {
1974 1974
             $array[$row['id']] = $row;
@@ -1996,33 +1996,33 @@  discard block
 block discarded – undo
1996 1996
             case GROUP_USER_PERMISSION_READER:
1997 1997
                 // I'm just a reader
1998 1998
                 $relation_group_title = get_lang('IAmAReader');
1999
-                $links .=  '<li class="'. ($show == 'invite_friends' ? 'active' : '') .'"><a href="group_invitation.php?id='.$group_id.'">'.
2000
-                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')) . get_lang('InviteFriends') . '</a></li>';
2001
-                $links .=  '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2002
-                            Display::return_icon('group_leave.png', get_lang('LeaveGroup')) . get_lang('LeaveGroup') . '</a></li>';
1999
+                $links .= '<li class="'.($show == 'invite_friends' ? 'active' : '').'"><a href="group_invitation.php?id='.$group_id.'">'.
2000
+                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')).get_lang('InviteFriends').'</a></li>';
2001
+                $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2002
+                            Display::return_icon('group_leave.png', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>';
2003 2003
                 if (UserGroup::canLeave($group_info)) {
2004
-                    $links .=  '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2005
-                        Display::return_icon('group_leave.png', get_lang('LeaveGroup')) . get_lang('LeaveGroup') . '</a></li>';
2004
+                    $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2005
+                        Display::return_icon('group_leave.png', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>';
2006 2006
                 }
2007 2007
                 break;
2008 2008
             case GROUP_USER_PERMISSION_ADMIN:
2009 2009
                 $relation_group_title = get_lang('IAmAnAdmin');
2010
-                $links .=  '<li class="'. ($show == 'group_edit' ? 'active' : '') .'"><a href="group_edit.php?id='.$group_id.'">'.
2011
-                            Display::return_icon('group_edit.png', get_lang('EditGroup')) . get_lang('EditGroup') . '</a></li>';
2012
-                $links .=  '<li class="'. ($show == 'member_list' ? 'active' : '') .'"><a href="group_waiting_list.php?id='.$group_id.'">'.
2013
-                            Display::return_icon('waiting_list.png', get_lang('WaitingList')) . get_lang('WaitingList') . '</a></li>';
2014
-                $links .=  '<li class="'. ($show == 'invite_friends' ? 'active' : '') .'"><a href="group_invitation.php?id='.$group_id.'">'.
2015
-                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')) . get_lang('InviteFriends') . '</a></li>';
2010
+                $links .= '<li class="'.($show == 'group_edit' ? 'active' : '').'"><a href="group_edit.php?id='.$group_id.'">'.
2011
+                            Display::return_icon('group_edit.png', get_lang('EditGroup')).get_lang('EditGroup').'</a></li>';
2012
+                $links .= '<li class="'.($show == 'member_list' ? 'active' : '').'"><a href="group_waiting_list.php?id='.$group_id.'">'.
2013
+                            Display::return_icon('waiting_list.png', get_lang('WaitingList')).get_lang('WaitingList').'</a></li>';
2014
+                $links .= '<li class="'.($show == 'invite_friends' ? 'active' : '').'"><a href="group_invitation.php?id='.$group_id.'">'.
2015
+                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')).get_lang('InviteFriends').'</a></li>';
2016 2016
                 if (UserGroup::canLeave($group_info)) {
2017 2017
                     $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2018
-                        Display::return_icon('group_leave.png', get_lang('LeaveGroup')) . get_lang('LeaveGroup') . '</a></li>';
2018
+                        Display::return_icon('group_leave.png', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>';
2019 2019
                 }
2020 2020
                 break;
2021 2021
             case GROUP_USER_PERMISSION_PENDING_INVITATION:
2022 2022
 //				$links .=  '<li><a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.Display::return_icon('addd.gif', get_lang('YouHaveBeenInvitedJoinNow'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('YouHaveBeenInvitedJoinNow').'</span></a></li>';
2023 2023
                 break;
2024 2024
             case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER:
2025
-                $relation_group_title =  get_lang('WaitingForAdminResponse');
2025
+                $relation_group_title = get_lang('WaitingForAdminResponse');
2026 2026
                 break;
2027 2027
             case GROUP_USER_PERMISSION_MODERATOR:
2028 2028
                 $relation_group_title = get_lang('IAmAModerator');
@@ -2030,28 +2030,28 @@  discard block
 block discarded – undo
2030 2030
                 //$links .=  '<li><a href="groups.php?id='.$group_id.'">'.				Display::return_icon('message_list.png', get_lang('MessageList'), array('hspace'=>'6')).'<span class="'.($show=='messages_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MessageList').'</span></a></li>';
2031 2031
                 //$links .=  '<li><a href="group_members.php?id='.$group_id.'">'.		Display::return_icon('member_list.png', get_lang('MemberList'), array('hspace'=>'6')).'<span class="'.($show=='member_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MemberList').'</span></a></li>';
2032 2032
                 if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED) {
2033
-                    $links .=  '<li><a href="group_waiting_list.php?id='.$group_id.'">'.
2034
-                                Display::return_icon('waiting_list.png', get_lang('WaitingList')) . get_lang('WaitingList') . '</a></li>';
2033
+                    $links .= '<li><a href="group_waiting_list.php?id='.$group_id.'">'.
2034
+                                Display::return_icon('waiting_list.png', get_lang('WaitingList')).get_lang('WaitingList').'</a></li>';
2035 2035
                 }
2036
-                $links .=  '<li><a href="group_invitation.php?id='.$group_id.'">'.
2037
-                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')) . get_lang('InviteFriends') . '</a></li>';
2036
+                $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'.
2037
+                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')).get_lang('InviteFriends').'</a></li>';
2038 2038
                 if (UserGroup::canLeave($group_info)) {
2039
-                    $links .=  '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2040
-                        Display::return_icon('group_leave.png', get_lang('LeaveGroup')) . get_lang('LeaveGroup') . '</a></li>';
2039
+                    $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2040
+                        Display::return_icon('group_leave.png', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>';
2041 2041
                 }
2042 2042
                 break;
2043 2043
             case GROUP_USER_PERMISSION_HRM:
2044 2044
                 $relation_group_title = get_lang('IAmAHRM');
2045 2045
                 $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&action=add_message_group" class="ajax" title="'.get_lang('ComposeMessage').'" data-size="lg" data-title="'.get_lang('ComposeMessage').'">'.
2046
-                            Display::return_icon('new-message.png', get_lang('NewTopic')) . get_lang('NewTopic') . '</a></li>';
2047
-                $links .=  '<li><a href="group_view.php?id='.$group_id.'">'.
2048
-                            Display::return_icon('message_list.png', get_lang('MessageList')) . get_lang('MessageList') . '</a></li>';
2049
-                $links .=  '<li><a href="group_invitation.php?id='.$group_id.'">'.
2050
-                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')) . get_lang('InviteFriends') . '</a></li>';
2051
-                $links .=  '<li><a href="group_members.php?id='.$group_id.'">'.
2052
-                            Display::return_icon('member_list.png', get_lang('MemberList')) . get_lang('MemberList') . '</a></li>';
2053
-                $links .=  '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2054
-                            Display::return_icon('delete_data.gif', get_lang('LeaveGroup')) . get_lang('LeaveGroup') . '</a></li>';
2046
+                            Display::return_icon('new-message.png', get_lang('NewTopic')).get_lang('NewTopic').'</a></li>';
2047
+                $links .= '<li><a href="group_view.php?id='.$group_id.'">'.
2048
+                            Display::return_icon('message_list.png', get_lang('MessageList')).get_lang('MessageList').'</a></li>';
2049
+                $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'.
2050
+                            Display::return_icon('invitation_friend.png', get_lang('InviteFriends')).get_lang('InviteFriends').'</a></li>';
2051
+                $links .= '<li><a href="group_members.php?id='.$group_id.'">'.
2052
+                            Display::return_icon('member_list.png', get_lang('MemberList')).get_lang('MemberList').'</a></li>';
2053
+                $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
2054
+                            Display::return_icon('delete_data.gif', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>';
2055 2055
                 break;
2056 2056
             default:
2057 2057
                 //$links .=  '<li><a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.Display::return_icon('addd.gif', get_lang('JoinGroup'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('JoinGroup').'</a></span></li>';
@@ -2143,7 +2143,7 @@  discard block
 block discarded – undo
2143 2143
         }
2144 2144
 
2145 2145
         $direction = 'ASC';
2146
-        if (!in_array($direction, array('ASC','DESC'))) {
2146
+        if (!in_array($direction, array('ASC', 'DESC'))) {
2147 2147
             $direction = 'ASC';
2148 2148
         }
2149 2149
 
@@ -2154,8 +2154,8 @@  discard block
 block discarded – undo
2154 2154
         $sql .= " LIMIT $from,$number_of_items";
2155 2155
 
2156 2156
         $res = Database::query($sql);
2157
-        if (Database::num_rows($res)> 0) {
2158
-            while ($row = Database::fetch_array($res,'ASSOC')) {
2157
+        if (Database::num_rows($res) > 0) {
2158
+            while ($row = Database::fetch_array($res, 'ASSOC')) {
2159 2159
                 if (!in_array($row['id'], $return)) {
2160 2160
                     $return[$row['id']] = $row;
2161 2161
                 }
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
             if ($i == $max_level) {
2181 2181
                 $select_part .= "rg$rg_number.group_id as id_$rg_number ";
2182 2182
             } else {
2183
-                $select_part .="rg$rg_number.group_id as id_$rg_number, ";
2183
+                $select_part .= "rg$rg_number.group_id as id_$rg_number, ";
2184 2184
             }
2185 2185
             if ($i == 1) {
2186 2186
                 $cond_part .= "FROM $t_rel_group rg0 LEFT JOIN $t_rel_group rg$i on rg$rg_number.group_id = rg$i.subgroup_id ";
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
         $nameList = '<ul class="list-unstyled">';
2366 2366
 
2367 2367
         foreach ($groupsNameListParsed as $name) {
2368
-            $nameList .= '<li>' . Display::span($name, ['class' => 'label label-info']) . '</li>';
2368
+            $nameList .= '<li>'.Display::span($name, ['class' => 'label label-info']).'</li>';
2369 2369
         }
2370 2370
 
2371 2371
         $nameList .= '</ul>';
Please login to merge, or discard this patch.
main/inc/lib/VideoChat.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      * Create a video chat
44 44
      * @param int $fromUser The sender user
45 45
      * @param int $toUser The receiver user
46
-     * @return int The created video chat id. Otherwise return false
46
+     * @return false|string The created video chat id. Otherwise return false
47 47
      */
48 48
     public static function createRoom($fromUser, $toUser)
49 49
     {
Please login to merge, or discard this patch.