Completed
Push — 1.10.x ( ad23de...73a570 )
by Yannick
448:11 queued 407:15
created
main/inc/lib/link.lib.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
         $params['session_id'] = api_get_session_id();
78 78
         $params['category_id'] = isset($params['category_id']) ? $params['category_id'] : 0;
79 79
 
80
-        $sql =  "SELECT MAX(display_order)
80
+        $sql = "SELECT MAX(display_order)
81 81
                 FROM  ".$this->table."
82 82
                 WHERE
83 83
                     c_id = $courseId AND
84
-                    category_id = '" . intval($params['category_id'])."'";
84
+                    category_id = '".intval($params['category_id'])."'";
85 85
         $result = Database:: query($sql);
86 86
         list ($orderMax) = Database:: fetch_row($result);
87 87
         $order = $orderMax + 1;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
             // We ensure URL to be absolute.
187 187
             if (strpos($urllink, '://') === false) {
188
-                $urllink = 'http://' . $urllink;
188
+                $urllink = 'http://'.$urllink;
189 189
             }
190 190
 
191 191
             // If the title is empty, we use the URL as title.
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                     'c_id' => $course_id,
208 208
                     'url' => $urllink,
209 209
                     'title' => $title,
210
-                    'description' => $description ,
210
+                    'description' => $description,
211 211
                     'category_id' => $selectcategory,
212 212
                     'on_homepage' => $onhomepage,
