Completed
Push — 1.10.x ( 222be4...5f4aa3 )
by Julito
57:51 queued 09:24
created
main/inc/lib/course.lib.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
                         $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher);
1881 1881
                     }
1882 1882
                     $html .= '</ul>';
1883
-                }else{
1883
+                } else{
1884 1884
                     $html .= array_to_string($list, $separator);
1885 1885
                 }
1886 1886
             }
@@ -3236,7 +3236,7 @@  discard block
 block discarded – undo
3236 3236
             $html .= '<a class="thumbnail" href="'.$params['link'].'">';
3237 3237
             $html .= $params['icon'];
3238 3238
             $html .= '</a>';
3239
-        }else{
3239
+        } else{
3240 3240
             $html .= $params['icon'];
3241 3241
         }
3242 3242
         $html .= '</div>';
Please login to merge, or discard this patch.
main/inc/lib/social.lib.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1631,11 +1631,11 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
             if ($size == IMAGE_WALL_SMALL) {
1633 1633
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1634
-            }else if($size == IMAGE_WALL_MEDIUM){
1634
+            } else if($size == IMAGE_WALL_MEDIUM){
1635 1635
                 $name = IMAGE_WALL_MEDIUM. '_' . $array[2];
1636
-            }else if($size == IMAGE_WALL_BIG){
1636
+            } else if($size == IMAGE_WALL_BIG){
1637 1637
                 $name = IMAGE_WALL_BIG. '_' . $array[2];
1638
-            }else {
1638
+            } else {
1639 1639
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1640 1640
             }
1641 1641
             $lessImage = str_replace($array[2], '', $path);
@@ -1759,7 +1759,9 @@  discard block
 block discarded – undo
1759 1759
             $friendHtml.= '<ul class="nav nav-list">';
1760 1760
             $j = 1;
