Completed
Push — 1.11.x ( 78f130...f6f5c2 )
by José
50:40 queued 24:26
created
main/admin/sub_language_ajax.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 
10 10
 api_protect_admin_script();
11 11
 
12
-$new_language        = Security::remove_XSS($_REQUEST['new_language']);
13
-$language_variable    = Security::remove_XSS($_REQUEST['variable_language']);
14
-$file_id            = intval($_REQUEST['file_id']);
12
+$new_language = Security::remove_XSS($_REQUEST['new_language']);
13
+$language_variable = Security::remove_XSS($_REQUEST['variable_language']);
14
+$file_id = intval($_REQUEST['file_id']);
15 15
 /**
16 16
  * Code
17 17
  */
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
     //update variable language
29 29
     // Replace double quotes to avoid parse errors
30
-    $new_language = str_replace('"', '\"',$new_language);
30
+    $new_language = str_replace('"', '\"', $new_language);
31 31
     // Replace new line signs to avoid parse errors - see #6773
32
-    $new_language = str_replace("\n","\\n",$new_language);
33
-    $all_file_of_directory[$language_variable]="\"".$new_language."\";";
32
+    $new_language = str_replace("\n", "\\n", $new_language);
33
+    $all_file_of_directory[$language_variable] = "\"".$new_language."\";";
34 34
     $result_array = array();
35 35
 
36 36
     foreach ($all_file_of_directory as $key_value=>$value_info) {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     if (!empty($result_array)) {
41 41
         foreach ($result_array as $key => $result) {
42 42
             if ($result == false) {
43
-                $variables_with_problems .=$key.' <br />';
43
+                $variables_with_problems .= $key.' <br />';
44 44
             }
45 45
         }
46 46
     }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             Display::return_message(get_lang('TheNewWordHasBeenAdded'), 'success')
51 51
         );
52 52
 
53
-        $redirectUrl = api_get_path(WEB_CODE_PATH) . 'admin/extra_fields.php?type=';
53
+        $redirectUrl = api_get_path(WEB_CODE_PATH).'admin/extra_fields.php?type=';
54 54
 
