Completed
Pull Request — 1.11.x (#1262)
by José
41:21
created
main/inc/lib/display.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -666,9 +666,10 @@
 block discarded – undo
666 666
         $result = '';
667 667
         for ($i = $min; $i <= $max; $i ++) {
668 668
             $result .= '<option value="'.$i.'"';
669
-            if (is_int($selected_num))
670
-                if ($selected_num == $i) {
669
+            if (is_int($selected_num)) {
670
+                            if ($selected_num == $i) {
671 671
                     $result .= ' selected="selected"';
672
+            }
672 673
                 }
673 674
             $result .= '>'.$i.'</option>';
674 675
         }
Please login to merge, or discard this patch.
main/inc/lib/events.lib.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -333,8 +333,12 @@  discard block
 block discarded – undo
333 333
     ) {
334 334
         global $debug;
335 335
 
336
-        if ($debug) error_log('Called to update_event_exercice');
337
-        if ($debug) error_log('duration:' . $duration);
336
+        if ($debug) {
337
+            error_log('Called to update_event_exercice');
338
+        }
339
+        if ($debug) {
340
+            error_log('duration:' . $duration);
341
+        }
338 342
 
339 343
         if ($exeid != '') {
340 344
             /*
@@ -386,8 +390,12 @@  discard block
 block discarded – undo
386 390
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
387 391
             $res = Database::query($sql);
388 392
 
389
-            if ($debug) error_log('update_event_exercice called');
390
-            if ($debug) error_log("$sql");
393
+            if ($debug) {
394
+                error_log('update_event_exercice called');
395
+            }
396
+            if ($debug) {
397
+                error_log("$sql");
398
+            }
391 399
 
392 400
             //Deleting control time session track
393 401
             //ExerciseLib::exercise_time_control_delete($exo_id);
Please login to merge, or discard this patch.
main/inc/lib/message.lib.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
             $direction = 'DESC';
132 132
         } else {
133 133
             $column = intval($column);
134
-            if (!in_array($direction, array('ASC', 'DESC')))
135
-                $direction = 'ASC';
134
+            if (!in_array($direction, array('ASC', 'DESC'))) {
135
+                            $direction = 'ASC';
136
+            }
136 137
         }
137 138
         $table_message = Database::get_main_table(TABLE_MESSAGE);
138 139
 
@@ -488,8 +489,9 @@  discard block
 block discarded – undo
488 489
     public static function delete_message_by_user_receiver($user_receiver_id, $id)
489 490
     {
490 491
         $table_message = Database::get_main_table(TABLE_MESSAGE);
491
-        if ($id != strval(intval($id)))
492
-            return false;
492
+        if ($id != strval(intval($id))) {
493
+                    return false;
494
+        }
493 495
         $user_receiver_id = intval($user_receiver_id);
494 496
         $id = intval($id);
495 497
         $sql = "SELECT * FROM $table_message
@@ -664,8 +666,9 @@  discard block
 block discarded – undo
664 666
      */
665 667
     public static function update_message($user_id, $message_id)
666 668
     {
667
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
668
-            return false;
669
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
670
+                    return false;
671
+        }
669 672
 
670 673
         $table_message = Database::get_main_table(TABLE_MESSAGE);
671 674
         $sql = "UPDATE $table_message SET msg_status = '0'
@@ -705,8 +708,9 @@  discard block
 block discarded – undo
705 708
      */
706 709
     public static function get_message_by_user($user_id, $message_id)
707 710
     {
708
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
709
-            return false;
711
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
712
+                    return false;
713
+        }
710 714
         $table_message = Database::get_main_table(TABLE_MESSAGE);
711 715
         $query = "SELECT * FROM $table_message
712 716
                   WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'";
@@ -721,8 +725,9 @@  discard block
 block discarded – undo
721 725
      */
722 726
     public static function get_messages_by_group($group_id)
723 727
     {
724
-        if ($group_id != strval(intval($group_id)))
725
-            return false;
728
+        if ($group_id != strval(intval($group_id))) {
729
+                    return false;
730
+        }
726 731
 
727 732
         $table_message = Database::get_main_table(TABLE_MESSAGE);
728 733
         $group_id = intval($group_id);
@@ -749,8 +754,9 @@  discard block
 block discarded – undo
749 754
      */
750 755
     public static function get_messages_by_group_by_message($group_id, $message_id)
751 756
     {
752
-        if ($group_id != strval(intval($group_id)))
753
-            return false;
757
+        if ($group_id != strval(intval($group_id))) {
758
+                    return false;
759
+        }
754 760
         $table_message = Database::get_main_table(TABLE_MESSAGE);
755 761
         $group_id = intval($group_id);
756 762
         $sql = "SELECT * FROM $table_message
@@ -828,8 +834,9 @@  discard block
 block discarded – undo
828 834
      */
829 835
     public static function exist_message($user_id, $id)
830 836
     {
831
-        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id)))
832
-            return false;
837
+        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id))) {
838
+                    return false;
839
+        }
833 840
         $table_message = Database::get_main_table(TABLE_MESSAGE);