1761 1761
             for ($k=0; $k < $number_friends; $k++) {
1762
-                if ($j > $number_of_images) break;
1762
+                if ($j > $number_of_images) {
1763
+                    break;
1764
+                }
1763 1765
 
1764 1766
                 if (isset($friends[$k])) {
1765 1767
                     $friend = $friends[$k];
@@ -1815,7 +1817,9 @@  discard block
 block discarded – undo
1815 1817
             $friendHtml.= '<div class="list-group">';
1816 1818
             $j = 1;
1817 1819
             for ($k=0; $k < $number_friends; $k++) {
1818
-                if ($j > $number_of_images) break;
1820
+                if ($j > $number_of_images) {
1821
+                    break;
1822
+                }
1819 1823
 
1820 1824
                 if (isset($friends[$k])) {
1821 1825
                     $friend = $friends[$k];
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/pclzip/pclzip.lib.php 1 patch
Braces   +120 added lines, -162 removed lines patch added patch discarded remove patch
@@ -344,8 +344,7 @@  discard block
 block discarded – undo
344 344
         // ----- Look for the optional second argument
345 345
         if ($v_size == 2) {
346 346
           $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
347
-        }
348
-        else if ($v_size > 2) {
347
+        } else if ($v_size > 2) {
349 348
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
350 349
 		                       "Invalid number / type of arguments");
351 350
           return 0;
@@ -394,8 +393,7 @@  discard block
 block discarded – undo
394 393
       foreach ($v_string_list as $v_string) {
395 394
         if ($v_string != '') {
396 395
           $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
397
-        }
398
-        else {
396
+        } else {
399 397
         }
400 398
       }
401 399
     }
@@ -529,8 +527,7 @@  discard block
 block discarded – undo
529 527
         // ----- Look for the optional second argument
530 528
         if ($v_size == 2) {
531 529
           $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
532
-        }
533
-        else if ($v_size > 2) {
530
+        } else if ($v_size > 2) {
534 531
           // ----- Error log
535 532
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
536 533
 
@@ -806,8 +803,7 @@  discard block
 block discarded – undo
806 803
         // ----- Look for the optional second argument
807 804
         if ($v_size == 2) {
808 805
           $v_remove_path = $v_arg_list[1];
809
-        }
810
-        else if ($v_size > 2) {
806
+        } else if ($v_size > 2) {
811 807
           // ----- Error log
812 808
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
813 809
 
@@ -951,8 +947,7 @@  discard block
 block discarded – undo
951 947
         }
952 948
         if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
953 949
           $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
954
-        }
955
-        else {
950
+        } else {
956 951
         }
957 952
       }
958 953
 
@@ -967,8 +962,7 @@  discard block
 block discarded – undo
967 962
         // ----- Look for the optional second argument
968 963
         if ($v_size == 2) {
969 964
           $v_remove_path = $v_arg_list[1];
970
-        }
971
-        else if ($v_size > 2) {
965
+        } else if ($v_size > 2) {
972 966
           // ----- Error log
973 967
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
974 968
 
@@ -1204,8 +1198,7 @@  discard block
 block discarded – undo
1204 1198
         // ----- Error log
1205 1199
         PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
1206 1200
         $v_result = PCLZIP_ERR_MISSING_FILE;
1207
-      }
1208
-      else {
1201
+      } else {
1209 1202
         // ----- Duplicate the archive
1210 1203
         $v_result = $this->privDuplicate($p_archive);
1211 1204
       }
@@ -1293,8 +1286,7 @@  discard block
 block discarded – undo
1293 1286
   {
1294 1287
     if (PCLZIP_ERROR_EXTERNAL == 1) {
1295 1288
       return(PclErrorCode());
1296
-    }
1297
-    else {
1289
+    } else {
1298 1290
       return($this->error_code);
1299 1291
     }
1300 1292
   }
@@ -1332,15 +1324,13 @@  discard block
 block discarded – undo
1332 1324
 
1333 1325
     if (isset($v_name[$this->error_code])) {
1334 1326
       $v_value = $v_name[$this->error_code];
1335
-    }
1336
-    else {
1327
+    } else {
1337 1328
       $v_value = 'NoName';
1338 1329
     }
1339 1330
 
1340 1331
     if ($p_with_code) {
1341 1332
       return($v_value.' ('.$this->error_code.')');
1342
-    }
1343
-    else {
1333
+    } else {
1344 1334
       return($v_value);
1345 1335
     }
1346 1336
   }
@@ -1355,12 +1345,10 @@  discard block
 block discarded – undo
1355 1345
   {
1356 1346
     if (PCLZIP_ERROR_EXTERNAL == 1) {
1357 1347
       return(PclErrorString());
1358
-    }
1359
-    else {
1348
+    } else {
1360 1349
       if ($p_full) {
1361 1350
         return($this->errorName(true)." : ".$this->error_string);
1362
-      }
1363
-      else {
1351
+      } else {
1364 1352
         return($this->error_string." [code ".$this->error_code."]");
1365 1353
       }
1366 1354
     }
@@ -1545,8 +1533,7 @@  discard block
 block discarded – undo
1545 1533
               && ($p_options_list[$i+1] != '')) {
1546 1534
             $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1547 1535
             $i++;
1548
-          }
1549
-          else {
1536
+          } else {
1550 1537
           }
1551 1538
         break;
1552 1539
 
@@ -1564,11 +1551,9 @@  discard block
 block discarded – undo
1564 1551
           // ----- Get the value
1565 1552
           if (is_string($p_options_list[$i+1])) {
1566 1553
               $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
1567
-          }
1568
-          else if (is_array($p_options_list[$i+1])) {
1554
+          } else if (is_array($p_options_list[$i+1])) {
1569 1555
               $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1570
-          }
1571
-          else {
1556
+          } else {
1572 1557
             // ----- Error log
1573 1558
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1574 1559
 
@@ -1597,8 +1582,7 @@  discard block
 block discarded – undo
1597 1582
           // ----- Get the value
1598 1583
           if (is_string($p_options_list[$i+1])) {
1599 1584
               $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1600
-          }
1601
-          else {
1585
+          } else {
1602 1586
             // ----- Error log
1603 1587
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1604 1588
 
@@ -1627,8 +1611,7 @@  discard block
 block discarded – undo
1627 1611
           // ----- Get the value
1628 1612
           if (is_string($p_options_list[$i+1])) {
1629 1613
               $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1630
-          }
1631
-          else {
1614
+          } else {
1632 1615
             // ----- Error log
1633 1616
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
1634 1617
 			                     "Wrong parameter value for option '"
@@ -1661,14 +1644,11 @@  discard block
 block discarded – undo
1661 1644
 
1662 1645
               // ----- Parse items
1663 1646
               $v_work_list = explode(",", $p_options_list[$i+1]);
1664
-          }
1665
-          else if (is_integer($p_options_list[$i+1])) {
1647
+          } else if (is_integer($p_options_list[$i+1])) {
1666 1648
               $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
1667
-          }
1668
-          else if (is_array($p_options_list[$i+1])) {
1649
+          } else if (is_array($p_options_list[$i+1])) {
1669 1650
               $v_work_list = $p_options_list[$i+1];
1670
-          }
1671
-          else {
1651
+          } else {
1672 1652
             // ----- Error log
1673 1653
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1674 1654
 
@@ -1695,13 +1675,11 @@  discard block
 block discarded – undo
1695 1675
                   // ----- Set the option value
1696 1676
                   $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1697 1677
                   $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
1698
-              }
1699
-              elseif ($v_size_item_list == 2) {
1678
+              } elseif ($v_size_item_list == 2) {
1700 1679
                   // ----- Set the option value
1701 1680
                   $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1702 1681
                   $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
1703
-              }
1704
-              else {
1682
+              } else {
1705 1683
                   // ----- Error log
1706 1684
                   PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1707 1685
 
@@ -1857,14 +1835,17 @@  discard block
 block discarded – undo
1857 1835
     $v_memory_limit = trim($v_memory_limit);
1858 1836
     $last = strtolower(substr($v_memory_limit, -1));
1859 1837
 
1860
-    if($last == 'g')
1861
-        //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1862
-        $v_memory_limit = $v_memory_limit*1073741824;
1863
-    if($last == 'm')
1864
-        //$v_memory_limit = $v_memory_limit*1024*1024;
1865
-        $v_memory_limit = $v_memory_limit*1048576;
1866
-    if($last == 'k')
1867
-        $v_memory_limit = $v_memory_limit*1024;
1838
+    if($last == 'g') {
1839
+            //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1840
+        $v_memory_limit = $v_memory_limit*1073741824;
1841
+    }
1842
+    if($last == 'm') {
1843
+            //$v_memory_limit = $v_memory_limit*1024*1024;
1844
+        $v_memory_limit = $v_memory_limit*1048576;
1845
+    }
1846
+    if($last == 'k') {
1847
+            $v_memory_limit = $v_memory_limit*1024;
1848
+    }
1868 1849
 
1869 1850
     $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
1870 1851
 
@@ -2037,15 +2018,12 @@  discard block
 block discarded – undo
2037 2018
       if (file_exists($v_descr['filename'])) {
2038 2019
         if (@is_file($v_descr['filename'])) {
2039 2020
           $v_descr['type'] = 'file';
2040
-        }
2041
-        else if (@is_dir($v_descr['filename'])) {
2021
+        } else if (@is_dir($v_descr['filename'])) {
2042 2022
           $v_descr['type'] = 'folder';
2043
-        }
2044
-        else if (@is_link($v_descr['filename'])) {
2023
+        } else if (@is_link($v_descr['filename'])) {
2045 2024
           // skip
2046 2025
           continue;
2047
-        }
2048
-        else {
2026
+        } else {
2049 2027
           // skip
2050 2028
           continue;
2051 2029
         }
@@ -2094,8 +2072,7 @@  discard block
 block discarded – undo
2094 2072
                  && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
2095 2073
               if ($v_descr['stored_filename'] != '') {
2096 2074
                 $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
2097
-              }
2098
-              else {
2075
+              } else {
2099 2076
                 $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
2100 2077
               }
2101 2078
             }
@@ -2104,8 +2081,7 @@  discard block
 block discarded – undo
2104 2081
           }
2105 2082
 
2106 2083
           @closedir($v_folder_handler);
2107
-        }
2108
-        else {
2084
+        } else {
2109 2085
           // TBC : unable to open folder in read mode
2110 2086
         }
2111 2087
 
@@ -2118,8 +2094,7 @@  discard block
 block discarded – undo
2118 2094
 
2119 2095
           // ----- Concat the resulting list
2120 2096
           $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
2121
-        }
2122
-        else {
2097
+        } else {
2123 2098
         }
2124 2099
 
2125 2100
         // ----- Free local array
@@ -2393,8 +2368,9 @@  discard block
 block discarded – undo
2393 2368
   {
2394 2369
     $v_result=1;
2395 2370
 
2396
-    if ($this->zip_fd != 0)
2397
-      @fclose($this->zip_fd);
2371
+    if ($this->zip_fd != 0) {
2372
+          @fclose($this->zip_fd);
2373
+    }
2398 2374
     $this->zip_fd = 0;
2399 2375
 
2400 2376
     // ----- Return
@@ -2611,11 +2587,9 @@  discard block
 block discarded – undo
2611 2587
     // ----- Look for filetime
2612 2588
     if (isset($p_filedescr['mtime'])) {
2613 2589
       $p_header['mtime'] = $p_filedescr['mtime'];
2614
-    }
2615
-    else if ($p_filedescr['type'] == 'virtual_file') {
2590
+    } else if ($p_filedescr['type'] == 'virtual_file') {
2616 2591
       $p_header['mtime'] = time();
2617
-    }
2618
-    else {
2592
+    } else {
2619 2593
       $p_header['mtime'] = filemtime($p_filename);
2620 2594
     }
2621 2595
 
@@ -2623,8 +2597,7 @@  discard block
 block discarded – undo
2623 2597
     if (isset($p_filedescr['comment'])) {
2624 2598
       $p_header['comment_len'] = strlen($p_filedescr['comment']);
2625 2599
       $p_header['comment'] = $p_filedescr['comment'];
2626
-    }
2627
-    else {
2600
+    } else {
2628 2601
       $p_header['comment_len'] = 0;
2629 2602
       $p_header['comment'] = '';
2630 2603
     }
@@ -2935,20 +2908,17 @@  discard block
 block discarded – undo
2935 2908
     $p_filename = $p_filedescr['filename'];
2936 2909
     if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
2937 2910
       $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
2938
-    }
2939
-    else {
2911
+    } else {
2940 2912
       $p_add_dir = '';
2941 2913
     }
2942 2914
     if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
2943 2915
       $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
2944
-    }
2945
-    else {
2916
+    } else {
2946 2917
       $p_remove_dir = '';
2947 2918
     }
