Passed
Push — master ( 5a5c41...fade3b )
by Cody
04:50 queued 10s
created
classes/auth/base.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@
 block discarded – undo
28 28
 		if ($login && defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE) {
29 29
 			$user_id = $this->find_user_by_login($login);
30 30
 
31
-			if (!$password) $password = make_password();
31
+			if (!$password) {
32
+				$password = make_password();
33
+			}
32 34
 
33 35
 			if (!$user_id) {
34 36
 				$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 
18 18
 		$timestamp = filemtime($filename);
19 19
 
20
-		if ($query) $timestamp .= "&$query";
20
+		if ($query) {
21
+			$timestamp .= "&$query";
22
+		}
21 23
 
22 24
 		return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n";
23 25
 	}
Please login to merge, or discard this patch.
opml.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
 	require_once "db.php";
11 11
 	require_once "db-prefs.php";
12 12
 
13
-	if (!init_plugins()) return;
13
+	if (!init_plugins()) {
14
+		return;
15
+	}
14 16
 
15 17
 	$op = $_REQUEST['op'];
16 18
 
Please login to merge, or discard this patch.
lib/MiniTemplator.class.php 1 patch
Braces   +177 added lines, -82 removed lines patch added patch discarded remove patch
@@ -175,7 +175,9 @@  discard block
 block discarded – undo
175 175
    if (!$this->readFileIntoString($fileName,$s)) {
176 176
       $this->triggerError ("Error while reading template file " . $fileName . ".");
177 177
       return false; }
178
-   if (!$this->setTemplateString($s)) return false;
178
+   if (!$this->setTemplateString($s)) {
179
+   	return false;
180
+   }
179 181
    return true; }
180 182
 
181 183
 /**
@@ -187,7 +189,9 @@  discard block
 block discarded – undo
187 189
 function setTemplateString ($templateString) {
188 190
    $this->templateValid = false;
189 191
    $this->template = $templateString;
190
-   if (!$this->parseTemplate()) return false;
192
+   if (!$this->parseTemplate()) {
193
+   	return false;
194
+   }
191 195
    $this->reset();
192 196
    $this->templateValid = true;
193 197
    return true; }
@@ -214,10 +218,16 @@  discard block
 block discarded – undo
214 218
 function parseTemplate() {
215 219
    $this->initParsing();
216 220
    $this->beginMainBlock();
217
-   if (!$this->parseTemplateCommands()) return false;
221
+   if (!$this->parseTemplateCommands()) {
222
+   	return false;
223
+   }
218 224
    $this->endMainBlock();
219
-   if (!$this->checkBlockDefinitionsComplete()) return false;
220
-   if (!$this->parseTemplateVariables()) return false;
225
+   if (!$this->checkBlockDefinitionsComplete()) {
226
+   	return false;
227
+   }
228
+   if (!$this->parseTemplateVariables()) {
229
+   	return false;
230
+   }
221 231
    $this->associateVariablesWithBlocks();
222 232
    return true; }
223 233
 
@@ -272,16 +282,22 @@  discard block
 block discarded – undo
272 282
    $p = 0;
273 283
    while (true) {
274 284
       $p0 = strpos($this->template,'<!--',$p);
275
-      if ($p0 === false) break;
285
+      if ($p0 === false) {
286
+      	break;
287
+      }
276 288
       $p = strpos($this->template,'-->',$p0);
277 289
       if ($p === false) {
278 290
          $this->triggerError ("Invalid HTML comment in template at offset $p0.");
279 291
          return false; }
280 292
       $p += 3;
281 293
       $cmdL = substr($this->template,$p0+4,$p-$p0-7);
282
-      if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart))
283
-         return false;
284
-      if ($resumeFromStart) $p = $p0; }
294
+      if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart)) {
295
+               return false;
296
+      }
297
+      if ($resumeFromStart) {
298
+      	$p = $p0;
299
+      }
300
+      }
285 301
    return true; }
286 302
 
287 303
 /**
@@ -292,20 +308,25 @@  discard block
 block discarded – undo
292 308
    $resumeFromStart = false;
293 309
    $p = 0;
294 310
    $cmd = '';
295
-   if (!$this->parseWord($cmdL,$p,$cmd)) return true;
311
+   if (!$this->parseWord($cmdL,$p,$cmd)) {
312
+   	return true;
313
+   }
296 314
    $parms = substr($cmdL,$p);
297 315
    switch (strtoupper($cmd)) {
298 316
       case '$BEGINBLOCK':
299
-         if (!$this->processBeginBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
300
-            return false;
317
+         if (!$this->processBeginBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) {
318
+                     return false;
319
+         }
301 320
          break;
302 321
       case '$ENDBLOCK':
303
-         if (!$this->processEndBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
304
-            return false;
322
+         if (!$this->processEndBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) {
323
+                     return false;
324
+         }
305 325
          break;
306 326
       case '$INCLUDE':
307
-         if (!$this->processincludeCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
308
-            return false;
327
+         if (!$this->processincludeCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) {
328
+                     return false;
329
+         }
309 330
          $resumeFromStart = true;
310 331
          break;
311 332
       default:
@@ -377,8 +398,9 @@  discard block
 block discarded – undo
377 398
    $btr =& $this->blockTab[$blockNo];
378 399
    $btr = array();
379 400
    $btr['blockName'] = $blockName;
380
-   if (!$this->lookupBlockName($blockName,$btr['nextWithSameName']))
381
-      $btr['nextWithSameName'] = -1;
401
+   if (!$this->lookupBlockName($blockName,$btr['nextWithSameName'])) {
402
+         $btr['nextWithSameName'] = -1;
403
+   }
382 404
    $btr['definitionIsOpen'] = true;
383 405
    $btr['instances'] = 0;
384 406
    $btr['firstBlockInstNo'] = -1;
@@ -428,7 +450,9 @@  discard block
 block discarded – undo
428 450
    if (strlen($this->template) > $this->maxInclTemplateSize) {
429 451
       $this->triggerError ("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
430 452
       return false; }
431
-   if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) return false;
453
+   if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) {
454
+   	return false;
455
+   }
432 456
    // (Copying the template to insert a subtemplate is a bit slow. In a future implementation of MiniTemplator,
433 457
    // a table could be used that contains references to the string fragments.)
434 458
    $this->template = substr($this->template,0,$tPos1) . $subtemplate . substr($this->template,$tPos2);
@@ -443,7 +467,9 @@  discard block
 block discarded – undo
443 467
    $p = 0;
444 468
    while (true) {
445 469
       $p = strpos($this->template, '${', $p);
446
-      if ($p === false) break;
470
+      if ($p === false) {
471
+      	break;
472
+      }
447 473
       $p0 = $p;
448 474
       $p = strpos($this->template, '}', $p);
449 475
       if ($p === false) {
@@ -461,8 +487,9 @@  discard block
 block discarded – undo
461 487
 * @access private
462 488
 */
