Completed
Push — 1.11.x ( c5cfcc...1cf9be )
by José
46:45 queued 17:54
created
main/webservices/user_info.soap.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,8 @@
 block discarded – undo
184 184
  * @param int    End date, in YYYYMMDD format
185 185
  * @return array Events list
186 186
  */
187
-function WSEventsList($username, $signature, $datestart = 0, $dateend = 0) {
187
+function WSEventsList($username, $signature, $datestart = 0, $dateend = 0)
188
+{
188 189
 
189 190
     if (empty($username) or empty($signature)) { return -1; }
190 191
 
Please login to merge, or discard this patch.
main/webservices/lp.php 1 patch
Braces   +50 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
 define('WS_ERROR_SECRET_KEY', 1);
22 22
 
23
-function return_error($code) {
23
+function return_error($code)
24
+{
24 25
     $fault = null;
25 26
     switch ($code) {
26 27
         case WS_ERROR_SECRET_KEY:
@@ -48,19 +49,22 @@  discard block
 block discarded – undo
48 49
         list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
49 50
         $ip = trim($ip1);
50 51
     }
51
-    if ($debug)
52
-        error_log("ip: $ip");
52
+    if ($debug) {
53
+            error_log("ip: $ip");
54
+    }
53 55
     // Check if a file that limits access from webservices exists and contains
54 56
     // the restraining check
55 57
     if (is_file('webservice-auth-ip.conf.php')) {
56 58
         include 'webservice-auth-ip.conf.php';
57
-        if ($debug)
58
-            error_log("webservice-auth-ip.conf.php file included");
59
+        if ($debug) {
60
+                    error_log("webservice-auth-ip.conf.php file included");
61
+        }
59 62
         if (!empty($ws_auth_ip)) {
60 63
             $check_ip = true;
61 64
             $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip);
62
-            if ($debug)
63
-                error_log("ip_matches: $ip_matches");
65
+            if ($debug) {
66
+                            error_log("ip_matches: $ip_matches");
67
+            }
64 68
         }
65 69
     }
66 70
 
@@ -76,8 +80,9 @@  discard block
 block discarded – undo
76 80
     }
77 81
     $result = api_is_valid_secret_key($secret_key, $security_key);
78 82
     //error_log($secret_key.'-'.$security_key);
79
-    if ($debug)
80
-        error_log('WSHelperVerifyKey result: '.intval($result));
83
+    if ($debug) {
84
+            error_log('WSHelperVerifyKey result: '.intval($result));
85
+    }
81 86
     return $result;
82 87
 }
83 88
 
@@ -140,7 +145,9 @@  discard block
 block discarded – undo
140 145
     if (!WSHelperVerifyKey($params)) {
141 146
         return return_error(WS_ERROR_SECRET_KEY);
142 147
     }
143
-    if ($debug) error_log('WSImportLP');
148
+    if ($debug) {
149
+        error_log('WSImportLP');
150
+    }
144 151
 
145 152
     $courseIdName = $params['course_id_name'];
146 153
     $courseIdValue = $params['course_id_value'];
@@ -156,7 +163,9 @@  discard block
 block discarded – undo
156 163
     $courseId = $courseInfo['real_id'];
157 164
 
158 165
     if (empty($courseInfo)) {
159
-        if ($debug) error_log('Course not found');
166
+        if ($debug) {
167
+            error_log('Course not found');
168
+        }
160 169
         return 'Course not found';
161 170
     }
162 171
 
@@ -169,7 +178,9 @@  discard block
 block discarded – undo
169 178
 
170 179
         if (empty($sessionId)) {
171 180
 
172
-            if ($debug) error_log('Session not found');
181
+            if ($debug) {
182
+                error_log('Session not found');
183
+            }
173 184
             return 'Session not found';
174 185
         }
175 186
     }
@@ -196,7 +207,9 @@  discard block
 block discarded – undo
196 207
     $manifest = $oScorm->import_package($fileInfo, '', $courseInfo);
197 208
 
198 209
     if (!$manifest) {
199
-        if ($debug) error_log('manifest.xml file not found');
210
+        if ($debug) {
211
+            error_log('manifest.xml file not found');
212
+        }
200 213
         return 'manifest.xml file not found';
201 214
     }
