Completed
Push — 1.11.x ( a12f80...59baa4 )
by José
192:14 queued 157:06
created
main/lp/learnpath.class.php 1 patch
Braces   +104 added lines, -71 removed lines patch added patch discarded remove patch
@@ -3944,8 +3944,9 @@  discard block
 block discarded – undo
3944 3944
                 WHERE c_id = ".$course_id."
3945 3945
                 ORDER BY display_order";
3946 3946
         $res = Database::query($sql);
3947
-        if ($res === false)
3948
-            return false;
3947
+        if ($res === false) {
3948
+                    return false;
3949
+        }
3949 3950
         $lps = array ();
3950 3951
         $lp_order = array ();
3951 3952
         $num = Database :: num_rows($res);
@@ -4545,8 +4546,9 @@  discard block
 block discarded – undo
4545 4546
         if ($this->debug > 0) {
4546 4547
             error_log('New LP - In learnpath::set_maker()', 0);
4547 4548
         }
4548
-        if (empty ($name))
4549
-            return false;
4549
+        if (empty ($name)) {
4550
+                    return false;
4551
+        }
4550 4552
         $this->maker = $name;
4551 4553
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4552 4554
         $course_id = api_get_course_int_id();
@@ -4611,8 +4613,9 @@  discard block
 block discarded – undo
4611 4613
     public function set_terms_by_prefix($terms_string, $prefix)
4612 4614
     {
4613 4615
         $course_id = api_get_course_int_id();
4614
-        if (api_get_setting('search_enabled') !== 'true')
4615
-            return false;
4616
+        if (api_get_setting('search_enabled') !== 'true') {
4617
+                    return false;
4618
+        }
4616 4619
 
4617 4620
         if (!extension_loaded('xapian')) {
4618 4621
             return false;
@@ -4625,8 +4628,9 @@  discard block
 block discarded – undo
4625 4628
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4626 4629
 
4627 4630
         // Don't do anything if no change, verify only at DB, not the search engine.
4628
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4629
-            return false;
4631
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4632
+                    return false;
4633
+        }
4630 4634
 
4631 4635
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4632 4636
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -4818,8 +4822,9 @@  discard block
 block discarded – undo
4818 4822
         if ($this->debug > 0) {
4819 4823
             error_log('New LP - In learnpath::set_proximity()', 0);
4820 4824
         }
4821
-        if (empty ($name))
4822
-            return false;
4825
+        if (empty ($name)) {
4826
+                    return false;
4827
+        }
4823 4828
 
4824 4829
         $this->proximity = $name;
4825 4830
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@@ -5163,8 +5168,9 @@  discard block
 block discarded – undo
5163 5168
 
5164 5169
         $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order";
5165 5170
         $res = Database::query($sql);
5166
-        if ($res === false)
5167
-            return false;
5171
+        if ($res === false) {
5172
+                    return false;
5173
+        }
5168 5174
 
5169 5175
         $num = Database :: num_rows($res);
5170 5176
         // First check the order is correct, globally (might be wrong because
@@ -5475,8 +5481,9 @@  discard block
 block discarded – undo
5475 5481
             $position[$key] = $row['display_order'];
5476 5482
         }
5477 5483
 
5478
-        if (count($array) > 0)
5479
-            array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5484
+        if (count($array) > 0) {
5485
+                    array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5486
+        }
5480 5487
 
5481 5488
         return $array;
5482 5489
     }
@@ -6190,10 +6197,12 @@  discard block
 block discarded – undo
6190 6197
                     if ($new_comment || $new_title) {
6191 6198
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6192 6199
                         $ct = '';
6193
-                        if ($new_comment)
6194
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6195
-                        if ($new_title)
6196
-                            $ct .= ", title='" . Database::escape_string($new_title)."' ";
6200
+                        if ($new_comment) {
6201
+                                                    $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6202
+                        }
6203
+                        if ($new_title) {
6204
+                                                    $ct .= ", title='" . Database::escape_string($new_title)."' ";
6205
+                        }
6197 6206
 
6198 6207
                         $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6199 6208
                                WHERE c_id = ".$course_id." AND id = " . $document_id;
@@ -6217,17 +6226,21 @@  discard block
 block discarded – undo
6217 6226
         // Please, do not modify this dirname formatting.
6218 6227
         $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
6219 6228
 
6220
-        if (strstr($dir, '..'))
6221
-            $dir = '/';
6229
+        if (strstr($dir, '..')) {
6230
+                    $dir = '/';
6231
+        }
6222 6232
 
6223
-        if ($dir[0] == '.')
6224
-            $dir = substr($dir, 1);
6233
+        if ($dir[0] == '.') {
6234
+                    $dir = substr($dir, 1);
6235
+        }
6225 6236
 
6226
-        if ($dir[0] != '/')
6227
-            $dir = '/' . $dir;
6237
+        if ($dir[0] != '/') {
6238
+                    $dir = '/' . $dir;
6239
+        }
6228 6240
 
6229
-        if ($dir[strlen($dir) - 1] != '/')
6230
-            $dir .= '/';
6241
+        if ($dir[strlen($dir) - 1] != '/') {
6242
+                    $dir .= '/';
6243
+        }
6231 6244
 
6232 6245
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6233 6246
 
@@ -6292,8 +6305,9 @@  discard block
 block discarded – undo
6292 6305
                 }
6293 6306
                 $return .= '<div style="padding:10px;">';
6294 6307
 
6295
-                if ($msg != '')
6296
-                    $return .= $msg;
6308
+                if ($msg != '') {
6309
+                                    $return .= $msg;
6310
+                }
6297 6311
 
6298 6312
                 $return .= '<h3>'.$row['title'].'</h3>';
6299 6313
                 switch ($row['item_type']) {
@@ -6554,10 +6568,11 @@  discard block
 block discarded – undo
6554 6568
         $item_title			= Security::remove_XSS($item_title);
6555 6569
         $item_description 	= Security::remove_XSS($item_description);
6556 6570
 
6557
-        if ($id != 0 && is_array($extra_info))
6558
-            $parent = $extra_info['parent_item_id'];
6559
-        else
6560
-            $parent = 0;
6571
+        if ($id != 0 && is_array($extra_info)) {
6572
+                    $parent = $extra_info['parent_item_id'];
6573
+        } else {
6574
+                    $parent = 0;
6575
+        }
6561 6576
 
6562 6577
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6563 6578
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6822,11 +6837,13 @@  discard block
 block discarded – undo
6822 6837
         }
6823 6838
 
6824 6839
         $legend = '<legend>';
6825
-        if ($action == 'add')
6826
-            $legend .= get_lang('CreateTheExercise');
6827
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6828
-        else
6829
-            $legend .= get_lang('EditCurrentExecice');
6840
+        if ($action == 'add') {
6841
+                    $legend .= get_lang('CreateTheExercise');
6842
+        } elseif ($action == 'move') {
6843
+            $legend .= get_lang('MoveTheCurrentExercise');
6844
+        } else {
6845
+                    $legend .= get_lang('EditCurrentExecice');
6846
+        }
6830 6847
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6831 6848
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6832 6849
         }
@@ -6853,8 +6870,9 @@  discard block
 block discarded – undo
6853 6870
                         $arrHide[] = $arrLP[$i]['id'];
6854 6871
                     }
6855 6872
                 } else {
6856
-                    if ($arrLP[$i]['item_type'] == 'dir')
6857
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6873
+                    if ($arrLP[$i]['item_type'] == 'dir') {
6874
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6875
+                    }
6858 6876
                 }
6859 6877
             }
6860 6878
 
@@ -6872,11 +6890,13 @@  discard block
 block discarded – undo
6872 6890
 
6873 6891
         for ($i = 0; $i < count($arrLP); $i++) {
6874 6892
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6875
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6893
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6894
+                                    $selected = 'selected="selected" ';
6895
+                } elseif ($action == 'add') {
6876 6896
                     $selected = 'selected="selected" ';
6877
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6878
-                else
6879
-                    $selected = '';
6897
+                } else {
6898
+                                    $selected = '';
6899
+                }
6880 6900
 