213 213
                     'target' => $target,
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
                 if ((api_get_setting('search_enabled') == 'true') &&
221 221
                     $link_id && extension_loaded('xapian')
222 222
                 ) {
223
-                    require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
224
-                    require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
225
-                    require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
223
+                    require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
224
+                    require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
225
+                    require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
226 226
 
227 227
                     $course_int_id = $_course['real_id'];
228 228
                     $courseCode = $_course['code'];
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                         if (isset ($_REQUEST[$specific_field['code']])) {
236 236
                             $sterms = trim($_REQUEST[$specific_field['code']]);
237 237
                             if (!empty ($sterms)) {
238
-                                $all_specific_terms .= ' ' . $sterms;
238
+                                $all_specific_terms .= ' '.$sterms;
239 239
                                 $sterms = explode(',', $sterms);
240 240
                                 foreach ($sterms as $sterm) {
241 241
                                     $ic_slide->addTerm(
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
                         SE_COURSE_ID => $courseCode,
263 263
                         SE_TOOL_ID => TOOL_LINK,
264 264
                         SE_DATA => array(
265
-                            'link_id' => (int)$link_id
265
+                            'link_id' => (int) $link_id
266 266
                         ),
267
-                        SE_USER => (int)api_get_user_id(),
267
+                        SE_USER => (int) api_get_user_id(),
268 268
                     );
269 269
                     $ic_slide->xapian_data = serialize($xapian_data);
270
-                    $description = $all_specific_terms . ' ' . $description;
270
+                    $description = $all_specific_terms.' '.$description;
271 271
                     $ic_slide->addValue('content', $description);
272 272
 
273 273
                     // Add category name if set.
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                         $sql_cat = sprintf(
280 280
                             $sql_cat,
281 281
                             $table_link_category,
282
-                            (int)$selectcategory,
282
+                            (int) $selectcategory,
283 283
                             $course_int_id
284 284
                         );
285 285
                         $result = Database:: query($sql_cat);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
                 // This will make a restore function possible for the platform administrator.
400 400
 
401 401
                 $sql = "UPDATE $tbl_link SET on_homepage='0'
402
-                        WHERE c_id = $course_id AND id='" . $id . "'";
402
+                        WHERE c_id = $course_id AND id='".$id."'";
403 403
                 Database:: query($sql);
404 404
 
405 405
                 api_item_property_update(
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
                 break;
416 416
             case 'category':
417 417
                 // First we delete the category itself and afterwards all the links of this category.
418
-                $sql = "DELETE FROM " . $tbl_categories . "
419
-                        WHERE c_id = $course_id AND id='" . $id . "'";
418
+                $sql = "DELETE FROM ".$tbl_categories."
419
+                        WHERE c_id = $course_id AND id='".$id."'";
420 420
                 Database:: query($sql);
421 421
 
422
-                $sql = "DELETE FROM " . $tbl_link . "
423
-                        WHERE c_id = $course_id AND category_id='" . $id . "'";
422
+                $sql = "DELETE FROM ".$tbl_link."
423
+                        WHERE c_id = $course_id AND category_id='".$id."'";
424 424
                 Database:: query($sql);
425 425
 
426 426
                 api_item_property_update(
@@ -459,16 +459,16 @@  discard block
 block discarded – undo
459 459
                 $row = Database:: fetch_array($res);
460 460
                 require_once api_get_path(
461 461
                         LIBRARY_PATH
462
-                    ) . 'search/ChamiloIndexer.class.php';
462
+                    ).'search/ChamiloIndexer.class.php';
463 463
                 $di = new ChamiloIndexer();
464
-                $di->remove_document((int)$row['search_did']);
464
+                $di->remove_document((int) $row['search_did']);
465 465
             }
466 466
             $sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1';
467 467
             $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_LINK, $link_id);
468 468
             Database:: query($sql);
469 469
 
470 470
             // Remove terms from db.
471
-            require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
471
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
472 472
             delete_all_values_for_item($course_id, TOOL_DOCUMENT, $link_id);
473 473
         }
474 474
     }
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
     {
485 485
         $tbl_link = Database:: get_course_table(TABLE_LINK);
486 486
         $course_id = api_get_course_int_id();
487
-        $sql = "SELECT * FROM " . $tbl_link . "
488
-                WHERE c_id = $course_id AND id='" . intval($id) . "' ";
487
+        $sql = "SELECT * FROM ".$tbl_link."
488
+                WHERE c_id = $course_id AND id='".intval($id)."' ";
489 489
         $result = Database::query($sql);
490 490
         $data = array();
491 491
         if (Database::num_rows($result)) {
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
         // We ensure URL to be absolute.
516 516
         if (strpos($values['url'], '://') === false) {
517
-            $values['url'] = 'http://' . $_POST['url'];
517
+            $values['url'] = 'http://'.$_POST['url'];
518 518
         }
519 519
 
520 520
         // If the title is empty, we use the URL as title.
@@ -532,18 +532,18 @@  discard block
 block discarded – undo
532 532
         }
533 533
 
534 534
         // Finding the old category_id.
535
-        $sql = "SELECT * FROM " . $tbl_link . "
536
-                WHERE c_id = $course_id AND id='" . $id . "'";
535
+        $sql = "SELECT * FROM ".$tbl_link."
536
+                WHERE c_id = $course_id AND id='".$id."'";
537 537
         $result = Database:: query($sql);
538 538
         $row = Database:: fetch_array($result);
539 539
         $category_id = $row['category_id'];
540 540
 
541 541
         if ($category_id != $values['category_id']) {
542 542
             $sql = "SELECT MAX(display_order)
543
-                    FROM " . $tbl_link . "
543
+                    FROM " . $tbl_link."
544 544
                     WHERE
545 545
                         c_id = $course_id AND
546
-                        category_id='" . intval($values['category_id']) . "'";
546
+                        category_id='".intval($values['category_id'])."'";
547 547
             $result = Database:: query($sql);
548 548
             list ($max_display_order) = Database:: fetch_row($result);
549 549
             $max_display_order++;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
             'target' => $values['target'],
561 561
             'category_id' => $values['category_id'],
562 562
         ];
563
-        Database::update($tbl_link, $params, ['c_id = ? AND id = ?' => [$course_id, $id] ]);
563
+        Database::update($tbl_link, $params, ['c_id = ? AND id = ?' => [$course_id, $id]]);
564 564
 
565 565
         // Update search enchine and its values table if enabled.
566 566
         if (api_get_setting('search_enabled') == 'true') {
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                             $_REQUEST[$specific_field['code']]
614 614
                         );
615 615
                         if (!empty ($sterms)) {
616
-                            $all_specific_terms .= ' ' . $sterms;
616
+                            $all_specific_terms .= ' '.$sterms;
617 617
                             $sterms = explode(',', $sterms);
618 618
                             foreach ($sterms as $sterm) {
619 619
                                 $ic_slide->addTerm(
@@ -640,13 +640,13 @@  discard block
 block discarded – undo
640 640
                     SE_COURSE_ID => $course_id,
641 641
                     SE_TOOL_ID => TOOL_LINK,
642 642
                     SE_DATA => array(
643
-                        'link_id' => (int)$id
643
+                        'link_id' => (int) $id
644 644
                     ),
645
-                    SE_USER => (int)api_get_user_id(),
645
+                    SE_USER => (int) api_get_user_id(),
646 646
 
647 647
                 );
648 648
                 $ic_slide->xapian_data = serialize($xapian_data);
649
-                $link_description = $all_specific_terms . ' ' . $link_description;
649
+                $link_description = $all_specific_terms.' '.$link_description;
650 650
                 $ic_slide->addValue('content', $link_description);
651 651
 
652 652
                 // Add category name if set.
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                 $di = new ChamiloIndexer();
675 675
                 isset ($_POST['language']) ? $lang = Database:: escape_string($_POST['language']) : $lang = 'english';
676 676
                 $di->connectDb(null, null, $lang);
677
-                $di->remove_document((int)$se_ref['search_did']);
677
+                $di->remove_document((int) $se_ref['search_did']);
678 678
                 $di->addChunk($ic_slide);
679 679
 
680 680
                 // Index and return search engine document id.
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         $sql = "SELECT *, linkcat.id
792 792
                 FROM $tblLinkCategory linkcat
793 793
                 WHERE
794
-                    linkcat.c_id = " . $courseId . "
794
+                    linkcat.c_id = ".$courseId."
795 795
                     $sessionCondition
796 796
                 ORDER BY linkcat.display_order DESC";
797 797
 
@@ -803,10 +803,10 @@  discard block
 block discarded – undo
803 803
                 INNER JOIN $tblItemProperty itemproperties
804 804
                 ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id)
805 805
                 WHERE
806
-                    itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND
806
+                    itemproperties.tool = '".TOOL_LINK_CATEGORY."' AND
807 807
                     (itemproperties.visibility = '0' OR itemproperties.visibility = '1')
808 808
                     $sessionCondition AND
809
-                    linkcat.c_id = " . $courseId . "
809
+                    linkcat.c_id = ".$courseId."
810 810
                 ORDER BY linkcat.display_order DESC";
811 811
 
812 812
         $result = Database::query($sql);
@@ -829,10 +829,10 @@  discard block
 block discarded – undo
829 829
                 INNER JOIN $tblItemProperty itemproperties
830 830
                 ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id)
831 831
                 WHERE
832
-                    itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND
832
+                    itemproperties.tool = '".TOOL_LINK_CATEGORY."' AND
833 833
                     (itemproperties.visibility = '0' OR itemproperties.visibility = '1')
834 834
                     $sessionCondition AND
835
-                    linkcat.c_id = " . $courseId . "
835
+                    linkcat.c_id = ".$courseId."
836 836
                 ORDER BY linkcat.display_order DESC
837 837
                 ";
838 838
         $result = Database::query($sql);
@@ -864,12 +864,12 @@  discard block
 block discarded – undo
864 864
                 INNER JOIN $TABLE_ITEM_PROPERTY itemproperties
865 865
                 ON (link.id=itemproperties.ref AND link.c_id = itemproperties.c_id )
866 866
                 WHERE
867
-                    itemproperties.tool='" . TOOL_LINK . "' AND
868
-                    link.category_id='" . $catid . "' AND
867
+                    itemproperties.tool='".TOOL_LINK."' AND
868
+                    link.category_id='" . $catid."' AND
869 869
                     (itemproperties.visibility='0' OR itemproperties.visibility='1')
870 870
                     $condition_session AND
871
-                    link.c_id = " . $course_id . " AND
872
-                    itemproperties.c_id = " . $course_id . "
871
+                    link.c_id = ".$course_id." AND
872
+                    itemproperties.c_id = " . $course_id."
873 873
                 ORDER BY link.display_order DESC";
874 874
         $result = Database:: query($sql);
875 875
         $numberoflinks = Database:: num_rows($result);
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
                             'retweet',
893 893
                             'default btn-sm',
894 894
                             array(
895
-                                'onclick' => "check_url('" . $myrow['id'] . "', '" . addslashes($myrow['url']) . "');",
895
+                                'onclick' => "check_url('".$myrow['id']."', '".addslashes($myrow['url'])."');",
896 896
                                 'title' => get_lang('CheckURL')
897 897
                                 )
898 898
                             );
899 899
                     $link_validator .= Display::span(
900 900
                         '',
901 901
                         array(
902
-                            'id' => 'url_id_' . $myrow['id'],
902
+                            'id' => 'url_id_'.$myrow['id'],
903 903
                             'class' => 'check-link'
904 904
                             )
905 905
                     );
@@ -909,10 +909,10 @@  discard block
 block discarded – undo
909 909
                 if (api_is_allowed_to_edit(null, true)) {
910 910
 
911 911
                     if ($session_id == $myrow['session_id']) {
912
-                        $url = api_get_self() . '?' . api_get_cidreq() .
913
-                            '&action=editlink&category=' . (!empty ($category) ? $category : '') .
914
-                            '&id=' . $myrow['id'] .
915
-                            '&category_id=' . $myrow['id'];
912
+                        $url = api_get_self().'?'.api_get_cidreq().
913
+                            '&action=editlink&category='.(!empty ($category) ? $category : '').
914
+                            '&id='.$myrow['id'].
915
+                            '&category_id='.$myrow['id'];
916 916
                         $title = get_lang('Edit');
917 917
                         $toolbar .= Display::toolbarButton(
918 918
                             '',
@@ -940,10 +940,10 @@  discard block
 block discarded – undo
940 940
                         }*/
941 941
 
942 942
                         if ($myrow['visibility'] == '1') {
943
-                            $url .= 'link.php?' . api_get_cidreq() .
944
-                                '&sec_token=' . $token .
945
-                                '&action=invisible&id=' . $myrow['id'] .
946
-                                '&scope=link&category_id=' . $myrow['category_id'];
943
+                            $url .= 'link.php?'.api_get_cidreq().
944
+                                '&sec_token='.$token.
945
+                                '&action=invisible&id='.$myrow['id'].
946
+                                '&scope=link&category_id='.$myrow['category_id'];
947 947
                             $title = get_lang('MakeInvisible');
948 948
                             $toolbar .= Display::toolbarButton(
949 949
                                 '',
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 
958 958
                         }
959 959
                         if ($myrow['visibility'] == '0') {
960
-                            $url .= 'link.php?' . api_get_cidreq() .'&sec_token=' . $token .'&action=visible&id=' . $myrow['id'] .'&scope=link&category_id=' . $myrow['category_id'];
960
+                            $url .= 'link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope=link&category_id='.$myrow['category_id'];
961 961
                             $title = get_lang('MakeVisible');
962 962
                             $toolbar .= Display::toolbarButton(
963 963
                                 '',
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
                             );
971 971
                         }
972 972
 
973
-                        $url .= api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=deletelink&id=' . $myrow['id'] .'&category_id=' . $myrow['category_id'];
974
-                        $event = "javascript: if(!confirm('" . get_lang('LinkDelconfirm') . "'))return false;";
973
+                        $url .= api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletelink&id='.$myrow['id'].'&category_id='.$myrow['category_id'];
974
+                        $event = "javascript: if(!confirm('".get_lang('LinkDelconfirm')."'))return false;";
975 975
                         $title = get_lang('Delete');
976 976
 
977 977
                         $toolbar .= Display::toolbarButton(
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                     $content .= '<div class="pull-right"><div class="btn-group">'.$toolbar.'</div></div>';
1013 1013
                     $content .= '<h4 class="list-group-item-heading">';
1014 1014
                     $content .= $iconLink;
1015
-                    $url =  'link_goto.php?' . api_get_cidreq() .'&link_id=' . $myrow['id'] .'&link_url=' . urlencode($myrow['url']);
1015
+                    $url = 'link_goto.php?'.api_get_cidreq().'&link_id='.$myrow['id'].'&link_url='.urlencode($myrow['url']);
1016 1016
                     $content .= Display::tag(
1017 1017
                             'a',
1018 1018
                             Security:: remove_XSS($myrow['title']),
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
                     $content .= $session_img;
1026 1026
                     $content .= '</h4>';
1027 1027
 
1028
-                    $content .= '<p class="list-group-item-text">' . $myrow['description'] . '</p>';
1028
+                    $content .= '<p class="list-group-item-text">'.$myrow['description'].'</p>';
1029 1029
                     $content .= '</div>';
1030 1030
                 } else {
1031 1031
                     if (api_is_allowed_to_edit(null, true)) {
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
                         $content .= '<div class="pull-right"><div class="btn-group">'.$toolbar.'</div></div>';
1034 1034
                         $content .= '<h4 class="list-group-item-heading">';
1035 1035
                         $content .= $iconLink;
1036
-                        $url = 'link_goto.php?' . api_get_cidreq() .'&link_id=' . $myrow['id'] . "&link_url=" . urlencode($myrow['url']);
1036
+                        $url = 'link_goto.php?'.api_get_cidreq().'&link_id='.$myrow['id']."&link_url=".urlencode($myrow['url']);
1037 1037
                         $content .= Display::tag(
1038 1038
                                 'a',
1039 1039
                                 Security:: remove_XSS($myrow['title']),
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
                         $content .= $link_validator;
1047 1047
                         $content .= $session_img;
1048 1048
                         $content .= '</h4>';
1049
-                        $content .= '<p class="list-group-item-text">' . $myrow['description'] . '</p>';
1049
+                        $content .= '<p class="list-group-item-text">'.$myrow['description'].'</p>';
1050 1050
                         $content .= '</div>';
1051 1051
                     }
1052 1052
                 }
@@ -1068,58 +1068,58 @@  discard block
 block discarded – undo
1068 1068
     {
1069 1069
         $categoryId = $category['id'];
1070 1070
         $token = null;
1071
-        $tools = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&sec_token=' . $token . '&action=editcategory&id=' . $categoryId . '&category_id=' . $categoryId . '" title=' . get_lang('Modify') . '">' .
1071
+        $tools = '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=editcategory&id='.$categoryId.'&category_id='.$categoryId.'" title='.get_lang('Modify').'">'.
1072 1072
             Display:: return_icon(
1073 1073
                 'edit.png',
1074 1074
                 get_lang('Modify'),
1075 1075
                 array(),
1076 1076
                 ICON_SIZE_SMALL
1077
-            ) . '</a>';
1077
+            ).'</a>';
1078 1078
 
1079 1079
         // DISPLAY MOVE UP COMMAND only if it is not the top link.
1080 1080
         if ($currentCategory != 0) {
1081
-            $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&sec_token=' . $token . '&action=up&up='.$categoryId.'&category_id='.$categoryId.'" title="'.get_lang('Up').'">'.
1081
+            $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=up&up='.$categoryId.'&category_id='.$categoryId.'" title="'.get_lang('Up').'">'.
1082 1082
                 Display:: return_icon(
1083 1083
                     'up.png',
1084 1084
                     get_lang('Up'),
1085 1085
                     array(),
1086 1086
                     ICON_SIZE_SMALL
1087
-                ) . '</a>';
1087
+                ).'</a>';
1088 1088
         } else {
1089 1089
             $tools .= Display:: return_icon(
1090 1090
                 'up_na.png',
1091 1091
                 get_lang('Up'),
1092 1092
                 array(),
1093 1093
                 ICON_SIZE_SMALL
1094
-            ) . '</a>';
1094
+            ).'</a>';
1095 1095
         }
1096 1096
 
1097 1097
         // DISPLAY MOVE DOWN COMMAND only if it is not the bottom link.
1098
-        if ($currentCategory < $countCategories-1) {
1099
-            $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=down&down=' . $categoryId .'&category_id=' . $categoryId . '">'.
1098
+        if ($currentCategory < $countCategories - 1) {
1099
+            $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=down&down='.$categoryId.'&category_id='.$categoryId.'">'.
1100 1100
                 Display:: return_icon(
1101 1101
                     'down.png',
1102 1102
                     get_lang('Down'),
1103 1103
                     array(),
1104 1104
                     ICON_SIZE_SMALL
1105
-                ) . '</a>';
1105
+                ).'</a>';
1106 1106
         } else {
1107 1107
             $tools .= Display:: return_icon(
1108 1108
                     'down_na.png',
1109 1109
                     get_lang('Down'),
1110 1110
                     array(),
1111 1111
                     ICON_SIZE_SMALL
1112
-                ) . '</a>';
1112
+                ).'</a>';
1113 1113
         }
1114 1114
 
1115
-        $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=deletecategory&id='.$categoryId.            "&category_id=$categoryId\"
1116
-            onclick=\"javascript: if(!confirm('" . get_lang('CategoryDelconfirm') . "')) return false;\">".
1115
+        $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletecategory&id='.$categoryId."&category_id=$categoryId\"
1116
+            onclick=\"javascript: if(!confirm('".get_lang('CategoryDelconfirm')."')) return false;\">".
1117 1117
             Display:: return_icon(
1118 1118
                 'delete.png',
1119 1119
                 get_lang('Delete'),
1120 1120
                 array(),
1121 1121
                 ICON_SIZE_SMALL
1122
-            ) . '</a>';
1122
+            ).'</a>';
1123 1123
 
1124 1124
         return $tools;
1125 1125
     }
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
             $movetable = $tbl_link;
1167 1167
             // Getting the category of the link.
1168 1168
             if (!empty ($thiscatlinkId)) {
1169
-                $sql = "SELECT category_id FROM " . $movetable . "
1169
+                $sql = "SELECT category_id FROM ".$movetable."
1170 1170
                         WHERE c_id = $courseId AND id='$thiscatlinkId'";
1171 1171
                 $result = Database:: query($sql);
1172 1172
                 $catid = Database:: fetch_array($result);
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
                         ORDER BY display_order $sortDirection";
1187 1187
             } else {
1188 1188
                 $sql = "SELECT id, display_order FROM  $movetable
1189
-                        WHERE c_id = $courseId AND category_id='" . $catid[0] . "'
1189
+                        WHERE c_id = $courseId AND category_id='".$catid[0]."'
1190 1190
                         ORDER BY display_order $sortDirection";
1191 1191
             }
1192 1192
             $linkresult = Database:: query($sql);
@@ -1200,12 +1200,12 @@  discard block
 block discarded – undo
1200 1200
                     $nextlinkOrder = $sortrow['display_order'];
1201 1201
 
1202 1202
                     Database:: query(
1203
-                        "UPDATE " . $movetable . "
1203
+                        "UPDATE ".$movetable."
1204 1204
                         SET display_order = '$nextlinkOrder'
1205 1205
                         WHERE c_id = $courseId  AND id =  '$thiscatlinkId'"
1206 1206
                     );
1207 1207
                     Database:: query(
1208
-                        "UPDATE " . $movetable . "
1208
+                        "UPDATE ".$movetable."
1209 1209
                         SET display_order = '$thislinkOrder'
1210 1210
                         WHERE c_id = $courseId  AND id =  '$nextlinkId'"
1211 1211
                     );
@@ -1233,10 +1233,10 @@  discard block
 block discarded – undo
1233 1233
         $course_id = api_get_course_int_id();
1234 1234
 
1235 1235
         $result = Database:: query(
1236
-            "SELECT id FROM " . $tbl_categories . "
1237
-            WHERE c_id = $course_id AND category_title='" . Database::escape_string(
1236
+            "SELECT id FROM ".$tbl_categories."
1237
+            WHERE c_id = $course_id AND category_title='".Database::escape_string(
1238 1238
                 $catname
1239
-            ) . "'"
1239
+            )."'"
1240 1240
         );
