Completed
Push — 1.11.x ( 6904fa...6a92e6 )
by José
525:44 queued 484:20
created
main/inc/lib/sortable_table.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $params['spacesBeforeSeparator'] = '';
216 216
             $params['spacesAfterSeparator'] = '';
217 217
             $query_vars = array_keys($_GET);
218
-            $query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
218
+            $query_vars_needed = array($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
219 219
             if (count($this->additional_parameters) > 0) {
220 220
                 $query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters));
221 221
             }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
         if (!$empty_table) {
287 287
             if (!empty($this->additional_parameters)) {
288
-                foreach($this->additional_parameters as $key => $value) {
288
+                foreach ($this->additional_parameters as $key => $value) {
289 289
                     $html .= '<input type="hidden" name ="'.Security::remove_XSS($key).'" value ="'.Security::remove_XSS($value).'" />';
290 290
                 }
291 291
             }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     $html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>';
311 311
                 }
312 312
                 $html .= '</ul>';
313
-                $html .= '</div>';//btn-group
313
+                $html .= '</div>'; //btn-group
314 314
                 $html .= '</div>'; //toolbar
315 315
             } else {
316 316
                 $html .= $form;
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
             }
335 335
         }
336 336
 
337
-        return '<div class="table-responsive">' . $html . '</div>';
337
+        return '<div class="table-responsive">'.$html.'</div>';
338 338
     }
339 339
 
340 340
     /**
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
             $html .= '<div class="clear"></div>';
390 390
             if (count($this->form_actions) > 0) {
391
-                $script= '<script>
391
+                $script = '<script>
392 392
                             /*<![CDATA[*/
393 393
                             function setCheckbox(value) {
394 394
                                  d = document.form_'.$this->table_name.';
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             }
411 411
         }
412 412
         // Getting the items of the table
413
-        $items = $this->get_clean_html(false);    //no sort
413
+        $items = $this->get_clean_html(false); //no sort
414 414
 
415 415
         // Generation of style classes must be improved. Maybe we need a a table name to create style on the fly:
416 416
         // i.e: .whoisonline_table_grid_container instead of  .grid_container
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
             $html .= '<div class="clear"></div>';