6881 6901
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6882 6902
             }
@@ -6903,9 +6923,11 @@  discard block
 block discarded – undo
6903 6923
                 $arrHide = array ();
6904 6924
                 for ($i = 0; $i < count($arrLP); $i++) {
6905 6925
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
6906
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6907
-                            $s_selected_position = $arrLP[$i]['id'];
6908
-                        elseif ($action == 'add') $s_selected_position = 0;
6926
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6927
+                                                    $s_selected_position = $arrLP[$i]['id'];
6928
+                        } elseif ($action == 'add') {
6929
+                            $s_selected_position = 0;
6930
+                        }
6909 6931
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6910 6932
 
6911 6933
                     }
@@ -7098,9 +7120,11 @@  discard block
 block discarded – undo
7098 7120
             $arrHide = array();
7099 7121
             for ($i = 0; $i < count($arrLP); $i++) {
7100 7122
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
7101
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7102
-                        $s_selected_position = $arrLP[$i]['id'];
7103
-                    elseif ($action == 'add') $s_selected_position = 0;
7123
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7124
+                                            $s_selected_position = $arrLP[$i]['id'];
7125
+                    } elseif ($action == 'add') {
7126
+                        $s_selected_position = 0;
7127
+                    }
7104 7128
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7105 7129
                 }
7106 7130
             }
@@ -7295,9 +7319,11 @@  discard block
 block discarded – undo
7295 7319
 
7296 7320
             for ($i = 0; $i < count($arrLP); $i++) {
7297 7321
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
7298
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7299
-                        $s_selected_position = $arrLP[$i]['id'];
7300
-                    elseif ($action == 'add') $s_selected_position = 0;
7322
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7323
+                                            $s_selected_position = $arrLP[$i]['id'];
7324
+                    } elseif ($action == 'add') {
7325
+                        $s_selected_position = 0;
7326
+                    }
7301 7327
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7302 7328
 
7303 7329
                 }
@@ -7331,8 +7357,7 @@  discard block
 block discarded – undo
7331 7357
 
7332 7358
         if (is_numeric($extra_info)) {
7333 7359
             $form->addHidden('path', $extra_info);
7334
-        }
7335
-        elseif (is_array($extra_info)) {
7360
+        } elseif (is_array($extra_info)) {
7336 7361
             $form->addHidden('path', $extra_info['path']);
7337 7362
         }
7338 7363
 
@@ -7385,8 +7410,9 @@  discard block
 block discarded – undo
7385 7410
                     lp_id = " . $this->lp_id . " AND
7386 7411
                     id != $id";
7387 7412
 
7388
-        if ($item_type == 'dir')
7389
-            $sql .= " AND parent_item_id = 0";
7413
+        if ($item_type == 'dir') {
7414
+                    $sql .= " AND parent_item_id = 0";
7415
+        }
7390 7416
 
7391 7417
         $result = Database::query($sql);
7392 7418
         $arrLP = array ();
@@ -7787,9 +7813,11 @@  discard block
 block discarded – undo
7787 7813
             $arrHide = array();
7788 7814
             for ($i = 0; $i < count($arrLP); $i++) {
7789 7815
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) {
7790
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7816
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7817
+                                            $s_selected_position = $arrLP[$i]['id'];
7818
+                    } elseif ($action == 'add') {
7791 7819
                         $s_selected_position = $arrLP[$i]['id'];
7792
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7820
+                    }
7793 7821
 
7794 7822
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7795 7823
 
@@ -7800,17 +7828,18 @@  discard block
 block discarded – undo
7800 7828
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7801 7829
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7802 7830
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) {
7803
-                    if (isset ($_POST['content']))
7804
-                        $content = stripslashes($_POST['content']);
7805
-                    elseif (is_array($extra_info)) {
7831
+                    if (isset ($_POST['content'])) {
7832
+                                            $content = stripslashes($_POST['content']);
7833
+                    } elseif (is_array($extra_info)) {
7806 7834
                         //If it's an html document or a text file
7807 7835
                         if (!$no_display_edit_textarea) {
7808 7836
                             $content = $this->display_document($extra_info['path'], false, false);
7809 7837
                         }
7810
-                    } elseif (is_numeric($extra_info))
7811
-                        $content = $this->display_document($extra_info, false, false);
7812
-                    else
7813
-                        $content = '';
7838
+                    } elseif (is_numeric($extra_info)) {
7839
+                                            $content = $this->display_document($extra_info, false, false);
7840
+                    } else {
7841
+                                            $content = '';
7842
+                    }
7814 7843
 
7815 7844
                     if (!$no_display_edit_textarea) {
7816 7845
                         // We need to calculate here some specific settings for the online editor.
@@ -8074,9 +8103,11 @@  discard block
 block discarded – undo
8074 8103
             $arrHide = array();
8075 8104
             for ($i = 0; $i < count($arrLP); $i++) {
8076 8105
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
8077
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8078
-                        $s_selected_position = $arrLP[$i]['id'];
8079
-                    elseif ($action == 'add') $s_selected_position = 0;
8106
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8107
+                                            $s_selected_position = $arrLP[$i]['id'];
8108
+                    } elseif ($action == 'add') {
8109
+                        $s_selected_position = 0;
8110
+                    }
8080 8111
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8081 8112
 
8082 8113
                 }
@@ -8272,9 +8303,11 @@  discard block
 block discarded – undo
8272 8303
             $arrHide = array ();
8273 8304
             for ($i = 0; $i < count($arrLP); $i++) {
8274 8305
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
8275
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8276
-                        $s_selected_position = $arrLP[$i]['id'];
8277
-                    elseif ($action == 'add') $s_selected_position = 0;
8306
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8307
+                                            $s_selected_position = $arrLP[$i]['id'];
8308
+                    } elseif ($action == 'add') {
8309
+                        $s_selected_position = 0;
8310
+                    }
8278 8311
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8279 8312
 
8280 8313
                 }
Please login to merge, or discard this patch.
main/ticket/tickets.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 $isAdmin = api_is_platform_admin();
139 139
 
140 140
 Display::display_header(get_lang('MyTickets'));