1241 1241
         if (Database:: num_rows($result) >= 1 && ($row = Database:: fetch_array(
1242 1242
                 $result
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
         }
1247 1247
 
1248 1248
         $result = Database:: query(
1249
-            "SELECT MAX(display_order) FROM " . $tbl_categories . " WHERE c_id = $course_id "
1249
+            "SELECT MAX(display_order) FROM ".$tbl_categories." WHERE c_id = $course_id "
1250 1250
         );
1251 1251
         list ($max_order) = Database:: fetch_row($result);
1252 1252
 
@@ -1273,12 +1273,12 @@  discard block
 block discarded – undo
1273 1273
         $tbl_link = Database:: get_course_table(TABLE_LINK);
1274 1274
         $course_id = api_get_course_int_id();
1275 1275
 
1276
-        $urleq = "url='" . Database:: escape_string($url) . "'";
1277
-        $cateq = "category_id=" . intval($cat);
1276
+        $urleq = "url='".Database:: escape_string($url)."'";
1277
+        $cateq = "category_id=".intval($cat);
1278 1278
 
1279 1279
         $result = Database:: query("
1280 1280
             SELECT id FROM $tbl_link
1281
-            WHERE c_id = $course_id AND " . $urleq . ' AND ' . $cateq
1281
+            WHERE c_id = $course_id AND ".$urleq.' AND '.$cateq
1282 1282
         );
1283 1283
 
1284 1284
         if (Database:: num_rows($result) >= 1 && ($row = Database:: fetch_array(
@@ -1286,14 +1286,14 @@  discard block
 block discarded – undo
1286 1286
             ))
1287 1287
         ) {
1288 1288
             Database:: query(
1289
-                "UPDATE $tbl_link set title='" . Database:: escape_string(
1289
+                "UPDATE $tbl_link set title='".Database:: escape_string(
1290 1290
                     $title
1291
-                ) . "', description='" . Database:: escape_string(
1291
+                )."', description='".Database:: escape_string(
1292 1292
                     $description
1293
-                ) . "'
1294
-                WHERE c_id = $course_id AND  id='" . Database:: escape_string(
1293
+                )."'
1294
+                WHERE c_id = $course_id AND  id='".Database:: escape_string(
1295 1295
                     $row['id']
1296
-                ) . "'"
1296
+                )."'"
1297 1297
             );
1298 1298
 
1299 1299
             $ipu = 'LinkUpdated';
@@ -1302,18 +1302,18 @@  discard block
 block discarded – undo
1302 1302
             // Add new link
1303 1303
             $result = Database:: query(
1304 1304
                 "SELECT MAX(display_order) FROM  $tbl_link
1305
-                WHERE c_id = $course_id AND category_id='" . intval($cat) . "'"
1305
+                WHERE c_id = $course_id AND category_id='".intval($cat)."'"
1306 1306
             );
1307 1307
             list ($max_order) = Database:: fetch_row($result);
1308 1308
 
1309 1309
             Database:: query(
1310 1310
                 "INSERT INTO $tbl_link (c_id, url, title, description, category_id, display_order, on_homepage)
1311
-                VALUES (" . api_get_course_int_id() . ",
1312
-                '" . Database:: escape_string($url) . "',
1313
-                '" . Database:: escape_string($title) . "',
1314
-                '" . Database:: escape_string($description) . "',
1315
-                '" . intval($cat) . "','" . (intval($max_order) + 1) . "',
1316
-                '" . intval($on_homepage) .
1311
+                VALUES (".api_get_course_int_id().",
1312
+                '" . Database:: escape_string($url)."',
1313
+                '" . Database:: escape_string($title)."',
1314
+                '" . Database:: escape_string($description)."',
1315
+                '" . intval($cat)."','".(intval($max_order) + 1)."',
1316
+                '" . intval($on_homepage).
1317 1317
                 "')"
1318 1318
             );
1319 1319
 
@@ -1391,30 +1391,30 @@  discard block
 block discarded – undo
1391 1391
                     )
1392 1392
                 ) { // possibly in <...>
1393 1393
                     if (($kwlist = trim($regs[1])) != '') {
1394
-                        $kw = '<i kw="' . htmlspecialchars($kwlist) . '">';
1394
+                        $kw = '<i kw="'.htmlspecialchars($kwlist).'">';
1395 1395
                     } else {
1396 1396
                         $kw = '';
1397 1397
                     }
1398 1398
                     // i.e. assume only one of the $hide_fields will be present
1399 1399
                     // and if found, hide the value as expando property of an <i> tag
1400 1400
                 } elseif (trim($value)) {
1401
-                    $d .= ', ' . $key . ':' . $value;
1401
+                    $d .= ', '.$key.':'.$value;
1402 1402
                 }
1403 1403
             }
1404 1404
         }
1405 1405
         if (!empty($d)) {
1406
-            $d = substr($d, 2) . ' - ';
1406
+            $d = substr($d, 2).' - ';
1407 1407
         }
1408 1408
 
1409 1409
         return Link::put_link(
1410 1410
             $url,
1411 1411
             $cat,
1412 1412
             $title,
1413
-            $kw . ereg_replace(
1413
+            $kw.ereg_replace(
1414 1414
                 '\[((/?(b|big|i|small|sub|sup|u))|br/)\]',
1415 1415
                 '<\\1>',
1416
-                htmlspecialchars($d . $linkdata['description'])
1417
-            ) . ($kw ? '</i>' : ''),
1416
+                htmlspecialchars($d.$linkdata['description'])
1417
+            ).($kw ? '</i>' : ''),
1418 1418
             $linkdata['on_homepage'] ? '1' : '0',
1419 1419
             $linkdata['hidden'] ? '1' : '0'
1420 1420
         );
@@ -1535,19 +1535,19 @@  discard block
 block discarded – undo
1535 1535
         echo '<div class="actions">';
1536 1536
         if (api_is_allowed_to_edit(null, true)) {
1537 1537
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addlink&category_id='.$categoryId.'">'.
1538
-                Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>';
1538
+                Display::return_icon('new_link.png', get_lang('LinkAdd'), '', ICON_SIZE_MEDIUM).'</a>';
1539 1539
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addcategory&category_id='.$categoryId.'">'.
1540
-                Display::return_icon('new_folder.png', get_lang('CategoryAdd'),'',ICON_SIZE_MEDIUM).'</a>';
1540
+                Display::return_icon('new_folder.png', get_lang('CategoryAdd'), '', ICON_SIZE_MEDIUM).'</a>';
1541 1541
         }
1542 1542
 
1543 1543
         $categories = Link::getLinkCategories($course_id, $session_id);
1544 1544
         $count = count($categories);
1545 1545
         if (!empty($count)) {
1546 1546
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=list&show=none">';
1547
-            echo Display::return_icon('forum_listview.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . ' </a>';
1547
+            echo Display::return_icon('forum_listview.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).' </a>';
1548 1548
 
1549 1549
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=list&show=all">';
1550
-            echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM) . '</a>';
1550
+            echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM).'</a>';
1551 1551
         }
1552 1552
         echo '</div>';
1553 1553
 
@@ -1579,12 +1579,12 @@  discard block
 block discarded – undo
1579 1579
             $strVisibility = '';
1580 1580
             $visibilityClass = null;
1581 1581
             if ($myrow['visibility'] == '1') {
1582
-                $strVisibility =  '<a href="link.php?' . api_get_cidreq() .  '&sec_token='.$token.'&action=invisible&id=' . $myrow['id'] . '&scope=' . TOOL_LINK_CATEGORY . '" title="' . get_lang('Hide') . '">' .
1583
-                    Display :: return_icon('visible.png', get_lang('Hide'), array (), ICON_SIZE_SMALL) . '</a>';
1582
+                $strVisibility = '<a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=invisible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Hide').'">'.
1583
+                    Display :: return_icon('visible.png', get_lang('Hide'), array(), ICON_SIZE_SMALL).'</a>';
1584 1584
             } elseif ($myrow['visibility'] == '0') {
1585 1585
                 $visibilityClass = 'invisible';
1586
-                $strVisibility =  ' <a href="link.php?' . api_get_cidreq() .  '&sec_token='.$token.'&action=visible&id=' . $myrow['id'] . '&scope=' . TOOL_LINK_CATEGORY . '" title="' . get_lang('Show') . '">' .
1587
-                    Display :: return_icon('invisible.png', get_lang('Show'), array (), ICON_SIZE_SMALL) . '</a>';
1586
+                $strVisibility = ' <a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Show').'">'.
1587
+                    Display :: return_icon('invisible.png', get_lang('Show'), array(), ICON_SIZE_SMALL).'</a>';
1588 1588
             }