2948 2919
     if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
2949 2920
       $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
2950
-    }
2951
-    else {
2921
+    } else {
2952 2922
       $p_remove_all_dir = 0;
2953 2923
     }
2954 2924
 
@@ -2971,8 +2941,7 @@  discard block
 block discarded – undo
2971 2941
           $v_dir = $v_path_info['dirname'].'/';
2972 2942
         }
2973 2943
         $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
2974
-      }
2975
-      else {
2944
+      } else {
2976 2945
         // ----- Calculate the stored filename
2977 2946
         $v_stored_filename = $p_filename;
2978 2947
       }
@@ -2983,8 +2952,9 @@  discard block
 block discarded – undo
2983 2952
       }
2984 2953
       // ----- Look for partial path remove
2985 2954
       else if ($p_remove_dir != "") {
2986
-        if (substr($p_remove_dir, -1) != '/')
2987
-          $p_remove_dir .= "/";
2955
+        if (substr($p_remove_dir, -1) != '/') {
2956
+                  $p_remove_dir .= "/";
2957
+        }
2988 2958
 
2989 2959
         if (   (substr($p_filename, 0, 2) == "./")
2990 2960
             || (substr($p_remove_dir, 0, 2) == "./")) {
@@ -3004,8 +2974,7 @@  discard block
 block discarded – undo
3004 2974
         if ($v_compare > 0) {
3005 2975
           if ($v_compare == 2) {
3006 2976
             $v_stored_filename = "";
3007
-          }
3008
-          else {
2977
+          } else {
3009 2978
             $v_stored_filename = substr($v_stored_filename,
3010 2979
                                         strlen($p_remove_dir));
3011 2980
           }
@@ -3017,10 +2986,11 @@  discard block
 block discarded – undo
3017 2986
 
3018 2987
       // ----- Look for path to add
3019 2988
       if ($p_add_dir != "") {
3020
-        if (substr($p_add_dir, -1) == "/")
3021
-          $v_stored_filename = $p_add_dir.$v_stored_filename;
3022
-        else
3023
-          $v_stored_filename = $p_add_dir."/".$v_stored_filename;
2989
+        if (substr($p_add_dir, -1) == "/") {
2990
+                  $v_stored_filename = $p_add_dir.$v_stored_filename;
2991
+        } else {
2992
+                  $v_stored_filename = $p_add_dir."/".$v_stored_filename;
2993
+        }
3024 2994
       }
3025 2995
     }
3026 2996
 
@@ -3303,8 +3273,9 @@  discard block
 block discarded – undo
3303 3273
     if (   ($p_path == "")
3304 3274
 	    || (   (substr($p_path, 0, 1) != "/")
3305 3275
 		    && (substr($p_path, 0, 3) != "../")
3306
-			&& (substr($p_path,1,2)!=":/")))
3307
-      $p_path = "./".$p_path;
3276
+			&& (substr($p_path,1,2)!=":/"))) {
3277
+          $p_path = "./".$p_path;
3278
+    }
3308 3279
 