141
-if (!empty($projectId))
142
-if ($isAdmin ) {
141
+if (!empty($projectId)) {
142
+    if ($isAdmin ) {
143 143
     $getParameters = [
144 144
         'keyword',
145 145
         'keyword_status',
@@ -151,6 +151,7 @@  discard block
 block discarded – undo
151 151
         'Tickets_per_page',
152 152
         'Tickets_column'
153 153
     ];
154
+}
154 155
     $get_parameter = '';
155 156
     foreach ($getParameters as $getParameter) {
156 157
         if (isset($_GET[$getParameter])) {
Please login to merge, or discard this patch.
main/webservices/registration.soap.php 1 patch
Braces   +186 added lines, -64 removed lines patch added patch discarded remove patch
@@ -63,14 +63,16 @@  discard block
 block discarded – undo
63 63
         list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
64 64
         $ip = trim($ip1);
65 65
     }
66
-    if ($debug)
67
-        error_log("ip: $ip");
66
+    if ($debug) {
67
+            error_log("ip: $ip");
68
+    }
68 69
     // Check if a file that limits access from webservices exists and contains
69 70
     // the restraining check
70 71
     if (is_file('webservice-auth-ip.conf.php')) {
71 72
         include 'webservice-auth-ip.conf.php';
72
-        if ($debug)
73
-            error_log("webservice-auth-ip.conf.php file included");
73
+        if ($debug) {
74
+                    error_log("webservice-auth-ip.conf.php file included");
75
+        }
74 76
         if (!empty($ws_auth_ip)) {
75 77
             $check_ip = true;
76 78
             $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip);
@@ -556,7 +558,9 @@  discard block
 block discarded – undo
556 558
 
557 559
     // First check wether the login already exists
558 560
     if (!UserManager::is_username_available($loginName)) {
559
-        if ($debug) error_log("Username $loginName is not available");
561
+        if ($debug) {
562
+            error_log("Username $loginName is not available");
563
+        }
560 564
         return 0;
561 565
     }
562 566
 
@@ -1049,9 +1053,15 @@  discard block
 block discarded – undo
1049 1053
         );
1050 1054
     }
1051 1055
 
1052
-    if ($debug) error_log('$userId found: '. $userId);
1053
-    if ($debug) error_log('$courseId found: '. $courseId);
1054
-    if ($debug) error_log('$sessionId found: '. $sessionId);
1056
+    if ($debug) {
1057
+        error_log('$userId found: '. $userId);
1058
+    }
1059
+    if ($debug) {
1060
+        error_log('$courseId found: '. $courseId);
1061
+    }
1062
+    if ($debug) {
1063
+        error_log('$sessionId found: '. $sessionId);
1064
+    }
1055 1065
 
1056 1066
     return [
1057 1067
         'user_id' => $userId,
@@ -1081,13 +1091,17 @@  discard block
 block discarded – undo
1081 1091
 {
1082 1092
     global $debug;
1083 1093
 
1084
-    if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
1094
+    if ($debug) {
1095
+        error_log('WSSubscribeTeacherToSessionCourse');
1096
+    }
1085 1097
 
1086 1098
     if (!WSHelperVerifyKey($params)) {
1087 1099
         return returnError(WS_ERROR_SECRET_KEY);
1088 1100
     }
1089 1101
 
1090
-    if ($debug) error_log('Params '. print_r($params, 1));
1102
+    if ($debug) {
1103
+        error_log('Params '. print_r($params, 1));
1104
+    }
1091 1105
 
1092 1106
     $params = parseCourseSessionUserParams($params);
1093 1107
 
@@ -1100,13 +1114,17 @@  discard block
 block discarded – undo
1100 1114
     $result = 0;
1101 1115
 
1102 1116
     if (!empty($coaches)) {
1103
-        if ($debug) error_log('Coaches:  '. print_r($coaches, 1));
1117
+        if ($debug) {
1118
+            error_log('Coaches:  '. print_r($coaches, 1));
1119
+        }
1104 1120
         if (in_array($userId, $coaches)) {
1105 1121
             $result = 1;
1106 1122
         }
1107 1123
     }
1108 1124
 
1109
-    if ($debug) error_log('Result:  '. $result);
1125
+    if ($debug) {
1126
+        error_log('Result:  '. $result);
1127
+    }
1110 1128
 
1111 1129
     return $result;
1112 1130
 }
@@ -1132,13 +1150,17 @@  discard block
 block discarded – undo
1132 1150
 {
1133 1151
     global $debug;
1134 1152
 
1135
-    if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
1153
+    if ($debug) {
1154
+        error_log('WSSubscribeTeacherToSessionCourse');
1155
+    }
1136 1156
 
1137 1157
     if (!WSHelperVerifyKey($params)) {
1138 1158
         return returnError(WS_ERROR_SECRET_KEY);
1139 1159
     }
1140 1160
 
1141
-    if ($debug) error_log('Params '. print_r($params, 1));
1161
+    if ($debug) {
1162
+        error_log('Params '. print_r($params, 1));
1163
+    }
1142 1164
 
1143 1165
     $params = parseCourseSessionUserParams($params);
1144 1166
 
@@ -1152,7 +1174,9 @@  discard block
 block discarded – undo
1152 1174
     $result = 0;
1153 1175
 
1154 1176
     if (!empty($coaches)) {
1155
-        if ($debug) error_log('Coaches:  ' . print_r($coaches, 1));
1177
+        if ($debug) {
1178
+            error_log('Coaches:  ' . print_r($coaches, 1));
1179
+        }
1156 1180
         if (!in_array($userId, $coaches)) {
1157 1181
             $result = 1;
1158 1182
         }
@@ -1160,7 +1184,9 @@  discard block
 block discarded – undo
1160 1184
         $result = 1;
1161 1185
     }
1162 1186
 
1163
-    if ($debug) error_log('Final Result: '. $result);
1187
+    if ($debug) {
1188
+        error_log('Final Result: '. $result);
1189
+    }
1164 1190
 
1165 1191
     return $result;
1166 1192
 }
@@ -1212,8 +1238,12 @@  discard block
 block discarded – undo
1212 1238
 {
1213 1239
     global $_user, $_configuration, $debug;
1214 1240
     $debug = 1;
1215
-    if ($debug) error_log('WSCreateUserPasswordCrypted');
1216
-    if ($debug) error_log(print_r($params,1));
1241
+    if ($debug) {
1242
+        error_log('WSCreateUserPasswordCrypted');
1243
+    }
1244
+    if ($debug) {
1245
+        error_log(print_r($params,1));
1246
+    }
1217 1247
 
1218 1248
     if (!WSHelperVerifyKey($params)) {
1219 1249
         return returnError(WS_ERROR_SECRET_KEY);
@@ -1245,22 +1275,30 @@  discard block
 block discarded – undo
1245 1275
         if ($_configuration['password_encryption'] === $encrypt_method ) {
1246 1276
             if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) {
1247 1277
                 $msg = "Encryption $encrypt_method is invalid";
1248
-                if ($debug) error_log($msg);
1278
+                if ($debug) {
1279
+                    error_log($msg);
1280
+                }
1249 1281
                 return $msg;
1250 1282
 
1251 1283
             } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) {
1252 1284
                 $msg = "Encryption $encrypt_method is invalid";
1253
-                if ($debug) error_log($msg);
1285
+                if ($debug) {
1286
+                    error_log($msg);
1287
+                }
1254 1288
                 return $msg;
1255 1289
             }
1256 1290
         } else {
1257 1291
             $msg = "This encryption $encrypt_method is not configured";
1258
-            if ($debug) error_log($msg);
1292
+            if ($debug) {
1293
+                error_log($msg);
1294
+            }
1259 1295
             return $msg;
1260 1296
         }
1261 1297
     } else {
1262 1298
         $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured';
1263
-        if ($debug) error_log($msg);
1299
+        if ($debug) {
1300
+            error_log($msg);
1301
+        }
1264 1302
         return $msg;
1265 1303
     }
1266 1304
 
@@ -1280,10 +1318,14 @@  discard block
 block discarded – undo
1280 1318
         $original_user_id_name
1281 1319
     );
1282 1320
 
1283
-    if ($debug) error_log('Ready to create user');
1321
+    if ($debug) {
1322
+        error_log('Ready to create user');
1323
+    }
1284 1324
 
1285 1325
     if ($user_id > 0) {
1286
-        if ($debug) error_log('User found with id: '.$user_id);
1326
+        if ($debug) {
1327
+            error_log('User found with id: '.$user_id);
1328
+        }
1287 1329
 
1288 1330
         // Check whether user is not active
1289 1331
         //@todo why this condition exists??
@@ -1294,7 +1336,9 @@  discard block
 block discarded – undo
1294 1336
         $count_check_user = Database::num_rows($resu);
1295 1337
         if ($count_check_user > 0) {
1296 1338
 
1297
-            if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1');
1339
+            if ($debug) {
1340
+                error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1');
1341
+            }
1298 1342
 
1299 1343
             $sql = "UPDATE $table_user SET
1300 1344
                     lastname='".Database::escape_string($lastName)."',
@@ -1315,7 +1359,9 @@  discard block
 block discarded – undo
1315 1359
                     hr_dept_id=".intval($hr_dept_id)." 
1316 1360
                 WHERE user_id='".$r_check_user[0]."'";
1317 1361
 
1318
-            if ($debug) error_log($sql);
1362
+            if ($debug) {
1363
+                error_log($sql);
1364
+            }
1319 1365
             Database::query($sql);
1320 1366
 
1321 1367
             if (is_array($extra_list) && count($extra_list) > 0) {
@@ -1332,11 +1378,15 @@  discard block
 block discarded – undo
1332 1378
             }
1333 1379
             return $r_check_user[0];
1334 1380
         } else {
1335
-            if ($debug) error_log('User exists but is active. Cant be updated');
1381
+            if ($debug) {
1382
+                error_log('User exists but is active. Cant be updated');
1383
+            }
1336 1384
             return 0;
1337 1385
         }
1338 1386
     } else {
1339
-        if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name");
1387
+        if ($debug) {
1388
+            error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name");
1389
+        }
1340 1390
     }
1341 1391
 
1342 1392
     // Default language.
@@ -1352,7 +1402,9 @@  discard block
 block discarded – undo
1352 1402
 
1353 1403
     // First check wether the login already exists
1354 1404
     if (!UserManager::is_username_available($loginName)) {
1355
-        if ($debug) error_log("Username $loginName is not available");
1405
+        if ($debug) {
1406
+            error_log("Username $loginName is not available");
1407
+        }
1356 1408
         return 0;
1357 1409
     }
1358 1410
 
@@ -1374,7 +1426,9 @@  discard block
 block discarded – undo
1374 1426
             expiration_date     = '".Database::escape_string($expiration_date)."',
1375 1427
             hr_dept_id          = '".Database::escape_string($hr_dept_id)."',
1376 1428
             active              = '".Database::escape_string($active)."'";
1377
-    if ($debug) error_log($sql);
1429
+    if ($debug) {
1430
+        error_log($sql);
1431
+    }
1378 1432
 
1379 1433
     Database::query($sql);
1380 1434
     $return = Database::insert_id();
@@ -1386,7 +1440,9 @@  discard block
 block discarded – undo
1386 1440
 
1387 1441
         $url_id = api_get_current_access_url_id();
1388 1442
         UrlManager::add_user_to_url($return, $url_id);
1389
-        if ($debug) error_log("Adding user_id = $return to URL id $url_id ");
1443
+        if ($debug) {
1444
+            error_log("Adding user_id = $return to URL id $url_id ");
1445
+        }
1390 1446
 
1391 1447
         // Create extra field for the original_user_id_name
1392 1448
         UserManager::create_extra_field(
@@ -1423,7 +1479,9 @@  discard block
 block discarded – undo
1423 1479
             }
1424 1480
         }