834 841
         $query = "SELECT id FROM $table_message
835 842
                   WHERE
@@ -860,8 +867,9 @@  discard block
 block discarded – undo
860 867
             $direction = 'DESC';
861 868
         } else {
862 869
             $column = intval($column);
863
-            if (!in_array($direction, array('ASC', 'DESC')))
864
-                $direction = 'ASC';
870
+            if (!in_array($direction, array('ASC', 'DESC'))) {
871
+                            $direction = 'ASC';
872
+            }
865 873
         }
866 874
         $table_message = Database::get_main_table(TABLE_MESSAGE);
867 875
         $request = api_is_xml_http_request();
Please login to merge, or discard this patch.
main/inc/lib/search/xapian/XapianIndexer.class.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,13 +70,16 @@
 block discarded – undo
70 70
      */
71 71
     function connectDb($path = null, $dbMode = null, $lang = 'english')
72 72
     {
73
-        if ($this->db != null)
74
-            return $this->db;
75
-        if ($dbMode == null)
76
-            $dbMode = Xapian::DB_CREATE_OR_OPEN;
73
+        if ($this->db != null) {
74
+                    return $this->db;
75
+        }
76
+        if ($dbMode == null) {
77
+                    $dbMode = Xapian::DB_CREATE_OR_OPEN;
78
+        }
77 79
 
78
-        if ($path == null)
79
-            $path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/';
80
+        if ($path == null) {
81
+                    $path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/';
82
+        }
80 83
 
81 84
         try {
82 85
             $this->db = new XapianWritableDatabase($path, $dbMode);
Please login to merge, or discard this patch.
main/inc/lib/search/search_widget.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
     foreach ($sf_term_array as $raw_term) {
50 50
         $term = substr($raw_term, 1);
51
-        if (empty($term)) continue;
51
+        if (empty($term)) {
52
+            continue;
53
+        }
52 54
         $html_term = htmlspecialchars($term, ENT_QUOTES, $charset);
53 55
         $selected = '';
54 56
         if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) {
@@ -69,7 +71,9 @@  discard block
 block discarded – undo
69 71
     $max = count($sf_terms);
70 72
     $multiple_selects .='';
71 73
     foreach ($sf_terms as $prefix => $sf_term_array) {
72
-        if ($prefix == $prefilter_prefix) continue;
74
+        if ($prefix == $prefilter_prefix) {
75
+            continue;
76
+        }
73 77
         $multiple_select = '';
74 78
         if ($i>0) {
75 79
             //print "+" image
@@ -342,9 +346,10 @@  discard block
 block discarded – undo
342 346
 
343 347
 	// Tool introduction
344 348
     // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here.
345
-    if (api_get_course_id() !== -1)
346
-    if (!empty($groupId)) {
349
+    if (api_get_course_id() !== -1) {
350
+        if (!empty($groupId)) {
347 351
         Display::display_introduction_section(TOOL_SEARCH.$groupId);
352
+    }
348 353
     } else {
349 354
         Display::display_introduction_section(TOOL_SEARCH);
350 355
     }
@@ -366,7 +371,9 @@  discard block
 block discarded – undo
366 371
                     break;
367 372
                 }
368 373
             }
369
-            if ($thesaurus_decided) break;
374
+            if ($thesaurus_decided) {
375
+                break;
376
+            }
370 377
         }
371 378
     }
372 379
 
Please login to merge, or discard this patch.
main/inc/lib/search/ChamiloIndexer.class.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
         $stored_terms = $this->get_terms_on_db($prefix, $course_code, $tool_id, $ref_id_high_level);
37 37
 
38 38
         // don't do anything if no change, verify only at DB, not the search engine
39
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
40
-            return FALSE;
39
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
40
+                    return FALSE;
41
+        }
41 42
 
42 43
         require_once api_get_path(LIBRARY_PATH) . 'search/xapian/XapianQuery.php';
43 44
 
@@ -45,8 +46,9 @@  discard block
 block discarded – undo
45 46
         $doc = $this->get_document($search_did);
46 47
         $xapian_terms = xapian_get_doc_terms($doc, $prefix);
47 48
         $xterms = array();
48
-        foreach ($xapian_terms as $xapian_term)
49
-            $xterms[] = substr($xapian_term['name'], 1);
49
+        foreach ($xapian_terms as $xapian_term) {
50
+                    $xterms[] = substr($xapian_term['name'], 1);
51
+        }
50 52
 
51 53
         $dterms = $terms;
52 54
 
Please login to merge, or discard this patch.
main/inc/lib/baker.lib.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,8 +94,9 @@  discard block
 block discarded – undo
94 94
         // Read the magic bytes and verify
95 95
         $retval = substr($png,0,8);
96 96
         $ipos = 8;
97
-        if ($retval != "\x89PNG\x0d\x0a\x1a\x0a")
98
-            throw new Exception('Is not a valid PNG image');
97
+        if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") {
98
+                    throw new Exception('Is not a valid PNG image');
99
+        }
99 100
         // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