3309 3280
     // ----- Reduce the path last (and duplicated) '/'
3310 3281
     if (($p_path != "./") && ($p_path != "/"))
@@ -3791,8 +3762,7 @@  discard block
 block discarded – undo
3791 3762
         // ----- Change the file status
3792 3763
         if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
3793 3764
 		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
3794
-	  	  }
3795
-		    else {
3765
+	  	  } else {
3796 3766
             $p_entry['status'] = "newer_exist";
3797 3767
 
3798 3768
             // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
@@ -3808,19 +3778,19 @@  discard block
 block discarded – undo
3808 3778
                 return PclZip::errorCode();
3809 3779
 		      }
3810 3780
 		    }
3811
-      }
3812
-      else {
3781
+      } else {
3813 3782
       }
3814 3783
     }
3815 3784
 
3816 3785
     // ----- Check the directory availability and create it if necessary
3817 3786
     else {
3818
-      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
3819
-        $v_dir_to_check = $p_entry['filename'];
3820
-      else if (!strstr($p_entry['filename'], "/"))
3821
-        $v_dir_to_check = "";
3822
-      else
3823
-        $v_dir_to_check = dirname($p_entry['filename']);
3787
+      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
3788
+              $v_dir_to_check = $p_entry['filename'];
3789
+      } else if (!strstr($p_entry['filename'], "/")) {
3790
+              $v_dir_to_check = "";
3791
+      } else {
3792
+              $v_dir_to_check = dirname($p_entry['filename']);
3793
+      }
3824 3794
 