202 215
 
@@ -214,10 +227,14 @@  discard block
 block discarded – undo
214 227
         $oScorm->set_maker($maker, $courseId);
215 228
         //$oScorm->set_jslib('scorm_api.php');
216 229
 
217
-        if ($debug) error_log('scorm was added');
230
+        if ($debug) {
231
+            error_log('scorm was added');
232
+        }
218 233
         return 1;
219 234
     } else {
220
-        if ($debug) error_log('manifest data empty');
235
+        if ($debug) {
236
+            error_log('manifest data empty');
237
+        }
221 238
         return 'manifest data empty';
222 239
     }
223 240
 }
@@ -310,7 +327,9 @@  discard block
 block discarded – undo
310 327
     );
311 328
 
312 329
     if (empty($courseInfo)) {
313
-        if ($debug) error_log("Course not found: $courseIdName : $courseIdValue");
330
+        if ($debug) {
331
+            error_log("Course not found: $courseIdName : $courseIdValue");
332
+        }
314 333
         return 'Course not found';
315 334
     }
316 335
 
@@ -324,7 +343,9 @@  discard block
 block discarded – undo
324 343
         );
325 344
 
326 345
         if (empty($sessionId)) {
327
-            if ($debug) error_log('Session not found');
346
+            if ($debug) {
347
+                error_log('Session not found');
348
+            }
328 349
             return 'Session not found';
329 350
         }
330 351
     }
@@ -405,7 +426,9 @@  discard block
 block discarded – undo
405 426
     );
406 427
 
407 428
     if (empty($courseInfo)) {
408
-        if ($debug) error_log("Course not found: $courseIdName : $courseIdValue");
429
+        if ($debug) {
430
+            error_log("Course not found: $courseIdName : $courseIdValue");
431
+        }
409 432
         return 'Course not found';
410 433
     }
411 434
     $courseId = $courseInfo['real_id'];
@@ -430,7 +453,9 @@  discard block
 block discarded – undo
430 453
 
431 454
     $lp = new learnpath($courseCode, $lpId, null);
432 455
     if ($lp) {
433
-        if ($debug) error_log("LP deleted $lpId");
456
+        if ($debug) {
457
+            error_log("LP deleted $lpId");
458
+        }
434 459
 
435 460
         $course_dir = $courseInfo['directory'].'/document';
436 461
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
@@ -446,7 +471,9 @@  discard block
 block discarded – undo
446 471
                 if ($item) {
447 472
                     $documentId = $item->get_path();
448 473
 
449
-                    if ($debug) error_log("lp item id found #$itemId");
474
+                    if ($debug) {
475
+                        error_log("lp item id found #$itemId");
476
+                    }
450 477
 
451 478
                     $documentInfo = DocumentManager::get_document_data_by_id(
452 479
                         $documentId,
@@ -472,7 +499,9 @@  discard block
 block discarded – undo
472 499
                         }
473 500
                     }
474 501
                 } else {
475
-                    if ($debug) error_log("Document not found #$itemId");
502
+                    if ($debug) {
503
+                        error_log("Document not found #$itemId");
504
+                    }
476 505
                 }
477 506
             }
478 507
         }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/displaygradebook.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -545,8 +545,9 @@
 block discarded – undo
545 545
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
546 546
             $scoretotal_display = isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable');
547 547
             $scoreinfo = get_lang('StatsStudent').' :<b> '.$user['complete_name'].'</b><br />';
548
-            if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search'])))
549
-                $scoreinfo .= '<br />'.get_lang('TotalForThisCategory').' : <b>'.$scorecourse_display.'</b>';
548
+            if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
549
+                            $scoreinfo .= '<br />'.get_lang('TotalForThisCategory').' : <b>'.$scorecourse_display.'</b>';
550
+            }
550 551
             $scoreinfo .= '<br />'.get_lang('Total').' : <b>'.$scoretotal_display.'</b>';