1425 1481
     } else {
1426
-        if ($debug) error_log('Error while inserting a user');
1482
+        if ($debug) {
1483
+            error_log('Error while inserting a user');
1484
+        }
1427 1485
 
1428 1486
         return 0;
1429 1487
     }
@@ -4194,7 +4252,9 @@  discard block
 block discarded – undo
4194 4252
             continue;
4195 4253
         }
4196 4254
 
4197
-        if (empty($nolimit) && $duration) $nolimit = 1;
4255
+        if (empty($nolimit) && $duration) {
4256
+            $nolimit = 1;
4257
+        }
4198 4258
 
4199 4259
         if (empty($nolimit)) {
4200 4260
             $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start).' 00:00:00';
@@ -4507,7 +4567,9 @@  discard block
 block discarded – undo
4507 4567
     if (!WSHelperVerifyKey($params)) {
4508 4568
         return returnError(WS_ERROR_SECRET_KEY);
4509 4569
     }
4510
-    if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4570
+    if ($debug) {
4571
+        error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4572
+    }
4511 4573
 
4512 4574
     $results = array();
4513 4575
     $userscourses = $params['userscourses'];
@@ -4526,7 +4588,9 @@  discard block
 block discarded – undo
4526 4588
             $original_user_id['original_user_id_value'],
4527 4589
             $original_user_id['original_user_id_name']
4528 4590
         );
4529
-        if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4591
+        if ($debug) {
4592
+            error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4593
+        }
4530 4594
 
4531 4595
         if ($user_id == 0) {
4532 4596
             // If user was not found, there was a problem
@@ -4544,13 +4608,19 @@  discard block
 block discarded – undo
4544 4608
                 // Course was not found
4545 4609
                 $resultValue = 0;
4546 4610
             } else {
4547
-                if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4611
+                if ($debug) {
4612
+                    error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4613
+                }
4548 4614
                 $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false);
4549 4615
                 if ($result) {
4550 4616
                     $resultValue = 1;
4551
-                    if ($debug) error_log('WSSubscribeUserToCourse subscribed');
4617
+                    if ($debug) {
4618
+                        error_log('WSSubscribeUserToCourse subscribed');
4619
+                    }
4552 4620
                 } else {
4553
-                    if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: ');
4621
+                    if ($debug) {
4622
+                        error_log('WSSubscribeUserToCourse NOT subscribed: ');
4623
+                    }
4554 4624
                 }
4555 4625
             }
4556 4626
         }
@@ -4609,8 +4679,12 @@  discard block
 block discarded – undo
4609 4679
 function WSSubscribeUserToCourseSimple($params) {
4610 4680
     global $debug;
4611 4681
 
4612
-    if ($debug) error_log('WSSubscribeUserToCourseSimple');
4613
-    if ($debug) error_log('Params '. print_r($params, 1));
4682
+    if ($debug) {
4683
+        error_log('WSSubscribeUserToCourseSimple');
4684
+    }
4685
+    if ($debug) {
4686
+        error_log('Params '. print_r($params, 1));
4687
+    }
4614 4688
     if (!WSHelperVerifyKey($params)) {
4615 4689
         return returnError(WS_ERROR_SECRET_KEY);
4616 4690
     }
@@ -4628,7 +4702,9 @@  discard block
 block discarded – undo
4628 4702
     if (empty($user_data)) {
4629 4703
         // If user was not found, there was a problem
4630 4704
         $result = "User $user_id does not exist";
4631
-        if ($debug) error_log($result);
4705
+        if ($debug) {
4706
+            error_log($result);
4707
+        }
4632 4708
         return $result;
4633 4709
     }
4634 4710
     if (!empty($course_code)) {
@@ -4636,14 +4712,22 @@  discard block
 block discarded – undo
4636 4712
         if (empty($course_data)) {
4637 4713
             // Course was not found
4638 4714
             $result = "Course $course_code does not exist in the platform ";
4639
-            if ($debug) error_log($result);
4715
+            if ($debug) {
4716
+                error_log($result);
4717
+            }
4640 4718
         } else {
4641
-            if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4719
+            if ($debug) {
4720
+                error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4721
+            }
4642 4722
             if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) {
4643 4723
                 $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions ';
4644
-                if ($debug) error_log($result);
4724
+                if ($debug) {
4725
+                    error_log($result);
4726
+                }
4645 4727
             } else {
4646
-                if ($debug) error_log('User registered to the course: '.$course_data['code']);
4728
+                if ($debug) {
4729
+                    error_log('User registered to the course: '.$course_data['code']);
4730
+                }
4647 4731
                 $result = 1;
4648 4732
             }
4649 4733
         }
@@ -4696,8 +4780,12 @@  discard block
 block discarded – undo
4696 4780
 function WSGetUser($params)
4697 4781
 {
4698 4782
     global $debug;
4699
-    if ($debug) error_log('WSGetUser');
4700
-    if ($debug) error_log('$params: '.print_r($params, 1));
4783
+    if ($debug) {
4784
+        error_log('WSGetUser');
4785
+    }
4786
+    if ($debug) {
4787
+        error_log('$params: '.print_r($params, 1));
4788
+    }
4701 4789
 
4702 4790
     if (!WSHelperVerifyKey($params)) {
4703 4791
         return returnError(WS_ERROR_SECRET_KEY);
@@ -4751,8 +4839,12 @@  discard block
 block discarded – undo
4751 4839
 function WSGetUserFromUsername($params)
4752 4840
 {
4753 4841
     global $debug;
4754
-    if ($debug) error_log('WSGetUserFromUsername');
4755
-    if ($debug) error_log('$params: '.print_r($params, 1));
4842
+    if ($debug) {
4843
+        error_log('WSGetUserFromUsername');
4844
+    }
4845
+    if ($debug) {
4846
+        error_log('$params: '.print_r($params, 1));
4847
+    }
4756 4848
 
4757 4849
     if (!WSHelperVerifyKey($params)) {
4758 4850
         return returnError(WS_ERROR_SECRET_KEY);
@@ -5219,7 +5311,9 @@  discard block
 block discarded – undo
5219 5311
                 SessionManager::suscribe_users_to_session($sessionId, array($user_id), SESSION_VISIBLE_READ_ONLY, false);
5220 5312
                 $results[] = 1;
5221 5313
 
5222
-                if ($debug) error_log("subscribe user:$user_id to session $sessionId");
5314
+                if ($debug) {
5315
+                    error_log("subscribe user:$user_id to session $sessionId");
5316
+                }
5223 5317
             }
5224 5318
         }
5225 5319
     } // end principal foreach
@@ -5303,7 +5397,9 @@  discard block
 block discarded – undo
5303 5397
                 SESSION_VISIBLE_READ_ONLY,
5304 5398
                 false
5305 5399
             );
5306
-            if ($debug) error_log('User registered to the course: '.$session_id);
5400
+            if ($debug) {
5401
+                error_log('User registered to the course: '.$session_id);
5402
+            }
5307 5403
             $result = 1;
5308 5404
         }