1589 1589
 
1590 1590
             $header = '';
Please login to merge, or discard this patch.
main/inc/lib/extra_field_option.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
                         foreach ($sub_options as $sub_option) {
218 218
                             if (!empty($sub_option)) {
219
-                                $new_params  = array(
219
+                                $new_params = array(
220 220
                                     'field_id' => $field_id,
221 221
                                     'option_value' => $sub_id,
222 222
                                     'display_text' => $sub_option,
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         echo '<div class="actions">';
553 553
         $field_id = isset($_REQUEST['field_id']) ? intval($_REQUEST['field_id']) : null;
554 554
         echo '<a href="'.api_get_self().'?action=add&type='.$this->type.'&field_id='.$field_id.'">'.
555
-                Display::return_icon('add_user_fields.png', get_lang('Add'), '', ICON_SIZE_MEDIUM ).'</a>';
555
+                Display::return_icon('add_user_fields.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
556 556
         echo '</div>';
557 557
         echo Display::grid_html('extra_field_options');
558 558
     }
Please login to merge, or discard this patch.
main/inc/lib/add_many_session_to_category_functions.lib.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
      * @assert () !== ''
22 22
      * @assert ('abc','single') !== ''
23 23
      */
24
-    function search_courses($needle,$type)
24
+    function search_courses($needle, $type)
25 25
     {
26 26
         $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
27 27
 		$xajax_response = new xajaxResponse();
28 28
 		$return = '';
29
-		if(!empty($needle) && !empty($type)) {
29
+		if (!empty($needle) && !empty($type)) {
30 30
 			// xajax send utf8 datas... datas in db can be non-utf8 datas
31 31
 			$charset = api_get_system_encoding();
32 32
 			$needle = api_convert_encoding($needle, $charset, 'utf-8');
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 			$course_list = array();
39 39
 
40 40
 			$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
41
-			while($course = Database :: fetch_array($rs)) {
41
+			while ($course = Database :: fetch_array($rs)) {
42 42
 				$course_list[] = $course['id'];
43
-				$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>';
43
+				$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'], ENT_QUOTES).'">'.$course['name'].'</option>';
44 44
 			}
45 45
 			$return .= '</select>';
46
-			$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
46
+			$xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
47 47
 		}
48 48
 		$_SESSION['course_list'] = $course_list;
49 49
 		return $xajax_response;
Please login to merge, or discard this patch.
main/inc/lib/statistics.lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
         $course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
105 105
         $course_table = Database:: get_main_table(TABLE_MAIN_COURSE);
106 106
         $user_table = Database:: get_main_table(TABLE_MAIN_USER);
107
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
107
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
108 108
         $current_url_id = api_get_current_access_url_id();
109
-        $active_filter = $onlyActive?' AND active=1':'';
110
-        $status_filter = isset($status)?' AND status = '.intval($status):'';
109
+        $active_filter = $onlyActive ? ' AND active=1' : '';
110
+        $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
111 111
 
112 112
         if (api_is_multiple_url_enabled()) {
113 113
             $sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                     FROM $user_table
132 132
                     WHERE 1=1 $status_filter $active_filter";
133 133
             if (isset ($categoryCode)) {
134
-                $status_filter = isset($status)?' AND status = '.intval($status):'';
134
+                $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
135 135
                 $sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number
136 136
                         FROM $course_user_table cu, $course_table c
137 137
                         WHERE
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public static function countSessions()
157 157
     {
158 158
         $session_table = Database :: get_main_table(TABLE_MAIN_SESSION);
159
-        $access_url_rel_session_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
159
+        $access_url_rel_session_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
160 160
         if (api_is_multiple_url_enabled()) {
161 161
             $current_url_id = api_get_current_access_url_id();
162 162
             $sql = "SELECT COUNT(id) AS number
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
     public static function getNumberOfActivities()
180 180
     {
181 181
         // Database table definitions
182
-        $track_e_default  = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
182
+        $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
183 183
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
184
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
184
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
185 185
         $current_url_id = api_get_current_access_url_id();
186 186
         if (api_is_multiple_url_enabled()) {
187 187
             $sql = "SELECT count(default_id) AS total_number_of_items
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $from = intval($from);
226 226
         $numberOfItems = intval($numberOfItems);
227 227
 
228
-        if (!in_array($direction, array('ASC','DESC'))) {
228
+        if (!in_array($direction, array('ASC', 'DESC'))) {
229 229
             $direction = 'DESC';
230 230
         }
231 231
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $sql .= " LIMIT $from,$numberOfItems ";
277 277
 
278 278
         $res = Database::query($sql);
279
-        $activities = array ();
279
+        $activities = array();
280 280
         while ($row = Database::fetch_row($res)) {
281 281
 
282 282
             if (strpos($row[1], '_object') === false && strpos($row[1], '_array') === false) {
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $sql = "SELECT code, name FROM $categoryTable
344 344
                 ORDER BY tree_pos";
345 345
         $res = Database::query($sql);
346
-        $categories = array ();
346
+        $categories = array();
347 347
         while ($category = Database::fetch_object($res)) {
348 348
             $categories[$category->code] = $category->name;
349 349
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             $data_max = ($data_max < $value ? $value : $data_max);
365 365
         }
366 366
         reset($data);
367
-        $result = array ();
367
+        $result = array();
368 368
         $delta = $max / $data_max;
369 369
         foreach ($data as $index => $value) {
370 370
             $result[$index] = (int) round($value * $delta);
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
             } else {
399 399
                 $number_label = Statistics::makeSizeString($number);
400 400
             }
401
-            $percentage = ($total>0?number_format(100*$number/$total, 1, ',', '.'):'0');
401
+            $percentage = ($total > 0 ? number_format(100 * $number / $total, 1, ',', '.') : '0');
402 402
 
403
-            echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'">
403
+            echo '<tr class="row_'.($i % 2 == 0 ? 'odd' : 'even').'">
404 404
                     <td width="150">'.$subtitle.'</td>
405 405
                     <td width="550">'.Display::bar_progress($percentage, false).'</td>
406 406
                     <td align="right">'.$number_label.'</td>';
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 echo '<td align="right"> '.$percentage.'%</td>';
409 409
             }
410 410
             echo '</tr>';
411
-            $i ++;
411
+            $i++;
412 412
         }
413 413
         if ($showTotal) {
414 414
             if (!$isFileSize) {
@@ -428,17 +428,17 @@  discard block
 block discarded – undo
428 428
     public static function printLoginStats($type)
429 429
     {
430 430
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
431
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
431
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
432 432
         $current_url_id = api_get_current_access_url_id();
433 433
 
434 434
         $table_url = null;
435 435
         $where_url = null;
436 436
         $now = api_get_utc_datetime();
437
-        $where_url_last = ' WHERE login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
437
+        $where_url_last = ' WHERE login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
438 438
         if (api_is_multiple_url_enabled()) {
439 439
             $table_url = ", $access_url_rel_user_table";
440 440
             $where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'";
441
-            $where_url_last = ' AND login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
441
+            $where_url_last = ' AND login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
442 442
         }
443 443
 
444 444
         $period = get_lang('PeriodMonth');
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
             case 'hour':
454 454
                 $period = get_lang('PeriodHour');
455 455
                 $sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date ";
456
-                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date ";
456
+                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'DAY')." GROUP BY stat_date ORDER BY stat_date ";
457 457
                 break;
458 458
             case 'day':
459 459
                 $periodCollection = api_get_week_days_long();
460 460
                 $period = get_lang('PeriodDay');
461 461
                 $sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
462
-                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
462
+                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
463 463
                 break;
464 464
         }
465 465
         if ($sql_last_x) {
@@ -501,14 +501,14 @@  discard block
 block discarded – undo
501 501
     {
502 502
         $totalLogin = array();
503 503
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
504
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
504
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
505 505
         $current_url_id = api_get_current_access_url_id();
506 506
         if (api_is_multiple_url_enabled()) {
507 507
             $table_url = ", $access_url_rel_user_table";
508 508
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
509 509
         } else {
510 510
             $table_url = '';
511
-            $where_url='';
511
+            $where_url = '';
512 512
         }
513 513
         $now = api_get_utc_datetime();
514 514
         $field = 'login_user_id';
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
     {
541 541
         $totalLogin = [];
542 542
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
543
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
543
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
544 544
         $current_url_id = api_get_current_access_url_id();
545 545
         if (api_is_multiple_url_enabled()) {
546 546
             $table_url = ", $access_url_rel_user_table";
547 547
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
548 548
         } else {
549 549
             $table_url = '';
550
-            $where_url='';
550
+            $where_url = '';
551 551
         }
552 552
         $now = api_get_utc_datetime();
553 553
         $field = 'login_user_id';
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         $sql = "SELECT count($field) AS number, date(login_date) as login_date FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 15 DAY) >= '$now' $where_url GROUP BY date(login_date)";
558 558
         
559 559
         $res = Database::query($sql);
560
-        while($row = Database::fetch_array($res,'ASSOC')){
560
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
561 561
             $totalLogin[$row['login_date']] = $row['number'];
562 562
         }
563 563
         
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
     public static function printUserPicturesStats()
653 653
     {
654 654
         $user_table = Database :: get_main_table(TABLE_MAIN_USER);
655
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
655
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
656 656
         $current_url_id = api_get_current_access_url_id();
657 657
         $url_condition = null;
658 658
         $url_condition2 = null;
659 659
         $table = null;
660 660
         if (api_is_multiple_url_enabled()) {
661
-            $url_condition =  ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
661
+            $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
662 662
             $url_condition2 = " AND url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
663 663
             $table = ", $access_url_rel_user_table as url ";
664 664
         }
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
             'width=200px',
691 691
             false
692 692
         );
693
-        $renderer =& $form->defaultRenderer();
693
+        $renderer = & $form->defaultRenderer();
694 694
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
695 695
         $form->addElement('hidden', 'report', 'activities');
696 696
         $form->addElement('hidden', 'activities_direction', 'DESC');
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
         $columns[1] = 'access_date';
741 741
         $sql_order[SORT_ASC] = 'ASC';
742 742
         $sql_order[SORT_DESC] = 'DESC';
743
-        $per_page = isset($_GET['per_page'])?intval($_GET['per_page']) : 10;
744
-        $page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1;
745
-        $column = isset($_GET['column'])?intval($_GET['column']) : 0;
746
-        $date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60;
743
+        $per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10;
744
+        $page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1;
745
+        $column = isset($_GET['column']) ? intval($_GET['column']) : 0;
746
+        $date_diff = isset($_GET['date_diff']) ? intval($_GET['date_diff']) : 60;
747 747
 
748 748
         $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
749 749
 
@@ -772,25 +772,25 @@  discard block
 block discarded – undo
772 772
                         access_url_id='".$current_url_id."'
773 773
                    GROUP BY c_id
774 774
                    HAVING c_id <> ''
775
-                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff;
775
+                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff;
776 776
         } else {
777 777
             $sql = "SELECT * FROM $table
778 778
                    GROUP BY c_id
779 779
                    HAVING c_id <> ''
780
-                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff;
780
+                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff;
781 781
         }
782 782
         $sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction];
783
-        $from = ($page_nr -1) * $per_page;
783
+        $from = ($page_nr - 1) * $per_page;
784 784
         $sql .= ' LIMIT '.$from.','.$per_page;
785 785
 
786 786
         echo '<p>'.get_lang('LastAccess').' &gt;= '.$date_diff.' '.get_lang('Days').'</p>';
787 787
         $res = Database::query($sql);
788 788
         if (Database::num_rows($res) > 0) {
789
-            $courses = array ();
789
+            $courses = array();
790 790
             while ($obj = Database::fetch_object($res)) {
791 791
                 $courseInfo = api_get_course_info_by_id($obj->c_id);
792
-                $course = array ();
793
-                $course[]= '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
792
+                $course = array();
793
+                $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
794 794
                 // Allow sort by date hiding the numerical date
795 795
                 $course[] = '<span style="display:none;">'.$obj->access_date.'</span>'.api_convert_and_format_date($obj->access_date);
796 796
                 $courses[] = $course;
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
     {
864 864
         $user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
865 865
         $user_table = Database::get_main_table(TABLE_MAIN_USER);
866
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
866
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
867 867
         $current_url_id = api_get_current_access_url_id();
868 868
 
869 869
         if (api_is_multiple_url_enabled()) {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
     {
896 896
         $totalLogin = array();
897 897
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
898
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
898
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
899 899
         $current_url_id = api_get_current_access_url_id();
900 900
         $total = self::countUsers();
901 901
         if (api_is_multiple_url_enabled()) {
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
904 904
         } else {
905 905
             $table_url = '';
906
-            $where_url='';
906
+            $where_url = '';
907 907
         }
908 908
         $now = api_get_utc_datetime();
909
-        $sql[get_lang('ThisDay')]    =
909
+        $sql[get_lang('ThisDay')] =
910 910
             "SELECT count(distinct(login_user_id)) AS number ".
911 911
             " FROM $table $table_url ".
912 912
             " WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= '$now' $where_url";
913
-        $sql[get_lang('Last7days')]  =
913
+        $sql[get_lang('Last7days')] =
914 914
             "SELECT count(distinct(login_user_id)) AS number ".
915 915
             " FROM $table $table_url ".
916 916
             " WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= '$now' $where_url";
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
             "SELECT count(distinct(login_user_id)) AS number ".
923 923
             " FROM $table $table_url ".
924 924
             " WHERE DATE_ADD(login_date, INTERVAL 6 MONTH) >= '$now' $where_url";
925
-        $sql[get_lang('NeverConnected')]      =
925
+        $sql[get_lang('NeverConnected')] =
926 926
             "SELECT count(distinct(login_user_id)) AS number ".
927 927
             " FROM $table $table_url WHERE 1=1 $where_url";
928 928
         foreach ($sql as $index => $query) {
Please login to merge, or discard this patch.
main/inc/lib/auth.lib.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
         $special_course_list = array();
47 47
         if (Database::num_rows($result) > 0) {
48 48
             while ($result_row = Database::fetch_array($result)) {
49
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
49
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
50 50
             }
51 51
         }
52 52
         $without_special_courses = '';
53 53
         if (!empty($special_course_list)) {
54
-            $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')';
54
+            $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')';
55 55
         }
56 56
 
57 57
         // Secondly we select the courses that are in a category (user_course_cat<>0) and sort these according to the sort of the category
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
                 FROM $TABLECOURS course, $TABLECOURSUSER  course_rel_user
71 71
                 WHERE
72 72
                     course.id = course_rel_user.c_id AND
73
-                    course_rel_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
74
-                    course_rel_user.user_id = '" . $user_id . "' $without_special_courses
73
+                    course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND
74
+                    course_rel_user.user_id = '" . $user_id."' $without_special_courses
75 75
                 ORDER BY course_rel_user.sort ASC";
76 76
         $result = Database::query($sql);
77 77
         $courses = array();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $user_id = api_get_user_id();
104 104
         $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
105
-        $sql = "SELECT * FROM " . $table_category . "
105
+        $sql = "SELECT * FROM ".$table_category."
106 106
                 WHERE user_id=$user_id
107 107
                 ORDER BY sort ASC";
108 108
         $result = Database::query($sql);
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
         $special_course_list = array();
145 145
         if (Database::num_rows($result) > 0) {
146 146
             while ($result_row = Database::fetch_array($result)) {
147
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
147
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
148 148
             }
149 149
         }
150 150
 
151 151
         $without_special_courses = '';
152 152
         if (!empty($special_course_list)) {
153
-            $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')';
153
+            $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')';
154 154
         }
155 155
 
156 156
         $sql = "SELECT
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
                 $TABLECOURSUSER  course_rel_user
162 162
                 WHERE
163 163
                     course.id = course_rel_user.c_id AND
164
-                    course_rel_user.user_id = '" . $user_id . "' AND
165
-                    course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH . "
164
+                    course_rel_user.user_id = '".$user_id."' AND
165
+                    course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH."
166 166
                     $without_special_courses
167 167
                 ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
168 168
         $result = Database::query($sql);
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
         $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
192 192
         $max_sort_value = api_max_sort_value($newcategory, $current_user);
193 193
         $sql = "UPDATE $TABLECOURSUSER SET
194
-                    user_course_cat='" . $newcategory . "',
195
-                    sort='" . ($max_sort_value + 1) . "'
194
+                    user_course_cat='".$newcategory."',
195
+                    sort='" . ($max_sort_value + 1)."'
196 196
                 WHERE
197
-                    c_id ='" . $courseId . "' AND
198
-                    user_id='" . $current_user . "' AND
197
+                    c_id ='" . $courseId."' AND
198
+                    user_id='" . $current_user."' AND
199 199
                     relation_type<>" . COURSE_RELATION_TYPE_RRHH;
200 200
         $resultQuery = Database::query($sql);
201 201
 
@@ -254,18 +254,18 @@  discard block
 block discarded – undo
254 254
             $targetCourseId = $targetCourseInfo['real_id'];
255 255
 
256 256
             $sql = "UPDATE $table
257
-                    SET sort='" . $target_course['sort'] . "'
257
+                    SET sort='".$target_course['sort']."'
258 258
                     WHERE
259
-                        c_id = '" . $courseId . "' AND
260
-                        user_id = '" . $current_user_id . "' AND
259
+                        c_id = '" . $courseId."' AND
260
+                        user_id = '" . $current_user_id."' AND
261 261
                         relation_type<>" . COURSE_RELATION_TYPE_RRHH;
262 262
 
263 263
             $result1 = Database::query($sql);
264 264
 
265
-            $sql = "UPDATE $table SET sort='" . $source_course['sort'] . "'
265
+            $sql = "UPDATE $table SET sort='".$source_course['sort']."'
266 266
                     WHERE
267
-                        c_id ='" . $targetCourseId . "' AND
268
-                        user_id='" . $current_user_id . "' AND
267
+                        c_id ='" . $targetCourseId."' AND
268
+                        user_id='" . $current_user_id."' AND
269 269
                         relation_type<>" . COURSE_RELATION_TYPE_RRHH;
270 270
 
271 271
             $result2 = Database::query($sql);
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
         }
310 310
 
311 311
         if (count($target_category) > 0 && count($source_category) > 0) {
312
-            $sql_update1 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($target_category['sort']) . "'
313
-                            WHERE id='" . intval($source_category['id']) . "' AND user_id='" . $current_user_id . "'";
314
-            $sql_update2 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($source_category['sort']) . "'
315
-                            WHERE id='" . intval($target_category['id']) . "' AND user_id='" . $current_user_id . "'";
312
+            $sql_update1 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($target_category['sort'])."'
313
+                            WHERE id='" . intval($source_category['id'])."' AND user_id='".$current_user_id."'";
314
+            $sql_update2 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($source_category['sort'])."'
315
+                            WHERE id='" . intval($target_category['id'])."' AND user_id='".$current_user_id."'";
316 316
 
317 317
             $result1 = Database::query($sql_update2);
318 318
             $result2 = Database::query($sql_update1);
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
     {
332 332
         $current_user_id = api_get_user_id();
333 333
         $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
334
-        $sql = "SELECT * FROM " . $table_category . "
335
-                WHERE user_id='" . $current_user_id . "'
334
+        $sql = "SELECT * FROM ".$table_category."
335
+                WHERE user_id='" . $current_user_id."'
336 336
                 ORDER BY sort ASC";
337 337
         $result = Database::query($sql);
338 338
         while ($row = Database::fetch_array($result)) {
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
         $result = false;
356 356
         $tucc = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
357 357
         $sql = "UPDATE $tucc
358
-                SET title='" . api_htmlentities($title, ENT_QUOTES, api_get_system_encoding()) . "'
359
-                WHERE id='" . $category_id . "'";
358
+                SET title='".api_htmlentities($title, ENT_QUOTES, api_get_system_encoding())."'
359
+                WHERE id='" . $category_id."'";
360 360
         $resultQuery = Database::query($sql);
361 361
         if (Database::affected_rows($resultQuery)) {
362 362
             $result = true;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         $category_id = intval($category_id);
378 378
         $result = false;
379 379
         $sql_delete = "DELETE FROM $tucc
380
-                      WHERE id='" . $category_id . "' and user_id='" . $current_user_id . "'";
380
+                      WHERE id='".$category_id."' and user_id='".$current_user_id."'";
381 381
         $resultQuery = Database::query($sql_delete);
382 382
        if (Database::affected_rows($resultQuery)) {
383 383
             $result = true;
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
         $sql = "UPDATE $TABLECOURSUSER
386 386
                 SET user_course_cat='0'
387 387
                 WHERE
388
-                    user_course_cat='" . $category_id . "' AND
389
-                    user_id='" . $current_user_id . "' AND
390
-                    relation_type<>" . COURSE_RELATION_TYPE_RRHH . " ";
388
+                    user_course_cat='".$category_id."' AND
389
+                    user_id='" . $current_user_id."' AND
390
+                    relation_type<>" . COURSE_RELATION_TYPE_RRHH." ";
391 391
         Database::query($sql);
392 392
 
393 393
         return $result;
@@ -420,20 +420,20 @@  discard block
 block discarded – undo
420 420
         if (Database::num_rows($special_course_result) > 0) {
421 421
             $special_course_list = array();
422 422
             while ($result_row = Database::fetch_array($special_course_result)) {
423
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
423
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
424 424
             }
425 425
         }
426 426
         $without_special_courses = '';
427 427
         if (!empty($special_course_list)) {
428
-            $without_special_courses = ' AND course.code NOT IN (' . implode(',', $special_course_list) . ')';
428
+            $without_special_courses = ' AND course.code NOT IN ('.implode(',', $special_course_list).')';
429 429
         }
430 430
 
431 431
         $search_term_safe = Database::escape_string($search_term);
432 432
         $sql_find = "SELECT * FROM $courseTable
433 433
                     WHERE (
434
-                            code LIKE '%" . $search_term_safe . "%' OR
435
-                            title LIKE '%" . $search_term_safe . "%' OR
436
-                            tutor_name LIKE '%" . $search_term_safe . "%'
434
+                            code LIKE '%".$search_term_safe."%' OR
435
+                            title LIKE '%" . $search_term_safe."%' OR
436
+                            tutor_name LIKE '%" . $search_term_safe."%'
437 437
                         )
438 438
                         $without_special_courses
439 439
                     ORDER BY title, visual_code ASC
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
                             ON (url_rel_course.c_id = course.id)
451 451
                             WHERE
452 452
                                 access_url_id = $url_access_id AND (
453
-                                    code LIKE '%" . $search_term_safe . "%' OR
454
-                                    title LIKE '%" . $search_term_safe . "%' OR
455
-                                    tutor_name LIKE '%" . $search_term_safe . "%'
453
+                                    code LIKE '%".$search_term_safe."%' OR
454
+                                    title LIKE '%" . $search_term_safe."%' OR
455
+                                    tutor_name LIKE '%" . $search_term_safe."%'
456 456
                                 )
457 457
                                 $without_special_courses
458 458
                             ORDER BY title, visual_code ASC
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
         // (s)he can only delete the course
514 514
         $sql = "SELECT * FROM $tbl_course_user
515 515
                 WHERE
516
-                    user_id='" . $current_user_id . "' AND
517
-                    c_id ='" . $courseId . "' AND
516
+                    user_id='".$current_user_id."' AND
517
+                    c_id ='" . $courseId."' AND
518 518
                     status='1' ";
519 519
         $result_check = Database::query($sql);
520 520
         $number_of_rows = Database::num_rows($result_check);
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
         $result = false;
542 542
 
543 543
         // step 1: we determine the max value of the user defined course categories
544
-        $sql = "SELECT sort FROM $tucc WHERE user_id='" . $current_user_id . "' ORDER BY sort DESC";
544
+        $sql = "SELECT sort FROM $tucc WHERE user_id='".$current_user_id."' ORDER BY sort DESC";
545 545
         $rs_sort = Database::query($sql);
546 546
         $maxsort = Database::fetch_array($rs_sort);
547 547
         $nextsort = $maxsort['sort'] + 1;
548 548
 
549 549
         // step 2: we check if there is already a category with this name, if not we store it, else we give an error.
550
-        $sql = "SELECT * FROM $tucc WHERE user_id='" . $current_user_id . "' AND title='" . $category_title . "'ORDER BY sort DESC";
550
+        $sql = "SELECT * FROM $tucc WHERE user_id='".$current_user_id."' AND title='".$category_title."'ORDER BY sort DESC";
551 551
         $rs = Database::query($sql);
552 552
         if (Database::num_rows($rs) == 0) {
553 553
             $sql_insert = "INSERT INTO $tucc (user_id, title,sort)
554
-                           VALUES ('" . $current_user_id . "', '" . api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding()) . "', '" . $nextsort . "')";
554
+                           VALUES ('".$current_user_id."', '".api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding())."', '".$nextsort."')";
555 555
             $resultQuery = Database::query($sql_insert);
556 556
             if (Database::affected_rows($resultQuery)) {
557 557
                 $result = true;
@@ -628,10 +628,10 @@  discard block
 block discarded – undo
628 628
             if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) {
629 629
                 return false;
630 630
             }
631
-            $message = get_lang('CourseRequiresPassword') . '<br />';
631
+            $message = get_lang('CourseRequiresPassword').'<br />';
632 632
             $message .= $all_course_information['title'].' ('.$all_course_information['visual_code'].') ';
633 633
 
634
-            $action  = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token'];
634
+            $action  = api_get_path(WEB_CODE_PATH)."auth/courses.php?action=subscribe_user_with_password&sec_token=".$_SESSION['sec_token'];
635 635
             $form = new FormValidator('subscribe_user_with_password', 'post', $action);
636 636
             $form->addElement('hidden', 'sec_token', $_SESSION['sec_token']);
637 637
             $form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']);
Please login to merge, or discard this patch.
main/inc/lib/javascript/chat/video.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 $idUserLocal = api_get_user_id();
35 35
 $userLocal = api_get_user_info($idUserLocal, true);
36 36
 $htmlHeadXtra[] = '<script type="text/javascript" src="'
37
-    . api_get_path(WEB_PATH) . 'web/assets/SimpleWebRTC/latest.js'
38
-    . '"></script>' . "\n";
37
+    . api_get_path(WEB_PATH).'web/assets/SimpleWebRTC/latest.js'
38
+    . '"></script>'."\n";
39 39
 
40 40
 $template = new Template();
41 41
 $template->assign('room_name', $chatVideo->getRoomName());
Please login to merge, or discard this patch.
main/inc/lib/thematic.lib.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $from = intval($from);
75 75
         $number_of_items = intval($number_of_items);
76 76
 
77
-        if (!in_array($direction, array('ASC','DESC'))) {
77
+        if (!in_array($direction, array('ASC', 'DESC'))) {
78 78
             $direction = 'ASC';
79 79
         }
80 80
 
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
             $thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].'">'.
98 98
                 Security::remove_XSS($thematic[1], STUDENT).$session_star.'</a>';
99 99
             if (api_is_allowed_to_edit(null, true)) {
100
-                $actions  = '';
100
+                $actions = '';
101 101
 
102 102
                 if (api_get_session_id()) {
103 103
                     if (api_get_session_id() == $thematic[3]) {
104 104
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
105
-                            Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
105
+                            Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
106 106
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
107
-                            Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
107
+                            Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
108 108
 
109 109
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
110
-                            Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
110
+                            Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
111 111
                         $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
112
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
112
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
113 113
                     } else {
114
-                        $actions .= Display::return_icon('lesson_plan_na.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'&nbsp;';
115
-                        $actions .= Display::return_icon('lesson_plan_calendar_na.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'&nbsp;';
116
-                        $actions .= Display::return_icon('edit_na.png',get_lang('Edit'),'',ICON_SIZE_SMALL);
117
-                        $actions .= Display::return_icon('delete_na.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'&nbsp;';
114
+                        $actions .= Display::return_icon('lesson_plan_na.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'&nbsp;';
115
+                        $actions .= Display::return_icon('lesson_plan_calendar_na.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'&nbsp;';
116
+                        $actions .= Display::return_icon('edit_na.png', get_lang('Edit'), '', ICON_SIZE_SMALL);
117
+                        $actions .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'&nbsp;';
118 118
                         $actions .= Display::url(
119 119
                             Display::return_icon('cd.gif', get_lang('Copy')),
120 120
                             'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$thematic[0]
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
                     }
123 123
                 } else {
124 124
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
125
-                        Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
125
+                        Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
126 126
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
127
-                        Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
127
+                        Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
128 128
 
129 129
                     if ($thematic[2] > 1) {
130 130
                         $actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
131
-                            Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>';
131
+                            Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>';
132 132
                     } else {
133
-                        $actions .= Display::return_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
133
+                        $actions .= Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
134 134
                     }
135 135
                     if ($thematic[2] < self::get_max_thematic_item()) {
136 136
                         $actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
137
-                            Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>';
137
+                            Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>';
138 138
                     } else {
139
-                        $actions .= Display::return_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
139
+                        $actions .= Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
140 140
                     }
141 141
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
142
-                        Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
142
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
143 143
                     $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
144
-                        Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
144
+                        Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
145 145
                 }
146 146
                 $thematics[] = array($thematic[0], $thematic[1], $actions);
147 147
             }
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
         $res = Database::query($sql);
279 279
         if (Database::num_rows($res) > 0) {
280 280
             if (!empty($thematic_id)) {
281
-                $data = Database::fetch_array($res,'ASSOC');
281
+                $data = Database::fetch_array($res, 'ASSOC');
282 282
             } else {
283
-                while ($row = Database::fetch_array($res,'ASSOC')) {
283
+                while ($row = Database::fetch_array($res, 'ASSOC')) {
284 284
                     $data[$row['id']] = $row;
285 285
                 }
286 286
             }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
         if (is_array($thematic_id)) {
377 377
             foreach ($thematic_id as $id) {
378
-                $id	= intval($id);
378
+                $id = intval($id);
379 379
                 $sql = "UPDATE $tbl_thematic SET active = 0
380 380
                         WHERE c_id = $course_id AND id = $id";
381 381
                 $result = Database::query($sql);
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
                     );
392 392
                 }
393 393
             }
394
-        } else  {
395
-            $thematic_id	= intval($thematic_id);
394
+        } else {
395
+            $thematic_id = intval($thematic_id);
396 396
             $sql = "UPDATE $tbl_thematic SET active = 0
397 397
                     WHERE c_id = $course_id AND id = $thematic_id";
398 398
             $result = Database::query($sql);
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
         $new_thematic_id = $thematic_copy->thematic_save();
429 429
         if (!empty($new_thematic_id)) {
430 430
             $thematic_advanced = self::get_thematic_advance_by_thematic_id($thematic_id);
431
-            if(!empty($thematic_advanced)) {
432
-                foreach($thematic_advanced as $item) {
431
+            if (!empty($thematic_advanced)) {
432
+                foreach ($thematic_advanced as $item) {
433 433
                     $thematic = new Thematic();
434 434
                     $thematic->set_thematic_advance_attributes(
435 435
                         0,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         $column = intval($column);
493 493
         $from   = intval($from);
494 494
         $number_of_items = intval($number_of_items);
495
-        if (!in_array($direction, array('ASC','DESC'))) {
495
+        if (!in_array($direction, array('ASC', 'DESC'))) {
496 496
             $direction = 'ASC';
497 497
         }
498 498
         $data = array();
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
                     $thematic_advance[1] = api_get_local_time($thematic_advance[1]);
526 526
                     $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
527 527
                     $actions  = '';
528
-                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
529
-                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>';
528
+                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
529
+                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>';
530 530
                     $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions);
531 531
                     $i++;
532 532
                 }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
                 $session_star = '';
592 592
                 if (api_is_allowed_to_edit(null, true)) {
593
-                    if ($thematic_advance['session_id'] !=0) {
593
+                    if ($thematic_advance['session_id'] != 0) {
594 594
                         $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
595 595
                     }
596 596
                 }
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 
617 617
         foreach ($data as $thematic_id => $thematic_plan_data) {
618 618
             $new_thematic_plan_data = array();
619
-            foreach($thematic_plan_data as $thematic_item) {
619
+            foreach ($thematic_plan_data as $thematic_item) {
620 620
                 $thematic_simple_list[] = $thematic_item['description_type'];
621 621
                 $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
622 622
             }
623 623
 
624 624
             if (!empty($thematic_simple_list)) {
625
-                foreach($thematic_simple_list as $item) {
625
+                foreach ($thematic_simple_list as $item) {
626 626
                     $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
627 627
                 }
628 628
             }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
                     }
639 639
                     if (!empty($data[$thematic_id][$id]['title']) && !empty($data[$thematic_id][$id]['description'])) {
640 640
                         if (api_is_allowed_to_edit(null, true)) {
641
-                            if ($data[$thematic_id][$id]['session_id'] !=0) {
641
+                            if ($data[$thematic_id][$id]['session_id'] != 0) {
642 642
                                 $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
643 643
                             }
644 644
                         }
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
             if ($no_data) {
652 652
                 $return .= '<div><em>'.get_lang('StillDoNotHaveAThematicPlan').'</em></div>';
653 653
             }
654
-            $return  .= '</div>';
654
+            $return .= '</div>';
655 655
             $final_return[$thematic_id] = $return;
656 656
         }
657 657
         return $final_return;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 api_get_session_id()
692 692
             );
693 693
             foreach ($list as $value) {
694
-                $elements[$value['ref']]= $value;
694
+                $elements[$value['ref']] = $value;
695 695
             }
696 696
         }
697 697
 
@@ -865,18 +865,18 @@  discard block
 block discarded – undo
865 865
             api_get_session_id()
866 866
         );
867 867
 
868
-        $thematic_plan_complete_list  = array();
868
+        $thematic_plan_complete_list = array();
869 869
         $thematic_plan_id_list = array();
870 870
 
871 871
         if (!empty($items_from_course)) {
872
-            foreach($items_from_course as $item) {
872
+            foreach ($items_from_course as $item) {
873 873
                 $thematic_plan_id_list[] = $item['ref'];
874 874
                 $thematic_plan_complete_list[$item['ref']] = $item;
875 875
             }
876 876
         }
877 877
 
878 878
         if (!empty($items_from_session)) {
879
-            foreach($items_from_session as $item) {
879
+            foreach ($items_from_session as $item) {
880 880
                 $thematic_plan_id_list[] = $item['ref'];
881 881
                 $thematic_plan_complete_list[$item['ref']] = $item;
882 882
             }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 if (!isset($thematic_id) && !isset($description_type)) {
899 899
                     // group all data group by thematic id
900 900
                     $tmp = array();
901
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
901
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
902 902
                         $tmp[] = $row['thematic_id'];
903 903
                         if (in_array($row['thematic_id'], $tmp)) {
904 904
                             $row['session_id'] = $thematic_plan_complete_list[$row['id']];
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         }
907 907
                     }
908 908
                 } else {
909
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
909
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
910 910
                         $row['session_id'] = $thematic_plan_complete_list[$row['id']];
911 911
                         $data[] = $row;
912 912
                     }
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
         );
942 942
 
943 943
         $elements_to_show = array();
944
-        foreach($list as $value) {
945
-            $elements_to_show[]= $value['ref'];
944
+        foreach ($list as $value) {
945
+            $elements_to_show[] = $value['ref'];
946 946
         }
947 947
         $condition = '';
948 948
         if (!empty($elements_to_show)) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                     c_id = $course_id AND
955 955
                     thematic_id = $thematic_id AND
956 956
                     description_type = '$description_type'";
957
-        $rs	 = Database::query($sql);
957
+        $rs = Database::query($sql);
958 958
 
959 959
         $affected_rows = 0;
960 960
         if (Database::num_rows($rs) > 0) {
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
             $diff = array_diff($all, $a_thematic_advance_ids);
1191 1191
             if (!empty($diff)) {
1192 1192
                 $upd = "UPDATE $tbl_thematic_advance SET done_advance = 0
1193
-    			        WHERE c_id = $course_id AND id IN(".implode(',',$diff).") ";
1193
+    			        WHERE c_id = $course_id AND id IN(".implode(',', $diff).") ";
1194 1194
                 Database::query($upd);
1195 1195
             }
1196 1196
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
             $course_code = api_get_course_id();
1305 1305
         }
1306 1306
         if (api_get_session_id()) {
1307
-            $thematic_data = $this->get_thematic_list(null, $course_code );
1307
+            $thematic_data = $this->get_thematic_list(null, $course_code);
1308 1308
         } else {
1309 1309
             $thematic_data = $this->get_thematic_list(null, $course_code, 0);
1310 1310
         }
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
             }
1357 1357
             // calculate average by thematic
1358 1358
             $count_total_advances = count($advances);
1359
-            $average = round(($count_done_advances*100)/$count_total_advances);
1359
+            $average = round(($count_done_advances * 100) / $count_total_advances);
1360 1360
         }
1361 1361
 
1362 1362
         return $average;
@@ -1447,12 +1447,12 @@  discard block
 block discarded – undo
1447 1447
     public function get_default_thematic_plan_title()
1448 1448
     {
1449 1449
         $default_thematic_plan_titles = array();
1450
-        $default_thematic_plan_titles[1]= get_lang('Objectives');
1451
-        $default_thematic_plan_titles[2]= get_lang('SkillToAcquire');
1452
-        $default_thematic_plan_titles[3]= get_lang('Methodology');
1453
-        $default_thematic_plan_titles[4]= get_lang('Infrastructure');
1454
-        $default_thematic_plan_titles[5]= get_lang('Assessment');
1455
-        $default_thematic_plan_titles[6]= get_lang('Others');
1450
+        $default_thematic_plan_titles[1] = get_lang('Objectives');
1451
+        $default_thematic_plan_titles[2] = get_lang('SkillToAcquire');
1452
+        $default_thematic_plan_titles[3] = get_lang('Methodology');
1453
+        $default_thematic_plan_titles[4] = get_lang('Infrastructure');
1454
+        $default_thematic_plan_titles[5] = get_lang('Assessment');
1455
+        $default_thematic_plan_titles[6] = get_lang('Others');
1456 1456
 
1457 1457
         return $default_thematic_plan_titles;
1458 1458
     }
@@ -1464,12 +1464,12 @@  discard block
 block discarded – undo
1464 1464
     public function get_default_thematic_plan_icon()
1465 1465
     {
1466 1466
         $default_thematic_plan_icon = array();
1467
-        $default_thematic_plan_icon[1]= 'icons/32/objective.png';
1468
-        $default_thematic_plan_icon[2]= 'icons/32/skills.png';
1469
-        $default_thematic_plan_icon[3]= 'icons/32/strategy.png';
1470
-        $default_thematic_plan_icon[4]= 'icons/32/laptop.png';
1471
-        $default_thematic_plan_icon[5]= 'icons/32/assessment.png';
1472
-        $default_thematic_plan_icon[6]= 'icons/32/wizard.png';
1467
+        $default_thematic_plan_icon[1] = 'icons/32/objective.png';
1468
+        $default_thematic_plan_icon[2] = 'icons/32/skills.png';
1469
+        $default_thematic_plan_icon[3] = 'icons/32/strategy.png';
1470
+        $default_thematic_plan_icon[4] = 'icons/32/laptop.png';
1471
+        $default_thematic_plan_icon[5] = 'icons/32/assessment.png';
1472
+        $default_thematic_plan_icon[6] = 'icons/32/wizard.png';
1473 1473
 
1474 1474
         return $default_thematic_plan_icon;
1475 1475
     }
@@ -1481,11 +1481,11 @@  discard block
 block discarded – undo
1481 1481
     public function get_default_question()
1482 1482
     {
1483 1483
         $question = array();
1484
-        $question[1]= get_lang('ObjectivesQuestions');
1485
-        $question[2]= get_lang('SkillToAcquireQuestions');
1486
-        $question[3]= get_lang('MethodologyQuestions');
1487
-        $question[4]= get_lang('InfrastructureQuestions');
1488
-        $question[5]= get_lang('AssessmentQuestions');
1484
+        $question[1] = get_lang('ObjectivesQuestions');
1485
+        $question[2] = get_lang('SkillToAcquireQuestions');
1486
+        $question[3] = get_lang('MethodologyQuestions');
1487
+        $question[4] = get_lang('InfrastructureQuestions');
1488
+        $question[5] = get_lang('AssessmentQuestions');
1489 1489
 
1490 1490
         return $question;
1491 1491
     }
Please login to merge, or discard this patch.
main/inc/lib/glossary.lib.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
      * @param int $glossary_id
40 40
      * @return string The glossary description
41 41
      */
42
-    public static function get_glossary_term_by_glossary_id ($glossary_id)
42
+    public static function get_glossary_term_by_glossary_id($glossary_id)
43 43
     {
44
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
44
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
45 45
         $course_id = api_get_course_int_id();
46 46
         $sql = "SELECT description FROM $glossary_table
47 47
                 WHERE c_id = $course_id  AND glossary_id =".intval($glossary_id);
48
-        $rs=Database::query($sql);
48
+        $rs = Database::query($sql);
49 49
         if (Database::num_rows($rs) > 0) {
50 50
             $row = Database::fetch_array($rs);
51 51
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      * @param string The glossary term name
62 62
      * @return string The glossary description
63 63
      */
64
-    public static function get_glossary_term_by_glossary_name ($glossary_name)
64
+    public static function get_glossary_term_by_glossary_name($glossary_name)
65 65
     {
66
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
66
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
67 67
         $session_id = api_get_session_id();
68 68
         $course_id = api_get_course_int_id();
69 69
         $sql_filter = api_get_session_condition($session_id);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $course_id = api_get_course_int_id();
164 164
 
165 165
         // check if the glossary term already exists
166
-        if (GlossaryManager::glossary_exists($values['glossary_title'],$values['glossary_id'])) {
166
+        if (GlossaryManager::glossary_exists($values['glossary_title'], $values['glossary_id'])) {
167 167
             // display the feedback message
168 168
             if ($message)
169 169
                 Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt'));
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         $get_max = "SELECT MAX(display_order) FROM $t_glossary
211 211
                     WHERE c_id = $course_id ";
212 212
         $res_max = Database::query($get_max);
213
-        if (Database::num_rows($res_max)==0) {
213
+        if (Database::num_rows($res_max) == 0) {
214 214
             return 0;
215 215
         }
216 216
         $row = Database::fetch_array($res_max);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @author Patrick Cool <[email protected]>, Ghent University, Belgium
232 232
      * @version januari 2009, dokeos 1.8.6
233 233
      */
234
-    public static function glossary_exists($term, $not_id='')
234
+    public static function glossary_exists($term, $not_id = '')
235 235
     {
236 236
         // Database table definition
237 237
         $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                 WHERE
242 242
                     c_id = $course_id AND
243 243
                     name = '".Database::escape_string($term)."'";
244
-        if ($not_id<>'') {
244
+        if ($not_id <> '') {
245 245
             $sql .= " AND glossary_id <> '".intval($not_id)."'";
246 246
         }
247 247
         $result = Database::query($sql);
@@ -347,27 +347,27 @@  discard block
 block discarded – undo
347 347
         // action links
348 348
         echo '<div class="actions">';
349 349
 
350
-        if (api_is_allowed_to_edit(null,true)) {
350
+        if (api_is_allowed_to_edit(null, true)) {
351 351
             echo '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add?'.api_get_cidreq().'">'.
352
-                Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'),'', ICON_SIZE_MEDIUM).'</a>';
352
+                Display::return_icon('new_glossary_term.png', get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
353 353
         }
354 354
 
355 355
         echo '<a href="index.php?'.api_get_cidreq().'&action=export">'.
356
-            Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
357
-        if (api_is_allowed_to_edit(null,true)) {
356
+            Display::return_icon('export_csv.png', get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
357
+        if (api_is_allowed_to_edit(null, true)) {
358 358
             echo '<a href="index.php?'.api_get_cidreq().'&action=import">'.
359
-                Display::return_icon('import_csv.png',get_lang('ImportGlossary'),'',ICON_SIZE_MEDIUM).'</a>';
359
+                Display::return_icon('import_csv.png', get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
360 360
         }
361 361
 
362 362
         echo '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf">'.
363
-            Display::return_icon('pdf.png',get_lang('ExportToPDF'),'', ICON_SIZE_MEDIUM).'</a>';
363
+            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
364 364
 
365
-        if ((isset($_SESSION['glossary_view']) && $_SESSION['glossary_view'] == 'table') or (!isset($_SESSION['glossary_view']))){
365
+        if ((isset($_SESSION['glossary_view']) && $_SESSION['glossary_view'] == 'table') or (!isset($_SESSION['glossary_view']))) {
366 366
             echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.
367
-                Display::return_icon('view_detailed.png',get_lang('ListView'),'',ICON_SIZE_MEDIUM).'</a>';
367
+                Display::return_icon('view_detailed.png', get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
368 368
         } else {
369 369
             echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.
370
-                Display::return_icon('view_text.png',get_lang('TableView'),'',ICON_SIZE_MEDIUM).'</a>';
370
+                Display::return_icon('view_text.png', get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
371 371
         }
372 372
         echo '</div>';
373 373
         if (!$_SESSION['glossary_view'] || $_SESSION['glossary_view'] == 'table') {
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
             //$table->set_header(0, '', false);
381 381
             $table->set_header(0, get_lang('TermName'), true);
382 382
             $table->set_header(1, get_lang('TermDefinition'), true);
383
-            if (api_is_allowed_to_edit(null,true)) {
383
+            if (api_is_allowed_to_edit(null, true)) {
384 384
                 $table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions'));
385
-                $table->set_column_filter(2, array('GlossaryManager','actions_filter'));
385
+                $table->set_column_filter(2, array('GlossaryManager', 'actions_filter'));
386 386
             }
387 387
             $table->display();
388 388
         }
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
      */
400 400
     public static function display_glossary_list()
401 401
     {
402
-        $glossary_data = self::get_glossary_data(0,1000,0,'ASC');
402
+        $glossary_data = self::get_glossary_data(0, 1000, 0, 'ASC');
403 403
         foreach ($glossary_data as $key => $glossary_item) {
404 404
             $actions = '';
405
-            if (api_is_allowed_to_edit(null,true)) {
406
-                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '',$glossary_item).'</div>';
405
+            if (api_is_allowed_to_edit(null, true)) {
406
+                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '', $glossary_item).'</div>';
407 407
             }
408 408
             echo Display::panel($glossary_item[1], $glossary_item[0].' '.$actions);
409 409
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
      * @author Patrick Cool <[email protected]>, Ghent University, Belgium
419 419
      * @version januari 2009, dokeos 1.8.6
420 420
      */
421
-    public static  function get_number_glossary_terms($session_id=0)
421
+    public static  function get_number_glossary_terms($session_id = 0)
422 422
     {
423 423
         // Database table definition
424 424
         $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
457 457
         $t_item_propery = Database :: get_course_table(TABLE_ITEM_PROPERTY);
458 458
 
459
-        if (api_is_allowed_to_edit(null,true)) {
459
+        if (api_is_allowed_to_edit(null, true)) {
460 460
             $col2 = " glossary.glossary_id	as col2, ";
461 461
         } else {
462 462
             $col2 = " ";
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
             'glossary.session_id'
472 472
         );
473 473
         $column = intval($column);
474
-        if (!in_array($direction,array('DESC', 'ASC'))) {
475
-            $direction          = 'ASC';
474
+        if (!in_array($direction, array('DESC', 'ASC'))) {
475
+            $direction = 'ASC';
476 476
         }
477 477
         $from = intval($from);
478 478
         $number_of_items = intval($number_of_items);
@@ -497,15 +497,15 @@  discard block
 block discarded – undo
497 497
         while ($data = Database::fetch_array($res)) {
498 498
             // Validation when belongs to a session
499 499
             $session_img = api_get_session_image($data['session_id'], $_user['status']);
500
-            $array[0] = $data[0] . $session_img;
500
+            $array[0] = $data[0].$session_img;
501 501
 
502 502
             if (!$_SESSION['glossary_view'] || $_SESSION['glossary_view'] == 'table') {
503
-                $array[1] = str_replace(array('<p>','</p>'),array('','<br />'),$data[1]);
503
+                $array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]);
504 504
             } else {
505 505
                 $array[1] = $data[1];
506 506
             }
507 507
 
508
-            if (api_is_allowed_to_edit(null,true)) {
508
+            if (api_is_allowed_to_edit(null, true)) {
509 509
                 $array[2] = $data[2];
510 510
             }
511 511
             $return[] = $array;
@@ -528,14 +528,14 @@  discard block
 block discarded – undo
528 528
     public static function actions_filter($glossary_id, $url_params, $row)
529 529
     {
530 530
         $glossary_id = $row[2];
531
-        $return = '<a href="'.api_get_self().'?action=edit_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
531
+        $return = '<a href="'.api_get_self().'?action=edit_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
532 532
         $glossary_data = GlossaryManager::get_glossary_information($glossary_id);
533 533
 
534 534
         $glossary_term = $glossary_data['glossary_title'];
535 535
 
536 536
         if (api_is_allowed_to_edit(null, true)) {
537 537
             if ($glossary_data['session_id'] == api_get_session_id()) {
538
-                $return .= '<a href="'.api_get_self().'?action=delete_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
538
+                $return .= '<a href="'.api_get_self().'?action=delete_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a>';
539 539
             } else {
540 540
                 $return  = get_lang('EditionNotAvailableFromSession');
541 541
             }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
     {
557 557
         return "<script type=\"text/javascript\">
558 558
 				function confirmation (name) {
559
-					if (confirm(\" ". get_lang("TermConfirmDelete") ." \"+ name + \" ?\"))
559
+					if (confirm(\" ". get_lang("TermConfirmDelete")." \"+ name + \" ?\"))
560 560
 						{return true;}
561 561
 					else
562 562
 						{return false;}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $res = Database::query($sql);
617 617
         $found = false;
618 618
         while ($row = Database::fetch_array($res)) {
619
-            if ($found && empty($next_id))	{
619
+            if ($found && empty($next_id)) {
620 620
                 $next_id = $row['glossary_id'];
621 621
                 $next_display_order = $row['display_order'];
622 622
             }
Please login to merge, or discard this patch.
main/inc/lib/internationalization.lib.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     ) {
106 106
       require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php';
107 107
       global $langstats;
108
-      $langstats->add_use($variable,'');
108
+      $langstats->add_use($variable, '');
109 109
     }
110 110
 
111 111
     if (!isset($used_lang_vars)) {
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
     if ($use_users_timezone == 'true') {
372 372
         $userId = api_get_user_id();
373 373
         // Get the timezone based on user preference, if it exists
374
-        $timezone_user = UserManager::get_extra_user_data_by_field($userId,'timezone');
374
+        $timezone_user = UserManager::get_extra_user_data_by_field($userId, 'timezone');
375 375
         if (isset($timezone_user['timezone']) && $timezone_user['timezone'] != null) {
376 376
             $to_timezone = $timezone_user['timezone'];
377 377
         }
@@ -636,10 +636,10 @@  discard block
 block discarded – undo
636 636
         // We replace %a %A %b %B masks of date format with translated strings
637 637
         $translated = &_api_get_day_month_names($language);
638 638
         $date_format = str_replace(array('%A', '%a', '%B', '%b'),
639
-        array($translated['days_long'][(int)strftime('%w', $time )],
640
-            $translated['days_short'][(int)strftime('%w', $time)],
641
-            $translated['months_long'][(int)strftime('%m', $time) - 1],
642
-            $translated['months_short'][(int)strftime('%m', $time) - 1]),
639
+        array($translated['days_long'][(int) strftime('%w', $time)],
640
+            $translated['days_short'][(int) strftime('%w', $time)],
641
+            $translated['months_long'][(int) strftime('%m', $time) - 1],
642
+            $translated['months_short'][(int) strftime('%m', $time) - 1]),
643 643
         $date_format);
644 644
         $formatted_date = api_to_system_encoding(strftime($date_format, $time), 'UTF-8');
645 645
     }
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         if ($seconds > $time) {
738 738
             continue;
739 739
         }
740
-        $current_value = intval($time/$seconds);
740
+        $current_value = intval($time / $seconds);
741 741
 
742 742
         if ($current_value != 1) {
743 743
             $date_str = $sec_time_plu[$i];
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
     }
755 755
 
756 756
     if (!empty($key_result)) {
757
-        if ($key_result[0] == $min_day && $key_result[1]== $min_minute) {
757
+        if ($key_result[0] == $min_day && $key_result[1] == $min_minute) {
758 758
             $key_result[1] = ' 0 '.$min_hours;
759 759
             $str_result[0] = $time_result[0].' '.$key_result[0];
760 760
             $str_result[1] = $key_result[1];
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
  * @return string					Returns the encoding identificator modified in suitable for comparison way.
1688 1688
  */
1689 1689
 function api_refine_encoding_id($encoding) {
1690
-    if (is_array($encoding)){
1690
+    if (is_array($encoding)) {
1691 1691
         return array_map('api_refine_encoding_id', $encoding);
1692 1692
     }
1693 1693
     return strtoupper(str_replace('_', '-', $encoding));
Please login to merge, or discard this patch.