551 552
             Display::addFlash(
552 553
                 Display::return_message($scoreinfo, 'normal', false)
Please login to merge, or discard this patch.
main/exercise/exercise_submit.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -481,9 +481,15 @@  discard block
 block discarded – undo
481 481
  * If the expired time is major that zero(0) then the expired time is compute on this time.
482 482
  */
483 483
 if ($time_control) {
484
-    if ($debug) error_log('7.1. Time control is enabled');
485
-    if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
486
-    if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
484
+    if ($debug) {
485
+        error_log('7.1. Time control is enabled');
486
+    }
487
+    if ($debug) {
488
+        error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
489
+    }
490
+    if ($debug) {
491
+        error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
492
+    }
487 493
 
488 494
     if (!isset($_SESSION['expired_time'][$current_expired_time_key])) {
489 495
         //Timer - Get expired_time for a student
@@ -548,7 +554,8 @@  discard block
 block discarded – undo
548 554
  * The time control feature is enable here - this feature is enable for a jquery plugin called epiclock
549 555
  * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock
550 556
  */
551
-if ($time_control) { //Sends the exercise form when the expired time is finished
557
+if ($time_control) {
558
+//Sends the exercise form when the expired time is finished
552 559
     $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
553 560
 }
554 561
 
@@ -788,7 +795,8 @@  discard block
 block discarded – undo
788 795
 );
789 796
 $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->selectTitle(true));
790 797
 
791
-if ($origin != 'learnpath') { //so we are not in learnpath tool
798
+if ($origin != 'learnpath') {
799
+//so we are not in learnpath tool
792 800
     if (!api_is_allowed_to_session_edit()) {
793 801
         Display::addFlash(
794 802
             Display::return_message(get_lang('SessionIsReadOnly'), 'warning')
Please login to merge, or discard this patch.
main/lp/learnpath.class.php 1 patch
Braces   +63 added lines, -40 removed lines patch added patch discarded remove patch
@@ -3964,7 +3964,8 @@  discard block
 block discarded – undo
3964 3964
         if ($num > 0) {
3965 3965
             $i = 1;
3966 3966
             while ($row = Database::fetch_array($res)) {
3967
-                if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3967
+                if ($row['display_order'] != $i) {
3968
+// If we find a gap in the order, we need to fix it.
3968 3969
                     $sql = "UPDATE $lp_table SET display_order = $i
3969 3970
                             WHERE c_id = $courseId AND id = ".$row['id'];
3970 3971
                     Database::query($sql);
@@ -3975,9 +3976,11 @@  discard block
 block discarded – undo
3975 3976
                 $i++;
3976 3977
             }
3977 3978
         }
3978
-        if ($num > 1) { // If there's only one element, no need to sort.
3979
+        if ($num > 1) {
3980
+// If there's only one element, no need to sort.
3979 3981
             $order = $lps[$lp_id]['display_order'];
3980
-            if ($order > 1) { // If it's the first element, no need to move up.
3982
+            if ($order > 1) {
3983
+// If it's the first element, no need to move up.
3981 3984
                 $sql = "UPDATE $lp_table SET display_order = $order
3982 3985
                         WHERE c_id = $courseId AND id = ".$lp_order[$order - 1];
3983 3986
                 Database::query($sql);
@@ -4037,9 +4040,11 @@  discard block
 block discarded – undo
4037 4040
                 $i++;
4038 4041
             }
4039 4042
         }
4040
-        if ($num > 1) { // If there's only one element, no need to sort.
4043
+        if ($num > 1) {
4044
+// If there's only one element, no need to sort.
4041 4045
             $order = $lps[$lp_id]['display_order'];
4042
-            if ($order < $max) { // If it's the first element, no need to move up.
4046
+            if ($order < $max) {
4047
+// If it's the first element, no need to move up.
4043 4048
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4044 4049
                            WHERE c_id = ".$courseId." AND id = ".$lp_order[$order + 1];
4045 4050
                 Database::query($sql_u1);
@@ -4842,8 +4847,9 @@  discard block
 block discarded – undo
4842 4847
         if ($this->debug > 0) {
4843 4848
             error_log('New LP - In learnpath::set_maker()', 0);
4844 4849
         }
4845
-        if (empty ($name))
4846
-            return false;
4850
+        if (empty ($name)) {
4851
+                    return false;
4852
+        }
4847 4853
         $this->maker = $name;
4848 4854
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
4849 4855
         $course_id = api_get_course_int_id();
@@ -4908,8 +4914,9 @@  discard block
 block discarded – undo
4908 4914
     public function set_terms_by_prefix($terms_string, $prefix)
4909 4915
     {
4910 4916
         $course_id = api_get_course_int_id();
4911
-        if (api_get_setting('search_enabled') !== 'true')
4912
-            return false;
4917
+        if (api_get_setting('search_enabled') !== 'true') {
4918
+                    return false;
4919
+        }
4913 4920
 
4914 4921
         if (!extension_loaded('xapian')) {
4915 4922
             return false;
@@ -4922,8 +4929,9 @@  discard block
 block discarded – undo
4922 4929
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4923 4930
 
4924 4931
         // Don't do anything if no change, verify only at DB, not the search engine.
4925
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4926
-            return false;
4932
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4933
+                    return false;
4934
+        }
4927 4935
 
4928 4936
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4929 4937
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -5112,8 +5120,9 @@  discard block
 block discarded – undo
5112 5120
         if ($this->debug > 0) {
5113 5121
             error_log('New LP - In learnpath::set_proximity()', 0);
5114 5122
         }
5115
-        if (empty ($name))
5116
-            return false;
5123
+        if (empty ($name)) {
5124
+                    return false;
5125
+        }
5117 5126
 
5118 5127
         $this->proximity = $name;
5119 5128
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
@@ -6708,10 +6717,12 @@  discard block
 block discarded – undo
6708 6717
                     if ($new_comment || $new_title) {
6709 6718
                         $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
6710 6719
                         $ct = '';
6711
-                        if ($new_comment)
6712
-                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6713
-                        if ($new_title)
6714
-                            $ct .= ", title='".Database::escape_string($new_title)."' ";
6720
+                        if ($new_comment) {
6721
+                                                    $ct .= ", comment='".Database::escape_string($new_comment)."'";
6722
+                        }
6723
+                        if ($new_title) {
6724
+                                                    $ct .= ", title='".Database::escape_string($new_title)."' ";
6725
+                        }
6715 6726
 
6716 6727
                         $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6717 6728
                                WHERE c_id = ".$course_id." AND id = ".$document_id;
@@ -7443,8 +7454,9 @@  discard block
 block discarded – undo
7443 7454
                         $arrHide[] = $arrLP[$i]['id'];
7444 7455
                     }
7445 7456
                 } else {
7446
-                    if ($arrLP[$i]['item_type'] == 'dir')
7447
-                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7457
+                    if ($arrLP[$i]['item_type'] == 'dir') {
7458
+                                            $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7459
+                    }
7448 7460
                 }
7449 7461
             }
7450 7462
             reset($arrLP);
@@ -7461,11 +7473,13 @@  discard block
 block discarded – undo
7461 7473
 
7462 7474
         for ($i = 0; $i < count($arrLP); $i++) {
7463 7475
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7464
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7476
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7477
+                                    $selected = 'selected="selected" ';
7478
+                } elseif ($action == 'add') {
7465 7479
                     $selected = 'selected="selected" ';
7466
-                elseif ($action == 'add') $selected = 'selected="selected" ';
7467
-                else
7468
-                    $selected = '';
7480
+                } else {
7481
+                                    $selected = '';
7482
+                }
7469 7483
 
7470 7484
                 $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7471 7485
             }
@@ -7492,9 +7506,11 @@  discard block
 block discarded – undo
7492 7506
                 $arrHide = array();
7493 7507
                 for ($i = 0; $i < count($arrLP); $i++) {
7494 7508
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
7495
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7496
-                            $s_selected_position = $arrLP[$i]['id'];
7497
-                        elseif ($action == 'add') $s_selected_position = 0;
7509
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7510
+                                                    $s_selected_position = $arrLP[$i]['id'];
7511
+                        } elseif ($action == 'add') {
7512
+                            $s_selected_position = 0;
7513
+                        }
7498 7514
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7499 7515
                     }
7500 7516
                 }
@@ -7917,9 +7933,11 @@  discard block
 block discarded – undo
7917 7933
             $s_selected_position = 0;
7918 7934
             for ($i = 0; $i < count($arrLP); $i++) {
7919 7935
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
7920
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7921
-                        $s_selected_position = $arrLP[$i]['id'];
7922
-                    elseif ($action == 'add') $s_selected_position = 0;
7936
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7937
+                                            $s_selected_position = $arrLP[$i]['id'];
7938
+                    } elseif ($action == 'add') {
7939
+                        $s_selected_position = 0;
7940
+                    }
7923 7941
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7924 7942
 
7925 7943
                 }
@@ -7953,8 +7971,7 @@  discard block
 block discarded – undo
7953 7971
 
7954 7972
         if (is_numeric($extra_info)) {
7955 7973
             $form->addHidden('path', $extra_info);
7956
-        }
7957
-        elseif (is_array($extra_info)) {
7974
+        } elseif (is_array($extra_info)) {
7958 7975
             $form->addHidden('path', $extra_info['path']);
7959 7976
         }
7960 7977
 
@@ -8818,9 +8835,11 @@  discard block
 block discarded – undo
8818 8835
             $arrHide = array();
8819 8836
             for ($i = 0; $i < count($arrLP); $i++) {
8820 8837
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
8821
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8822
-                        $s_selected_position = $arrLP[$i]['id'];
8823
-                    elseif ($action == 'add') $s_selected_position = 0;
8838
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8839
+                                            $s_selected_position = $arrLP[$i]['id'];
8840
+                    } elseif ($action == 'add') {
8841
+                        $s_selected_position = 0;
8842
+                    }
8824 8843
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8825 8844
 
8826 8845
                 }
@@ -9020,9 +9039,11 @@  discard block
 block discarded – undo
9020 9039
             $arrHide = array();
9021 9040
             for ($i = 0; $i < count($arrLP); $i++) {
9022 9041
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') {
9023
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
9024
-                        $s_selected_position = $arrLP[$i]['id'];
9025
-                    elseif ($action == 'add') $s_selected_position = 0;
9042
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
9043
+                                            $s_selected_position = $arrLP[$i]['id'];
9044
+                    } elseif ($action == 'add') {
9045
+                        $s_selected_position = 0;
9046
+                    }
9026 9047
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
9027 9048
 
9028 9049
                 }
@@ -10232,10 +10253,11 @@  discard block
 block discarded – undo
10232 10253
 
10233 10254
                 // Dependency to other files - not yet supported.
10234 10255
                 $i = 1;
10235
-                if ($inc_docs)
10236
-                foreach ($inc_docs as $doc_info) {
10256
+                if ($inc_docs) {
10257
+                                foreach ($inc_docs as $doc_info) {
10237 10258
                     if (count($doc_info) < 1 || empty($doc_info[0])) {
10238 10259
                         continue;
10260
+                }
10239 10261
                     }
10240 10262
                     $my_dep = $xmldoc->createElement('resource');
10241 10263
                     $res_id = 'RESOURCE_'.$item->get_id().'_'.$i;
@@ -10686,7 +10708,8 @@  discard block
 block discarded – undo
10686 10708
 
10687 10709
                                                 // File path is courses/CHAMILO/document/....
10688 10710
                                                 $info_file_path = explode('/', $file_path);
10689
-                                                if ($info_file_path[0] == 'courses') { // Add character "/" in file path.
10711
+                                                if ($info_file_path[0] == 'courses') {
10712
+// Add character "/" in file path.
10690 10713
                                                     $file_path_dest = 'document/'.$file_path;
10691 10714
                                                 }
10692 10715
 
Please login to merge, or discard this patch.
main/inc/lib/search/search_widget.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -198,7 +198,8 @@  discard block
 block discarded – undo
198 198
     $sf_terms,
199 199
     $op,
200 200
     $prefilter_prefix = null
201
-) {
201
+)
202
+{
202 203
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
203 204
     $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
204 205
     $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
@@ -336,7 +337,8 @@  discard block
 block discarded – undo
336 337
     $specific_fields = get_specific_field_list();
337 338
     $url_params = array();
338 339
 
339
-    if (($cid = api_get_course_id()) != -1) { // with cid
340
+    if (($cid = api_get_course_id()) != -1) {
341
+// with cid
340 342
 
341 343
         // get search engine terms
342 344
         $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
@@ -354,7 +356,8 @@  discard block
 block discarded – undo
354 356
             $url_params[] = 'sf_'.$specific_field['code'];
355 357
             unset($temp);
356 358
         }
357
-    } else { // without cid
359
+    } else {
360
+// without cid
358 361
         // prepare specific fields names (and also get possible URL param names)
359 362
         foreach ($specific_fields as $specific_field) {
360 363
             //get Xapian terms for a specific term prefix, in ISO, apparently
@@ -366,9 +369,10 @@  discard block
 block discarded – undo
366 369
 
367 370
     // Tool introduction
368 371
     // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here.
369
-    if (api_get_course_id() !== -1)
370
-    if (!empty($groupId)) {
372
+    if (api_get_course_id() !== -1) {
373
+        if (!empty($groupId)) {
371 374
         Display::display_introduction_section(TOOL_SEARCH.$groupId);
375
+    }
372 376
     } else {
373 377
         Display::display_introduction_section(TOOL_SEARCH);
374 378
     }
Please login to merge, or discard this patch.
main/inc/lib/usermanager.lib.php 1 patch
Braces   +65 added lines, -41 removed lines patch added patch discarded remove patch
@@ -2440,8 +2440,9 @@  discard block
 block discarded – undo
2440 2440
         if (empty($user_id)) {
2441 2441
             $user_id = 0;
2442 2442
         } else {
2443
-            if ($user_id != strval(intval($user_id)))
2444
-                return array();
2443
+            if ($user_id != strval(intval($user_id))) {
2444
+                            return array();
2445
+            }
2445 2446
         }
2446 2447
         $extra_data = array();
2447 2448
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2533,8 +2534,9 @@  discard block
 block discarded – undo
2533 2534
         if (empty($user_id)) {
2534 2535
             $user_id = 0;
2535 2536
         } else {
2536
-            if ($user_id != strval(intval($user_id)))
2537
-                return array();
2537
+            if ($user_id != strval(intval($user_id))) {
2538
+                            return array();
2539
+            }
2538 2540
         }
2539 2541
         $extra_data = array();
2540 2542
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2651,7 +2653,7 @@  discard block
 block discarded – undo
2651 2653
      * @return array with extra data info of a user i.e array('field_variable'=>'value');
2652 2654
      */
2653 2655
      public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2654
-    {
2656
+     {
2655 2657
         $extraFieldValue = new ExtraFieldValue('user');
2656 2658
         $extraField = new ExtraField('user');
2657 2659
 
@@ -3354,13 +3356,15 @@  discard block
 block discarded – undo
3354 3356
      */
3355 3357
     public static function get_api_keys($user_id = null, $api_service = 'dokeos')
3356 3358
     {
3357
-        if ($user_id != strval(intval($user_id)))
3358
-            return false;
3359
+        if ($user_id != strval(intval($user_id))) {
3360
+                    return false;
3361
+        }
3359 3362
         if (empty($user_id)) {
3360 3363
             $user_id = api_get_user_id();
3361 3364
         }
3362
-        if ($user_id === false)
3363
-            return false;
3365
+        if ($user_id === false) {
3366
+                    return false;
3367
+        }
3364 3368
         $service_name = Database::escape_string($api_service);
3365 3369
         if (is_string($service_name) === false) {
3366 3370
             return false;
@@ -3368,11 +3372,14 @@  discard block
 block discarded – undo
3368 3372
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3369 3373
         $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';";
3370 3374
         $res = Database::query($sql);
3371
-        if ($res === false)
3372
-            return false; //error during query
3375
+        if ($res === false) {
3376
+                    return false;
3377
+        }
3378
+        //error during query
3373 3379
         $num = Database::num_rows($res);
3374
-        if ($num == 0)
3375
-            return false;
3380
+        if ($num == 0) {
3381
+                    return false;
3382
+        }
3376 3383
         $list = array();
3377 3384
         while ($row = Database::fetch_array($res)) {
3378 3385
             $list[$row['id']] = $row['api_key'];
@@ -3387,13 +3394,15 @@  discard block
 block discarded – undo
3387 3394
      */
3388 3395
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
3389 3396
     {
3390
-        if ($user_id != strval(intval($user_id)))
3391
-            return false;
3397
+        if ($user_id != strval(intval($user_id))) {
3398
+                    return false;
3399
+        }
3392 3400
         if (empty($user_id)) {
3393 3401
             $user_id = api_get_user_id();
3394 3402
         }
3395
-        if ($user_id === false)
3396
-            return false;
3403
+        if ($user_id === false) {
3404
+                    return false;
3405
+        }
3397 3406
         $service_name = Database::escape_string($api_service);
3398 3407
         if (is_string($service_name) === false) {
3399 3408
             return false;
@@ -3402,8 +3411,10 @@  discard block
 block discarded – undo
3402 3411
         $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key
3403 3412
         $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')";
3404 3413
         $res = Database::query($sql);
3405
-        if ($res === false)
3406
-            return false; //error during query
3414
+        if ($res === false) {
3415
+                    return false;
3416
+        }
3417
+        //error during query
3407 3418
         $num = Database::insert_id();
3408 3419
         return ($num == 0) ? false : $num;
3409 3420
     }
@@ -3415,22 +3426,29 @@  discard block
 block discarded – undo
3415 3426
      */
3416 3427
     public static function delete_api_key($key_id)
3417 3428
     {
3418
-        if ($key_id != strval(intval($key_id)))
3419
-            return false;
3420
-        if ($key_id === false)
3421
-            return false;
3429
+        if ($key_id != strval(intval($key_id))) {
3430
+                    return false;
3431
+        }
3432
+        if ($key_id === false) {
3433
+                    return false;
3434
+        }
3422 3435
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3423 3436
         $sql = "SELECT * FROM $t_api WHERE id = ".$key_id;
3424 3437
         $res = Database::query($sql);
3425
-        if ($res === false)
3426
-            return false; //error during query
3438
+        if ($res === false) {
3439
+                    return false;
3440
+        }
3441
+        //error during query
3427 3442
         $num = Database::num_rows($res);
3428
-        if ($num !== 1)
3429
-            return false;
3443
+        if ($num !== 1) {
3444
+                    return false;
3445
+        }
3430 3446
         $sql = "DELETE FROM $t_api WHERE id = ".$key_id;
3431 3447
         $res = Database::query($sql);
3432
-        if ($res === false)
3433
-            return false; //error during query
3448
+        if ($res === false) {
3449
+                    return false;
3450
+        }
3451
+        //error during query
3434 3452
         return true;
3435 3453
     }
3436 3454
 
@@ -3442,10 +3460,12 @@  discard block
 block discarded – undo
3442 3460
      */
3443 3461
     public static function update_api_key($user_id, $api_service)
3444 3462
     {
3445
-        if ($user_id != strval(intval($user_id)))
3446
-            return false;
3447
-        if ($user_id === false)
3448
-            return false;
3463
+        if ($user_id != strval(intval($user_id))) {
3464
+                    return false;
3465
+        }
3466
+        if ($user_id === false) {
3467
+                    return false;
3468
+        }
3449 3469
         $service_name = Database::escape_string($api_service);
3450 3470
         if (is_string($service_name) === false) {
3451 3471
             return false;
@@ -3472,12 +3492,15 @@  discard block
 block discarded – undo
3472 3492
      */
3473 3493
     public static function get_api_key_id($user_id, $api_service)
3474 3494
     {
3475
-        if ($user_id != strval(intval($user_id)))
3476
-            return false;
3477
-        if ($user_id === false)
3478
-            return false;
3479
-        if (empty($api_service))
3480
-            return false;
3495
+        if ($user_id != strval(intval($user_id))) {
3496
+                    return false;
3497
+        }
3498
+        if ($user_id === false) {
3499
+                    return false;
3500
+        }
3501
+        if (empty($api_service)) {
3502
+                    return false;
3503
+        }
3481 3504
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3482 3505
         $api_service = Database::escape_string($api_service);
3483 3506
         $sql = "SELECT id FROM $t_api 
@@ -5418,8 +5441,9 @@  discard block
 block discarded – undo
5418 5441
         $url .= "?s=$s&d=$d&r=$r";
5419 5442
         if ($img) {
5420 5443
             $url = '<img src="'.$url.'"';
5421
-            foreach ($atts as $key => $val)
5422
-                $url .= ' '.$key.'="'.$val.'"';
5444
+            foreach ($atts as $key => $val) {
5445
+                            $url .= ' '.$key.'="'.$val.'"';
5446
+            }
5423 5447
             $url .= ' />';
5424 5448
         }
5425 5449
         return $url;
Please login to merge, or discard this patch.
main/forum/forumfunction.inc.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1045,7 +1045,8 @@  discard block
 block discarded – undo
1045 1045
     $id,
1046 1046
     $current_visibility_status,
1047 1047
     $additional_url_parameters = ''
1048
-) {
1048
+)
1049
+{
1049 1050
     $html = '';
1050 1051
     $id = (int) $id;
1051 1052
     $current_visibility_status = (int) $current_visibility_status;
@@ -1513,7 +1514,8 @@  discard block
 block discarded – undo
1513 1514
     $course_code = '',
1514 1515
     $includeGroupsForum = true,
1515 1516
     $sessionId = 0
1516
-) {
1517
+)
1518
+{
1517 1519
     $course_info = api_get_course_info($course_code);
1518 1520
 
1519 1521
     $table_forums = Database::get_course_table(TABLE_FORUM);
@@ -1992,7 +1994,8 @@  discard block
 block discarded – undo
1992 1994
     $recursive = false,
1993 1995
     $postId = null,
1994 1996
     $depth = -1
1995
-) {
1997
+)
1998
+{
1996 1999
     $em = Database::getManager();
1997 2000
 
1998 2001
     if (api_is_allowed_to_edit(false, true)) {
@@ -2577,7 +2580,8 @@  discard block
 block discarded – undo
2577 2580
     $showMessage = true,
2578 2581
     $userId = 0,
2579 2582
     $sessionId = 0
2580
-) {
2583
+)
2584
+{
2581 2585
     $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo;
2582 2586
     $userId = $userId ?: api_get_user_id();
2583 2587
     $course_id = $courseInfo['real_id'];
@@ -3138,7 +3142,8 @@  discard block
 block discarded – undo
3138 3142
     $thread_qualify = 0,
3139 3143
     $qualify_time,
3140 3144
     $session_id = 0
3141
-) {
3145
+)
3146
+{
3142 3147
     $table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
3143 3148
     $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
3144 3149
 
@@ -3327,7 +3332,8 @@  discard block
 block discarded – undo
3327 3332
     $course_id,
3328 3333
     $user_id,
3329 3334
     $thread_id
3330
-) {
3335
+)
3336
+{
3331 3337
     $table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
3332 3338
     $table_threads_qualify_log = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY_LOG);
3333 3339
 
@@ -3549,7 +3555,8 @@  discard block
 block discarded – undo
3549 3555
     $current_forum,
3550 3556
     $form_values = '',
3551 3557
     $id_attach = 0
3552
-) {
3558
+)
3559
+{
3553 3560
     // Initialize the object.
3554 3561
     $form = new FormValidator(
3555 3562
         'edit_post',
@@ -5706,7 +5713,8 @@  discard block
 block discarded – undo
5706 5713
  * @param null $courseId Course ID to find row to update.
5707 5714
  * @return int Number of affected rows.
5708 5715
  */
5709
-function editAttachedFile($array, $id, $courseId = null) {
5716
+function editAttachedFile($array, $id, $courseId = null)
5717
+{
5710 5718
     // Init variables
5711 5719
     $setString = '';
5712 5720
     $id = intval($id);
@@ -5835,7 +5843,8 @@  discard block
 block discarded – undo
5835 5843
     $postId = 0,
5836 5844
     $attachId = 0,
5837 5845
     $courseId = 0
5838
-) {
5846
+)
5847
+{
5839 5848
     $forumId = intval($forumId);
5840 5849
     $courseId = intval($courseId);
5841 5850
     $attachId = intval($attachId);
Please login to merge, or discard this patch.
main/inc/lib/events.lib.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -871,7 +871,8 @@
 block discarded – undo
871 871
                     WHERE dokeos_folder = "'.$event_message_language.'"
872 872
                 )';
873 873
             Database::query($sql);
874
-        } else { // else we create a new record
874
+        } else {
875
+// else we create a new record
875 876
             // gets the language_-_id
876 877
             $lang_id = '(SELECT id FROM '.Database::get_main_table(TABLE_MAIN_LANGUAGE).'
877 878
                         WHERE dokeos_folder = "'.$event_message_language.'")';
Please login to merge, or discard this patch.