5309 5405
     }
@@ -5451,7 +5547,9 @@  discard block
 block discarded – undo
5451 5547
 
5452 5548
                 $results[] = 1;
5453 5549
 
5454
-                if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session");
5550
+                if ($debug) {
5551
+                    error_log("Unsubscribe user:$user_id to session:$id_session");
5552
+                }
5455 5553
             }
5456 5554
         }
5457 5555
     } // end principal foreach
@@ -5598,7 +5696,9 @@  discard block
 block discarded – undo
5598 5696
         return returnError(WS_ERROR_SECRET_KEY);
5599 5697
     }
5600 5698
 
5601
-    if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5699
+    if ($debug) {
5700
+        error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5701
+    }
5602 5702
 
5603 5703
     $coursessessions_params = $params['coursessessions'];
5604 5704
     $results = array();
@@ -5644,7 +5744,9 @@  discard block
 block discarded – undo
5644 5744
                     array($courseInfo['real_id']),
5645 5745
                     false
5646 5746
                 );
5647
-                if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5747
+                if ($debug) {
5748
+                    error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5749
+                }
5648 5750
 
5649 5751
                 $results[] = 1;
5650 5752
             }
@@ -6917,7 +7019,9 @@  discard block
 block discarded – undo
6917 7019
     if (!WSHelperVerifyKey($params)) {
6918 7020
         return returnError(WS_ERROR_SECRET_KEY);
6919 7021
     }
6920
-    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1));
7022
+    if ($debug) {
7023
+        error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1));
7024
+    }
6921 7025
 
6922 7026
     $results = array();
6923 7027
     $userscourses = $params['userscourses'];
@@ -6933,7 +7037,9 @@  discard block
 block discarded – undo
6933 7037
             $original_user_id['original_user_id_value'],
6934 7038
             $original_user_id['original_user_id_name']
6935 7039
         );
6936
-        if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId);
7040
+        if ($debug) {
7041
+            error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId);
7042
+        }
6937 7043
 
6938 7044
         if ($userId == 0) {
6939 7045
             // If user was not found, there was a problem
@@ -6950,13 +7056,19 @@  discard block
 block discarded – undo
6950 7056
                 // Course was not found
6951 7057
                 $resultValue = 0;
6952 7058
             } else {
6953
-                if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode);
7059
+                if ($debug) {
7060
+                    error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode);
7061
+                }
6954 7062
                 $result = CourseManager::addUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible);
6955 7063
                 if ($result) {
6956 7064
                     $resultValue = 1;
6957
-                    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue registered');
7065
+                    if ($debug) {
7066
+                        error_log('WSAddUserVisibilityToCourseCatalogue registered');
7067
+                    }
6958 7068
                 } else {
6959
-                    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: ');
7069
+                    if ($debug) {
7070
+                        error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: ');
7071
+                    }
6960 7072
                 }
6961 7073
             }
6962 7074
         }
@@ -6989,7 +7101,9 @@  discard block
 block discarded – undo
6989 7101
     if (!WSHelperVerifyKey($params)) {
6990 7102
         return returnError(WS_ERROR_SECRET_KEY);
6991 7103
     }
6992
-    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1));
7104
+    if ($debug) {
7105
+        error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1));
7106
+    }
6993 7107
 
6994 7108
     $results = array();
6995 7109
     $userscourses = $params['userscourses'];
@@ -7005,7 +7119,9 @@  discard block
 block discarded – undo
7005 7119
             $original_user_id['original_user_id_value'],
7006 7120
             $original_user_id['original_user_id_name']
7007 7121
         );
7008
-        if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId);
7122
+        if ($debug) {
7123
+            error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId);
7124
+        }
7009 7125
 
7010 7126
         if ($userId == 0) {
7011 7127
             // If user was not found, there was a problem
@@ -7023,13 +7139,19 @@  discard block
 block discarded – undo
7023 7139
                 // Course was not found
7024 7140
                 $resultValue = 0;
7025 7141
             } else {
7026
-                if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode);
7142
+                if ($debug) {
7143
+                    error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode);
7144
+                }
7027 7145
                 $result = CourseManager::removeUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible);
7028 7146
                 if ($result) {
7029 7147
                     $resultValue = 1;
7030
-                    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue removed');
7148
+                    if ($debug) {
7149
+                        error_log('WSRemoveUserVisibilityToCourseInCatalogue removed');
7150
+                    }
7031 7151
                 } else {
7032
-                    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: ');
7152
+                    if ($debug) {
7153
+                        error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: ');
7154
+                    }
7033 7155
                 }
7034 7156
             }
7035 7157
         }
Please login to merge, or discard this patch.
src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -532,7 +532,9 @@  discard block
 block discarded – undo
532 532
 
533 533
                                 if (in_array($file_info['extension'], array('html', 'htm'))) {
534 534
                                     $content = file_get_contents($path.$document->path);
535
-                                    if (UTF8_CONVERT) $content = utf8_encode($content);
535
+                                    if (UTF8_CONVERT) {
536
+                                        $content = utf8_encode($content);
537
+                                    }
536 538
                                     $content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
537 539
                                         $content,
538 540
                                         $this->course->code,
@@ -2788,8 +2790,9 @@  discard block
 block discarded – undo
2788 2790
                             echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>';
2789 2791
                         }*/
2790 2792
                     } elseif(is_dir($path)) {
2791
-                        if (!is_dir($dest . '/' . $file))
2792
-                        mkdir($dest . '/' . $file);
2793
+                        if (!is_dir($dest . '/' . $file)) {
2794
+                                                mkdir($dest . '/' . $file);
2795
+                        }
2793 2796
                         self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite);
2794 2797
                     }
2795 2798
                 }
Please login to merge, or discard this patch.
main/upload/upload.document.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,9 +64,10 @@
 block discarded – undo
64 64
     	$new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : '';
65 65
     	$new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : '';
66 66
 
67
-    	if ($new_path && ($new_comment || $new_title))
68
-    	if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
67
+    	if ($new_path && ($new_comment || $new_title)) {
68
+    	    	if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
69 69
         	$table_document = Database::get_course_table(TABLE_DOCUMENT);
70
+    	}
70 71
         	$ct = '';