463 489
 function registerVariableReference ($varName, $tPosBegin, $tPosEnd) {
464
-   if (!$this->lookupVariableName($varName,$varNo))
465
-      $this->registerVariable($varName,$varNo);
490
+   if (!$this->lookupVariableName($varName,$varNo)) {
491
+         $this->registerVariable($varName,$varNo);
492
+   }
466 493
    $varRefNo = $this->varRefTabCnt++;
467 494
    $vrtr =& $this->varRefTab[$varRefNo];
468 495
    $vrtr = array();
@@ -502,12 +529,14 @@  discard block
 block discarded – undo
502 529
             $nextBlockNo += 1;
503 530
             continue; }}
504 531
       $btr =& $this->blockTab[$activeBlockNo];
505
-      if ($varRefTPos < $btr['tPosBegin'])
506
-         $this->programLogicError(1);
532
+      if ($varRefTPos < $btr['tPosBegin']) {
533
+               $this->programLogicError(1);
534
+      }
507 535
       $blockVarNo = $btr['blockVarCnt']++;
508 536
       $btr['blockVarNoToVarNoMap'][$blockVarNo] = $varNo;
509
-      if ($btr['firstVarRefNo'] == -1)
510
-         $btr['firstVarRefNo'] = $varRefNo;
537
+      if ($btr['firstVarRefNo'] == -1) {
538
+               $btr['firstVarRefNo'] = $varRefNo;
539
+      }
511 540
       $vrtr['blockNo'] = $activeBlockNo;
512 541
       $vrtr['blockVarNo'] = $blockVarNo;
513 542
       $varRefNo += 1; }}
@@ -523,8 +552,9 @@  discard block
 block discarded – undo
523 552
 * @access public
524 553
 */
