Completed
Pull Request — 1.11.x (#1262)
by José
41:21
created
main/inc/lib/notification.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                 $newMessageText = '';
356 356
                 $linkToNewMessage = Display::url(
357 357
                     get_lang('SeeMessage'),
358
-                    api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'
358
+                    api_get_path(WEB_CODE_PATH).'messages/inbox.php'
359 359
                 );
360 360
                 break;
361 361
             case self::NOTIFICATION_TYPE_MESSAGE:
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 }
371 371
                 $linkToNewMessage = Display::url(
372 372
                     get_lang('SeeMessage'),
373
-                    api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'
373
+                    api_get_path(WEB_CODE_PATH).'messages/inbox.php'
374 374
                 );
375 375
                 break;
376 376
             case self::NOTIFICATION_TYPE_INVITATION:
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                 }
386 386
                 $linkToNewMessage = Display::url(
387 387
                     get_lang('SeeInvitation'),
388
-                    api_get_path(WEB_CODE_PATH) . 'social/invitations.php'
388
+                    api_get_path(WEB_CODE_PATH).'social/invitations.php'
389 389
                 );
390 390
                 break;
391 391
             case self::NOTIFICATION_TYPE_GROUP:
Please login to merge, or discard this patch.
main/inc/lib/redirect.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             self::navigate($url);
35 35
         }
36 36
 
37
-        $url = self::www() . $url;
37
+        $url = self::www().$url;
38 38
         self::navigate($url);
39 39
     }
40 40
 
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
                     case COURSEMANAGER:
68 68
                         $redir = api_get_setting('teacher_page_after_login');
69 69
                         if (!empty($redir)) {
70
-                            self::navigate(api_get_path(WEB_PATH) . $redir);
70
+                            self::navigate(api_get_path(WEB_PATH).$redir);
71 71
                         }
72 72
                         break;
73 73
                     case STUDENT:
74 74
                         $redir = api_get_setting('student_page_after_login');
75 75
                         if (!empty($redir)) {
76
-                            self::navigate(api_get_path(WEB_PATH) . $redir);
76
+                            self::navigate(api_get_path(WEB_PATH).$redir);
77 77
                         }
78 78
                         break;
79 79
                     case DRH:
80 80
                         $redir = api_get_setting('drh_page_after_login');
81 81
                         if (!empty($redir)) {
82
-                            self::navigate(api_get_path(WEB_PATH) . $redir);
82
+                            self::navigate(api_get_path(WEB_PATH).$redir);
83 83
                         }
84 84
                         break;
85 85
                     case SESSIONADMIN:
86 86
                         $redir = api_get_setting('sessionadmin_page_after_login');
87 87
                         if (!empty($redir)) {
88
-                            self::navigate(api_get_path(WEB_PATH) . $redir);
88
+                            self::navigate(api_get_path(WEB_PATH).$redir);
89 89
                         }
90 90
                         break;
91 91
                     default:
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             }
112 112
             $page_after_login = api_get_setting('page_after_login');
113 113
             if (!empty($page_after_login)) {
114
-                self::navigate(api_get_path(WEB_PATH) . $page_after_login);
114
+                self::navigate(api_get_path(WEB_PATH).$page_after_login);
115 115
             }
116 116
         }
117 117
     }
Please login to merge, or discard this patch.
main/inc/lib/gradebook.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         $c_id = $c_id ? intval($c_id) : api_get_course_int_id();
59
-        $table  = Database::get_course_table(TABLE_TOOL_LIST);
59
+        $table = Database::get_course_table(TABLE_TOOL_LIST);
60 60
         $sql = "SELECT * from $table
61 61
                 WHERE c_id = $c_id and name='$name'
62 62
                 LIMIT 1";
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $clean_gradebook = array();
114 114
 