71 72
             if ($new_comment) {
72 73
                 $ct .= ", comment='$new_comment'";
Please login to merge, or discard this patch.
main/exercise/hotspot_admin.inc.php 1 patch
Braces   +29 added lines, -11 removed lines patch added patch discarded remove patch
@@ -679,12 +679,15 @@  discard block
 block discarded – undo
679 679
                                     $option1 = $option2 = $option3 = '';
680 680
                                     for ($k = 1; $k <= 100; $k++) {
681 681
                                         $selected1 = $selected2 = $selected3 = '';
682
-                                        if ($k == $threadhold1[$i])
683
-                                            $selected1 = 'selected="selected"';
684
-                                        if ($k == $threadhold2[$i])
685
-                                            $selected2 = 'selected="selected"';
686
-                                        if ($k == $threadhold3[$i])
687
-                                            $selected3 = 'selected="selected"';
682
+                                        if ($k == $threadhold1[$i]) {
683
+                                                                                    $selected1 = 'selected="selected"';
684
+                                        }
685
+                                        if ($k == $threadhold2[$i]) {
686
+                                                                                    $selected2 = 'selected="selected"';
687
+                                        }
688
+                                        if ($k == $threadhold3[$i]) {
689
+                                                                                    $selected3 = 'selected="selected"';
690
+                                        }
688 691
                                         $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
689 692
                                         $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
690 693
                                         $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
@@ -731,7 +734,10 @@  discard block
 block discarded – undo
731 734
                                                 <div class="checkbox">
732 735
                                                     <p>
733 736
                                                         <label>
734
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
737
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) {
738
+    echo'checked';
739
+}
740
+?> />
735 741
                                                             <?php echo get_lang('TryAgain'); ?>
736 742
                                                         </label>
737 743
                                                     </p>
@@ -784,7 +790,10 @@  discard block
 block discarded – undo
784 790
                                                             <div class="checkbox">
785 791
                                                                 <p>
786 792
                                                                     <label>
787
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
793
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) {
794
+    echo'checked';
795
+}
796
+?> />
788 797
                                                                         <?php echo get_lang('TryAgain'); ?>
789 798
                                                                     </label>
790 799
                                                                 </p>
@@ -823,7 +832,10 @@  discard block
 block discarded – undo
823 832
                                             <th ><?php echo get_lang('OAR'); ?>*</th>
824 833
                                             <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
825 834
                                                 <th colspan="2" ><?php echo get_lang('Comment'); ?></th>
826
-                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th>
835
+                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) {
836
+    echo get_lang('Scenario');
837
+}
838
+?></th>
827 839
                                             <?php } else { ?>
828 840
                                                 <th colspan="3" ><?php echo get_lang('Comment'); ?></th>
829 841
                                             <?php } ?>
@@ -849,7 +861,10 @@  discard block
 block discarded – undo
849 861
                                                 <div class="checkbox">
850 862
                                                     <p>
851 863
                                                         <label>
852
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
864
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) {
865
+    echo'checked';
866
+}
867
+?> />
853 868
                                                             <?php echo get_lang('TryAgain'); ?>
854 869
                                                         </label>
855 870
                                                     </p>
@@ -998,7 +1013,10 @@  discard block
 block discarded – undo
998 1013
                                         <div class="checkbox">
999 1014
                                             <p>
1000 1015
                                                 <label>
1001
-                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> />
1016
+                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) {
1017
+    echo'checked';
1018
+}
1019
+?> />
1002 1020
                                                     <?php echo get_lang('TryAgain'); ?>
1003 1021
                                                 </label>
1004 1022
                                             </p>
Please login to merge, or discard this patch.
main/inc/lib/blog.lib.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1007,8 +1007,9 @@  discard block
 block discarded – undo
1007 1007
             $blog_post_actions .= '</a>';
1008 1008
         }
1009 1009
 
1010
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_rate'))
1011
-            $rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1010
+        if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) {
1011
+                    $rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1012
+        }
1012 1013
 
1013 1014
         $blog_post_text=stripslashes($blog_post_text);
1014 1015
 
@@ -1652,8 +1653,9 @@  discard block
 block discarded – undo
1652 1653
 
1653 1654
                         $arrPermissions = array();
1654 1655
 
1655
-                        while ($row = Database::fetch_array($result))
1656
-                            $arrPermissions[] = $row['action'];
1656
+                        while ($row = Database::fetch_array($result)) {
1657
+                                                    $arrPermissions[] = $row['action'];
1658
+                        }
1657 1659
 
1658 1660
                             echo '<tr>';
1659 1661
                             echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ':&nbsp;&nbsp;</td>';
@@ -2329,8 +2331,9 @@  discard block
 block discarded – undo
2329 2331
         //Handle leap year
2330 2332
         $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
2331 2333
 
2332
-        if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
2333
-            $numberofdays[2] = 29;
2334
+        if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {
2335
+                    $numberofdays[2] = 29;
2336
+        }
2334 2337
 
2335 2338
         //Get the first day of the month
2336 2339
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
@@ -2360,8 +2363,9 @@  discard block
 block discarded – undo
2360 2363
         if( Database::num_rows($result) > 0) {
2361 2364
             while($blog_post = Database::fetch_array($result)) {
2362 2365
                 // If the day of this post is not yet in the array, add it.
2363
-                if (!in_array($blog_post['post_day'], $posts))
2364
-                    $posts[] = $blog_post['post_day'];
2366
+                if (!in_array($blog_post['post_day'], $posts)) {
2367
+                                    $posts[] = $blog_post['post_day'];
2368
+                }
2365 2369
             }
2366 2370
         }
2367 2371
 
@@ -2400,8 +2404,9 @@  discard block
 block discarded – undo
2400 2404
 
2401 2405
         echo "<tr>";
2402 2406
 
2403
-        for($ii = 1; $ii < 8; $ii ++)
2404
-            echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2407
+        for($ii = 1; $ii < 8; $ii ++) {
2408
+                    echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2409
+        }
2405 2410
 
2406 2411
         echo "</tr>";
2407 2412
 
@@ -2411,8 +2416,9 @@  discard block
 block discarded – undo
2411 2416
         while ($curday <= $numberofdays[$month]) {
2412 2417
             echo "<tr>";
2413 2418
             for ($ii = 0; $ii < 7; $ii ++) {
2414
-                if (($curday == -1) && ($ii == $startdayofweek))
2415
-                    $curday = 1;
2419
+                if (($curday == -1) && ($ii == $startdayofweek)) {
2420
+                                    $curday = 1;
2421
+                }
2416 2422
 
2417 2423
                 if (($curday > 0) && ($curday <= $numberofdays[$month])) {
2418 2424
                     $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\"";
@@ -2426,10 +2432,11 @@  discard block
 block discarded – undo
2426 2432
                     echo "<td " . $class.">";
2427 2433
 
2428 2434
                     // If there are posts on this day, create a filter link.
2429
-                    if(in_array($curday, $posts))
2430
-                        echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2431
-                    else
2432
-                        echo $dayheader;
2435
+                    if(in_array($curday, $posts)) {
2436
+                                            echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2437
+                    } else {
2438
+                                            echo $dayheader;
2439
+                    }
2433 2440
 
2434 2441
                     if (count($tasks) > 0) {
2435 2442
                         if (isset($tasks[$curday]) && is_array($tasks[$curday])) {
@@ -2444,8 +2451,9 @@  discard block
 block discarded – undo
2444 2451
 
2445 2452
                     echo "</td>";
2446 2453
                     $curday ++;
2447
-                } else
2448
-                    echo "<td>&nbsp;</td>";
2454
+                } else {
2455
+                                    echo "<td>&nbsp;</td>";
2456
+                }
2449 2457
             }
2450 2458
             echo "</tr>";
2451 2459
         }
Please login to merge, or discard this patch.
main/inc/lib/message.lib.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -143,8 +143,9 @@  discard block
 block discarded – undo
143 143
             $direction = 'DESC';
144 144
         } else {
145 145
             $column = intval($column);
146
-            if (!in_array($direction, array('ASC', 'DESC')))
147
-                $direction = 'ASC';
146
+            if (!in_array($direction, array('ASC', 'DESC'))) {
147
+                            $direction = 'ASC';
148
+            }
148 149
         }
149 150
 
150 151
         $keyword = Session::read('message_search_keyword');
@@ -697,8 +698,9 @@  discard block
 block discarded – undo
697 698
      */
698 699
     public static function update_message($user_id, $message_id)
699 700
     {
700
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
701
-            return false;
701
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
702
+                    return false;
703
+        }
702 704
 
703 705
         $table_message = Database::get_main_table(TABLE_MESSAGE);
704 706
         $sql = "UPDATE $table_message SET msg_status = '0'
@@ -738,8 +740,9 @@  discard block
 block discarded – undo
738 740
      */
739 741
     public static function get_message_by_user($user_id, $message_id)