480 480
             if (count($this->form_actions) > 0) {
481
-                $script= '<script>
481
+                $script = '<script>
482 482
                             /*<![CDATA[*/
483 483
                             function setCheckbox(value) {
484 484
                                  d = document.form_'.$this->table_name.';
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
                     $counter = 0;
587 587
                     foreach ($row as $index => $rowInfo) {
588 588
                         if (!isset($this->columnsToHide[$index])) {
589
-                            $newRow[$counter] = $rowInfo ;
589
+                            $newRow[$counter] = $rowInfo;
590 590
                             $counter++;
591 591
                         }
592 592
                     }
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         }
602 602
 
603 603
         if ($this->odd_even_rows_enabled == true) {
604
-            $this->altRowAttributes(0, array ('class' => 'row_odd'), array ('class' => 'row_even'), true);
604
+            $this->altRowAttributes(0, array('class' => 'row_odd'), array('class' => 'row_even'), true);
605 605
         }
606 606
 
607 607
         foreach ($this->th_attributes as $column => $attributes) {
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
         }
664 664
         $result[] = '<select name="'.$this->param_prefix.'per_page" onchange="javascript: this.form.submit();">';
665 665
         for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) {
666
-            $result[] = '<option value="'.$nr.'" '. ($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>';
666
+            $result[] = '<option value="'.$nr.'" '.($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>';
667 667
         }
668 668
         // @todo no limits
669 669
         //if ($total_number_of_items < 500) {
670
-            $result[] = '<option value="'.$total_number_of_items.'" '. ($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>';
670
+            $result[] = '<option value="'.$total_number_of_items.'" '.($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>';
671 671
         //}
672 672
         $result[] = '</select>';
673 673
         $result[] = '<noscript>';
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
      */
786 786
     public function get_additional_url_paramstring()
787 787
     {
788
-        $param_string_parts = array ();
788
+        $param_string_parts = array();
789 789
         if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) {
790 790
             foreach ($this->additional_parameters as $key => & $value) {
791 791
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
                 //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction'];
799 799
                 $my_get_direction = $_GET[$tablename.'_direction'];
800 800
                 if (!in_array($my_get_direction, array('ASC', 'DESC'))) {
801
-                     $param[$tablename.'_direction'] =  'ASC';
801
+                     $param[$tablename.'_direction'] = 'ASC';
802 802
                 } else {
803 803
                     $param[$tablename.'_direction'] = $my_get_direction;
804 804
                 }
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             if (isset($_GET[$tablename.'_column'])) {
813 813
                 $param[$tablename.'_column'] = intval($_GET[$tablename.'_column']);
814 814
             }
815
-            $param_string_parts = array ();
815
+            $param_string_parts = array();
816 816
             foreach ($param as $key => & $value) {
817 817
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
818 818
             }
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
         $param[$this->param_prefix.'page_nr'] = $this->page_nr;
834 834
         $param[$this->param_prefix.'per_page'] = $this->per_page;
835 835
         $param[$this->param_prefix.'column'] = $this->column;
836
-        $param_string_parts = array ();
836
+        $param_string_parts = array();
837 837
         foreach ($param as $key => & $value) {
838 838
             $param_string_parts[] = urlencode($key).'='.urlencode($value);
839 839
         }
Please login to merge, or discard this patch.
main/inc/lib/TicketManager.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
         $sql = "SELECT id, name, description, total_tickets
76 76
                 FROM $table";
77 77
 
78
-        if (!in_array($direction, array('ASC','DESC'))) {
78
+        if (!in_array($direction, array('ASC', 'DESC'))) {
79 79
             $direction = 'ASC';
80 80
         }
81 81
         $column = intval($column);
82
-        $from 	= intval($from);
82
+        $from = intval($from);
83 83
         $numberItems = intval($numberItems);
84 84
 
85 85
         //$sql .= " ORDER BY col$column $direction ";
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     public static function get_all_tickets_status()
237 237
     {
238 238
         $table_support_status = Database::get_main_table(TABLE_TICKET_STATUS);
239
-        $sql = "SELECT * FROM " . $table_support_status;
239
+        $sql = "SELECT * FROM ".$table_support_status;
240 240
         $result = Database::query($sql);
241 241
         $types = array();
242 242
         while ($row = Database::fetch_assoc($result)) {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $ticket_id = Database::insert($table_support_tickets, $params);
356 356
 
357 357
         if ($ticket_id) {
358
-            $ticket_code = "A" . str_pad($ticket_id, 11, '0', STR_PAD_LEFT);
358
+            $ticket_code = "A".str_pad($ticket_id, 11, '0', STR_PAD_LEFT);
359 359
 
360 360
             Display::addFlash(Display::return_message(
361 361
                 sprintf(
@@ -396,32 +396,32 @@  discard block
 block discarded – undo
396 396
             $helpDeskMessage =
397 397
                 '<table>
398 398
                         <tr>
399
-                            <td width="100px"><b>' . get_lang('User') . '</b></td>
400
-                            <td width="400px">' . $user['firstname']. ' ' . $user['lastname'] . '</td>
399
+                            <td width="100px"><b>' . get_lang('User').'</b></td>
400
+                            <td width="400px">' . $user['firstname'].' '.$user['lastname'].'</td>
401 401
                         </tr>
402 402
                         <tr>
403
-                            <td width="100px"><b>' . get_lang('Username') . '</b></td>
404
-                            <td width="400px">' . $user['username'] . '</td>
403
+                            <td width="100px"><b>' . get_lang('Username').'</b></td>
404
+                            <td width="400px">' . $user['username'].'</td>
405 405
                         </tr>
406 406
                         <tr>
407
-                            <td width="100px"><b>' . get_lang('Email') . '</b></td>
408
-                            <td width="400px">' . $user['email'] . '</td>
407
+                            <td width="100px"><b>' . get_lang('Email').'</b></td>
408
+                            <td width="400px">' . $user['email'].'</td>
409 409
                         </tr>
410 410
                         <tr>
411
-                            <td width="100px"><b>' . get_lang('Phone') . '</b></td>
412
-                            <td width="400px">' . $user['phone'] . '</td>
411
+                            <td width="100px"><b>' . get_lang('Phone').'</b></td>
412
+                            <td width="400px">' . $user['phone'].'</td>
413 413
                         </tr>
414 414
                         <tr>
415
-                            <td width="100px"><b>' . get_lang('Date') . '</b></td>
416
-                            <td width="400px">' . api_convert_and_format_date($now, DATE_TIME_FORMAT_LONG) . '</td>
415
+                            <td width="100px"><b>' . get_lang('Date').'</b></td>
416
+                            <td width="400px">' . api_convert_and_format_date($now, DATE_TIME_FORMAT_LONG).'</td>
417 417
                         </tr>
418 418
                         <tr>
419
-                            <td width="100px"><b>' . get_lang('Title') . '</b></td>
420
-                            <td width="400px">' . $subject . '</td>
419
+                            <td width="100px"><b>' . get_lang('Title').'</b></td>
420
+                            <td width="400px">' . $subject.'</td>
421 421
                         </tr>
422 422
                         <tr>
423
-                            <td width="100px"><b>' . get_lang('Description') . '</b></td>
424
-                            <td width="400px">' . $content . '</td>
423
+                            <td width="100px"><b>' . get_lang('Description').'</b></td>
424
+                            <td width="400px">' . $content.'</td>
425 425
                         </tr>
426 426
                     </table>';
427 427
 
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
         $table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
657 657
         $table_support_message_attachments = Database::get_main_table(TABLE_TICKET_MESSAGE_ATTACHMENTS);
658 658
         if ($sendConfirmation) {
659
-            $form = '<form action="ticket_details.php?ticket_id=' . $ticket_id . '" id="confirmticket" method="POST" >
660
-                         <p>' . get_lang('TicketWasThisAnswerSatisfying') . '</p>
661
-                         <button class="btn btn-primary responseyes" name="response" id="responseyes" value="1">' . get_lang('Yes') . '</button>
662
-                         <button class="btn btn-danger responseno" name="response" id="responseno" value="0">' . get_lang('No') . '</button>
659
+            $form = '<form action="ticket_details.php?ticket_id='.$ticket_id.'" id="confirmticket" method="POST" >
660
+                         <p>' . get_lang('TicketWasThisAnswerSatisfying').'</p>
661
+                         <button class="btn btn-primary responseyes" name="response" id="responseyes" value="1">' . get_lang('Yes').'</button>
662
+                         <button class="btn btn-danger responseno" name="response" id="responseno" value="0">' . get_lang('No').'</button>
663 663
                      </form>';
664 664
             $content .= $form;
665 665
 
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
         } else {
761 761
             $new_file_name = uniqid('');
762 762
             $path_attachment = api_get_path(SYS_ARCHIVE_PATH);
763
-            $path_message_attach = $path_attachment . 'plugin_ticket_messageattch/';
763
+            $path_message_attach = $path_attachment.'plugin_ticket_messageattch/';
764 764
             if (!file_exists($path_message_attach)) {
765 765
                 @mkdir($path_message_attach, api_get_permissions_for_new_directories(), true);
766 766
             }
767
-            $new_path = $path_message_attach . $new_file_name;
767
+            $new_path = $path_message_attach.$new_file_name;
768 768
             if (is_uploaded_file($file_attach['tmp_name'])) {
769 769
                 @copy($file_attach['tmp_name'], $new_path);
770 770
             }
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                     '$ticket_id',
788 788
                     '$message_id',
789 789
                     '$message_attch_id',
790
-                    '" . $file_attach['size'] . "',
790
+                    '".$file_attach['size']."',
791 791
                     '$user_id',
792 792
                     '$now',
793 793
                     '$user_id',
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
             Database::query($sql);
797 797
 
798 798
             return array(
799
-                'path' => $path_message_attach . $safe_new_file_name,
799
+                'path' => $path_message_attach.$safe_new_file_name,
800 800
                 'filename' => $safe_file_name,
801 801
             );
802 802
         }
@@ -999,23 +999,23 @@  discard block
 block discarded – undo
999 999
             $unread = Database::fetch_object($result_unread)->unread;*/
1000 1000
 
1001 1001
             $userInfo = api_get_user_info($row['sys_insert_user_id']);
1002
-            $hrefUser = $webPath . 'main/admin/user_information.php?user_id=' . $userInfo['user_id'];
1002
+            $hrefUser = $webPath.'main/admin/user_information.php?user_id='.$userInfo['user_id'];
1003 1003
             $name = "<a href='$hrefUser'> {$userInfo['username']} </a>";
1004 1004
             $actions = '';
1005 1005
 
1006 1006
             if ($row['assigned_last_user'] != 0) {
1007 1007
                 $assignedUserInfo = api_get_user_info($row['assigned_last_user']);
1008 1008
                 if (!empty($assignedUserInfo)) {
1009
-                    $hrefResp = $webPath . 'main/admin/user_information.php?user_id=' . $assignedUserInfo['user_id'];
1009
+                    $hrefResp = $webPath.'main/admin/user_information.php?user_id='.$assignedUserInfo['user_id'];
1010 1010
                     $row['assigned_last_user'] = "<a href='$hrefResp'> {$assignedUserInfo['username']} </a>";
1011 1011
                 } else {
1012 1012
                     $row['assigned_last_user'] = get_lang('UnknownUser');
1013 1013
                 }
1014 1014
             } else {
1015 1015
                 if ($row['status_id'] !== self::STATUS_FORWARDED) {
1016
-                    $row['assigned_last_user'] = '<span style="color:#ff0000;">' . get_lang('ToBeAssigned') . '</span>';
1016
+                    $row['assigned_last_user'] = '<span style="color:#ff0000;">'.get_lang('ToBeAssigned').'</span>';
1017 1017
                 } else {
1018
-                    $row['assigned_last_user'] = '<span style="color:#00ff00;">' . get_lang('MessageResent') . '</span>';
1018
+                    $row['assigned_last_user'] = '<span style="color:#00ff00;">'.get_lang('MessageResent').'</span>';
1019 1019
                 }
1020 1020
             }
1021 1021
 
@@ -1037,11 +1037,11 @@  discard block
 block discarded – undo
1037 1037
             $row['col2'] = api_get_local_time($row['col2']);
1038 1038
             if ($isAdmin) {
1039 1039
                 if ($row['priority_id'] === self::PRIORITY_HIGH && $row['status_id'] != self::STATUS_CLOSE) {
1040
-                    $actions .= '<img src="' . $webCodePath . 'img/exclamation.png" border="0" />';
1040
+                    $actions .= '<img src="'.$webCodePath.'img/exclamation.png" border="0" />';
1041 1041
                 }
1042 1042
                 $row['col0'] = Display::return_icon(
1043 1043
                                 $img_source, get_lang('Info')
1044
-                        ) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['code'] . '</a>';
1044
+                        ).'<a href="ticket_details.php?ticket_id='.$row['col0'].'">'.$row['code'].'</a>';
1045 1045
                 // @todo fix
1046 1046
                 /*if ($row['col7'] == 'PENDIENTE') {
1047 1047
                     $row['col7'] = '<span style="color: #f00; font-weight:bold;">' . $row['col7'] . '</span>';
@@ -1062,17 +1062,17 @@  discard block
 block discarded – undo
1062 1062
                 $row['col0'] = Display::return_icon(
1063 1063
                         $img_source,
1064 1064
                         get_lang('Info')
1065
-                    ) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['code'] . '</a>';
1065
+                    ).'<a href="ticket_details.php?ticket_id='.$row['col0'].'">'.$row['code'].'</a>';
1066 1066
                 $now = api_strtotime(api_get_utc_datetime());
1067 1067
                 $last_edit_date = api_strtotime($row['sys_lastedit_datetime']);
1068 1068
                 $dif = $now - $last_edit_date;
1069 1069
 
1070 1070
                 if ($dif > 172800 && $row['priority_id'] === self::PRIORITY_NORMAL && $row['status_id'] != self::STATUS_CLOSE) {
1071
-                    $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
1072
-                                 <img src="' . Display::returnIconPath('exclamation.png') . '" border="0" /></a>';
1071
+                    $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php?ticket_id='.$row['ticket_id'].'&amp;action=alert">
1072
+                                 <img src="' . Display::returnIconPath('exclamation.png').'" border="0" /></a>';
1073 1073
                 }
1074 1074
                 if ($row['priority_id'] === self::PRIORITY_HIGH) {
1075
-                    $actions .= '<img src="' . Display::returnIconPath('admin_star.png') . '" border="0" />';
1075
+                    $actions .= '<img src="'.Display::returnIconPath('admin_star.png').'" border="0" />';
1076 1076
                 }
1077 1077
                 $ticket = array(
1078 1078
                     $row['col0'],
@@ -1088,9 +1088,9 @@  discard block
 block discarded – undo
1088 1088
                                 </a>';
1089 1089
             }*/
1090 1090
             if ($isAdmin) {
1091
-                $ticket['0'] .= '&nbsp;&nbsp;<a  href="javascript:void(0)" onclick="load_history_ticket(\'div_' . $row['ticket_id'] . '\',' . $row['ticket_id'] . ')">
1092
-					<img onclick="load_course_list(\'div_' . $row['ticket_id'] . '\',' . $row['ticket_id'] . ')" onmouseover="clear_course_list (\'div_' . $row['ticket_id'] . '\')" src="' . Display::returnIconPath('history.gif') . '" title="' . get_lang('Historial') . '" alt="' . get_lang('Historial') . '"/>
1093
-					<div class="blackboard_hide" id="div_' . $row['ticket_id'] . '">&nbsp;&nbsp;</div>
1091
+                $ticket['0'] .= '&nbsp;&nbsp;<a  href="javascript:void(0)" onclick="load_history_ticket(\'div_'.$row['ticket_id'].'\','.$row['ticket_id'].')">
1092
+					<img onclick="load_course_list(\'div_' . $row['ticket_id'].'\','.$row['ticket_id'].')" onmouseover="clear_course_list (\'div_'.$row['ticket_id'].'\')" src="'.Display::returnIconPath('history.gif').'" title="'.get_lang('Historial').'" alt="'.get_lang('Historial').'"/>
1093
+					<div class="blackboard_hide" id="div_' . $row['ticket_id'].'">&nbsp;&nbsp;</div>
1094 1094
 					</a>&nbsp;&nbsp;';
1095 1095
             }
1096 1096
             $tickets[] = $ticket;
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
                 }
1325 1325
 
1326 1326
                 $userInfo = api_get_user_info($row['sys_insert_user_id']);
1327
-                $row['user_url'] = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/user_information.php?user_id=' . $userInfo['user_id'] . '">
1328
-                ' . $userInfo['complete_name']. '</a>';
1327
+                $row['user_url'] = '<a href="'.api_get_path(WEB_PATH).'main/admin/user_information.php?user_id='.$userInfo['user_id'].'">
1328
+                ' . $userInfo['complete_name'].'</a>';
1329 1329
                 $ticket['usuario'] = $userInfo;
1330 1330
                 $ticket['ticket'] = $row;
1331 1331
             }
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
             while ($row = Database::fetch_assoc($result)) {
1343 1343
                 $message = $row;
1344 1344
                 $completeName = api_get_person_name($row['firstname'], $row['lastname']);
1345
-                $href = $webPath . 'main/admin/user_information.php?user_id=' . $row['user_id'];
1345
+                $href = $webPath.'main/admin/user_information.php?user_id='.$row['user_id'];
1346 1346
                 // Check if user is an admin
1347 1347
                 $sql_admin = "SELECT user_id FROM $admin_table
1348
-		                      WHERE user_id = '" . intval($message['user_id']) . "'
1348
+		                      WHERE user_id = '".intval($message['user_id'])."'
1349 1349
                               LIMIT 1";
1350 1350
                 $result_admin = Database::query($sql_admin);
1351 1351
                 $message['admin'] = false;
@@ -1357,12 +1357,12 @@  discard block
 block discarded – undo
1357 1357
                 $sql = "SELECT *
1358 1358
                         FROM $table_support_message_attachments
1359 1359
                         WHERE
1360
-                            message_id = " . $row['id'] . " AND
1360
+                            message_id = ".$row['id']." AND
1361 1361
                             ticket_id = '$ticket_id'  ";
1362 1362
                 $result_attach = Database::query($sql);
1363 1363
                 while ($row2 = Database::fetch_assoc($result_attach)) {
1364
-                    $archiveURL = $archiveURL = $webPath . "plugin/" . PLUGIN_NAME . '/src/download.php?ticket_id=' . $ticket_id . '&file=';
1365
-                    $row2['attachment_link'] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $row2['path'] . '&title=' . $row2['filename'] . '">' . $row2['filename'] . '</a>&nbsp;(' . $row2['size'] . ')';
1364
+                    $archiveURL = $archiveURL = $webPath."plugin/".PLUGIN_NAME.'/src/download.php?ticket_id='.$ticket_id.'&file=';
1365
+                    $row2['attachment_link'] = $attach_icon.'&nbsp;<a href="'.$archiveURL.$row2['path'].'&title='.$row2['filename'].'">'.$row2['filename'].'</a>&nbsp;('.$row2['size'].')';
1366 1366
                     $message['attachments'][] = $row2;
1367 1367
                 }
1368 1368
                 $ticket['messages'][] = $message;
@@ -1386,10 +1386,10 @@  discard block
 block discarded – undo
1386 1386
         );
1387 1387
         $table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
1388 1388
         $now = api_get_utc_datetime();
1389
-        $sql = "UPDATE " . $table_support_messages . "
1389
+        $sql = "UPDATE ".$table_support_messages."
1390 1390
                 SET status = 'LEI', 
1391
-                sys_lastedit_user_id ='" . api_get_user_id() . "',
1392
-                sys_lastedit_datetime ='" . $now . "'
1391
+                sys_lastedit_user_id ='" . api_get_user_id()."',
1392
+                sys_lastedit_datetime ='" . $now."'
1393 1393
                 WHERE ticket_id ='$ticket_id' ";
1394 1394
 
1395 1395
         if (api_is_platform_admin()) {
@@ -1508,10 +1508,10 @@  discard block
 block discarded – undo
1508 1508
         $user_id = intval($user_id);
1509 1509
 
1510 1510
         $now = api_get_utc_datetime();
1511
-        $sql = "UPDATE " . $table_support_tickets . " SET
1511
+        $sql = "UPDATE ".$table_support_tickets." SET
1512 1512
                 status_id = '$status_id',
1513 1513
                 sys_lastedit_user_id ='$user_id',
1514
-                sys_lastedit_datetime ='" . $now . "'
1514
+                sys_lastedit_datetime ='".$now."'
1515 1515
                 WHERE ticket_id ='$ticket_id'";
1516 1516
         $result = Database::query($sql);
1517 1517
 
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
         $sql = "UPDATE $table_support_tickets SET
1597 1597
                     status_id = '".self::STATUS_CLOSE."',
1598 1598
                     sys_lastedit_user_id ='$user_id',
1599
-                    sys_lastedit_datetime ='" . $now . "',
1599
+                    sys_lastedit_datetime ='".$now."',
1600 1600
                     end_date ='$now'
1601 1601
                 WHERE id ='$ticket_id'";
1602 1602
         Database::query($sql);
@@ -1656,8 +1656,8 @@  discard block
 block discarded – undo
1656 1656
             $row['assigned_date'] = api_convert_and_format_date(
1657 1657
                 api_get_local_time($row['assigned_date']), '%d/%m/%y-%H:%M:%S', _api_get_timezone()
1658 1658
             );
1659
-            $row['assignuser'] = $row['user_id'] != 0 ? ('<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['user_id'] . '"  target="_blank">' . $assignuser['username'] . '</a>') : get_lang('Unassign');
1660
-            $row['insertuser'] = '<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['sys_insert_user_id'] . '"  target="_blank">' . $insertuser['username'] . '</a>';
1659
+            $row['assignuser'] = $row['user_id'] != 0 ? ('<a href="'.$webpath.'main/admin/user_information.php?user_id='.$row['user_id'].'"  target="_blank">'.$assignuser['username'].'</a>') : get_lang('Unassign');
1660
+            $row['insertuser'] = '<a href="'.$webpath.'main/admin/user_information.php?user_id='.$row['sys_insert_user_id'].'"  target="_blank">'.$insertuser['username'].'</a>';
1661 1661
             $history[] = $row;
1662 1662
         }
1663 1663
 
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
         while ($row = Database::fetch_assoc($result)) {
1854 1854
             if ($row['responsable'] != 0) {
1855 1855
                 $row['responsable'] = api_get_user_info($row['responsable']);
1856
-                $row['responsable'] = $row['responsable']['firstname'] . ' ' . $row['responsable']['lastname'];
1856
+                $row['responsable'] = $row['responsable']['firstname'].' '.$row['responsable']['lastname'];
1857 1857
             }
1858 1858
             $row['sys_insert_datetime'] = api_format_date(
1859 1859
                     $row['sys_insert_datetime'], '%d/%m/%y - %I:%M:%S %p'
Please login to merge, or discard this patch.
main/inc/lib/login.lib.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
             if ($by_username) {
38 38
                 $secret_word = self::get_secret_word($user['email']);
39 39
                 if ($reset) {
40
-                    $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $user['uid'];
40
+                    $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$user['uid'];
41 41
                 } else {
42
-                    $reset_link = get_lang('Pass') . " : $user[password]";
42
+                    $reset_link = get_lang('Pass')." : $user[password]";
43 43
                 }
44
-                $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . '';
44
+                $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.'';
45 45
 
46 46
                 if ($user_account_list) {
47
-                    $user_account_list = "\n-----------------------------------------------\n" . $user_account_list;
47
+                    $user_account_list = "\n-----------------------------------------------\n".$user_account_list;
48 48
                 }
49 49
             } else {
50 50
                 foreach ($user as $this_user) {
51 51
                     $secret_word = self::get_secret_word($this_user['email']);
52 52
                     if ($reset) {
53
-                        $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $this_user['uid'];
53
+                        $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$this_user['uid'];
54 54
                     } else {
55
-                        $reset_link = get_lang('Pass') . " : $this_user[password]";
55
+                        $reset_link = get_lang('Pass')." : $this_user[password]";
56 56
                     }
57
-                    $user_account_list[] = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $this_user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . '';
57
+                    $user_account_list[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$this_user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.'';
58 58
                 }
59 59
                 if ($user_account_list) {
60 60
                     $user_account_list = implode("\n-----------------------------------------------\n", $user_account_list);
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
             if (!$by_username) {
65 65
                 $user = $user[0];
66 66
             }
67
-            $reset_link = get_lang('Pass') . " : $user[password]";
68
-            $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . $reset_link . '';
67
+            $reset_link = get_lang('Pass')." : $user[password]";
68
+            $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.'';
69 69
         }
70 70
         return $user_account_list;
71 71
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public static function send_password_to_user($user, $by_username = false)
80 80
     {
81
-        $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT
81
+        $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT
82 82
 
83 83
         if ($by_username) { // Show only for lost password
84 84
             $user_account_list = self::get_user_account_list($user, false, $by_username); // BODY
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             }
98 98
         }
99 99
 
100
-        $email_body = get_lang('YourAccountParam') . " " . $portal_url . "\n\n$user_account_list";
100
+        $email_body = get_lang('YourAccountParam')." ".$portal_url."\n\n$user_account_list";
101 101
         // SEND MESSAGE
102 102
         $sender_name = api_get_person_name(
103 103
             api_get_setting('administratorName'),
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public static function handle_encrypted_password($user, $by_username = false)
138 138
     {
139
-        $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT
139
+        $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT
140 140
 
141 141
         if ($by_username) {
142 142
         // Show only for lost password
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
             $user_account_list = self::get_user_account_list($user, true); // BODY
147 147
             $email_to = $user[0]['email'];
148 148
         }
149
-        $email_body = get_lang('DearUser') . " :\n" . get_lang('password_request') . "\n";
150
-        $email_body .= $user_account_list . "\n-----------------------------------------------\n\n";
149
+        $email_body = get_lang('DearUser')." :\n".get_lang('password_request')."\n";
150
+        $email_body .= $user_account_list."\n-----------------------------------------------\n\n";
151 151
         $email_body .= get_lang('PasswordEncryptedForSecurity');
152 152
 
153
-        $email_body .= "\n\n" . get_lang('SignatureFormula') . ",\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('PlataformAdmin') . " - " . api_get_setting('siteName');
153
+        $email_body .= "\n\n".get_lang('SignatureFormula').",\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname')."\n".get_lang('PlataformAdmin')." - ".api_get_setting('siteName');
154 154
 
155 155
         $sender_name = api_get_person_name(
156 156
             api_get_setting('administratorName'),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                     password,
252 252
                     email,
253 253
                     auth_source
254
-                FROM " . $tbl_user . "
254
+                FROM " . $tbl_user."
255 255
                 WHERE user_id = $id";
256 256
         $result = Database::query($sql);
257 257
         $num_rows = Database::num_rows($result);
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                         ON user.user_id = a.user_id
310 310
                         LEFT JOIN $track_e_login login
311 311
                         ON user.user_id  = login.login_user_id
312
-                        WHERE user.user_id = '" . $_user['user_id'] . "'
312
+                        WHERE user.user_id = '".$_user['user_id']."'
313 313
                         ORDER BY login.login_date DESC LIMIT 1";
314 314
 
315 315
                 $result = Database::query($sql);
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                     Session::write('is_platformAdmin', $is_platformAdmin);
340 340
                     Session::write('is_allowedCreateCourse', $is_allowedCreateCourse);
341 341
                 } else {
342
-                    header('location:' . api_get_path(WEB_PATH));
342
+                    header('location:'.api_get_path(WEB_PATH));
343 343
                     //exit("WARNING UNDEFINED UID !! ");
344 344
                 }
345 345
             } else { // no uid => logout or Anonymous
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
         global $_course;
388 388
         global $_real_cid;
389 389
 
390
-        global $is_courseAdmin;  //course teacher
391
-        global $is_courseTutor;  //course teacher - some rights
392
-        global $is_courseCoach;  //course coach
390
+        global $is_courseAdmin; //course teacher
391
+        global $is_courseTutor; //course teacher - some rights
392
+        global $is_courseCoach; //course coach
393 393
         global $is_courseMember; //course student
394 394
         global $is_sessionAdmin;
395 395
         global $is_allowed_in_course;
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
                     if (!empty($_GET['id_session'])) {
448 448
                         $_SESSION['id_session'] = intval($_GET['id_session']);
449
-                        $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"';
449
+                        $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"';
450 450
                         $rs = Database::query($sql);
451 451
                         list($_SESSION['session_name']) = Database::fetch_array($rs);
452 452
                     } else {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
                     }
463 463
                 } else {
464 464
                     //exit("WARNING UNDEFINED CID !! ");
465
-                    header('location:' . api_get_path(WEB_PATH));
465
+                    header('location:'.api_get_path(WEB_PATH));
466 466
                 }
467 467
             } else {
468 468
                 Session::erase('_cid');
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         } else {
490 490
             // Continue with the previous values
491 491
             if (empty($_SESSION['_course']) OR empty($_SESSION['_cid'])) { //no previous values...
492
-                $_cid = -1;        //set default values that will be caracteristic of being unset
492
+                $_cid = -1; //set default values that will be caracteristic of being unset
493 493
                 $_course = -1;
494 494
             } else {
495 495
                 $_cid = $_SESSION['_cid'];
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                 // Moreover, if we want to track a course with another session it can be usefull
500 500
                 if (!empty($_GET['id_session'])) {
501 501
                     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
502
-                    $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"';
502
+                    $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"';
503 503
                     $rs = Database::query($sql);
504 504
                     list($_SESSION['session_name']) = Database::fetch_array($rs);
505 505
                     $_SESSION['id_session'] = intval($_GET['id_session']);
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
                             //But only if the login date is < than now + max_life_time
540 540
                             $sql = "SELECT course_access_id FROM $course_tracking_table
541 541
                                     WHERE
542
-                                        user_id     = " . intval($_user ['user_id']) . " AND
542
+                                        user_id     = ".intval($_user ['user_id'])." AND
543 543
                                         c_id = '".api_get_course_int_id()."' AND
544
-                                        session_id  = " . api_get_session_id() . " AND
544
+                                        session_id  = " . api_get_session_id()." AND
545 545
                                         login_course_date > now() - INTERVAL $session_lifetime SECOND
546 546
                                     ORDER BY login_course_date DESC LIMIT 0,1";
547 547
                             $result = Database::query($sql);
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
                                 //We update the course tracking table
552 552
                                 $sql = "UPDATE $course_tracking_table
553 553
                                         SET logout_course_date = '$time', counter = counter+1
554
-                                        WHERE course_access_id = " . intval($i_course_access_id) . " AND session_id = " . api_get_session_id();
554
+                                        WHERE course_access_id = ".intval($i_course_access_id)." AND session_id = ".api_get_session_id();
555 555
                                 Database::query($sql);
556 556
                             } else {
557
-                                $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)" .
558
-                                        "VALUES('" . api_get_course_int_id() . "', '" . $_user['user_id'] . "', '$time', '$time', '1','" . api_get_session_id() . "')";
557
+                                $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)".
558
+                                        "VALUES('".api_get_course_int_id()."', '".$_user['user_id']."', '$time', '$time', '1','".api_get_session_id()."')";
559 559
                                 Database::query($sql);
560 560
                             }
561 561
                         }
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                 $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
584 584
                 $sql = "SELECT * FROM $course_user_table
585 585
                        WHERE
586
-                        user_id  = '" . $user_id . "' AND
586
+                        user_id  = '".$user_id."' AND
587 587
                         relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
588 588
                         course_code = '$course_id'";
589 589
                 $result = Database::query($sql);
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
                         );
606 606
 
607 607
                         if (!$user_is_subscribed) {
608
-                            $url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $_course['code'] . '&session_id=' . $session_id;
609
-                            header('Location: ' . $url);
608
+                            $url = api_get_path(WEB_CODE_PATH).'course_info/legal.php?course_code='.$_course['code'].'&session_id='.$session_id;
609
+                            header('Location: '.$url);
610 610
                             exit;
611 611
                         }
612 612
                     }
@@ -647,11 +647,11 @@  discard block
 block discarded – undo
647 647
                         } else {
648 648
                             //Im a coach or a student?
649 649
                             $sql = "SELECT user_id, status
650
-                                    FROM " . $tbl_session_course_user . "
650
+                                    FROM " . $tbl_session_course_user."
651 651
                                     WHERE
652 652
                                         c_id = '$_cid' AND
653
-                                        user_id = '" . $user_id . "' AND
654
-                                        session_id = '" . $session_id . "'
653
+                                        user_id = '".$user_id."' AND
654
+                                        session_id = '" . $session_id."'
655 655
                                     LIMIT 1";
656 656
                             $result = Database::query($sql);
657 657
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
         if ($reset) { // session data refresh requested
798 798
             if ($group_id && $_cid && !empty($_course['real_id'])) { // have keys to search data
799 799
                 $group_table = Database::get_course_table(TABLE_GROUP);
800
-                $sql = "SELECT * FROM $group_table WHERE c_id = " . $_course['real_id'] . " AND id = '$group_id'";
800
+                $sql = "SELECT * FROM $group_table WHERE c_id = ".$_course['real_id']." AND id = '$group_id'";
801 801
                 $result = Database::query($sql);
802 802
                 if (Database::num_rows($result) > 0) { // This group has recorded status related to this course
803 803
                     $gpData = Database::fetch_array($result);
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
      */
851 851
     public static function get_user_accounts_by_username($username)
852 852
     {
853
-        if (strpos($username,'@')){
853
+        if (strpos($username, '@')) {
854 854
             $username = api_strtolower($username);
855 855
             $email = true;
856 856
         } else {
Please login to merge, or discard this patch.
main/admin/legal_add.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         } else {
48 48
             $changes = '';
49 49
         }
50
-        $submit  = $values['send'];
50
+        $submit = $values['send'];
51 51
 
52 52
         $default['content'] = $content;
53 53
         if (isset($values['language'])) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 Display::addFlash(Display::return_message($message));
67 67
                 header('Location: legal_list.php?sec_token='.$tok);
68 68
                 exit();
69
-            } elseif ($submit=='preview') {
69
+            } elseif ($submit == 'preview') {
70 70
                 $defaults['type'] = $type;
71 71
                 $defaults['content'] = $content;
72 72
                 $defaults['changes'] = $changes;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
                         $defaults = $term_preview;
83 83
                         if (!$term_preview) {
84 84
                             // there are not terms and conditions
85
-                            $term_preview['type']=-1;
86
-                            $defaults['type']=0;
85
+                            $term_preview['type'] = -1;
86
+                            $defaults['type'] = 0;
87 87
                         }
88 88
                     }
89 89
                 }
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
     $form->addElement('html', $buttons);
137 137
 
138 138
 } else {
139
-	$form->addElement('select_language', 'language', get_lang('Language'),null,array());
139
+	$form->addElement('select_language', 'language', get_lang('Language'), null, array());
140 140
 	$form->addButtonSearch(get_lang('Load'), 'send');
141 141
 
142 142
 }
143 143
 
144 144
 $tool_name = get_lang('AddTermsAndConditions');
145
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
145
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
146 146
 Display :: display_header($tool_name);
147 147
 
148 148
 echo '<script>
Please login to merge, or discard this patch.
main/admin/configure_inscription.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 $tool_name = get_lang('ConfigureInscription');
47 47
 if (!empty($action)) {
48 48
     $interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription'));
49
-    switch($action) {
49
+    switch ($action) {
50 50
         case 'edit_top':
51 51
             $tool_name = get_lang('EditTopRegister');
52 52
             break;
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
                 // This request is only the preparation for the update of the home_top
142 142
                 $home_top = '';
143 143
                 if (is_file($homep.$topf.'_'.$lang.$ext) && is_readable($homep.$topf.'_'.$lang.$ext)) {
144
-                    $home_top = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
144
+                    $home_top = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext);
145 145
                 } elseif (is_file($homep.$topf.$lang.$ext) && is_readable($homep.$topf.$lang.$ext)) {
146
-                    $home_top = @(string)file_get_contents($homep.$topf.$lang.$ext);
146
+                    $home_top = @(string) file_get_contents($homep.$topf.$lang.$ext);
147 147
                 } else {
148 148
                     $errorMsg = get_lang('HomePageFilesNotReadable');
149 149
                 }
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
     if (api_is_western_name_order()) {
185 185
         //	FIRST NAME and LAST NAME
186 186
         $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
187
-        $form->addElement('text', 'lastname',  get_lang('LastName'),  array('size' => 40, 'disabled' => 'disabled'));
187
+        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
188 188
     } else {
189 189
         //	LAST NAME and FIRST NAME
190
-        $form->addElement('text', 'lastname',  get_lang('LastName'),  array('size' => 40, 'disabled' => 'disabled'));
190
+        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
191 191
         $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
192 192
     }
193 193
     $form->applyFilter('firstname', 'trim');
194 194
     $form->applyFilter('lastname', 'trim');
195
-    $form->addRule('lastname',  get_lang('ThisFieldIsRequired'), 'required');
195
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
196 196
     $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
197 197
 
198 198
     //	EMAIL
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
211 211
     $form->addRule('username', get_lang('UsernameWrong'), 'username');
212 212
     $form->addRule('username', get_lang('UserTaken'), 'username_available');
213
-    $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
213
+    $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
214 214
 
215 215
     //	PASSWORD
216
-    $form->addElement('password', 'pass1', get_lang('Pass'),         array('size' => 40, 'disabled' => 'disabled'));
216
+    $form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled'));
217 217
     $form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 40, 'disabled' => 'disabled'));
218 218
     $form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required');
219 219
     $form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required');
@@ -241,25 +241,25 @@  discard block
 block discarded – undo
241 241
 
242 242
     //	EXTENDED FIELDS
243 243
     if (api_get_setting('extended_profile') == 'true' &&
244
-        api_get_setting('extendedprofile_registration','mycomptetences') == 'true'
244
+        api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true'
245 245
     ) {
246 246
         $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
247 247
     }
248 248
 
249 249
     if (api_get_setting('extended_profile') == 'true' &&
250
-        api_get_setting('extendedprofile_registration','mydiplomas') == 'true'
250
+        api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true'
251 251
     ) {
252 252
         $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
253 253
     }
254 254
 
255 255
     if (api_get_setting('extended_profile') == 'true' &&
256
-        api_get_setting('extendedprofile_registration','myteach') == 'true'
256
+        api_get_setting('extendedprofile_registration', 'myteach') == 'true'
257 257
     ) {
258 258
         $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
259 259
     }
260 260
 
261 261
     if (api_get_setting('extended_profile') == 'true' &&
262
-        api_get_setting('extendedprofile_registration','mypersonalopenarea') == 'true'
262
+        api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true'
263 263
     ) {
264 264
         $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
265 265
     }
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
 
350 350
 $form->setDefaults($defaults);
351 351
 
352
-switch ($action){
352
+switch ($action) {
353 353
     case 'edit_top':
354 354
         if ($action == 'edit_top') {
355 355
             $name = $topf;
356 356
             $open = $home_top;
357 357
         } else {
358 358
             $name = $newsf;
359
-            $open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext);
359
+            $open = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext);
360 360
             $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
361 361
         }
362 362
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
         $default = array();
368 368
         $form = new FormValidator('configure_inscription_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;'));
369
-        $renderer =& $form->defaultRenderer();
369
+        $renderer = & $form->defaultRenderer();
370 370
         $renderer->setHeaderTemplate('');
371 371
         $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
372 372
         $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 
386 386
         $open = '';
387 387
         if (file_exists($homep.$topf.'_'.$lang.$ext)) {
388
-            $open = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
388
+            $open = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext);
389 389
         } else {
390
-            $open = @(string)file_get_contents($homep.$topf.$ext);
390
+            $open = @(string) file_get_contents($homep.$topf.$ext);
391 391
         }
392 392
         $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
393 393
         if (!empty($open)) {
Please login to merge, or discard this patch.
main/admin/legal_list.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once '../inc/global.inc.php';
11 11
 $this_section = SECTION_PLATFORM_ADMIN;
12 12
 api_protect_admin_script();
13
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
13
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
14 14
 $tool_name = get_lang('TermsAndConditions');
15 15
 Display :: display_header($tool_name);
16 16
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 // action menu
20 20
 echo '<div class="actions">';
21 21
 echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_add.php">'.
22
-    Display::return_icon('edit.gif',get_lang('EditTermsAndConditions'), '').get_lang('EditTermsAndConditions').'</a>&nbsp;&nbsp;';
22
+    Display::return_icon('edit.gif', get_lang('EditTermsAndConditions'), '').get_lang('EditTermsAndConditions').'</a>&nbsp;&nbsp;';
23 23
 echo '</div>';
24 24
 
25 25
 $legal_count = LegalManager::count();
Please login to merge, or discard this patch.
main/admin/user_information.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 $interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList'));
43 43
 
44 44
 $userId = $user['user_id'];
45
-$tool_name = $user['complete_name'].(empty($user['official_code'])?'':' ('.$user['official_code'].')');
45
+$tool_name = $user['complete_name'].(empty($user['official_code']) ? '' : ' ('.$user['official_code'].')');
46 46
 $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
47 47
 $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
48 48
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         $tools = '<a href="course_information.php?code='.$courseCode.'">'.
420 420
             Display::return_icon('synthese_view.gif', get_lang('Overview')).'</a>'.
421 421
             '<a href="'.$courseInfo['course_public_url'].'">'.
422
-            Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>' .
422
+            Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>'.
423 423
             '<a href="course_edit.php?id='.$course->c_id.'">'.
424 424
             Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
425 425
         if ($course->status == STUDENT) {
Please login to merge, or discard this patch.
main/inc/lib/legal.lib.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             Database::insert($legal_table, $params);
45 45
 
46 46
             return true;
47
-        } elseif($last['type'] != $type && $language == $last['language_id']) {
47
+        } elseif ($last['type'] != $type && $language == $last['language_id']) {
48 48
             // Update
49 49
             $id = $last['id'];
50 50
             $params = [
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	public static function get_last_condition_version($language)
82 82
     {
83 83
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
84
-		$language= Database::escape_string($language);
84
+		$language = Database::escape_string($language);
85 85
 		$sql = "SELECT version FROM $legal_conditions_table
86 86
 		        WHERE language_id = '".$language."'
87 87
 		        ORDER BY id DESC LIMIT 1 ";
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	public static function get_last_condition($language)
105 105
     {
106 106
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
107
-		$language= Database::escape_string($language);
107
+		$language = Database::escape_string($language);
108 108
 		$sql = "SELECT * FROM $legal_conditions_table
109 109
                 WHERE language_id = '".$language."'
110 110
                 ORDER BY version DESC
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
                 ORDER BY version DESC
156 156
                 LIMIT 1 ";
157 157
         $result = Database::query($sql);
158
-        if (Database::num_rows($result)>0){
158
+        if (Database::num_rows($result) > 0) {
159 159
             $version = Database::fetch_array($result);
160
-            $version = explode(':',$version[0]);
160
+            $version = explode(':', $version[0]);
161 161
 
162 162
             return $version[0];
163 163
         } else {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 break;
185 185
                 // Page link
186 186
             case 1:
187
-                $preview ='<fieldset>
187
+                $preview = '<fieldset>
188 188
                              <legend>'.get_lang('TermsAndConditions').'</legend>';
189 189
                 $preview .= '<div id="legal-accept-wrapper" class="form-item">
190 190
                 <label class="option" for="legal-accept">
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		$number_of_items = intval($number_of_items);
217 217
 		$column = intval($column);
218 218
 
219
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
219
+ 		$sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
220 220
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
221 221
 		$sql .= "ORDER BY language, version ASC ";
222 222
 		$sql .= "LIMIT $from, $number_of_items ";
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		        FROM $legal_conditions_table
254 254
 		        ORDER BY id DESC ";
255 255
 		$result = Database::query($sql);
256
-		$url = Database::fetch_array($result,'ASSOC');
256
+		$url = Database::fetch_array($result, 'ASSOC');
257 257
 		$result = $url['count_result'];
258 258
 
259 259
 		return $result;
@@ -274,6 +274,6 @@  discard block
 block discarded – undo
274 274
 		        WHERE id =  "'.$legal_id.'" AND language_id="'.$language_id.'"';
275 275
 		$rs = Database::query($sql);
276 276
 
277
-		return Database::result($rs,0,'type');
277
+		return Database::result($rs, 0, 'type');
278 278
 	}
279 279
 }
Please login to merge, or discard this patch.
main/admin/add_users_to_usergroup.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 api_protect_admin_script(true);
19 19
 
20 20
 // setting breadcrumbs
21
-$interbreadcrumb[]= array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
22
-$interbreadcrumb[]= array('url' => 'usergroups.php','name' => get_lang('Classes'));
21
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
22
+$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
23 23
 
24 24
 // Database Table Definitions
25 25
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 
92 92
 </script>';
93 93
 
94
-$form_sent  = 0;
94
+$form_sent = 0;
95 95
 
96 96
 $extra_field_list = UserManager::get_extra_fields();
97 97
 $new_field_list = array();
98 98
 if (is_array($extra_field_list)) {
99 99
     foreach ($extra_field_list as $extra_field) {
100 100
         //if is enabled to filter and is a "<select>" field type
101
-        if ($extra_field[8]==1 && $extra_field[2]==4 ) {
101
+        if ($extra_field[8] == 1 && $extra_field[2] == 4) {
102 102
             $new_field_list[] = array(
103 103
                 'name'=> $extra_field[3],
104 104
                 'variable' => $extra_field[1], 'data'=> $extra_field[9]
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         foreach ($users as $user) {
147 147
             $data[] = array($user['username'], $groupInfo['name']);
148 148
         }
149
-        $filename = 'export_user_class_' . api_get_local_time();
149
+        $filename = 'export_user_class_'.api_get_local_time();
150 150
         Export::arrayToCsv($data, $filename);
151 151
         exit;
152 152
     }
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 // Filter by Extra Fields
157 157
 $use_extra_fields = false;
158 158
 if (is_array($extra_field_list)) {
159
-    if (is_array($new_field_list) && count($new_field_list)>0 ) {
159
+    if (is_array($new_field_list) && count($new_field_list) > 0) {
160 160
         foreach ($new_field_list as $new_field) {
161 161
             $varname = 'field_'.$new_field['variable'];
162 162
             if (UserManager::is_extra_field_available($new_field['variable'])) {
163
-                if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
163
+                if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
164 164
                     $use_extra_fields = true;
165 165
                     $extra_field_result[] = UserManager::get_extra_user_data_by_value(
166 166
                         $new_field['variable'],
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 
175 175
 if ($use_extra_fields) {
176 176
     $final_result = array();
177
-    if (count($extra_field_result)>1) {
178
-        for ($i=0; $i<count($extra_field_result)-1; $i++) {
179
-            if (is_array($extra_field_result[$i+1])) {
180
-                $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]);
177
+    if (count($extra_field_result) > 1) {
178
+        for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
179
+            if (is_array($extra_field_result[$i + 1])) {
180
+                $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
181 181
             }
182 182
         }
183 183
     } else {
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
198 198
 $searchForm->addHeader(get_lang('AdvancedSearch'));
199
-$renderer =& $searchForm->defaultRenderer();
199
+$renderer = & $searchForm->defaultRenderer();
200 200
 
201 201
 $searchForm->addElement('hidden', 'id', $id);
202 202
 foreach ($filters as $param) {
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 $searchForm->display();
346 346
 echo '</div>';
347 347
 ?>
348
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;">
348
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;">
349 349
 <?php
350 350
 echo '<legend>'.$tool_name.': '.$data['name'].'</legend>';
351 351
 
352 352
 
353 353
     if (is_array($extra_field_list)) {
354
-        if (is_array($new_field_list) && count($new_field_list)>0) {
354
+        if (is_array($new_field_list) && count($new_field_list) > 0) {
355 355
             echo '<h3>'.get_lang('FilterByUser').'</h3>';
356 356
             foreach ($new_field_list as $new_field) {
357 357
                 echo $new_field['name'];
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                 echo '&nbsp;<select name="'.$varname.'">';
360 360
                 echo '<option value="0">--'.get_lang('Select').'--</option>';
361 361
                 foreach ($new_field['data'] as $option) {
362
-                    $checked='';
362
+                    $checked = '';
363 363
                     if (isset($_POST[$varname])) {
364 364
                         if ($_POST[$varname] == $option[1]) {
365 365
                             $checked = 'selected="true"';
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
         <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?>
387 387
         <select name="relation" id="relation">
388 388
             <option value=""><?php echo get_lang('SelectARelationType')?></option>
389
-            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN)?'selected=selected':'') ?> >
389
+            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> >
390 390
                 <?php echo get_lang('Admin') ?></option>
391
-            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER)?'selected=selected':'') ?> >
391
+            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> >
392 392
                 <?php echo get_lang('Reader') ?></option>
393
-            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION)?'selected=selected':'') ?> >
393
+            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> >
394 394
                 <?php echo get_lang('PendingInvitation') ?></option>
395
-            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR)?'selected=selected':'') ?> >
395
+            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> >
396 396
                 <?php echo get_lang('Moderator') ?></option>
397
-            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM)?'selected=selected':'') ?> >
397
+            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> >
398 398
                 <?php echo get_lang('Drh') ?></option>
399 399
         </select>
400 400
         <?php } ?>
@@ -414,13 +414,13 @@  discard block
 block discarded – undo
414 414
         'elements_not_in_name',
415 415
         $elements_not_in,
416 416
         '',
417
-        array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),
417
+        array('class'=>'col-md-7', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'),
418 418
         false
419 419
     );
420 420
     ?>
421 421
     <br />
422 422
       <label class="control-label">
423
-          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
423
+          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"'; ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
424 424
           <?php echo get_lang('UsersRegisteredInAnyGroup'); ?>
425 425
       </label>
426 426
     </div>
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             'elements_in_name[]',
445 445
             $elements_in,
446 446
             '',
447
-            array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'),
447
+            array('class'=>'col-md-7', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'),
448 448
             false
449 449
         );
450 450
         unset($sessionUsersList);
Please login to merge, or discard this patch.