115 115
         if (!empty($skill_gradebooks_source)) {
116
-            foreach($skill_gradebooks_source as $source) {
116
+            foreach ($skill_gradebooks_source as $source) {
117 117
                 $clean_gradebook[] = $source['skill_id'];
118 118
             }
119 119
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $selected_skills = self::get_skills_by_gradebook($gradebook_id);
193 193
         $clean_selected_skills = array();
194 194
         if (!empty($selected_skills)) {
195
-            foreach($selected_skills as $skill) {
195
+            foreach ($selected_skills as $skill) {
196 196
                 $clean_selected_skills[] = $skill['id'];
197 197
             }
198 198
         }
Please login to merge, or discard this patch.
main/inc/lib/database.lib.php 1 patch
Spacing   +18 added lines, -19 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public static function getUTCDateTimeTypeClass()
117 117
     {
118
-        return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass :
119
-        'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType';
118
+        return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType';
120 119
     }
121 120
 
122 121
     /**
@@ -393,7 +392,7 @@  discard block
 block discarded – undo
393 392
 
394 393
         if (!empty($params)) {
395 394
             $sql = 'INSERT INTO '.$table_name.' ('.implode(',', $params).')
396
-                    VALUES (:'.implode(', :' ,$params).')';
395
+                    VALUES (:'.implode(', :', $params).')';
397 396
 
398 397
             $statement = self::getManager()->getConnection()->prepare($sql);
399 398
             $result = $statement->execute($attributes);
@@ -434,7 +433,7 @@  discard block
 block discarded – undo
434 433
             foreach ($attributes as $key => $value) {
435 434
                 $update_sql .= "$key = :$key ";
436 435
                 if ($count < count($attributes)) {
437
-                    $update_sql.=', ';
436
+                    $update_sql .= ', ';
438 437
                 }
439 438
                 $count++;
440 439
             }
@@ -481,7 +480,7 @@  discard block
 block discarded – undo
481 480
             if ($columns == '*') {
482 481
                 $clean_columns = '*';
483 482
             } else {
484
-                $clean_columns = (string)$columns;
483
+                $clean_columns = (string) $columns;
485 484
             }
486 485
         }
487 486
 
@@ -527,9 +526,9 @@  discard block
 block discarded – undo
527 526
                     foreach ($condition_data as $condition => $value_array) {
528 527
                         if (is_array($value_array)) {
529 528
                             $clean_values = array();
530
-                            foreach($value_array as $item) {
529
+                            foreach ($value_array as $item) {
531 530
                                 $item = Database::escape_string($item);
532
-                                $clean_values[]= $item;
531
+                                $clean_values[] = $item;
533 532
                             }
534 533
                         } else {
535 534
                             $value_array = Database::escape_string($value_array);
@@ -537,23 +536,23 @@  discard block
 block discarded – undo
537 536
                         }
538 537
 
539 538
                         if (!empty($condition) && $clean_values != '') {
540
-                            $condition = str_replace('%',"'@percentage@'", $condition); //replace "%"
541
-                            $condition = str_replace("'?'","%s", $condition);
542
-                            $condition = str_replace("?","%s", $condition);
539
+                            $condition = str_replace('%', "'@percentage@'", $condition); //replace "%"
540
+                            $condition = str_replace("'?'", "%s", $condition);
541
+                            $condition = str_replace("?", "%s", $condition);
543 542
 
544
-                            $condition = str_replace("@%s@","@-@", $condition);
545
-                            $condition = str_replace("%s","'%s'", $condition);
546
-                            $condition = str_replace("@-@","@%s@", $condition);
543
+                            $condition = str_replace("@%s@", "@-@", $condition);
544
+                            $condition = str_replace("%s", "'%s'", $condition);
545
+                            $condition = str_replace("@-@", "@%s@", $condition);
547 546
 
548 547
                             // Treat conditions as string
549 548
                             $condition = vsprintf($condition, $clean_values);
550
-                            $condition = str_replace('@percentage@','%', $condition); //replace "%"
549
+                            $condition = str_replace('@percentage@', '%', $condition); //replace "%"
551 550
                             $where_return .= $condition;
552 551
                         }
553 552
                     }
554 553
 
555 554
                     if (!empty($where_return)) {
556
-                        $return_value = " WHERE $where_return" ;
555
+                        $return_value = " WHERE $where_return";
557 556
                     }
558 557
                     break;
559 558
                 case 'order':
@@ -565,7 +564,7 @@  discard block
 block discarded – undo
565 564
                         $new_order_array = explode(',', $order_array);
566 565
                         $temp_value = array();
567 566
 
568
-                        foreach($new_order_array as $element) {
567
+                        foreach ($new_order_array as $element) {
569 568
                             $element = explode(' ', $element);
570 569
                             $element = array_filter($element);
571 570
                             $element = array_values($element);
@@ -576,10 +575,10 @@  discard block
 block discarded – undo
576 575
                                 if (in_array($element[1], array('desc', 'asc'))) {
577 576
                                     $order = $element[1];
578 577
                                 }
579
-                                $temp_value[]= $element[0].' '.$order.' ';
578
+                                $temp_value[] = $element[0].' '.$order.' ';
580 579
                             } else {
581 580
                                 //by default DESC
582
-                                $temp_value[]= $element[0].' DESC ';
581
+                                $temp_value[] = $element[0].' DESC ';
583 582
                             }
584 583
                         }
585 584
                         if (!empty($temp_value)) {
@@ -594,7 +593,7 @@  discard block
 block discarded – undo
594 593
                     if (!empty($limit_array)) {
595 594
                         if (count($limit_array) > 1) {
596 595
                             $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]);
597
-                        }  else {
596
+                        } else {
598 597
                             $return_value .= ' LIMIT '.intval($limit_array[0]);
599 598
                         }
600 599
                     }
Please login to merge, or discard this patch.
main/inc/lib/skill.visualizer.lib.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $this->skills   = $skills;
29 29
         $this->type     = $type;
30
-        $this->center_x = intval($offset_x + $this->canvas_x/2 - $this->block_size/2);
30
+        $this->center_x = intval($offset_x + $this->canvas_x / 2 - $this->block_size / 2);
31 31
     }
32 32
 
33 33
     function prepare_skill_box($skill, $position, $class)
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
             $extra_class = 'second_window';
40 40
         }
41 41
 
42
-        $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.'  '.$class.'" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">';
42
+        $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.'  '.$class.'" style = "top:'.$position['y'].'px; left:'.$position['x'].'px;">';
43 43
 
44
-        $content =  $skill['name'];
44
+        $content = $skill['name'];
45 45
         $content .= '<div class="btn-group">';
46 46
         $content .= Display::url(get_lang('Edit'), '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn'));
47 47
         $content .= Display::url('+', '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn'));
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
         }
88 88
         //default_arrow_color
89 89
 
90
-        $this->js .= 'var e'.$block_id.' = prepare("block_' . $block_id.'",  '.$end_point.');'."\n";
91
-        $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_' . $skill['parent_id'].'",  '.$end_point.');'."\n";
92
-        $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n";;
90
+        $this->js .= 'var e'.$block_id.' = prepare("block_'.$block_id.'",  '.$end_point.');'."\n";
91
+        $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_'.$skill['parent_id'].'",  '.$end_point.');'."\n";
92
+        $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n"; ;
93 93
     }
94 94
 
95 95
     /**
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
         $brothers = array();
126 126
 
127 127
         foreach ($this->skills as &$skill) {
128
-            if (!in_array($skill['parent_id'], array(0,1))) {
128
+            if (!in_array($skill['parent_id'], array(0, 1))) {
129 129
                 continue;
130 130
             }
131
-            $childs = isset($skill['children']) ? count($skill['children']) : 0 ;
131
+            $childs = isset($skill['children']) ? count($skill['children']) : 0;
132 132
 
133 133
             //$x = round($this->offsetX * sin(deg2rad($corner * $count)));
134 134
             //$y = round($this->offsetY * cos(deg2rad($corner * $count)));
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
             if ($skill['parent_id'] == 0) {
145 145
                 //$x = 130*$childs/2;
146 146
                 //$x = $this->space_between_blocks_x*$childs/2;
147
-                $x = $this->canvas_x/2  - $this->block_size/2;
147
+                $x = $this->canvas_x / 2 - $this->block_size / 2;
148 148
             } else {
149 149
                 $max = isset($this->skills[$skill['parent_id']]['children']) ? count($this->skills[$skill['parent_id']]['children']) : 0;
150
-                foreach($this->skills[$skill['parent_id']]['children'] as  $id => $sk) {
150
+                foreach ($this->skills[$skill['parent_id']]['children'] as  $id => $sk) {
151 151
                     if ($skill['id'] == $sk['id']) {
152 152
                         break;
153 153
                     }
@@ -155,17 +155,17 @@  discard block
 block discarded – undo
155 155
                 }
156 156
                 $parent_x = isset($this->skills[$skill['parent_id']]['x']) ? $this->skills[$skill['parent_id']]['x'] : 0;
157 157
                 //$x = $my_count*$this->space_between_blocks_x + $parent_x  + $this->block_size - ($this->space_between_blocks_x*$max/2) ;
158
-                $x = $my_count*$this->space_between_blocks_x + $parent_x  + $this->block_size - ($this->canvas_x/2 ) ;
158
+                $x = $my_count * $this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x / 2);
159 159
             }
160 160
 
161
-            $y = $skill['level']*$this->space_between_blocks_y;
161
+            $y = $skill['level'] * $this->space_between_blocks_y;
162 162
 
163 163
             $skill['x'] = $x;
164 164
             $skill['y'] = $y;
165 165
 
166 166
             //$skill['description']  = "{$brothers[$skill['parent_id']]} $x - $y";
167 167
             //$skill['name']  =  $skill['name']."  |  $x = $my_count * 150  +  $parent_x - (150* $max/2) - 10*$childs ";
168
-            $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y +$y));
168
+            $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y + $y));
169 169
         }
170 170
         return $this->get_html();
171 171
     }
Please login to merge, or discard this patch.
main/inc/lib/extra_field_value.lib.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                             break;
210 210
                     }
211 211
 
212
-                    $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE . "_{$params['item_id']}.png";
212
+                    $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE."_{$params['item_id']}.png";
213 213
 
214 214
                     if (!file_exists($fileDir)) {
215 215
                         mkdir($fileDir, $dirPermissions, true);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 
218 218
                     if ($value['error'] == 0) {
219 219
                         $imageExtraField = new Image($value['tmp_name']);
220
-                        $imageExtraField->send_image($fileDir . $fileName, -1, 'png');
220
+                        $imageExtraField->send_image($fileDir.$fileName, -1, 'png');
221 221
                         $newParams = array(
222 222
                             'item_id' => $params['item_id'],
223 223
                             'field_id' => $extraFieldInfo['id'],
224
-                            'value' => $fileDirStored . $fileName,
224
+                            'value' => $fileDirStored.$fileName,
225 225
                             'comment' => $comment
226 226
                         );
227 227
 
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
                     }
248 248
 
249 249
                     $cleanedName = api_replace_dangerous_char($value['name']);
250
-                    $fileName = ExtraField::FIELD_TYPE_FILE . "_{$params['item_id']}_$cleanedName";
250
+                    $fileName = ExtraField::FIELD_TYPE_FILE."_{$params['item_id']}_$cleanedName";
251 251
                     if (!file_exists($fileDir)) {
252 252
                         mkdir($fileDir, $dirPermissions, true);
253 253
                     }
254 254
 
255 255
                     if ($value['error'] == 0) {
256
-                        moveUploadedFile($value, $fileDir . $fileName);
256
+                        moveUploadedFile($value, $fileDir.$fileName);
257 257
 
258 258
                         $new_params = array(
259 259
                             'item_id' => $params['item_id'],
260 260
                             'field_id' => $extraFieldInfo['id'],
261
-                            'value' => $fileDirStored . $fileName
261
+                            'value' => $fileDirStored.$fileName
262 262
                         );
263 263
 
264 264
                         if ($this->type !== 'session' && $this->type !== 'course') {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                 */
381 381
                 if (false) {
382 382
                     global $app;
383
-                    switch($this->type) {
383
+                    switch ($this->type) {
384 384
                         case 'question':
385 385
                             $extraFieldValue = new ChamiloLMS\Entity\QuestionFieldValues();
386 386
                             $extraFieldValue->setUserId(api_get_user_id());
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
                 */
443 443
                 if (false) {
444 444
                     global $app;
445
-                    switch($this->type) {
445
+                    switch ($this->type) {
446 446
                         case 'question':
447 447
                             $extraFieldValue = $app['orm.ems']['db_write']->getRepository('ChamiloLMS\Entity\QuestionFieldValues')->find($field_values['id']);
448 448
                             $extraFieldValue->setUserId(api_get_user_id());
Please login to merge, or discard this patch.
main/inc/lib/export.lib.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         }
100 100
         foreach ($data as $row) {
101 101
             $string = implode("</td><td>", $row);
102
-            $string = '<tr><td>' . $string . '</td></tr>';
102
+            $string = '<tr><td>'.$string.'</td></tr>';
103 103
             if ($encoding != 'utf-8') {
104 104
                 $string = api_convert_encoding($string, $encoding, $systemEncoding);
105 105
             }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             fwrite($handle, '<'.$wrapper_tagname.'>');
174 174
         }
175 175
         $s = self::_export_complex_table_xml_helper($data);
176
-        fwrite($handle,$s);
176
+        fwrite($handle, $s);
177 177
         if (!is_null($wrapper_tagname)) {
178 178
             fwrite($handle, '</'.$wrapper_tagname.'>'."\n");
179 179
         }
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
         }
196 196
         $string = '';
197 197
         foreach ($data as $row) {
198
-            $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
198
+            $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>';
199 199
             if (is_array($row['value'])) {
200
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
201
-                $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
200
+            	$string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n";
201
+                $string .= str_repeat("\t", $level).'</'.$row['name'].'>';
202 202
             } else {
203 203
                 $string .= $row['value'];
204 204
                 $string .= '</'.$row['name'].'>';
Please login to merge, or discard this patch.
main/inc/lib/chat.lib.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $to_user_id,
187 187
         $message,
188 188
         $printResult = true,
189
-        $sanitize =  true
189
+        $sanitize = true
190 190
     )
191 191
     {
192 192
         $user_friend_relation = SocialManager::get_relation_between_contacts(
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 $messagesan = $message;
207 207
             }
208 208
 
209
-            error_log(print_r($sanitize) . '----' . $messagesan);
209
+            error_log(print_r($sanitize).'----'.$messagesan);
210 210
 
211 211
             if (!isset($_SESSION['chatHistory'][$to_user_id])) {
212 212
                 $_SESSION['chatHistory'][$to_user_id] = array();
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
      */
290 290
     public static function disableChat()
291 291
     {
292
-        if (!empty($_SESSION['disable_chat'])){
292
+        if (!empty($_SESSION['disable_chat'])) {
293 293
             $status = $_SESSION['disable_chat'];
294
-            if ($status == true){
294
+            if ($status == true) {
295 295
                 $_SESSION['disable_chat'] = null;
296 296
                 return true;
297 297
             }
Please login to merge, or discard this patch.
main/inc/lib/array.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 {
111 111
 	$old_locale = setlocale(LC_ALL, null);
112 112
 	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
113
+	$locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
114 114
 	$try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
116
+	foreach ($locale_list as $locale) {
117 117
 		$my_local = setlocale(LC_COLLATE, $locale);
118 118
 		if ($my_local) {
119 119
 			$try_sort = true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     $flatten = array();
152 152
     array_walk_recursive(
153 153
         $array,
154
-        function ($value) use (&$flatten) {
154
+        function($value) use (&$flatten) {
155 155
             $flatten[] = $value;
156 156
         }
157 157
     );
Please login to merge, or discard this patch.