740 742
     {
741
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
742
-            return false;
743
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
744
+                    return false;
745
+        }
743 746
         $table_message = Database::get_main_table(TABLE_MESSAGE);
744 747
         $query = "SELECT * FROM $table_message
745 748
                   WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'";
@@ -864,8 +867,9 @@  discard block
 block discarded – undo
864 867
      */
865 868
     public static function exist_message($user_id, $id)
866 869
     {
867
-        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id)))
868
-            return false;
870
+        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id))) {
871
+                    return false;
872
+        }
869 873
         $table_message = Database::get_main_table(TABLE_MESSAGE);
870 874
         $query = "SELECT id FROM $table_message
871 875
                   WHERE
@@ -896,8 +900,9 @@  discard block
 block discarded – undo
896 900
             $direction = 'DESC';
897 901
         } else {
898 902
             $column = intval($column);
899
-            if (!in_array($direction, array('ASC', 'DESC')))
900
-                $direction = 'ASC';
903
+            if (!in_array($direction, array('ASC', 'DESC'))) {
904
+                            $direction = 'ASC';
905
+            }
901 906
         }
902 907
         $table_message = Database::get_main_table(TABLE_MESSAGE);
903 908
         $request = api_is_xml_http_request();
Please login to merge, or discard this patch.
main/admin/user_move_stats.php 1 patch
Braces   +99 added lines, -43 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@  discard block
 block discarded – undo
107 107
                 //Check if the user is registered in the session otherwise we will add it
108 108
                 $result = SessionManager::get_users_by_session($new_session_id);
109 109
                 if (empty($result) || !in_array($user_id, array_keys($result))) {
110
-                    if ($debug) echo 'User added to the session';
110
+                    if ($debug) {
111
+                        echo 'User added to the session';
112
+                    }
111 113
                     //Registering user to the new session
112 114
                     SessionManager::suscribe_users_to_session($new_session_id,array($user_id),false);
113 115
                 }
@@ -142,10 +144,11 @@  discard block
 block discarded – undo
142 144
                     $list[$row['exe_id']]= $row;
143 145
                 }
144 146
 