55 55
         switch ($_REQUEST['extra_field_type']) {
56 56
             case \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE:
Please login to merge, or discard this patch.
main/inc/lib/glossary.lib.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      *
96 96
      * @param array  $values  Array of title + description (name => $title, description => $comment)
97 97
      *
98
-     * @return mixed   Term id on success, false on failure
98
+     * @return false|string   Term id on success, false on failure
99 99
      *
100 100
      */
101 101
     public static function save_glossary($values, $showMessage = true)
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 
449 449
     /**
450 450
      * Display the glossary terms in a list
451
-     * @return bool true
451
+     * @return string true
452 452
      */
453 453
     public static function displayGlossaryList()
454 454
     {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
      * Update action icons column
586 586
      *
587 587
      * @param integer $glossary_id
588
-     * @param array   $url_params Parameters to use to affect links
588
+     * @param string   $url_params Parameters to use to affect links
589 589
      * @param array   $row The line of results from a query on the glossary table
590 590
      *
591 591
      * @return string HTML string for the action icons columns
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @return string The glossary description
49 49
      */
50
-    public static function get_glossary_term_by_glossary_id ($glossary_id)
50
+    public static function get_glossary_term_by_glossary_id($glossary_id)
51 51
     {
52
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
52
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
53 53
         $course_id = api_get_course_int_id();
54 54
         $sql = "SELECT description FROM $glossary_table
55 55
                 WHERE c_id = $course_id  AND glossary_id =".intval($glossary_id);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public static function get_glossary_term_by_glossary_name($glossary_name)
74 74
     {
75
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
75
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
76 76
         $session_id = api_get_session_id();
77 77
         $course_id = api_get_course_int_id();
78 78
         $sql_filter = api_get_session_condition($session_id);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $get_max = "SELECT MAX(display_order) FROM $t_glossary
226 226
                     WHERE c_id = $course_id ";
227 227
         $res_max = Database::query($get_max);
228
-        if (Database::num_rows($res_max)==0) {
228
+        if (Database::num_rows($res_max) == 0) {
229 229
             return 0;
230 230
         }
231 231
         $row = Database::fetch_array($res_max);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                 WHERE
255 255
                     c_id = $course_id AND
256 256
                     name = '".Database::escape_string($term)."'";
257
-        if ($not_id<>'') {
257
+        if ($not_id <> '') {
258 258
             $sql .= " AND glossary_id <> '".intval($not_id)."'";
259 259
         }
260 260
         $result = Database::query($sql);
@@ -378,25 +378,25 @@  discard block
 block discarded – undo
378 378
         $actionsLeft = '';
379 379
         if (api_is_allowed_to_edit(null, true)) {
380 380
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add?'.api_get_cidreq().'">'.
381
-                Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
381
+                Display::return_icon('new_glossary_term.png', get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
382 382
         }
383 383
 
384 384
         $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export">'.
385
-            Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
385
+            Display::return_icon('export_csv.png', get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
386 386
         if (api_is_allowed_to_edit(null, true)) {
387 387
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=import">'.
388
-                Display::return_icon('import_csv.png',get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
388
+                Display::return_icon('import_csv.png', get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
389 389
         }
390 390
 
391 391
         $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf">'.
392
-            Display::return_icon('pdf.png',get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
392
+            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
393 393
 
394 394
         if (($view == 'table') || (!isset($view))) {
395 395
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.
396
-                Display::return_icon('view_detailed.png',get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
396
+                Display::return_icon('view_detailed.png', get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
397 397
         } else {
398 398
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.
399
-                Display::return_icon('view_text.png',get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
399
+                Display::return_icon('view_text.png', get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
400 400
         }
401 401
 
402 402
         /* BUILD SEARCH FORM */
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             $table->set_header(1, get_lang('TermDefinition'), true);
434 434
             if (api_is_allowed_to_edit(null, true)) {
435 435
                 $table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions'));
436
-                $table->set_column_filter(2, array('GlossaryManager','actions_filter'));
436
+                $table->set_column_filter(2, array('GlossaryManager', 'actions_filter'));
437 437
             }
438 438
             $content .= $table->return_table();
439 439
         }
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
         $content = '';
456 456
         foreach ($glossary_data as $key => $glossary_item) {
457 457
             $actions = '';
458
-            if (api_is_allowed_to_edit(null,true)) {
459
-                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '',$glossary_item).'</div>';
458
+            if (api_is_allowed_to_edit(null, true)) {
459
+                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '', $glossary_item).'</div>';
460 460
             }
461 461
             $content .= Display::panel($glossary_item[1], $glossary_item[0].' '.$actions);
462 462
         }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
      * @return integer Count of glossary terms
470 470
      *
471 471
      */
472
-    public static function get_number_glossary_terms($session_id=0)
472
+    public static function get_number_glossary_terms($session_id = 0)
473 473
     {
474 474
         // Database table definition
475 475
         $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
         while ($data = Database::fetch_array($res)) {
564 564
             // Validation when belongs to a session
565 565
             $session_img = api_get_session_image($data['session_id'], $_user['status']);
566
-            $array[0] = $data[0] . $session_img;
566
+            $array[0] = $data[0].$session_img;
567 567
 
568 568
             if (!$view || $view === 'table') {
569 569
                 $array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]);
@@ -593,13 +593,13 @@  discard block
 block discarded – undo
593 593
     {
594 594
         $glossary_id = $row[2];
595 595
         $return = '<a href="'.api_get_self().'?action=edit_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.
596
-            Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
596
+            Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
597 597
         $glossary_data = GlossaryManager::get_glossary_information($glossary_id);
598 598
         $glossary_term = $glossary_data['name'];
599 599
         if (api_is_allowed_to_edit(null, true)) {
600 600
             if ($glossary_data['session_id'] == api_get_session_id()) {
601 601
                 $return .= '<a href="'.api_get_self().'?action=delete_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.
602
-                    Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
602
+                    Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a>';
603 603
             } else {
604 604
                 $return = get_lang('EditionNotAvailableFromSession');
605 605
             }
Please login to merge, or discard this patch.
main/glossary/index.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
                     api_get_local_time($glossary_data['update_date'])
140 140
                 );
141 141
             } else {
142
-                 $glossary_data['update_date'] = '';
142
+                    $glossary_data['update_date'] = '';
143 143
             }
144 144
 
145 145
             $form->addLabel(get_lang('CreationDate'), $glossary_data['insert_date']);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         if (!api_is_allowed_to_edit(null, true)) {
54 54
             api_not_allowed(true);
55 55
         }
56
-        $tool_name =  get_lang('Add');
56
+        $tool_name = get_lang('Add');
57 57
         $form = new FormValidator(
58 58
             'glossary',
59 59
             'post',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         if (!api_is_allowed_to_edit(null, true)) {
191 191
             api_not_allowed(true);
192 192
         }
193
-        $tool_name =  get_lang('ImportGlossary');
193
+        $tool_name = get_lang('ImportGlossary');
194 194
         $form = new FormValidator(
195 195
             'glossary',
196 196
             'post',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 foreach (GlossaryManager::get_glossary_terms() as $term) {
219 219
                     if (!GlossaryManager::delete_glossary($term['id'], false)) {
220 220
                         Display::addFlash(
221
-                            Display::return_message(get_lang("CannotDeleteGlossary") . ':' . $term['id'], 'error')
221
+                            Display::return_message(get_lang("CannotDeleteGlossary").':'.$term['id'], 'error')
222 222
                         );
223 223
                     } else {
224 224
                         $termsDeleted[] = $term['name'];
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             if (count($badList) > 0) {
316 316
                 Display::addFlash(
317 317
                     Display::return_message(
318
-                        get_lang("GlossaryTermAlreadyExists").': ' . implode(', ', $badList),
318
+                        get_lang("GlossaryTermAlreadyExists").': '.implode(', ', $badList),
319 319
                         'error'
320 320
                     )
321 321
                 );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         GlossaryManager::export_to_pdf();
359 359
         break;
360 360
     case 'changeview':
361
-        if (in_array($_GET['view'], array('list','table'))) {
361
+        if (in_array($_GET['view'], array('list', 'table'))) {
362 362
             Session::write('glossary_view', $_GET['view']);
363 363
         } else {
364 364
             $view = Session::read('glossary_view');
Please login to merge, or discard this patch.
main/inc/lib/usermanager.lib.php 4 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1267,13 +1267,13 @@  discard block
 block discarded – undo
1267 1267
     }
1268 1268
 
1269 1269
     /**
1270
-    * Get the users by ID
1271
-    * @param array $ids student ids
1272
-    * @param string $active
1273
-    * @param string $order
1274
-    * @param string $limit
1275
-    * @return array $result student information
1276
-    */
1270
+     * Get the users by ID
1271
+     * @param array $ids student ids
1272
+     * @param string $active
1273
+     * @param string $order
1274
+     * @param string $limit
1275
+     * @return array $result student information
1276
+     */
1277 1277
     public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null)
1278 1278
     {
1279 1279
         if (empty($ids)) {
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
      *
2315 2315
      * @return array with extra data info of a user i.e array('field_variable'=>'value');
2316 2316
      */
2317
-     public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2317
+        public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2318 2318
     {
2319 2319
         $extraFieldValue = new ExtraFieldValue('user');
2320 2320
         $extraField = new ExtraField('user');
@@ -3409,12 +3409,12 @@  discard block
 block discarded – undo
3409 3409
         if ($tag_id == 0) {
3410 3410
             //the tag doesn't exist
3411 3411
             $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)";
3412
-             Database::query($sql);
3412
+                Database::query($sql);
3413 3413
             $last_insert_id = Database::insert_id();
3414 3414
         } else {
3415 3415
             //the tag exists we update it
3416 3416
             $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id  = $tag_id";
3417
-             Database::query($sql);
3417
+                Database::query($sql);
3418 3418
             $last_insert_id = $tag_id;
3419 3419
         }
3420 3420
 
@@ -3610,9 +3610,9 @@  discard block
 block discarded – undo
3610 3610
     }
3611 3611
 
3612 3612
     /**
3613
-      * Get extra filtrable user fields (only type select)
3614
-      * @return array
3615
-      */
3613
+     * Get extra filtrable user fields (only type select)
3614
+     * @return array
3615
+     */
3616 3616
     public static function get_extra_filtrable_fields()
3617 3617
     {
3618 3618
         $extraFieldList = UserManager::get_extra_fields();
@@ -3637,9 +3637,9 @@  discard block
 block discarded – undo
3637 3637
     }
3638 3638
 
3639 3639
     /**
3640
-      * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3641
-      * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3642
-      */
3640
+     * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3641
+     * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3642
+     */
3643 3643
     public static function get_search_form_where_extra_fields()
3644 3644
     {
3645 3645
         $useExtraFields = false;
@@ -3958,23 +3958,23 @@  discard block
 block discarded – undo
3958 3958
     }
3959 3959
 
3960 3960
     /**
3961
-    * Get users followed by human resource manager
3962
-    * @param int $userId
3963
-    * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3964
-    * @param bool $getOnlyUserId
3965
-    * @param bool $getSql
3966
-    * @param bool $getCount
3967
-    * @param int $from
3968
-    * @param int $numberItems
3969
-    * @param int $column
3970
-    * @param string $direction
3971
-    * @param int $active
3972
-    * @param string $lastConnectionDate
3973
-    * @param int $status the function is called by who? COURSEMANAGER, DRH?
3974
-    * @param string $keyword
3961
+     * Get users followed by human resource manager
3962
+     * @param int $userId
3963
+     * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3964
+     * @param bool $getOnlyUserId
3965
+     * @param bool $getSql
3966
+     * @param bool $getCount
3967
+     * @param int $from
3968
+     * @param int $numberItems
3969
+     * @param int $column
3970
+     * @param string $direction
3971
+     * @param int $active
3972
+     * @param string $lastConnectionDate
3973
+     * @param int $status the function is called by who? COURSEMANAGER, DRH?
3974
+     * @param string $keyword
3975 3975
      *
3976
-    * @return array user list
3977
-    */
3976
+     * @return array user list
3977
+     */
3978 3978
     public static function getUsersFollowedByUser(
3979 3979
         $userId,
3980 3980
         $userStatus = null,
Please login to merge, or discard this patch.
Braces   +88 added lines, -56 removed lines patch added patch discarded remove patch
@@ -2165,8 +2165,9 @@  discard block
 block discarded – undo
2165 2165
         if (empty($user_id)) {
2166 2166
             $user_id = 0;
2167 2167
         } else {
2168
-            if ($user_id != strval(intval($user_id)))
2169
-                return array();
2168
+            if ($user_id != strval(intval($user_id))) {
2169
+                            return array();
2170
+            }
2170 2171
         }
2171 2172
         $extra_data = array();
2172 2173
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2258,8 +2259,9 @@  discard block
 block discarded – undo
2258 2259
         if (empty($user_id)) {
2259 2260
             $user_id = 0;
2260 2261
         } else {
2261
-            if ($user_id != strval(intval($user_id)))
2262
-                return array();
2262
+            if ($user_id != strval(intval($user_id))) {
2263
+                            return array();
2264
+            }
2263 2265
         }
2264 2266
         $extra_data = array();
2265 2267
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -3042,13 +3044,15 @@  discard block
 block discarded – undo
3042 3044
      */
3043 3045
     public static function get_api_keys($user_id = null, $api_service = 'dokeos')
3044 3046
     {
3045
-        if ($user_id != strval(intval($user_id)))
3046
-            return false;
3047
+        if ($user_id != strval(intval($user_id))) {
3048
+                    return false;
3049
+        }
3047 3050
         if (empty($user_id)) {
3048 3051
             $user_id = api_get_user_id();
3049 3052
         }
3050
-        if ($user_id === false)
3051
-            return false;
3053
+        if ($user_id === false) {
3054
+                    return false;
3055
+        }
3052 3056
         $service_name = Database::escape_string($api_service);
3053 3057
         if (is_string($service_name) === false) {
3054 3058
             return false;
@@ -3056,11 +3060,14 @@  discard block
 block discarded – undo
3056 3060
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3057 3061
         $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';";
3058 3062
         $res = Database::query($sql);
3059
-        if ($res === false)
3060
-            return false; //error during query
3063
+        if ($res === false) {
3064
+                    return false;
3065
+        }
3066
+        //error during query
3061 3067
         $num = Database::num_rows($res);
3062
-        if ($num == 0)
3063
-            return false;
3068
+        if ($num == 0) {
3069
+                    return false;
3070
+        }
3064 3071
         $list = array();
3065 3072
         while ($row = Database::fetch_array($res)) {
3066 3073
             $list[$row['id']] = $row['api_key'];
@@ -3075,13 +3082,15 @@  discard block
 block discarded – undo
3075 3082
      */
3076 3083
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
3077 3084
     {
3078
-        if ($user_id != strval(intval($user_id)))
3079
-            return false;
3085
+        if ($user_id != strval(intval($user_id))) {
3086
+                    return false;
3087
+        }
3080 3088
         if (empty($user_id)) {
3081 3089
             $user_id = api_get_user_id();
3082 3090
         }
3083
-        if ($user_id === false)
3084
-            return false;
3091
+        if ($user_id === false) {
3092
+                    return false;
3093
+        }
3085 3094
         $service_name = Database::escape_string($api_service);
3086 3095
         if (is_string($service_name) === false) {
3087 3096
             return false;
@@ -3090,8 +3099,10 @@  discard block
 block discarded – undo
3090 3099
         $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key
3091 3100
         $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')";
3092 3101
         $res = Database::query($sql);
3093
-        if ($res === false)
3094
-            return false; //error during query
3102
+        if ($res === false) {
3103
+                    return false;
3104
+        }
3105
+        //error during query
3095 3106
         $num = Database::insert_id();
3096 3107
         return ($num == 0) ? false : $num;
3097 3108
     }
@@ -3103,22 +3114,29 @@  discard block
 block discarded – undo
3103 3114
      */
3104 3115
     public static function delete_api_key($key_id)
3105 3116
     {
3106
-        if ($key_id != strval(intval($key_id)))
3107
-            return false;
3108
-        if ($key_id === false)
3109
-            return false;
3117
+        if ($key_id != strval(intval($key_id))) {
3118
+                    return false;
3119
+        }
3120
+        if ($key_id === false) {
3121
+                    return false;
3122
+        }
3110 3123
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3111 3124
         $sql = "SELECT * FROM $t_api WHERE id = ".$key_id;
3112 3125
         $res = Database::query($sql);
3113
-        if ($res === false)
3114
-            return false; //error during query
3126
+        if ($res === false) {
3127
+                    return false;
3128
+        }
3129
+        //error during query
3115 3130
         $num = Database::num_rows($res);
3116
-        if ($num !== 1)
3117
-            return false;
3131
+        if ($num !== 1) {
3132
+                    return false;
3133
+        }
3118 3134
         $sql = "DELETE FROM $t_api WHERE id = ".$key_id;
3119 3135
         $res = Database::query($sql);
3120
-        if ($res === false)
3121
-            return false; //error during query
3136
+        if ($res === false) {
3137
+                    return false;
3138
+        }
3139
+        //error during query
3122 3140
         return true;
3123 3141
     }
3124 3142
 
@@ -3130,10 +3148,12 @@  discard block
 block discarded – undo
3130 3148
      */
3131 3149
     public static function update_api_key($user_id, $api_service)
3132 3150
     {
3133
-        if ($user_id != strval(intval($user_id)))
3134
-            return false;
3135
-        if ($user_id === false)
3136
-            return false;
3151
+        if ($user_id != strval(intval($user_id))) {
3152
+                    return false;
3153
+        }
3154
+        if ($user_id === false) {
3155
+                    return false;
3156
+        }
3137 3157
         $service_name = Database::escape_string($api_service);
3138 3158
         if (is_string($service_name) === false) {
3139 3159
             return false;
@@ -3159,12 +3179,15 @@  discard block
 block discarded – undo
3159 3179
      */
3160 3180
     public static function get_api_key_id($user_id, $api_service)
3161 3181
     {
3162
-        if ($user_id != strval(intval($user_id)))
3163
-            return false;
3164
-        if ($user_id === false)
3165
-            return false;
3166
-        if (empty($api_service))
3167
-            return false;
3182
+        if ($user_id != strval(intval($user_id))) {
3183
+                    return false;
3184
+        }
3185
+        if ($user_id === false) {
3186
+                    return false;
3187
+        }
3188
+        if (empty($api_service)) {
3189
+                    return false;
3190
+        }
3168 3191
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3169 3192
         $api_service = Database::escape_string($api_service);
3170 3193
         $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'";
@@ -4666,8 +4689,9 @@  discard block
 block discarded – undo
4666 4689
                     $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
4667 4690
                     $form->applyFilter('extra_'.$field_details[1], 'trim');
4668 4691
                     if (!$admin_permissions) {
4669
-                        if ($field_details[7] == 0)
4670
-                            $form->freeze('extra_'.$field_details[1]);
4692
+                        if ($field_details[7] == 0) {
4693
+                                                    $form->freeze('extra_'.$field_details[1]);
4694
+                        }
4671 4695
                     }
4672 4696
                     break;
4673 4697
                 case ExtraField::FIELD_TYPE_RADIO:
@@ -4724,8 +4748,9 @@  discard block
 block discarded – undo
4724 4748
                     );
4725 4749
 
4726 4750
                     if (!$admin_permissions) {
4727
-                        if ($field_details[7] == 0)
4728
-                            $form->freeze('extra_'.$field_details[1]);
4751
+                        if ($field_details[7] == 0) {
4752
+                                                    $form->freeze('extra_'.$field_details[1]);
4753
+                        }
4729 4754
                     }
4730 4755
                     break;
4731 4756
                 case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
@@ -4741,8 +4766,9 @@  discard block
 block discarded – undo
4741 4766
                         array('multiple' => 'multiple')
4742 4767
                     );
4743 4768
                     if (!$admin_permissions) {
4744
-                        if ($field_details[7] == 0)
4745
-                            $form->freeze('extra_'.$field_details[1]);
4769
+                        if ($field_details[7] == 0) {
4770
+                                                    $form->freeze('extra_'.$field_details[1]);
4771
+                        }
4746 4772
                     }
4747 4773
                     break;
4748 4774
                 case ExtraField::FIELD_TYPE_DATE:
@@ -4750,8 +4776,9 @@  discard block
 block discarded – undo
4750 4776
                     $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
4751 4777
                     $form->setDefaults($defaults);
4752 4778
                     if (!$admin_permissions) {
4753
-                        if ($field_details[7] == 0)
4754
-                            $form->freeze('extra_'.$field_details[1]);
4779
+                        if ($field_details[7] == 0) {
4780
+                                                    $form->freeze('extra_'.$field_details[1]);
4781
+                        }
4755 4782
                     }
4756 4783
                     $form->applyFilter('theme', 'trim');
4757 4784
                     break;
@@ -4760,8 +4787,9 @@  discard block
 block discarded – undo
4760 4787
                     $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
4761 4788
                     $form->setDefaults($defaults);
4762 4789
                     if (!$admin_permissions) {
4763
-                        if ($field_details[7] == 0)
4764
-                            $form->freeze('extra_'.$field_details[1]);
4790
+                        if ($field_details[7] == 0) {
4791
+                                                    $form->freeze('extra_'.$field_details[1]);
4792
+                        }
4765 4793
                     }
4766 4794
                     $form->applyFilter('theme', 'trim');
4767 4795
                     break;
@@ -4780,8 +4808,9 @@  discard block
 block discarded – undo
4780 4808
                     $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3]);
4781 4809
 
4782 4810
                     if (!$admin_permissions) {
4783
-                        if ($field_details[7] == 0)
4784
-                            $form->freeze('extra_'.$field_details[1]);
4811
+                        if ($field_details[7] == 0) {
4812
+                                                    $form->freeze('extra_'.$field_details[1]);
4813
+                        }
4785 4814
                     }
4786 4815
 
4787 4816
                     /* Recoding the selected values for double : if the user has
@@ -4841,8 +4870,9 @@  discard block
 block discarded – undo
4841 4870
                     break;
4842 4871
                 case ExtraField::FIELD_TYPE_TIMEZONE:
4843 4872
                     $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), '');
4844
-                    if ($field_details[7] == 0)
4845
-                        $form->freeze('extra_'.$field_details[1]);
4873
+                    if ($field_details[7] == 0) {
4874
+                                            $form->freeze('extra_'.$field_details[1]);
4875
+                    }
4846 4876
                     break;
4847 4877
                 case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
4848 4878
                     // get the social network's favicon
@@ -4867,8 +4897,9 @@  discard block
 block discarded – undo
4867 4897
                     );
4868 4898
                     $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
4869 4899
                     $form->applyFilter('extra_'.$field_details[1], 'trim');
4870
-                    if ($field_details[7] == 0)
4871
-                        $form->freeze('extra_'.$field_details[1]);
4900
+                    if ($field_details[7] == 0) {
4901
+                                            $form->freeze('extra_'.$field_details[1]);
4902
+                    }
4872 4903
                     break;
4873 4904
                 case ExtraField::FIELD_TYPE_FILE:
4874 4905
                     $extra_field = 'extra_'.$field_details[1];
@@ -5277,8 +5308,9 @@  discard block
 block discarded – undo
5277 5308
         $url .= "?s=$s&d=$d&r=$r";
5278 5309
         if ( $img ) {
5279 5310
             $url = '<img src="' . $url . '"';
5280
-            foreach ( $atts as $key => $val )
5281
-                $url .= ' ' . $key . '="' . $val . '"';
5311
+            foreach ( $atts as $key => $val ) {
5312
+                            $url .= ' ' . $key . '="' . $val . '"';
5313
+            }
5282 5314
             $url .= ' />';
5283 5315
         }
5284 5316
         return $url;
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     const USER_FIELD_TYPE_TIMEZONE = 11;
35 35
     const USER_FIELD_TYPE_SOCIAL_PROFILE = 12;
36 36
     const USER_FIELD_TYPE_FILE = 13;
37
-    const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER  = 14;
37
+    const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14;
38 38
 
39 39
     private static $encryptionMethod;
40 40
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
         $res = Database::query($sql);
541 541
         while ($course = Database::fetch_object($res)) {
542 542
             $sql = "SELECT id FROM $table_course_user
543
-                    WHERE status=1 AND c_id = " . intval($course->c_id);
543
+                    WHERE status=1 AND c_id = ".intval($course->c_id);
544 544
             $res2 = Database::query($sql);
545 545
             if (Database::num_rows($res2) == 1) {
546 546
 
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
             // into ASCII letters in order they not to be totally removed.
1245 1245
             // 2. Applying the strict purifier.
1246 1246
             // 3. Length limitation.
1247
-            $return  = api_get_setting('login_is_email') === 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH);
1247
+            $return = api_get_setting('login_is_email') === 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH);
1248 1248
             $return = URLify::transliterate($return);
1249 1249
 
1250 1250
             return $return;
@@ -1338,12 +1338,12 @@  discard block
 block discarded – undo
1338 1338
 
1339 1339
         if (!is_null($order)) {
1340 1340
             $order = Database::escape_string($order);
1341
-            $sql .= ' ORDER BY ' . $order;
1341
+            $sql .= ' ORDER BY '.$order;
1342 1342
         }
1343 1343
 
1344 1344
         if (!is_null($limit)) {
1345 1345
             $limit = Database::escape_string($limit);
1346
-            $sql .= ' LIMIT ' . $limit;
1346
+            $sql .= ' LIMIT '.$limit;
1347 1347
         }
1348 1348
 
1349 1349
         $rs = Database::query($sql);
@@ -1437,11 +1437,11 @@  discard block
 block discarded – undo
1437 1437
             }
1438 1438
 
1439 1439
             if (api_is_multiple_url_enabled()) {
1440
-                $sql_query .= ' AND auru.access_url_id = ' . api_get_current_access_url_id();
1440
+                $sql_query .= ' AND auru.access_url_id = '.api_get_current_access_url_id();
1441 1441
             }
1442 1442
         } else {
1443 1443
             if (api_is_multiple_url_enabled()) {
1444
-                $sql_query .= ' WHERE auru.access_url_id = ' . api_get_current_access_url_id();
1444
+                $sql_query .= ' WHERE auru.access_url_id = '.api_get_current_access_url_id();
1445 1445
             }
1446 1446
         }
1447 1447
         if (count($order_by) > 0) {
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
             // directory might not have been created. Make sure it is before
1551 1551
             // going further.
1552 1552
 
1553
-            $rootPath = api_get_path(SYS_UPLOAD_PATH) . 'users/' . substr((string) $id, 0, 1);
1553
+            $rootPath = api_get_path(SYS_UPLOAD_PATH).'users/'.substr((string) $id, 0, 1);
1554 1554
             if (!is_dir($rootPath)) {
1555 1555
                 $perm = api_get_permissions_for_new_directories();
1556 1556
                 try {
@@ -1806,7 +1806,7 @@  discard block
 block discarded – undo
1806 1806
         $path_info = self::get_user_picture_path_by_id($user_id, 'system');
1807 1807
         $path = $path_info['dir'];
1808 1808
         if (!empty($extra_field)) {
1809
-            $path .= $extra_field . '/';
1809
+            $path .= $extra_field.'/';
1810 1810
         }
1811 1811
         // If this directory does not exist - we create it.
1812 1812
         if (!file_exists($path)) {
@@ -2070,10 +2070,10 @@  discard block
 block discarded – undo
2070 2070
         if (count($extra_files) > 0) {
2071 2071
             $extra_file_list = '<div class="files-production"><ul id="productions">';
2072 2072
             foreach ($extra_files as $file) {
2073
-                $filename = substr($file,strlen($extra_field)+1);
2073
+                $filename = substr($file, strlen($extra_field) + 1);
2074 2074
                 $extra_file_list .= '<li>'.Display::return_icon('archive.png').'<a href="'.$path.$extra_field.'/'.urlencode($filename).'" target="_blank">'.htmlentities($filename).'</a> ';
2075 2075
                 if ($showDelete) {
2076
-                    $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_' . $extra_field . '['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>';
2076
+                    $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_'.$extra_field.'['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>';
2077 2077
                 }
2078 2078
             }
2079 2079
             $extra_file_list .= '</ul></div>';
@@ -2715,7 +2715,7 @@  discard block
 block discarded – undo
2715 2715
 
2716 2716
         if (api_is_allowed_to_create_course()) {
2717 2717
             $sessionListFromCourseCoach = array();
2718
-            $sql =" SELECT DISTINCT session_id
2718
+            $sql = " SELECT DISTINCT session_id
2719 2719
                     FROM $tbl_session_course_user
2720 2720
                     WHERE user_id = $user_id AND status = 2 ";
2721 2721
 
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
             if (Database::num_rows($result)) {
2724 2724
                 $result = Database::store_result($result);
2725 2725
                 foreach ($result as $session) {
2726
-                    $sessionListFromCourseCoach[]= $session['session_id'];
2726
+                    $sessionListFromCourseCoach[] = $session['session_id'];
2727 2727
                 }
2728 2728
             }
2729 2729
             if (!empty($sessionListFromCourseCoach)) {
@@ -2755,7 +2755,7 @@  discard block
 block discarded – undo
2755 2755
         ";
2756 2756
 
2757 2757
         $result = Database::query($sql);
2758
-        if (Database::num_rows($result)>0) {
2758
+        if (Database::num_rows($result) > 0) {
2759 2759
             while ($row = Database::fetch_assoc($result)) {
2760 2760
                 $sessions[$row['id']] = $row;
2761 2761
             }
@@ -2771,7 +2771,7 @@  discard block
 block discarded – undo
2771 2771
                 ORDER BY access_start_date, access_end_date, name";
2772 2772
 
2773 2773
         $result = Database::query($sql);
2774
-        if (Database::num_rows($result)>0) {
2774
+        if (Database::num_rows($result) > 0) {
2775 2775
             while ($row = Database::fetch_assoc($result)) {
2776 2776
                 if (empty($sessions[$row['id']])) {
2777 2777
                     $sessions[$row['id']] = $row;
@@ -3775,13 +3775,13 @@  discard block
 block discarded – undo
3775 3775
         $useExtraFields = false;
3776 3776
         $extraFields = UserManager::get_extra_filtrable_fields();
3777 3777
         $extraFieldResult = array();
3778
-        if (is_array($extraFields) && count($extraFields)>0 ) {
3778
+        if (is_array($extraFields) && count($extraFields) > 0) {
3779 3779
             foreach ($extraFields as $extraField) {
3780 3780
                 $varName = 'field_'.$extraField['variable'];
3781 3781
                 if (UserManager::is_extra_field_available($extraField['variable'])) {
3782
-                    if (isset($_GET[$varName]) && $_GET[$varName]!='0') {
3782
+                    if (isset($_GET[$varName]) && $_GET[$varName] != '0') {
3783 3783
                         $useExtraFields = true;
3784
-                        $extraFieldResult[]= UserManager::get_extra_user_data_by_value(
3784
+                        $extraFieldResult[] = UserManager::get_extra_user_data_by_value(
3785 3785
                             $extraField['variable'],
3786 3786
                             $_GET[$varName]
3787 3787
                         );
@@ -3792,17 +3792,17 @@  discard block
 block discarded – undo
3792 3792
 
3793 3793
         if ($useExtraFields) {
3794 3794
             $finalResult = array();
3795
-            if (count($extraFieldResult)>1) {
3796
-                for ($i=0; $i < count($extraFieldResult) -1; $i++) {
3797
-                if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i+1])) {
3798
-                        $finalResult  = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]);
3795
+            if (count($extraFieldResult) > 1) {
3796
+                for ($i = 0; $i < count($extraFieldResult) - 1; $i++) {
3797
+                if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i + 1])) {
3798
+                        $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i + 1]);
3799 3799
                     }
3800 3800
                 }
3801 3801
             } else {
3802 3802
                 $finalResult = $extraFieldResult[0];
3803 3803
             }
3804 3804
 
3805
-            if (is_array($finalResult) && count($finalResult)>0) {
3805
+            if (is_array($finalResult) && count($finalResult) > 0) {
3806 3806
                 $whereFilter = " AND u.id IN  ('".implode("','", $finalResult)."') ";
3807 3807
             } else {
3808 3808
                 //no results
@@ -3979,7 +3979,7 @@  discard block
 block discarded – undo
3979 3979
             $sql = 'DELETE FROM '.$tbl_my_friend.'
3980 3980
                     WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND friend_user_id='.$friend_id.' '.$extra_condition;
3981 3981
             Database::query($sql);
3982
-            $sql= 'DELETE FROM '.$tbl_my_friend.'
3982
+            $sql = 'DELETE FROM '.$tbl_my_friend.'
3983 3983
                    WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND user_id='.$friend_id.' '.$extra_condition;
3984 3984
             Database::query($sql);
3985 3985
         } else {
@@ -4180,7 +4180,7 @@  discard block
 block discarded – undo
4180 4180
 
4181 4181
         if (!empty($lastConnectionDate)) {
4182 4182
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
4183
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
4183
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
4184 4184
         }
4185 4185
 
4186 4186
         $courseConditions = null;
@@ -4248,7 +4248,7 @@  discard block
 block discarded – undo
4248 4248
                 ;
4249 4249
                 break;
4250 4250
             case STUDENT_BOSS:
4251
-                $drhConditions = " AND friend_user_id = $userId AND relation_type = " . USER_RELATION_TYPE_BOSS;
4251
+                $drhConditions = " AND friend_user_id = $userId AND relation_type = ".USER_RELATION_TYPE_BOSS;
4252 4252
                 break;
4253 4253
         }
4254 4254
 
@@ -4343,7 +4343,7 @@  discard block
 block discarded – undo
4343 4343
                     WHERE 
4344 4344
                         friend_user_id = $userId AND 
4345 4345
                         relation_type = $relationType AND 
4346
-                        access_url_id = " . api_get_current_access_url_id();
4346
+                        access_url_id = ".api_get_current_access_url_id();
4347 4347
         } else {
4348 4348
             $sql = "SELECT user_id FROM $userRelUserTable 
4349 4349
                     WHERE friend_user_id = $userId 
@@ -4628,7 +4628,7 @@  discard block
 block discarded – undo
4628 4628
         if (empty($years)) {
4629 4629
             $years = 1;
4630 4630
         }
4631
-        $inactive_time = $years * 31536000;  //1 year
4631
+        $inactive_time = $years * 31536000; //1 year
4632 4632
         $rs = Database::query($sql);
4633 4633
         if (Database::num_rows($rs) > 0) {
4634 4634
             if ($last_login_date = Database::result($rs, 0, 0)) {
@@ -4762,7 +4762,7 @@  discard block
 block discarded – undo
4762 4762
                         'extra_'.$field_details[1],
4763 4763
                         $field_details[3],
4764 4764
                         $options,
4765
-                        array('id' => 'extra_' . $field_details[1])
4765
+                        array('id' => 'extra_'.$field_details[1])
4766 4766
                     );
4767 4767
 
4768 4768
                     if (!$admin_permissions) {
@@ -4916,7 +4916,7 @@  discard block
 block discarded – undo
4916 4916
                     $extra_field = 'extra_'.$field_details[1];
4917 4917
                     $form->addElement('file', $extra_field, $field_details[3], null, '');
4918 4918
                     if ($extra_file_list = UserManager::build_user_extra_file_list($user_id, $field_details[1], '', true)) {
4919
-                        $form->addElement('static', $extra_field . '_list', null, $extra_file_list);
4919
+                        $form->addElement('static', $extra_field.'_list', null, $extra_file_list);
4920 4920
                     }
4921 4921
                     if ($field_details[7] == 0) {
4922 4922
                         $form->freeze($extra_field);
@@ -5088,7 +5088,7 @@  discard block
 block discarded – undo
5088 5088
         $direction = null,
5089 5089
         $active = null,
5090 5090
         $lastConnectionDate = null
5091
-    ){
5091
+    ) {
5092 5092
         return self::getUsersFollowedByUser(
5093 5093
             $userId,
5094 5094
             $userStatus,
@@ -5315,12 +5315,12 @@  discard block
 block discarded – undo
5315 5315
         if (!empty($_SERVER['HTTPS'])) {
5316 5316
             $url = 'https://secure.gravatar.com/avatar/';
5317 5317
         }
5318
-        $url .= md5( strtolower( trim( $email ) ) );
5318
+        $url .= md5(strtolower(trim($email)));
5319 5319
         $url .= "?s=$s&d=$d&r=$r";
5320
-        if ( $img ) {
5321
-            $url = '<img src="' . $url . '"';
5322
-            foreach ( $atts as $key => $val )
5323
-                $url .= ' ' . $key . '="' . $val . '"';
5320
+        if ($img) {
5321
+            $url = '<img src="'.$url.'"';
5322
+            foreach ($atts as $key => $val)
5323
+                $url .= ' '.$key.'="'.$val.'"';
5324 5324
             $url .= ' />';
5325 5325
         }
5326 5326
         return $url;
Please login to merge, or discard this patch.
Doc Comments   +22 added lines, -16 removed lines patch added patch discarded remove patch
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * Validates the password
132 132
      *
133
-     * @param $encoded
134
-     * @param $raw
135
-     * @param $salt
133
+     * @param string $encoded
134
+     * @param string $raw
135
+     * @param string $salt
136 136
      * @return bool
137 137
      */
138 138
     public static function isPasswordValid($encoded, $raw, $salt)
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @param string $raw
148 148
      * @param User   $user
149 149
      *
150
-     * @return bool
150
+     * @return string
151 151
      */
152 152
     public static function encryptPassword($raw, User $user)
153 153
     {
@@ -1094,6 +1094,7 @@  discard block
 block discarded – undo
1094 1094
     /**
1095 1095
      * Disables a user
1096 1096
      * @param int User id
1097
+     * @param integer $user_id
1097 1098
      * @return bool
1098 1099
      * @uses UserManager::change_active_state() to actually disable the user
1099 1100
      * @assert (0) === false
@@ -1110,6 +1111,7 @@  discard block
 block discarded – undo
1110 1111
     /**
1111 1112
      * Enable a user
1112 1113
      * @param int User id
1114
+     * @param integer $user_id
1113 1115
      * @return bool
1114 1116
      * @uses UserManager::change_active_state() to actually disable the user
1115 1117
      * @assert (0) === false
@@ -1276,6 +1278,7 @@  discard block
 block discarded – undo
1276 1278
      * Checks whether the user id exists in the database
1277 1279
      *
1278 1280
      * @param int User id
1281
+     * @param integer $userId
1279 1282
      * @return bool True if user id was found, false otherwise
1280 1283
      */
1281 1284
     public static function is_user_id_valid($userId)
@@ -1417,7 +1420,7 @@  discard block
 block discarded – undo
1417 1420
     /**
1418 1421
      * Get a list of users of which the given conditions match with a LIKE '%cond%'
1419 1422
      * @param array $conditions a list of condition (exemple : status=>STUDENT)
1420
-     * @param array $order_by a list of fields on which sort
1423
+     * @param string[] $order_by a list of fields on which sort
1421 1424
      * @return array An array with all users of the platform.
1422 1425
      * @todo optional course code parameter, optional sorting parameters...
1423 1426
      * @todo security filter order_by
@@ -1488,7 +1491,7 @@  discard block
 block discarded – undo
1488 1491
      * @param   array $userInfo user information to avoid query the DB
1489 1492
      * returns the /main/img/unknown.jpg image set it at true
1490 1493
      *
1491
-     * @return    array     Array of 2 elements: 'dir' and 'file' which contain
1494
+     * @return    integer     Array of 2 elements: 'dir' and 'file' which contain
1492 1495
      * the dir and file as the name implies if image does not exist it will
1493 1496
      * return the unknow image if anonymous parameter is true if not it returns an empty array
1494 1497
      */
@@ -1980,7 +1983,7 @@  discard block
 block discarded – undo
1980 1983
     /**
1981 1984
      * Returns an array with the user's productions.
1982 1985
      *
1983
-     * @param    $user_id    User id
1986
+     * @param    integer $user_id    User id
1984 1987
      * @return   array  An array containing the user's productions
1985 1988
      */
1986 1989
     public static function get_user_productions($user_id)
@@ -2135,7 +2138,7 @@  discard block
 block discarded – undo
2135 2138
 
2136 2139
     /**
2137 2140
      * Build a list of extra file already uploaded in $user_folder/{$extra_field}/
2138
-     * @param $user_id
2141
+     * @param integer $user_id
2139 2142
      * @param $extra_field
2140 2143
      * @param bool $force
2141 2144
      * @param bool $showDelete
@@ -2240,7 +2243,7 @@  discard block
 block discarded – undo
2240 2243
      * @param    int       $fieldType  Field's type
2241 2244
      * @param    string    $displayText Field's language var name
2242 2245
      * @param    string    $default Field's default value
2243
-     * @return int
2246
+     * @return boolean
2244 2247
      */
2245 2248
     public static function create_extra_field($variable, $fieldType, $displayText, $default)
2246 2249
     {
@@ -2274,6 +2277,7 @@  discard block
 block discarded – undo
2274 2277
      * @param    boolean    Whether to prefix the fields indexes with "extra_" (might be used by formvalidator)
2275 2278
      * @param    boolean    Whether to return invisible fields as well
2276 2279
      * @param    boolean    Whether to split multiple-selection fields or not
2280
+     * @param boolean $field_filter
2277 2281
      * @return    array    Array of fields => value for the given user
2278 2282
      */
2279 2283
     public static function get_extra_user_data(
@@ -3121,7 +3125,7 @@  discard block
 block discarded – undo
3121 3125
      * @param    string  $user_id   User ID
3122 3126
      * @param   string  $course course directory
3123 3127
      * @param   string  $resourcetype resourcetype: images, all
3124
-     * @return    int        User ID (or false if not found)
3128
+     * @return    string        User ID (or false if not found)
3125 3129
      */
3126 3130
     public static function get_user_upload_files_by_course($user_id, $course, $resourcetype = 'all')
3127 3131
     {
@@ -3205,7 +3209,7 @@  discard block
 block discarded – undo
3205 3209
     /**
3206 3210
      * Adds a new API key to the users' account
3207 3211
      * @param   int     Optional user ID (defaults to the results of api_get_user_id())
3208
-     * @return  boolean True on success, false on failure
3212
+     * @return  false|string True on success, false on failure
3209 3213
      */
3210 3214
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
3211 3215
     {
@@ -3260,6 +3264,7 @@  discard block
 block discarded – undo
3260 3264
      * Regenerate an API key from the user's account
3261 3265
      * @param   int     user ID (defaults to the results of api_get_user_id())
3262 3266
      * @param   string  API key's internal ID
3267
+     * @param string $api_service
3263 3268
      * @return  int        num
3264 3269
      */
3265 3270
     public static function update_api_key($user_id, $api_service)
@@ -3289,6 +3294,7 @@  discard block
 block discarded – undo
3289 3294
     /**
3290 3295
      * @param   int     user ID (defaults to the results of api_get_user_id())
3291 3296
      * @param   string    API key's internal ID
3297
+     * @param string $api_service
3292 3298
      * @return  int    row ID, or return false if not found
3293 3299
      */
3294 3300
     public static function get_api_key_id($user_id, $api_service)
@@ -3504,7 +3510,7 @@  discard block
 block discarded – undo
3504 3510
      * @param int $field_id
3505 3511
      * @param bool $show_links show links or not
3506 3512
      *
3507
-     * @return array
3513
+     * @return string
3508 3514
      */
3509 3515
     public static function get_user_tags_to_string($user_id, $field_id, $show_links = true)
3510 3516
     {
@@ -3601,7 +3607,7 @@  discard block
 block discarded – undo
3601 3607
      * @param mixed $tag
3602 3608
      * @param int $user_id
3603 3609
      * @param int $field_id field id of the tag
3604
-     * @return bool
3610
+     * @return boolean|null
3605 3611
      */
3606 3612
     public static function add_tag($tag, $user_id, $field_id)
3607 3613
     {
@@ -5047,7 +5053,7 @@  discard block
 block discarded – undo
5047 5053
     }
5048 5054
 
5049 5055
     /**
5050
-     * @return array
5056
+     * @return string[]
5051 5057
      */
5052 5058
     public static function get_user_field_types()
5053 5059
     {
@@ -5339,7 +5345,7 @@  discard block
 block discarded – undo
5339 5345
 
5340 5346
     /**
5341 5347
      * Get the boss user ID from a followed user id
5342
-     * @param $userId
5348
+     * @param integer $userId
5343 5349
      * @return bool
5344 5350
      */
5345 5351
     public static function getStudentBossList($userId)
@@ -5391,7 +5397,7 @@  discard block
 block discarded – undo
5391 5397
      * Get either a Gravatar URL or complete image tag for a specified email address.
5392 5398
      *
5393 5399
      * @param string $email The email address
5394
-     * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]
5400
+     * @param integer $s Size in pixels, defaults to 80px [ 1 - 2048 ]
5395 5401
      * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
5396 5402
      * @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
5397 5403
      * @param boole $img True to return a complete IMG tag False for just the URL
Please login to merge, or discard this patch.
main/mySpace/works_in_session_report.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     foreach ($sessionCourses as $sessionCourse) {
47 47
         $course = $sessionCourse->getCourse();
48
-        $coursesInfo[$course->getId()] =  $course->getCode();
48
+        $coursesInfo[$course->getId()] = $course->getCode();
49 49
         $criteria = Criteria::create()->where(
50 50
             Criteria::expr()->eq("status", Session::STUDENT)
51 51
         );
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
                 ];
69 69
             }
70 70
 
71
-            $usersInfo[$user->getId()][$course->getId() . '_score'] = null;
72
-            $usersInfo[$user->getId()][$course->getId() . '_progress'] = null;
73
-            $usersInfo[$user->getId()][$course->getId() . '_last_sent_date'] = null;
71
+            $usersInfo[$user->getId()][$course->getId().'_score'] = null;
72
+            $usersInfo[$user->getId()][$course->getId().'_progress'] = null;
73
+            $usersInfo[$user->getId()][$course->getId().'_last_sent_date'] = null;
74 74
 
75 75
             if (!$session->hasStudentInCourse($user, $course)) {
76 76
                 continue;
77 77
             }
78 78
 
79
-            $usersInfo[$user->getId()][$course->getId() . '_score'] = Tracking::get_avg_student_score(
79
+            $usersInfo[$user->getId()][$course->getId().'_score'] = Tracking::get_avg_student_score(
80 80
                 $user->getId(),
81 81
                 $course->getCode(),
82 82
                 null,
83 83
                 $session->getId()
84 84
             );
85
-            $usersInfo[$user->getId()][$course->getId() . '_progress'] = Tracking::get_avg_student_progress(
85
+            $usersInfo[$user->getId()][$course->getId().'_progress'] = Tracking::get_avg_student_progress(
86 86
                 $user->getId(),
87 87
                 $course->getCode(),
88 88
                 null,
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 continue;
96 96
             }
97 97
 
98
-            $usersInfo[$user->getId()][$course->getId() . '_last_sent_date'] = api_format_date(
98
+            $usersInfo[$user->getId()][$course->getId().'_last_sent_date'] = api_format_date(
99 99
                 $lastPublication->getSentDate()->getTimestamp(),
100 100
                 DATE_TIME_FORMAT_SHORT
101 101
             );
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $dataToExport = [
108 108
         [$toolName]
109 109
     ];
110
-    $fileName = 'works_in_session_' . api_get_local_time();
110
+    $fileName = 'works_in_session_'.api_get_local_time();
111 111
 
112 112
     $dataToExport['headers'][] = get_lang('OfficialCode');
113 113
     $dataToExport['headers'][] = get_lang('StudentName');
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 }
139 139
 
140 140
 $interbreadcrumb[] = [
141
-    'url' => api_get_path(WEB_CODE_PATH) . 'mySpace/index.php',
141
+    'url' => api_get_path(WEB_CODE_PATH).'mySpace/index.php',
142 142
     'name' => get_lang('MySpace')
143 143
 ];
144 144
 
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
     $actions = [
149 149
         Display::url(
150 150
             Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM),
151
-            api_get_self() . '?' . http_build_query(['export' => 'csv', 'session' => $session->getId()])
151
+            api_get_self().'?'.http_build_query(['export' => 'csv', 'session' => $session->getId()])
152 152
         ),
153 153
         Display::url(
154 154
             Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM),
155
-            api_get_self() . '?' . http_build_query(['export' => 'xls', 'session' => $session->getId()])
155
+            api_get_self().'?'.http_build_query(['export' => 'xls', 'session' => $session->getId()])
156 156
         )
157 157
     ];
158 158
 }
Please login to merge, or discard this patch.
main/tracking/userLog.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php';
30 30
 
31 31
 if (isset($uInfo)) {
32
-    $interbreadcrumb[]= array(
32
+    $interbreadcrumb[] = array(
33 33
         'url'=>'../user/userInfo.php?uInfo='.Security::remove_XSS($uInfo), 
34 34
         "name"=> api_ucfirst(get_lang('Users'))
35 35
     );
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 /*]]>*/
51 51
 </style>";
52 52
 
53
-Display::display_header($nameTools,"Tracking");
53
+Display::display_header($nameTools, "Tracking");
54 54
 
55 55
 /*	Constants and variables */
56 56
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $courseId);
59 59
 
60 60
 // Database Table Definitions
61
-$TABLECOURSUSER	        	= Database::get_main_table(TABLE_MAIN_COURSE_USER);
62
-$TABLEUSER	        		= Database::get_main_table(TABLE_MAIN_USER);
63
-$tbl_session_course_user 	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
64
-$tbl_session 				= Database::get_main_table(TABLE_MAIN_SESSION);
65
-$TABLECOURSE_GROUPSUSER 	= Database::get_course_table(TABLE_GROUP_USER);
61
+$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
62
+$TABLEUSER = Database::get_main_table(TABLE_MAIN_USER);
63
+$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
64
+$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
65
+$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
66 66
 $now = api_get_utc_datetime();
67 67
 
68 68
 $sql = "SELECT 1
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
             OR (access_start_date='0000-00-00' AND access_end_date='0000-00-00'))
75 75
         WHERE session_id='".api_get_session_id()."' AND c_id = $courseId";
76 76
 //echo $sql;
77
-$result=Database::query($sql);
78
-if(!Database::num_rows($result)){
77
+$result = Database::query($sql);
78
+if (!Database::num_rows($result)) {
79 79
     $disabled = true;
80 80
 }
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 $tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW);
85 85
 $tbl_learnpath_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
86 86
 
87
-$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
87
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
88 88
 
89 89
 // The variables for the days and the months
90 90
 $DaysShort = api_get_week_days_short();
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 <table width="100%" cellpadding="2" cellspacing="3" border="0">
110 110
 <?php
111 111
 // check if uid is tutor of this group
112
-if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
112
+if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
113 113
     if (!$uInfo && !isset($uInfo)) {
114 114
         /*
115 115
         *		Display list of user of this group
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $step = 25; // number of student per page
134 134
         if ($userGroupNb > $step) {
135 135
             if (!isset($offset)) {
136
-                    $offset=0;
136
+                    $offset = 0;
137 137
             }
138 138
 
139 139
             $next     = $offset + $step;
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
         $list_users = getManyResults3Col($sql);
187 187
         echo "<table width='100%' cellpadding='2' cellspacing='1' border='0'>\n"
188 188
                     ."<tr align='center' valign='top' bgcolor='#E6E6E6'>\n"
189
-                    ."<td align='left'>",get_lang('UserName'),"</td>\n"
189
+                    ."<td align='left'>", get_lang('UserName'), "</td>\n"
190 190
                     ."</tr>\n";
191 191
         for ($i = 0; $i < sizeof($list_users); $i++) {
192 192
             echo    "<tr valign='top' align='center'>\n"
193 193
                     ."<td align='left'>"
194
-                    ."<a href='".api_get_self()."?uInfo=",$list_users[$i][0],"'>"
195
-                    .$list_users[$i][1]," ",$list_users[$i][2]
194
+                    ."<a href='".api_get_self()."?uInfo=", $list_users[$i][0], "'>"
195
+                    .$list_users[$i][1], " ", $list_users[$i][2]
196 196
                     ."</a>".
197 197
                     "</td>\n";
198 198
         }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             ";
250 250
 
251 251
             if (!isset($view)) {
252
-                $view ='0000000';
252
+                $view = '0000000';
253 253
             }
254 254
             //Logins
255 255
             TrackingUserLog::display_login_tracking_info($view, $uInfo, $courseId);
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
                 </tr>";
282 282
 
283 283
             $sql = "SELECT id, name FROM $tbl_learnpath_main";
284
-            $result=Database::query($sql);
285
-            $ar=Database::fetch_array($result);
284
+            $result = Database::query($sql);
285
+            $ar = Database::fetch_array($result);
286 286
 
287 287
             echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
288 288
             echo "<table cellpadding='2' cellspacing='1' border='0' align='center'><tr>
@@ -299,14 +299,14 @@  discard block
 block discarded – undo
299 299
                     if ($ar['id'] == $scormcontopen) {
300 300
                         //have to list the students here
301 301
                         $contentId = intval($ar['id']);
302
-                        $sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time " .
303
-                                "FROM $tbl_learnpath_item i " .
304
-                                "INNER JOIN $tbl_learnpath_item_view iv ON i.id=iv.lp_item_id " .
305
-                                "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id=v.id " .
302
+                        $sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time ".
303
+                                "FROM $tbl_learnpath_item i ".
304
+                                "INNER JOIN $tbl_learnpath_item_view iv ON i.id=iv.lp_item_id ".
305
+                                "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id=v.id ".
306 306
                                 "WHERE (v.user_id=".intval($uInfo)." and v.lp_id=$contentId)
307 307
                                 ORDER BY v.id, i.id";
308
-                        $result3=Database::query($sql3);
309
-                        $ar3=Database::fetch_array($result3);
308
+                        $result3 = Database::query($sql3);
309
+                        $ar3 = Database::fetch_array($result3);
310 310
                         if (is_array($ar3)) {
311 311
                             echo "<tr><td>&nbsp;&nbsp;&nbsp;</td>
312 312
                                    <td class='secLine'>
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
                                 echo "<tr><td>&nbsp;&nbsp;&nbsp;</td><td>";
329 329
                                 echo "$title</td><td align=right>{$ar3['status']}</td><td align=right>{$ar3['score']}</td><td align=right>$time</td>";
330 330
                                 echo "</tr>";
331
-                                $ar3=Database::fetch_array($result3);
331
+                                $ar3 = Database::fetch_array($result3);
332 332
                             }
333 333
                         } else {
334 334
                             echo "<tr>";
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                     $ar = Database::fetch_array($result);
340 340
                 }
341 341
             } else {
342
-                $noscorm=true;
342
+                $noscorm = true;
343 343
             }
344 344
 
345 345
             if ($noscorm) {
Please login to merge, or discard this patch.
main/auth/openid/login.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     // Now that there is an association created, move on
65 65
     // to request authentication from the IdP
66 66
     $identity = (!empty($services[0]['delegate'])) ? $services[0]['delegate'] : $claimed_id;
67
-    if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0 . '/server', $services[0]['types'])) {
67
+    if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0.'/server', $services[0]['types'])) {
68 68
         $identity = 'http://openid.net/identifier_select/2.0';
69 69
     }
70 70
     $authn_request = openid_authentication_request($claimed_id, $identity, $return_to, $assoc_handle, $services[0]['version']);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
     $xrds_url = $claimed_id;
121 121
     if (_openid_is_xri($claimed_id)) {
122
-        $xrds_url = 'http://xri.net/' . $claimed_id;
122
+        $xrds_url = 'http://xri.net/'.$claimed_id;
123 123
     }
124 124
     $url = @parse_url($xrds_url);
125 125
     if ($url['scheme'] == 'http' || $url['scheme'] == 'https') {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     //@todo Remove Old Associations:
183 183
     $openid_association = Database::get_main_table(TABLE_MAIN_OPENID_ASSOCIATION);
184 184
     $sql = "DELETE FROM $openid_association
185
-            WHERE created + expires_in < '" . api_get_utc_datetime() . "'";
185
+            WHERE created + expires_in < '".api_get_utc_datetime()."'";
186 186
     Database::query($sql);
187 187
 
188 188
     // Check to see if we have an association for this IdP already
@@ -339,17 +339,17 @@  discard block
 block discarded – undo
339 339
     switch ($uri['scheme']) {
340 340
         case 'http':
341 341
             $port = isset($uri['port']) ? $uri['port'] : 80;
342
-            $host = $uri['host'] . ($port != 80 ? ':' . $port : '');
342
+            $host = $uri['host'].($port != 80 ? ':'.$port : '');
343 343
             $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
344 344
             break;
345 345
         case 'https':
346 346
             // Note: Only works for PHP 4.3 compiled with OpenSSL.
347 347
             $port = isset($uri['port']) ? $uri['port'] : 443;
348
-            $host = $uri['host'] . ($port != 443 ? ':' . $port : '');
349
-            $fp = @fsockopen('ssl://' . $uri['host'], $port, $errno, $errstr, 20);
348
+            $host = $uri['host'].($port != 443 ? ':'.$port : '');
349
+            $fp = @fsockopen('ssl://'.$uri['host'], $port, $errno, $errstr, 20);
350 350
             break;
351 351
         default:
352
-            $result->error = 'invalid schema ' . $uri['scheme'];
352
+            $result->error = 'invalid schema '.$uri['scheme'];
353 353
             return $result;
354 354
     }
355 355
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     // Construct the path to act on.
366 366
     $path = isset($uri['path']) ? $uri['path'] : '/';
367 367
     if (isset($uri['query'])) {
368
-        $path .= '?' . $uri['query'];
368
+        $path .= '?'.$uri['query'];
369 369
     }
370 370
 
371 371
     // Create HTTP request.
@@ -375,23 +375,23 @@  discard block
 block discarded – undo
375 375
         // host that do not take into account the port number.
376 376
         'Host' => "Host: $host",
377 377
         'User-Agent' => 'User-Agent: Chamilo (+http://www.chamilo.org/)',
378
-        'Content-Length' => 'Content-Length: ' . strlen($data)
378
+        'Content-Length' => 'Content-Length: '.strlen($data)
379 379
     );
380 380
 
381 381
     // If the server url has a user then attempt to use basic authentication
382 382
     if (isset($uri['user'])) {
383
-        $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));
383
+        $defaults['Authorization'] = 'Authorization: Basic '.base64_encode($uri['user'].(!empty($uri['pass']) ? ":".$uri['pass'] : ''));
384 384
     }
385 385
 
386 386
     foreach ($headers as $header => $value) {
387
-        $defaults[$header] = $header . ': ' . $value;
387
+        $defaults[$header] = $header.': '.$value;
388 388
     }
389 389
 
390
-    $request = $method . ' ' . $path . " HTTP/1.0\r\n";
390
+    $request = $method.' '.$path." HTTP/1.0\r\n";
391 391
     $request .= implode("\r\n", $defaults);
392 392
     $request .= "\r\n\r\n";
393 393
     if ($data) {
394
-        $request .= $data . "\r\n";
394
+        $request .= $data."\r\n";
395 395
     }
396 396
     $result->request = $request;
397 397
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         if (isset($result->headers[$header]) && $header == 'Set-Cookie') {
418 418
             // RFC 2109: the Set-Cookie response header comprises the token Set-
419 419
             // Cookie:, followed by a comma-separated list of one or more cookies.
420
-            $result->headers[$header] .= ',' . trim($value);
420
+            $result->headers[$header] .= ','.trim($value);
421 421
         } else {
422 422
             $result->headers[$header] = trim($value);
423 423
         }
Please login to merge, or discard this patch.
main/ticket/projects.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $form = TicketManager::getCategoryForm($url, $projectId);
64 64
         $formToString = $form->returnForm();
65 65
         if ($form->validate()) {
66
-            $values =$form->getSubmitValues();
66
+            $values = $form->getSubmitValues();
67 67
 
68 68
             $params = [
69 69
                 'name' => $values['name'],
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $form->setDefaults($cat);
96 96
         $formToString = $form->returnForm();
97 97
         if ($form->validate()) {
98
-            $values =$form->getSubmitValues();
98
+            $values = $form->getSubmitValues();
99 99
 
100 100
             $params = [
101 101
                 'name' => $values['name'],
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/CompareFields.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
  */
7 7
 class HTML_QuickForm_Compare_Fields extends HTML_QuickForm_Rule_Compare 
8 8
 {
9
-	/**
10
-	 * Function to check an array of fields 	 
11
-	 * @param   array of field names
9
+    /**
10
+     * Function to check an array of fields 	 
11
+     * @param   array of field names
12 12
      * @param   string operator ==, >=, etc
13 13
      * @param   string the value to compare
14
-	 * @return boolean True if date is valid
15
-	 */
16
-	function validate($values = [], $operator_and_max_value = null) {
14
+     * @return boolean True if date is valid
15
+     */
16
+    function validate($values = [], $operator_and_max_value = null) {
17 17
         if (is_array($values) && !empty($values) && !empty($operator_and_max_value)) {
18
-           $final_value = 0;
19
-           foreach ($values as $value) {
20
-               $final_value += $value;
21
-           }
22
-           $params = explode('@', $operator_and_max_value);
23
-           $operator    = $params[0];
24
-           $max_value   = $params[1];                      
25
-           return parent::validate(array($final_value, $max_value), $operator);
18
+            $final_value = 0;
19
+            foreach ($values as $value) {
20
+                $final_value += $value;
21
+            }
22
+            $params = explode('@', $operator_and_max_value);
23
+            $operator    = $params[0];
24
+            $max_value   = $params[1];                      
25
+            return parent::validate(array($final_value, $max_value), $operator);
26 26
         }
27 27
         return false;        
28
-	}
28
+    }
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.