525 554
 function reset() {
526
-   for ($varNo=0; $varNo<$this->varTabCnt; $varNo++)
527
-      $this->varTab[$varNo]['varValue'] = '';
555
+   for ($varNo=0; $varNo<$this->varTabCnt; $varNo++) {
556
+         $this->varTab[$varNo]['varValue'] = '';
557
+   }
528 558
    for ($blockNo=0; $blockNo<$this->blockTabCnt; $blockNo++) {
529 559
       $btr =& $this->blockTab[$blockNo];
530 560
       $btr['instances'] = 0;
@@ -551,7 +581,9 @@  discard block
 block discarded – undo
551 581
 function setVariable ($variableName, $variableValue, $isOptional=false) {
552 582
    if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
553 583
    if (!$this->lookupVariableName($variableName,$varNo)) {
554
-      if ($isOptional) return true;
584
+      if ($isOptional) {
585
+      	return true;
586
+      }
555 587
       $this->triggerError ("Variable \"$variableName\" not defined in template.");
556 588
       return false; }
557 589
    $this->varTab[$varNo]['varValue'] = $variableValue;
@@ -619,20 +651,23 @@  discard block
 block discarded – undo
619 651
    $btr =& $this->blockTab[$blockNo];
620 652
    $this->registerBlockInstance ($blockInstNo);
621 653
    $bitr =& $this->blockInstTab[$blockInstNo];
622
-   if ($btr['firstBlockInstNo'] == -1)
623
-      $btr['firstBlockInstNo'] = $blockInstNo;
624
-   if ($btr['lastBlockInstNo'] != -1)
625
-      $this->blockInstTab[$btr['lastBlockInstNo']]['nextBlockInstNo'] = $blockInstNo;
654
+   if ($btr['firstBlockInstNo'] == -1) {
655
+         $btr['firstBlockInstNo'] = $blockInstNo;
656
+   }
657
+   if ($btr['lastBlockInstNo'] != -1) {
658
+         $this->blockInstTab[$btr['lastBlockInstNo']]['nextBlockInstNo'] = $blockInstNo;
659
+   }
626 660
          // set forward pointer of chain
627 661
    $btr['lastBlockInstNo'] = $blockInstNo;
628 662
    $parentBlockNo = $btr['parentBlockNo'];
629 663
    $blockVarCnt = $btr['blockVarCnt'];
630 664
    $bitr['blockNo'] = $blockNo;
631 665
    $bitr['instanceLevel'] = $btr['instances']++;
632
-   if ($parentBlockNo == -1)
633
-      $bitr['parentInstLevel'] = -1;
634
-    else
635
-      $bitr['parentInstLevel'] = $this->blockTab[$parentBlockNo]['instances'];
666
+   if ($parentBlockNo == -1) {
667
+         $bitr['parentInstLevel'] = -1;
668
+   } else {
669
+          $bitr['parentInstLevel'] = $this->blockTab[$parentBlockNo]['instances'];
670
+    }
636 671
    $bitr['nextBlockInstNo'] = -1;
637 672
    $bitr['blockVarTab'] = array();
638 673
    // copy instance variables for this block
@@ -666,7 +701,9 @@  discard block
 block discarded – undo
666 701
 */
667 702
 function generateOutput () {
668 703
    $this->outputMode = 0;
669
-   if (!$this->generateOutputPage()) return false;
704
+   if (!$this->generateOutputPage()) {
705
+   	return false;
706
+   }
670 707
    return true; }
671 708
 
672 709
 /**
@@ -677,7 +714,9 @@  discard block
 block discarded – undo
677 714
 */
678 715
 function generateOutputToFile ($fileName) {
679 716
    $fh = fopen($fileName,"wb");
680
-   if ($fh === false) return false;
717
+   if ($fh === false) {
718
+   	return false;
719
+   }
681 720
    $this->outputMode = 1;
682 721
    $this->outputFileHandle = $fh;
683 722
    $ok = $this->generateOutputPage();
@@ -695,7 +734,9 @@  discard block
 block discarded – undo
695 734
    $outputString = "Error";
696 735
    $this->outputMode = 2;
697 736
    $this->outputString = "";
698
-   if (!$this->generateOutputPage()) return false;
737
+   if (!$this->generateOutputPage()) {
738
+   	return false;
739
+   }
699 740
    $outputString = $this->outputString;
700 741
    return true; }
701 742
 
@@ -705,14 +746,18 @@  discard block
 block discarded – undo
705 746
 */
706 747
 function generateOutputPage() {
707 748
    if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
708
-   if ($this->blockTab[0]['instances'] == 0)
709
-      $this->addBlockByNo (0);        // add main block
749
+   if ($this->blockTab[0]['instances'] == 0) {
750
+         $this->addBlockByNo (0);
751
+   }
752
+   // add main block
710 753
    for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
711 754
        $btr =& $this->blockTab[$blockNo];
712 755
        $btr['currBlockInstNo'] = $btr['firstBlockInstNo']; }
713 756
    $this->outputError = false;
714 757
    $this->writeBlockInstances (0, -1);
715
-   if ($this->outputError) return false;
758
+   if ($this->outputError) {
759
+   	return false;
760
+   }
716 761
    return true; }
717 762
 
718 763
 /**
@@ -725,11 +770,16 @@  discard block
 block discarded – undo
725 770
    $btr =& $this->blockTab[$blockNo];
726 771
    while (!$this->outputError) {
727 772
       $blockInstNo = $btr['currBlockInstNo'];
728
-      if ($blockInstNo == -1) break;
773
+      if ($blockInstNo == -1) {
774
+      	break;
775
+      }
729 776
       $bitr =& $this->blockInstTab[$blockInstNo];
730
-      if ($bitr['parentInstLevel'] < $parentInstLevel)
731
-         $this->programLogicError (2);
732
-      if ($bitr['parentInstLevel'] > $parentInstLevel) break;
777
+      if ($bitr['parentInstLevel'] < $parentInstLevel) {
778
+               $this->programLogicError (2);
779
+      }
780
+      if ($bitr['parentInstLevel'] > $parentInstLevel) {
781
+      	break;
782
+      }
733 783
       $this->writeBlockInstance ($blockInstNo);
734 784
       $btr['currBlockInstNo'] = $bitr['nextBlockInstNo']; }}
735 785
 
@@ -762,15 +812,17 @@  discard block
 block discarded – undo
762 812
          if ($subBtr['tPosBegin'] < $tPos2) {
763 813
             $tPos2 = $subBtr['tPosBegin'];
764 814
             $kind = 2; }}
765
-      if ($tPos2 > $tPos)
766
-         $this->writeString (substr($this->template,$tPos,$tPos2-$tPos));
815
+      if ($tPos2 > $tPos) {
816
+               $this->writeString (substr($this->template,$tPos,$tPos2-$tPos));
817
+      }
767 818
       switch ($kind) {
768 819
          case 0:         // end of block
769 820
             return;
770 821
          case 1:         // variable
771 822
             $vrtr =& $this->varRefTab[$varRefNo];
772
-            if ($vrtr['blockNo'] != $blockNo)
773
-               $this->programLogicError (4);
823
+            if ($vrtr['blockNo'] != $blockNo) {
824
+                           $this->programLogicError (4);
825
+            }
774 826
             $variableValue = $bitr['blockVarTab'][$vrtr['blockVarNo']];
775 827
             $this->writeString ($variableValue);
776 828
             $tPos = $vrtr['tPosEnd'];
@@ -778,8 +830,9 @@  discard block
 block discarded – undo
778 830
             break;
779 831
          case 2:         // sub block
780 832
             $subBtr =& $this->blockTab[$subBlockNo];
781
-            if ($subBtr['parentBlockNo'] != $blockNo)
782
-               $this->programLogicError (3);
833
+            if ($subBtr['parentBlockNo'] != $blockNo) {
834
+                           $this->programLogicError (3);
835
+            }
783 836
             $this->writeBlockInstances ($subBlockNo, $bitr['instanceLevel']);  // recursive call
784 837
             $tPos = $subBtr['tPosEnd'];
785 838
             $subBlockNo += 1;
@@ -789,15 +842,20 @@  discard block
 block discarded – undo
789 842
 * @access private
790 843
 */
791 844
 function writeString ($s) {
792
-   if ($this->outputError) return;
845
+   if ($this->outputError) {
846
+   	return;
847
+   }
793 848
    switch ($this->outputMode) {
794 849
       case 0:            // output to PHP output stream
795
-         if (!print($s))
796
-            $this->outputError = true;
850
+         if (!print($s)) {
851
+                     $this->outputError = true;
852
+         }
797 853
          break;
798 854
       case 1:            // output to file
799 855
          $rc = fwrite($this->outputFileHandle, $s);
800
-         if ($rc === false) $this->outputError = true;
856
+         if ($rc === false) {
857
+         	$this->outputError = true;
858
+         }
801 859
          break;
802 860
       case 2:            // output to string
803 861
          $this->outputString .= $s;
@@ -812,7 +870,9 @@  discard block
 block discarded – undo
812 870
 */
813 871
 function lookupVariableName ($varName, &$varNo) {
814 872
    $x =& $this->varNameToNoMap[strtoupper($varName)];
815
-   if (!isset($x)) return false;
873
+   if (!isset($x)) {
874
+   	return false;
875
+   }
816 876
    $varNo = $x;
817 877
    return true; }
818 878
 
@@ -825,7 +885,9 @@  discard block
 block discarded – undo
825 885
 */
826 886
 function lookupBlockName ($blockName, &$blockNo) {
827 887
    $x =& $this->blockNameToNoMap[strtoupper($blockName)];
828
-   if (!isset($x)) return false;
888
+   if (!isset($x)) {
889
+   	return false;
890
+   }
829 891
    $blockNo = $x;
830 892
    return true; }
831 893
 
@@ -839,15 +901,21 @@  discard block
 block discarded – undo
839 901
 function readFileIntoString ($fileName, &$s) {
840 902
    if (function_exists('version_compare') && version_compare(phpversion(),"4.3.0",">=")) {
841 903
       $s = file_get_contents($fileName);
842
-      if ($s === false) return false;
904
+      if ($s === false) {
905
+      	return false;
906
+      }
843 907
       return true; }
844 908
    $fh = fopen($fileName,"rb");
845
-   if ($fh === false) return false;
909
+   if ($fh === false) {
910
+   	return false;
911
+   }
846 912
    $fileSize = filesize($fileName);
847 913
    if ($fileSize === false) {fclose ($fh); return false; }
848 914
    $s = fread($fh,$fileSize);
849 915
    fclose ($fh);
850
-   if (strlen($s) != $fileSize) return false;
916
+   if (strlen($s) != $fileSize) {
917
+   	return false;
918
+   }
851 919
    return true; }
852 920
 
853 921
 /**
@@ -856,10 +924,16 @@  discard block
 block discarded – undo
856 924
 */
857 925
 function parseWord ($s, &$p, &$w) {
858 926
    $sLen = strlen($s);
859
-   while ($p < $sLen && ord($s{$p}) <= 32) $p++;
860
-   if ($p >= $sLen) return false;
927
+   while ($p < $sLen && ord($s{$p}) <= 32) {
928
+   	$p++;
929
+   }
930
+   if ($p >= $sLen) {
931
+   	return false;
932
+   }
861 933
    $p0 = $p;
862
-   while ($p < $sLen && ord($s{$p}) > 32) $p++;
934
+   while ($p < $sLen && ord($s{$p}) > 32) {
935
+   	$p++;
936
+   }
863 937
    $w = substr($s, $p0, $p - $p0);
864 938
    return true; }
865 939
 
@@ -869,12 +943,22 @@  discard block
 block discarded – undo
869 943
 */
870 944
 function parseQuotedString ($s, &$p, &$w) {
871 945
    $sLen = strlen($s);
872
-   while ($p < $sLen && ord($s{$p}) <= 32) $p++;
873
-   if ($p >= $sLen) return false;
874
-   if (substr($s,$p,1) != '"') return false;
946
+   while ($p < $sLen && ord($s{$p}) <= 32) {
947
+   	$p++;
948
+   }
949
+   if ($p >= $sLen) {
950
+   	return false;
951
+   }
952
+   if (substr($s,$p,1) != '"') {
953
+   	return false;
954
+   }
875 955
    $p++; $p0 = $p;
876
-   while ($p < $sLen && $s{$p} != '"') $p++;
877
-   if ($p >= $sLen) return false;
956
+   while ($p < $sLen && $s{$p} != '"') {
957
+   	$p++;
958
+   }
959
+   if ($p >= $sLen) {
960
+   	return false;
961
+   }
878 962
    $w = substr($s, $p0, $p - $p0);
879 963
    $p++;
880 964
    return true; }
@@ -885,25 +969,36 @@  discard block
 block discarded – undo
885 969
 */
886 970
 function parseWordOrQuotedString ($s, &$p, &$w) {
887 971
    $sLen = strlen($s);
888
-   while ($p < $sLen && ord($s{$p}) <= 32) $p++;
889
-   if ($p >= $sLen) return false;
890
-   if (substr($s,$p,1) == '"')
891
-      return $this->parseQuotedString($s,$p,$w);
892
-    else
893
-      return $this->parseWord($s,$p,$w); }
972
+   while ($p < $sLen && ord($s{$p}) <= 32) {
973
+   	$p++;
974
+   }
975
+   if ($p >= $sLen) {
976
+   	return false;
977
+   }
978
+   if (substr($s,$p,1) == '"') {
979
+         return $this->parseQuotedString($s,$p,$w);
980
+   } else {
981
+          return $this->parseWord($s,$p,$w);
982
+    }
983
+    }
894 984
 
895 985
 /**
896 986
 * Combine two file system paths.
897 987
 * @access private
898 988
 */
899 989
 function combineFileSystemPath ($path1, $path2) {
900
-   if ($path1 == '' || $path2 == '') return $path2;
990
+   if ($path1 == '' || $path2 == '') {
991
+   	return $path2;
992
+   }
901 993
    $s = $path1;
902
-   if (substr($s,-1) != '\\' && substr($s,-1) != '/') $s = $s . "/";
903
-   if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/')
904
-      $s = $s . substr($path2,1);
905
-    else
906
-      $s = $s . $path2;
994
+   if (substr($s,-1) != '\\' && substr($s,-1) != '/') {
995
+   	$s = $s . "/";
996
+   }
997
+   if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/') {
998
+         $s = $s . substr($path2,1);
999
+   } else {
1000
+          $s = $s . $path2;
1001
+    }
907 1002
    return $s; }
908 1003
 
909 1004
 /**
Please login to merge, or discard this patch.
lib/jimIcon.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,13 +24,15 @@  discard block
 block discarded – undo
24 24
                 $r = ord($str[2]);
25 25
                 if (strlen($str) > 3) {
26 26
                         $a = 127 - (ord($str[3]) / 2);
27
-                        if ($a != 0 && $a != 127)
28
-                                $this->had_alpha = 1;
27
+                        if ($a != 0 && $a != 127) {
28
+                                                        $this->had_alpha = 1;
29
+                        }
29 30
                 } else {
30 31
                         $a = 0;
31 32
                 }
32
-                if ($a != 127)
33
-                        $this->all_transaprent = 0;
33
+                if ($a != 127) {
34
+                                        $this->all_transaprent = 0;
35
+                }
34 36
                 return imagecolorallocatealpha($img, $r, $g, $b, $a);
35 37
         }
36 38
 
@@ -65,8 +67,9 @@  discard block
 block discarded – undo
65 67
                 $most_pixels = 0;
66 68
                 for ($i = 0; $i < $h["num"]; $i++) {
67 69
                         $entry = substr($ico, 6 + 16 * $i, 16);
68
-                        if (!$entry || strlen($entry) < 16)
69
-                                continue;
70
+                        if (!$entry || strlen($entry) < 16) {
71
+                                                        continue;
72
+                        }
70 73
                         $e = unpack("Cwidth/" .
71 74
                                     "Cheight/" .
72 75
                                     "Ccolors/" .
@@ -76,10 +79,12 @@  discard block
 block discarded – undo
76 79
                                     "Vsize/" .
77 80
                                     "Voffset/",
78 81
                                     $entry);
79
-                        if ($e["width"] == 0)
80
-                                $e["width"] = 256;
81
-                        if ($e["height"] == 0)
82
-                                $e["height"] = 256;
82
+                        if ($e["width"] == 0) {
83
+                                                        $e["width"] = 256;
84
+                        }
85
+                        if ($e["height"] == 0) {
86
+                                                        $e["height"] = 256;
87
+                        }
83 88
                         if ($e["zero"] != 0) {
84 89
                                 $this->error = "nonzero reserved field";
85 90
                                 return false;
@@ -226,8 +231,9 @@  discard block
 block discarded – undo
226 231
                                 }
227 232
                         }
228 233
                         // End of row padding
229
-                        while ($offset & 3)
230
-                                $offset++;
234
+                        while ($offset & 3) {
235
+                                                        $offset++;
236
+                        }
231 237
                 }
232 238
 
233 239
                 // Now the "AND" image, which is 1 bit per pixel.  Ignore
@@ -261,8 +267,9 @@  discard block
 block discarded – undo
261 267
                         }
262 268
 
263 269
                         // End of row padding
264
-                        while ($offset & 3)
265
-                                $offset++;
270
+                        while ($offset & 3) {
271
+                                                        $offset++;
272
+                        }
266 273
                 }
267 274
                 return $img;
268 275
         }
Please login to merge, or discard this patch.
lib/phpqrcode/qrbitstream.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -108,13 +108,15 @@  discard block
 block discarded – undo
108 108
         //----------------------------------------------------------------------
109 109
         public function appendNum($bits, $num)
110 110
         {
111
-            if ($bits == 0) 
112
-                return 0;
111
+            if ($bits == 0) {
112
+                            return 0;
113
+            }
113 114
 
114 115
             $b = QRbitstream::newFromNum($bits, $num);
115 116
             
116
-            if(is_null($b))
117
-                return -1;
117
+            if(is_null($b)) {
118
+                            return -1;
119
+            }
118 120
 
119 121
             $ret = $this->append($b);
120 122
             unset($b);
@@ -125,13 +127,15 @@  discard block
 block discarded – undo
125 127
         //----------------------------------------------------------------------
126 128
         public function appendBytes($size, $data)
127 129
         {
128
-            if ($size == 0) 
129
-                return 0;
130
+            if ($size == 0) {
131
+                            return 0;
132
+            }
130 133
 
131 134
             $b = QRbitstream::newFromBytes($size, $data);
132 135
             
133
-            if(is_null($b))
134
-                return -1;
136
+            if(is_null($b)) {
137
+                            return -1;
138
+            }
135 139
 
136 140
             $ret = $this->append($b);
137 141
             unset($b);
Please login to merge, or discard this patch.
lib/phpqrcode/qrsplit.php 1 patch
Braces   +38 added lines, -23 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
         //----------------------------------------------------------------------
48 48
         public static function isdigitat($str, $pos)
49 49
         {    
50
-            if ($pos >= strlen($str))
51
-                return false;
50
+            if ($pos >= strlen($str)) {
51
+                            return false;
52
+            }
52 53
             
53 54
             return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
54 55
         }
@@ -56,8 +57,9 @@  discard block
 block discarded – undo
56 57
         //----------------------------------------------------------------------
57 58
         public static function isalnumat($str, $pos)
58 59
         {
59
-            if ($pos >= strlen($str))
60
-                return false;
60
+            if ($pos >= strlen($str)) {
61
+                            return false;
62
+            }
61 63
                 
62 64
             return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
63 65
         }
@@ -65,8 +67,9 @@  discard block
 block discarded – undo
65 67
         //----------------------------------------------------------------------
66 68
         public function identifyMode($pos)
67 69
         {
68
-            if ($pos >= strlen($this->dataStr)) 
69
-                return QR_MODE_NUL;
70
+            if ($pos >= strlen($this->dataStr)) {
71
+                            return QR_MODE_NUL;
72
+            }
70 73
                 
71 74
             $c = $this->dataStr[$pos];
72 75
             
@@ -120,8 +123,9 @@  discard block
 block discarded – undo
120 123
             }
121 124
             
122 125
             $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
123
-            if($ret < 0)
124
-                return -1;
126
+            if($ret < 0) {
127
+                            return -1;
128
+            }
125 129
 
126 130
             return $run;
127 131
         }
@@ -167,8 +171,9 @@  discard block
 block discarded – undo
167 171
             }
168 172
 
169 173
             $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
170
-            if($ret < 0)
171
-                return -1;
174
+            if($ret < 0) {
175
+                            return -1;
176
+            }
172 177
 
173 178
             return $run;
174 179
         }
@@ -183,8 +188,9 @@  discard block
 block discarded – undo
183 188
             }
184 189
             
185 190
             $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
186
-            if($ret < 0)
187
-                return -1;
191
+            if($ret < 0) {
192
+                            return -1;
193
+            }
188 194
 
189 195
             return $ret;
190 196
         }
@@ -238,8 +244,9 @@  discard block
 block discarded – undo
238 244
             $run = $p;
239 245
             $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
240 246
             
241
-            if($ret < 0)
242
-                return -1;
247
+            if($ret < 0) {
248
+                            return -1;
249
+            }
243 250
 
244 251
             return $run;
245 252
         }
@@ -249,8 +256,9 @@  discard block
 block discarded – undo
249 256
         {
250 257
             while (strlen($this->dataStr) > 0)
251 258
             {
252
-                if($this->dataStr == '')
253
-                    return 0;
259
+                if($this->dataStr == '') {
260
+                                    return 0;
261
+                }
254 262
 
255 263
                 $mode = $this->identifyMode(0);
256 264
                 
@@ -258,16 +266,22 @@  discard block
 block discarded – undo
258 266
                     case QR_MODE_NUM: $length = $this->eatNum(); break;
259 267
                     case QR_MODE_AN:  $length = $this->eatAn(); break;
260 268
                     case QR_MODE_KANJI:
261
-                        if ($this->modeHint == QR_MODE_KANJI)
262
-                                $length = $this->eatKanji();
263
-                        else    $length = $this->eat8();
269
+                        if ($this->modeHint == QR_MODE_KANJI) {
270
+                                                        $length = $this->eatKanji();
271
+                        } else {
272
+                        	$length = $this->eat8();
273
+                        }
264 274
                         break;
265 275
                     default: $length = $this->eat8(); break;
266 276
                 
267 277
                 }
268 278
 
269
-                if($length == 0) return 0;
270
-                if($length < 0)  return -1;
279
+                if($length == 0) {
280
+                	return 0;
281
+                }
282
+                if($length < 0) {
283
+                	return -1;
284
+                }
271 285
                 
272 286
                 $this->dataStr = substr($this->dataStr, $length);
273 287
             }
@@ -303,8 +317,9 @@  discard block
 block discarded – undo
303 317
 
304 318
             $split = new QRsplit($string, $input, $modeHint);
305 319
             
306
-            if(!$casesensitive)
307
-                $split->toUpper();
320
+            if(!$casesensitive) {
321
+                            $split->toUpper();
322
+            }
308 323
                 
309 324
             return $split->splitString();
310 325
         }
Please login to merge, or discard this patch.
lib/phpqrcode/qrinput.php 1 patch
Braces   +33 added lines, -20 removed lines patch added patch discarded remove patch
@@ -197,8 +197,9 @@  discard block
 block discarded – undo
197 197
         {
198 198
             $bits = 0;
199 199
 
200
-            if($version == 0) 
201
-                $version = 1;
200
+            if($version == 0) {
201
+                            $version = 1;
202
+            }
202 203
 
203 204
             switch($this->mode) {
204 205
                 case QR_MODE_NUM:        $bits = QRinput::estimateBitsModeNum($this->size);    break;
@@ -257,8 +258,9 @@  discard block
 block discarded – undo
257 258
                             break;
258 259
                     }
259 260
                     
260
-                    if($ret < 0)
261
-                        return -1;
261
+                    if($ret < 0) {
262
+                                            return -1;
263
+                    }
262 264
                 }
263 265
 
264 266
                 return $this->bstream->size();
@@ -475,8 +477,9 @@  discard block
 block discarded – undo
475 477
         //----------------------------------------------------------------------
476 478
         public static function checkModeKanji($size, $data)
477 479
         {
478
-            if($size & 1)
479
-                return false;
480
+            if($size & 1) {
481
+                            return false;
482
+            }
480 483
 
481 484
             for($i=0; $i<$size; $i+=2) {
482 485
                 $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
@@ -496,8 +499,9 @@  discard block
 block discarded – undo
496 499
 
497 500
         public static function check($mode, $size, $data)
498 501
         {
499
-            if($size <= 0) 
500
-                return false;
502
+            if($size <= 0) {
503
+                            return false;
504
+            }
501 505
 
502 506
             switch($mode) {
503 507
                 case QR_MODE_NUM:       return self::checkModeNum($size, $data);   break;
@@ -562,8 +566,9 @@  discard block
 block discarded – undo
562 566
                     $chunks = (int)($payload / 11);
563 567
                     $remain = $payload - $chunks * 11;
564 568
                     $size = $chunks * 2;
565
-                    if($remain >= 6) 
566
-                        $size++;
569
+                    if($remain >= 6) {
570
+                                            $size++;
571
+                    }
567 572
                     break;
568 573
                 case QR_MODE_8:
569 574
                     $size = (int)($payload / 8);
@@ -580,8 +585,12 @@  discard block
 block discarded – undo
580 585
             }
581 586
             
582 587
             $maxsize = QRspec::maximumWords($mode, $version);
583
-            if($size < 0) $size = 0;
584
-            if($size > $maxsize) $size = $maxsize;
588
+            if($size < 0) {
589
+            	$size = 0;
590
+            }
591
+            if($size > $maxsize) {
592
+            	$size = $maxsize;
593
+            }
585 594
 
586 595
             return $size;
587 596
         }
@@ -594,8 +603,9 @@  discard block
 block discarded – undo
594 603
             foreach($this->items as $item) {
595 604
                 $bits = $item->encodeBitStream($this->version);
596 605
                 
597
-                if($bits < 0) 
598
-                    return -1;
606
+                if($bits < 0) {
607
+                                    return -1;
608
+                }
599 609
                     
600 610
                 $total += $bits;
601 611
             }
@@ -614,8 +624,9 @@  discard block
 block discarded – undo
614 624
             for(;;) {
615 625
                 $bits = $this->createBitStream();
616 626
                 
617
-                if($bits < 0) 
618
-                    return -1;
627
+                if($bits < 0) {
628
+                                    return -1;
629
+                }
619 630
                     
620 631
                 $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
621 632
                 if($ver < 0) {
@@ -652,8 +663,9 @@  discard block
 block discarded – undo
652 663
             $padding = new QRbitstream();
653 664
             $ret = $padding->appendNum($words * 8 - $bits + 4, 0);
654 665
             
655
-            if($ret < 0) 
656
-                return $ret;
666
+            if($ret < 0) {
667
+                            return $ret;
668
+            }
657 669
 
658 670
             $padlen = $maxwords - $words;
659 671
             
@@ -666,8 +678,9 @@  discard block
 block discarded – undo
666 678
                 
667 679
                 $ret = $padding->appendBytes($padlen, $padbuf);
668 680
                 
669
-                if($ret < 0)
670
-                    return $ret;
681
+                if($ret < 0) {
682
+                                    return $ret;
683
+                }
671 684
                 
672 685
             }
673 686
 
Please login to merge, or discard this patch.
lib/phpqrcode/qrencode.php 1 patch
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -104,14 +104,17 @@  discard block
 block discarded – undo
104 104
                 $blockNo++;
105 105
             }
106 106
 
107
-            if(QRspec::rsBlockNum2($spec) == 0)
108
-                return 0;
107
+            if(QRspec::rsBlockNum2($spec) == 0) {
108
+                            return 0;
109
+            }
109 110
 
110 111
             $dl = QRspec::rsDataCodes2($spec);
111 112
             $el = QRspec::rsEccCodes2($spec);
112 113
             $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
113 114
             
114
-            if($rs == NULL) return -1;
115
+            if($rs == NULL) {
116
+            	return -1;
117
+            }
115 118
             
116 119
             for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
117 120
                 $ecc = array_slice($this->ecccode,$eccPos);
@@ -249,7 +252,9 @@  discard block
 block discarded – undo
249 252
             }
250 253
 
251 254
             $input = new QRinput($version, $level);
252
-            if($input == NULL) return NULL;
255
+            if($input == NULL) {
256
+            	return NULL;
257
+            }
253 258
 
254 259
             $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
255 260
             if($ret < 0) {
@@ -269,7 +274,9 @@  discard block
 block discarded – undo
269 274
             }
270 275
 
271 276
             $input = new QRinput($version, $level);
272
-            if($input == NULL) return NULL;
277
+            if($input == NULL) {
278
+            	return NULL;
279
+            }
273 280
 
274 281
             $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
275 282
             if($ret < 0) {
@@ -379,7 +386,9 @@  discard block
 block discarded – undo
379 386
                         }
380 387
                     }
381 388
                 }
382
-                if($x < 0 || $y < 0) return null;
389
+                if($x < 0 || $y < 0) {
390
+                	return null;
391
+                }
383 392
 
384 393
                 $this->x = $x;
385 394
                 $this->y = $y;
@@ -486,8 +495,9 @@  discard block
 block discarded – undo
486 495
                 $err = ob_get_contents();
487 496
                 ob_end_clean();
488 497
                 
489
-                if ($err != '')
490
-                    QRtools::log($outfile, $err);
498
+                if ($err != '') {
499
+                                    QRtools::log($outfile, $err);
500
+                }
491 501
                 
492 502
                 $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
493 503
                 
Please login to merge, or discard this patch.