3825 3795
         if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
3826 3796
 
@@ -3876,8 +3846,7 @@  discard block
 block discarded – undo
3876 3846
           touch($p_entry['filename'], $p_entry['mtime']);
3877 3847
 
3878 3848
 
3879
-        }
3880
-        else {
3849
+        } else {
3881 3850
           // ----- TBC
3882 3851
           // Need to be finished
3883 3852
           if (($p_entry['flag'] & 1) == 1) {
@@ -4120,8 +4089,7 @@  discard block
 block discarded – undo
4120 4089
           // ----- Send the file to the output
4121 4090
           echo $v_buffer;
4122 4091
           unset($v_buffer);
4123
-        }
4124
-        else {
4092
+        } else {
4125 4093
 
4126 4094
           // ----- Read the compressed file in a buffer (one shot)
4127 4095
           $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@@ -4231,8 +4199,7 @@  discard block
 block discarded – undo
4231 4199
 
4232 4200
           // ----- Reading the file
4233 4201
           $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
4234
-        }
4235
-        else {
4202
+        } else {
4236 4203
 
4237 4204
           // ----- Reading the file
4238 4205
           $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
@@ -4244,8 +4211,7 @@  discard block
 block discarded – undo
4244 4211
         }
4245 4212
 
4246 4213
         // ----- Trace
4247
-      }
4248
-      else {
4214
+      } else {
4249 4215
           // TBC : error : can not extract a folder in a string
4250 4216
       }
4251 4217
 
@@ -4338,8 +4304,7 @@  discard block
 block discarded – undo
4338 4304
     // ----- Get extra_fields
4339 4305
     if ($v_data['extra_len'] != 0) {
4340 4306
       $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
4341
-    }
4342
-    else {
4307
+    } else {
4343 4308
       $p_header['extra'] = '';
4344 4309
     }
4345 4310
 
@@ -4370,8 +4335,7 @@  discard block
 block discarded – undo
4370 4335
       // ----- Get UNIX date format
4371 4336
       $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4372 4337
 
4373
-    }
4374
-    else
4338
+    } else
4375 4339
     {
4376 4340
       $p_header['mtime'] = time();
4377 4341
     }
@@ -4436,29 +4400,33 @@  discard block
 block discarded – undo
4436 4400
     $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
4437 4401
 
4438 4402
     // ----- Get filename