145
-                if (!empty($list))
146
-                    foreach ($list as $exe_id =>$data) {
147
+                if (!empty($list)) {
148
+                                    foreach ($list as $exe_id =>$data) {
147 149
                         if ($update_database) {
148 150
                             $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
151
+                }
149 152
                             $res = Database::query($sql);
150 153
                             $result_message[$TABLETRACK_EXERCICES]++;
151 154
                         } else {
@@ -169,10 +172,11 @@  discard block
 block discarded – undo
169 172
                         $list[$row['exe_id']]= $row;
170 173
                     }
171 174
 
172
-                    if (!empty($list))
173
-                        foreach ($list as $exe_id =>$data) {
175
+                    if (!empty($list)) {
176
+                                            foreach ($list as $exe_id =>$data) {
174 177
                             if ($update_database) {
175 178
                                 $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
179
+                    }
176 180
                                 $res = Database::query($sql);
177 181
                                 $result_message[$TABLETRACK_EXERCICES]++;
178 182
                             } else {
@@ -197,10 +201,11 @@  discard block
 block discarded – undo
197 201
                     $list[$row['course_access_id']] = $row;
198 202
                 }
199 203
 
200
-                if (!empty($list))
201
-                    foreach ($list as $id => $data) {
204
+                if (!empty($list)) {
205
+                                    foreach ($list as $id => $data) {
202 206
                         if ($update_database) {
203 207
                             $sql = "UPDATE $TBL_TRACK_E_COURSE_ACCESS SET session_id = $new_session_id WHERE course_access_id = $id";
208
+                }
204 209
                             if ($debug) {
205 210
                                 echo $sql;
206 211
                             }
@@ -219,13 +224,18 @@  discard block
 block discarded – undo
219 224
                 while($row = Database::fetch_array($res,'ASSOC')) {
220 225
                     $list[] = $row['access_id'];
221 226
                 }
222
-                if (!empty($list))
223
-                    foreach ($list as $id) {
227
+                if (!empty($list)) {
228
+                                    foreach ($list as $id) {
224 229
                         if ($update_database) {
225 230
                             $sql = "UPDATE $TBL_TRACK_E_LAST_ACCESS SET access_session_id = $new_session_id WHERE access_id = $id";
226
-                            if ($debug) echo $sql;
231
+                }
232
+                            if ($debug) {
233
+                                echo $sql;
234
+                            }
227 235
                             $res = Database::query($sql);
228
-                            if ($debug) error_log(__FILE__ . ' +' . __LINE__ . ': ' . print_r($res, 1));
236
+                            if ($debug) {
237
+                                error_log(__FILE__ . ' +' . __LINE__ . ': ' . print_r($res, 1));
238
+                            }
229 239
                             $result_message[$TBL_TRACK_E_LAST_ACCESS]++;
230 240
                         }
231 241
                     }
@@ -249,13 +259,18 @@  discard block
 block discarded – undo
249 259
                     }
250 260
                 }
251 261
 
252
-                if (!empty($list))
253
-                    foreach ($list as $id=>$data) {
262
+                if (!empty($list)) {
263
+                                    foreach ($list as $id=>$data) {
254 264
                         if ($update_database) {
255 265
                             $sql = "UPDATE $TBL_LP_VIEW SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
256
-                            if ($debug) var_dump($sql);
266
+                }
267
+                            if ($debug) {
268
+                                var_dump($sql);
269
+                            }
257 270
                             $res = Database::query($sql);
258
-                            if ($debug) var_dump($res);
271
+                            if ($debug) {
272
+                                var_dump($res);
273
+                            }
259 274
                             $result_message[$TBL_LP_VIEW]++;
260 275
                         } else {
261 276
                             //Getting all information of that lp_item_id
@@ -282,10 +297,11 @@  discard block
 block discarded – undo
282 297
                             $list[$row['id']] = $row;
283 298
                         }
284 299
                     }
285
-                    if (!empty($list))
286
-                        foreach ($list as $id=>$data) {
300
+                    if (!empty($list)) {
301
+                                            foreach ($list as $id=>$data) {
287 302
                             //Getting all information of that lp_item_id
288 303
                             $score    = Tracking::get_avg_student_score($user_id, $origin_course_code,        array($data['lp_id']), $new_session_id);
304
+                    }
289 305
                             $progress = Tracking::get_avg_student_progress($user_id, $origin_course_code,     array($data['lp_id']), $new_session_id);
290 306
                             $result_message_compare['LP_VIEW'][$data['lp_id']] = array('score' => $score, 'progress' =>$progress);
291 307
                         }
@@ -301,9 +317,13 @@  discard block
 block discarded – undo
301 317
                     $id = $row['ref'];
302 318
                     if ($update_database) {
303 319
                         $sql = "UPDATE $TBL_AGENDA SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
304
-                        if ($debug) var_dump($sql);
320
+                        if ($debug) {
321
+                            var_dump($sql);
322
+                        }
305 323
                         $res_update = Database::query($sql);
306
-                        if ($debug) var_dump($res_update);
324
+                        if ($debug) {
325
+                            var_dump($res_update);
326
+                        }
307 327
                         $result_message['agenda']++;
308 328
                     }
309 329
                 }
@@ -315,22 +335,30 @@  discard block
 block discarded – undo
315 335
                 //echo '<h1>Student publication</h1>';
316 336
 
317 337
                 $sql = "SELECT ref FROM $TBL_ITEM_PROPERTY WHERE tool = 'work' AND insert_user_id = $user_id AND c_id = $course_id";
318
-                if ($debug) echo $sql;
338
+                if ($debug) {
339
+                    echo $sql;
340
+                }
319 341
                 $res = Database::query($sql);
320 342
                 while($row = Database::fetch_array($res,'ASSOC')) {
321 343
                     $id = $row['ref'];
322 344
                     $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $id AND session_id = $origin_session_id AND c_id = $course_id";
323
-                    if ($debug) var_dump($sql);
345
+                    if ($debug) {
346
+                        var_dump($sql);
347
+                    }
324 348
                     $sub_res = Database::query($sql);
325 349
                     if (Database::num_rows($sub_res) > 0 ) {
326 350
                         $data = Database::fetch_array($sub_res,'ASSOC');
327
-                        if ($debug) var_dump($data);
351
+                        if ($debug) {
352
+                            var_dump($data);
353
+                        }
328 354
                         $parent_id = $data['parent_id'];
329 355
                         if (isset($data['parent_id']) && !empty($data['parent_id'])) {
330 356
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $parent_id AND c_id = $course_id";
331 357
                             $select_res     = Database::query($sql);
332 358
                             $parent_data    = Database::fetch_array($select_res,'ASSOC');
333
-                            if ($debug)     var_dump($parent_data);
359
+                            if ($debug) {
360
+                                var_dump($parent_data);
361
+                            }
334 362
 
335 363
                             $sys_course_path = api_get_path(SYS_COURSE_PATH);
336 364
                             $course_dir = $sys_course_path . $course_info['path'];
@@ -345,7 +373,9 @@  discard block
 block discarded – undo
345 373
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION
346 374
                             		WHERE description like '%$search_this%' AND url LIKE '%$search_this2%' AND session_id = $new_session_id AND c_id = $course_id
347 375
                             		ORDER BY id desc  LIMIT 1";
348
-                            if ($debug) echo $sql;
376
+                            if ($debug) {
377
+                                echo $sql;
378
+                            }
349 379
                             $sub_res = Database::query($sql);
350 380
                             $num_rows = Database::num_rows($sub_res);
351 381
 
@@ -389,7 +419,9 @@  discard block
 block discarded – undo
389 419
 
390 420
                             //Creating student_publication_assignment if exists
391 421
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION_ASSIGNMENT WHERE publication_id = $parent_id AND c_id = $course_id";
392
-                            if ($debug) var_dump($sql);
422
+                            if ($debug) {
423
+                                var_dump($sql);
424
+                            }
393 425
                             $rest_select     = Database::query($sql);
394 426
                             if (Database::num_rows($rest_select) > 0 ) {
395 427
                                 if ($update_database) {
@@ -401,7 +433,9 @@  discard block
 block discarded – undo
401 433
                                        add_to_calendar      = '".$assignment_data['add_to_calendar']."',
402 434
                                        enable_qualification = '".$assignment_data['enable_qualification']."',
403 435
                                        publication_id       = '".$new_parent_id."'";
404
-                                    if ($debug) echo $sql_add_publication;
436
+                                    if ($debug) {
437
+                                        echo $sql_add_publication;
438
+                                    }
405 439
                                     $rest_select     = Database::query($sql_add_publication);
406 440
                                     $id = Database::insert_id();
407 441
 
@@ -409,11 +443,15 @@  discard block
 block discarded – undo
409 443
                                         "has_properties         = '".$id."',
410 444
                                        view_properties    = '1'
411 445
                                        WHERE id   = ".$new_parent_id;
412
-                                    if ($debug) echo $sql_update;
446
+                                    if ($debug) {
447
+                                        echo $sql_update;
448
+                                    }
413 449
                                     $rest_update     = Database::query($sql_update);
414 450
 
415 451
 
416
-                                    if ($debug) var_dump($sql_update);
452
+                                    if ($debug) {
453
+                                        var_dump($sql_update);
454
+                                    }
417 455
                                     $result_message[$TBL_STUDENT_PUBLICATION_ASSIGNMENT]++;
418 456
                                 }
419 457
                             }
@@ -454,7 +492,9 @@  discard block
 block discarded – undo
454 492
                                     if ($result) {
455 493
                                         unlink($full_file_name);
456 494
                                         $sql = "DELETE FROM $TBL_STUDENT_PUBLICATION WHERE id= ".$data['id'];
457
-                                        if ($debug) var_dump($sql);
495
+                                        if ($debug) {
496
+                                            var_dump($sql);
497
+                                        }
458 498
                                         $result_delete     = Database::query($sql);
459 499
                                         api_item_property_update($course_info, 'work', $data['id'], 'DocumentDeleted', api_get_user_id());
460 500
                                     }
@@ -470,22 +510,30 @@  discard block
 block discarded – undo
470 510
                 //10. Dropbox - not neccesary to move categories (no presence of session_id)
471 511
 
472 512
                 $sql = "SELECT id FROM $TBL_DROPBOX_FILE WHERE uploader_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id";
473
-                if ($debug) var_dump($sql);
513
+                if ($debug) {
514
+                    var_dump($sql);
515
+                }
474 516
                 $res = Database::query($sql);
475 517
                 while($row = Database::fetch_array($res,'ASSOC')) {
476 518
                     $id = $row['id'];
477 519
                     if ($update_database) {
478 520
                         $sql = "UPDATE $TBL_DROPBOX_FILE SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id";
479
-                        if ($debug) var_dump($sql);
521
+                        if ($debug) {
522
+                            var_dump($sql);
523
+                        }
480 524
                         $res = Database::query($sql);
481
-                        if ($debug) var_dump($res);
525
+                        if ($debug) {
526
+                            var_dump($res);
527
+                        }
482 528
 
483 529
                         $sql = "UPDATE $TBL_DROPBOX_POST SET session_id = $new_session_id WHERE file_id = $id";
484
-                        if ($debug)
485
-                            var_dump($sql);
530
+                        if ($debug) {
531
+                                                    var_dump($sql);
532
+                        }
486 533
                         $res = Database::query($sql);
487
-                        if ($debug)
488
-                            var_dump($res);
534
+                        if ($debug) {
535
+                                                    var_dump($res);
536
+                        }
489 537
                         $result_message[$TBL_DROPBOX_FILE]++;
490 538
                     }
491 539
                 }
@@ -494,23 +542,30 @@  discard block
 block discarded – undo
494 542
 
495 543
                 $sql = "SELECT notebook_id FROM $TBL_NOTEBOOK
496 544
                         WHERE user_id = $user_id AND session_id = $origin_session_id AND course = '$origin_course_code' AND c_id = $course_id";
497
-                if ($debug) var_dump($sql);
545
+                if ($debug) {
546
+                    var_dump($sql);
547
+                }
498 548
                 $res = Database::query($sql);
499 549
                 while($row = Database::fetch_array($res,'ASSOC')) {
500 550
                     $id = $row['notebook_id'];
501 551
                     if ($update_database) {
502 552
                         $sql = "UPDATE $TBL_NOTEBOOK SET session_id = $new_session_id WHERE c_id = $course_id AND notebook_id = $id";
503
-                        if ($debug) var_dump($sql);
553
+                        if ($debug) {
554
+                            var_dump($sql);
555
+                        }
504 556
                         $res = Database::query($sql);
505
-                        if ($debug) var_dump($res);
557
+                        if ($debug) {
558
+                            var_dump($res);
559
+                        }
506 560
                     }
507 561
                 }
508 562
 
509 563
                 if ($update_database) {
510 564
                     echo '<h2>'.get_lang('StatsMoved').'</h2>';
511
-                    if (is_array($result_message))
512
-                        foreach ($result_message as $table=>$times) {
565
+                    if (is_array($result_message)) {
566
+                                            foreach ($result_message as $table=>$times) {
513 567
                             echo 'Table '.$table.' - '.$times.' records updated <br />';
568
+                    }
514 569
                         }
515 570
                 } else {
516 571
                     echo '<h2>'.get_lang('UserInformationOfThisCourse').'</h2>';
@@ -626,10 +681,11 @@  discard block
 block discarded – undo
626 681
 }
627 682
 $navigation .= '&nbsp;';
628 683
 $page ++;
629
-if ($page < $nro_pages)
684
+if ($page < $nro_pages) {
630 685
     $navigation .= '<a href="'.api_get_self().'?page='.$page.'">'.get_lang('Next').'</a>';
631
-else
686
+} else {
632 687
     $navigation .= get_lang('Next');
688
+}
633 689
 
634 690
 echo $navigation;
635 691
 $user_list      = UserManager::get_user_list(array(), array(), $begin, $default);
Please login to merge, or discard this patch.