100 101
         $chunkHeader = substr($png,$ipos,8);
101 102
         $ipos = $ipos + 8;
@@ -107,13 +108,17 @@  discard block
 block discarded – undo
107 108
                 $data = substr($png,$ipos,$chunk['size']);
108 109
                 $sections = explode("\0", $data);
109 110
                 print_r($sections);
110
-                if ( $sections[0] == $key ) $skip = true;
111
+                if ( $sections[0] == $key ) {
112
+                    $skip = true;
113
+                }
111 114
             }
112 115
             // Extract the data and the CRC
113 116
             $data = substr($png,$ipos,$chunk['size']+4);
114 117
             $ipos = $ipos + $chunk['size'] + 4;
115 118
             // Add in the header, data, and CRC
116
-            if ( ! $skip ) $retval = $retval . $chunkHeader . $data;
119
+            if ( ! $skip ) {
120
+                $retval = $retval . $chunkHeader . $data;
121
+            }
117 122
             // Read next chunk header
118 123
             $chunkHeader = substr($png,$ipos,8);
119 124
             $ipos = $ipos + 8;
Please login to merge, or discard this patch.
main/inc/lib/pdf.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -536,8 +536,9 @@
 block discarded – undo
536 536
             }
537 537
         } else {
538 538
             $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';   // course path
539
-            if (file_exists($store_path))
540
-                $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
539
+            if (file_exists($store_path)) {
540
+                            $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
541
+            }
541 542
         }
542 543
         return $web_path;
543 544
     }
Please login to merge, or discard this patch.
main/inc/lib/dashboard.lib.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,9 @@
 block discarded – undo
380 380
 					// check if user is allowed to see the block
381 381
 					if (method_exists($obj_block, 'is_block_visible_for_user')) {
382 382
 						$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
-						if (!$is_block_visible_for_user) continue;
383
+						if (!$is_block_visible_for_user) {
384
+						    continue;
385
+						}
384 386
 					}
385 387
 
386 388
 					echo '<tr>';
Please login to merge, or discard this patch.