4439
-    if ($p_header['filename_len'] != 0)
4440
-      //
4403
+    if ($p_header['filename_len'] != 0) {
4404
+          //
4441 4405
       // --------------------------------------------------------------------------------
4442 4406
       // A patch about stored filenames with backslash directory separator (Windows style).
4443 4407
       // Archives created by the utility IZArc 3.81 (possibly new versions too) need this patch.
4444 4408
       //$p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
4445
-      $p_header['filename'] = str_replace("\\", '/', fread($this->zip_fd, $p_header['filename_len']));
4409
+      $p_header['filename'] = str_replace("\\", '/', fread($this->zip_fd, $p_header['filename_len']));
4410
+    }
4446 4411
       // --------------------------------------------------------------------------------
4447 4412
       //
4448
-    else
4449
-      $p_header['filename'] = '';
4413
+    else {
4414
+          $p_header['filename'] = '';
4415
+    }
4450 4416
 
4451 4417
     // ----- Get extra
4452
-    if ($p_header['extra_len'] != 0)
4453
-      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
4454
-    else
4455
-      $p_header['extra'] = '';
4418
+    if ($p_header['extra_len'] != 0) {
4419
+          $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
4420
+    } else {
4421
+          $p_header['extra'] = '';
4422
+    }
4456 4423
 
4457 4424
     // ----- Get comment
4458
-    if ($p_header['comment_len'] != 0)
4459
-      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
4460
-    else
4461
-      $p_header['comment'] = '';
4425
+    if ($p_header['comment_len'] != 0) {
4426
+          $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
4427
+    } else {
4428
+          $p_header['comment'] = '';
4429
+    }
4462 4430
 
4463 4431
     // ----- Extract properties
4464 4432
 
@@ -4480,8 +4448,7 @@  discard block
 block discarded – undo
4480 4448
       // ----- Get UNIX date format
4481 4449
       $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4482 4450
 
4483
-    }
4484
-    else
4451
+    } else
4485 4452
     {
4486 4453
       $p_header['mtime'] = time();
4487 4454
     }
@@ -4594,8 +4561,9 @@  discard block
 block discarded – undo
4594 4561
     // ----- Go back to the maximum possible size of the Central Dir End Record
4595 4562
     if (!$v_found) {
4596 4563
       $v_maximum_size = 65557; // 0xFFFF + 22;
4597
-      if ($v_maximum_size > $v_size)
4598
-        $v_maximum_size = $v_size;
4564
+      if ($v_maximum_size > $v_size) {
4565
+              $v_maximum_size = $v_size;
4566
+      }
4599 4567
       @fseek($this->zip_fd, $v_size-$v_maximum_size);
4600 4568
       if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
4601 4569
       {
@@ -4680,9 +4648,9 @@  discard block
 block discarded – undo
4680 4648
     // ----- Get comment
4681 4649
     if ($v_data['comment_size'] != 0) {
4682 4650
       $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
4683
-    }
4684
-    else
4685
-      $p_central_dir['comment'] = '';
4651
+    } else {
4652
+          $p_central_dir['comment'] = '';
4653
+    }
4686 4654
 
4687 4655
     $p_central_dir['entries'] = $v_data['entries'];
4688 4656
     $p_central_dir['disk_entries'] = $v_data['disk_entries'];
@@ -4782,8 +4750,7 @@  discard block
 block discarded – undo
4782 4750
                   if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
4783 4751
                       && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
4784 4752
                       $v_found = true;
4785
-                  }
4786
-                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
4753
+                  } elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
4787 4754
                           && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
4788 4755
                       $v_found = true;
4789 4756
                   }
@@ -4834,8 +4801,7 @@  discard block
 block discarded – undo
4834 4801
                   break;
4835 4802
               }
4836 4803
           }
4837
-      }
4838
-      else {
4804
+      } else {
4839 4805
       	$v_found = true;
4840 4806
       }
4841 4807
 
@@ -4843,8 +4809,7 @@  discard block
 block discarded – undo
4843 4809
       if ($v_found)
4844 4810
       {
4845 4811
         unset($v_header_list[$v_nb_extracted]);
4846
-      }
4847
-      else
4812
+      } else
4848 4813
       {
4849 4814
         $v_nb_extracted++;
4850 4815
       }
@@ -5320,8 +5285,7 @@  discard block
 block discarded – undo
5320 5285
   {
5321 5286
     if (PCLZIP_ERROR_EXTERNAL == 1) {
5322 5287
       PclError($p_error_code, $p_error_string);
5323
-    }
5324
-    else {
5288
+    } else {
5325 5289
       $this->error_code = $p_error_code;
5326 5290
       $this->error_string = $p_error_string;
5327 5291
     }
@@ -5337,8 +5301,7 @@  discard block
 block discarded – undo
5337 5301
   {
5338 5302
     if (PCLZIP_ERROR_EXTERNAL == 1) {
5339 5303
       PclErrorReset();
5340
-    }
5341
-    else {
5304
+    } else {
5342 5305
       $this->error_code = 0;
5343 5306
       $this->error_string = '';
5344 5307
     }
@@ -5436,11 +5399,9 @@  discard block
 block discarded – undo
5436 5399
         if ($v_list[$i] == ".") {
5437 5400
           // ----- Ignore this directory
5438 5401
           // Should be the first $i=0, but no check is done
5439
-        }
5440
-        else if ($v_list[$i] == "..") {
5402
+        } else if ($v_list[$i] == "..") {
5441 5403
 		  $v_skip++;
5442
-        }
5443
-        else if ($v_list[$i] == "") {
5404
+        } else if ($v_list[$i] == "") {
5444 5405
 		  // ----- First '/' i.e. root slash
5445 5406
 		  if ($i == 0) {
5446 5407
             $v_result = "/".$v_result;
@@ -5460,13 +5421,11 @@  discard block
 block discarded – undo
5460 5421
             // ----- Ignore only the double '//' in path,
5461 5422
             // but not the first and last '/'
5462 5423
 		  }
5463
-        }
5464
-        else {
5424
+        } else {
5465 5425
 		  // ----- Look for item to skip
5466 5426
 		  if ($v_skip > 0) {
5467 5427
 		    $v_skip--;
5468
-		  }
5469
-		  else {
5428
+		  } else {
5470 5429
             $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
5471 5430
 		  }
5472 5431
         }
@@ -5549,14 +5508,17 @@  discard block
 block discarded – undo
5549 5508
     // ----- Look if everything seems to be the same
5550 5509
     if ($v_result) {
5551 5510
       // ----- Skip all the empty items
5552
-      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
5553
-      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
5511
+      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
5512
+          $j++;
5513
+      }
5514
+      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) {
5515
+          $i++;
5516
+      }
5554 5517
 
5555 5518
       if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
5556 5519
         // ----- There are exactly the same
5557 5520
         $v_result = 2;
5558
-      }
5559
-      else if ($i < $v_list_dir_size) {
5521
+      } else if ($i < $v_list_dir_size) {
5560 5522
         // ----- The path is shorter than the dir
5561 5523
         $v_result = 0;
5562 5524
       }
@@ -5591,8 +5553,7 @@  discard block
 block discarded – undo
5591 5553
         @fwrite($p_dest, $v_buffer, $v_read_size);
5592 5554
         $p_size -= $v_read_size;
5593 5555
       }
5594
-    }
5595
-    else if ($p_mode==1)
5556
+    } else if ($p_mode==1)
5596 5557
     {
5597 5558
       while ($p_size != 0)
5598 5559
       {
@@ -5601,8 +5562,7 @@  discard block
 block discarded – undo
5601 5562
         @fwrite($p_dest, $v_buffer, $v_read_size);
5602 5563
         $p_size -= $v_read_size;
5603 5564
       }
5604
-    }
5605
-    else if ($p_mode==2)
5565
+    } else if ($p_mode==2)
5606 5566
     {
5607 5567
       while ($p_size != 0)
5608 5568
       {
@@ -5611,8 +5571,7 @@  discard block
 block discarded – undo
5611 5571
         @gzwrite($p_dest, $v_buffer, $v_read_size);
5612 5572
         $p_size -= $v_read_size;
5613 5573
       }
5614
-    }
5615
-    else if ($p_mode==3)
5574
+    } else if ($p_mode==3)
5616 5575
     {
5617 5576
       while ($p_size != 0)
5618 5577
       {
@@ -5650,8 +5609,7 @@  discard block
 block discarded – undo
5650 5609
       // ----- Try to copy & unlink the src
5651 5610
       if (!@copy($p_src, $p_dest)) {
5652 5611
         $v_result = 0;
5653
-      }
5654
-      else if (!@unlink($p_src)) {
5612
+      } else if (!@unlink($p_src)) {
5655 5613
         $v_result = 0;
5656 5614
       }
5657 5615
     }
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.