Passed
Pull Request — master (#5)
by Cody
03:17
created
lib/phpqrcode/phpqrcode.php 1 patch
Braces   +194 added lines, -109 removed lines patch added patch discarded remove patch
@@ -176,8 +176,9 @@  discard block
 block discarded – undo
176 176
         {
177 177
             $barcode_array = array();
178 178
             
179
-            if (!is_array($mode))
180
-                $mode = explode(',', $mode);
179
+            if (!is_array($mode)) {
180
+                            $mode = explode(',', $mode);
181
+            }
181 182
                 
182 183
             $eccLevel = 'L';
183 184
                 
@@ -194,8 +195,9 @@  discard block
 block discarded – undo
194 195
                 
195 196
             foreach ($qrTab as $line) {
196 197
                 $arrAdd = array();
197
-                foreach(str_split($line) as $char)
198
-                    $arrAdd[] = ($char=='1')?1:0;
198
+                foreach(str_split($line) as $char) {
199
+                                    $arrAdd[] = ($char=='1')?1:0;
200
+                }
199 201
                 $barcode_array['bcode'][] = $arrAdd;
200 202
             }
201 203
                     
@@ -223,8 +225,9 @@  discard block
 block discarded – undo
223 225
 				
224 226
 				$width = count($frame);
225 227
 				$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
226
-				for ($maskNo=0; $maskNo<8; $maskNo++)
227
-					$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
228
+				for ($maskNo=0; $maskNo<8; $maskNo++) {
229
+									$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
230
+				}
228 231
             }
229 232
 			
230 233
 			QRtools::markTime('after_build_cache');
@@ -261,8 +264,9 @@  discard block
 block discarded – undo
261 264
             list($usec, $sec) = explode(" ", microtime());
262 265
             $time = ((float)$usec + (float)$sec);
263 266
             
264
-            if (!isset($GLOBALS['qr_time_bench']))
265
-                $GLOBALS['qr_time_bench'] = array();
267
+            if (!isset($GLOBALS['qr_time_bench'])) {
268
+                            $GLOBALS['qr_time_bench'] = array();
269
+            }
266 270
             
267 271
             $GLOBALS['qr_time_bench'][$markerId] = $time;
268 272
         }
@@ -427,8 +431,9 @@  discard block
 block discarded – undo
427 431
 
428 432
             for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
429 433
                 $words  = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
430
-                if($words >= $size) 
431
-                    return $i;
434
+                if($words >= $size) {
435
+                                    return $i;
436
+                }
432 437
             }
433 438
 
434 439
             return -1;
@@ -446,8 +451,9 @@  discard block
 block discarded – undo
446 451
         //----------------------------------------------------------------------
447 452
         public static function lengthIndicator($mode, $version)
448 453
         {
449
-            if ($mode == QR_MODE_STRUCTURE)
450
-                return 0;
454
+            if ($mode == QR_MODE_STRUCTURE) {
455
+                            return 0;
456
+            }
451 457
                 
452 458
             if ($version <= 9) {
453 459
                 $l = 0;
@@ -463,8 +469,9 @@  discard block
 block discarded – undo
463 469
         //----------------------------------------------------------------------
464 470
         public static function maximumWords($mode, $version)
465 471
         {
466
-            if($mode == QR_MODE_STRUCTURE) 
467
-                return 3;
472
+            if($mode == QR_MODE_STRUCTURE) {
473
+                            return 3;
474
+            }
468 475
                 
469 476
             if($version <= 9) {
470 477
                 $l = 0;
@@ -610,8 +617,9 @@  discard block
 block discarded – undo
610 617
         //----------------------------------------------------------------------
611 618
         public static function putAlignmentPattern($version, &$frame, $width)
612 619
         {
613
-            if($version < 2)
614
-                return;
620
+            if($version < 2) {
621
+                            return;
622
+            }
615 623
 
616 624
             $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
617 625
             if($d < 0) {
@@ -663,8 +671,9 @@  discard block
 block discarded – undo
663 671
         //----------------------------------------------------------------------
664 672
         public static function getVersionPattern($version)
665 673
         {
666
-            if($version < 7 || $version > QRSPEC_VERSION_MAX)
667
-                return 0;
674
+            if($version < 7 || $version > QRSPEC_VERSION_MAX) {
675
+                            return 0;
676
+            }
668 677
 
669 678
             return self::$versionPattern[$version -7];
670 679
         }
@@ -681,11 +690,13 @@  discard block
 block discarded – undo
681 690
 
682 691
         public static function getFormatInfo($mask, $level)
683 692
         {
684
-            if($mask < 0 || $mask > 7)
685
-                return 0;
693
+            if($mask < 0 || $mask > 7) {
694
+                            return 0;
695
+            }
686 696
                 
687
-            if($level < 0 || $level > 3)
688
-                return 0;                
697
+            if($level < 0 || $level > 3) {
698
+                            return 0;
699
+            }
689 700
 
690 701
             return self::$formatInfo[$level][$mask];
691 702
         }
@@ -865,8 +876,9 @@  discard block
 block discarded – undo
865 876
         //----------------------------------------------------------------------
866 877
         public static function newFrame($version)
867 878
         {
868
-            if($version < 1 || $version > QRSPEC_VERSION_MAX) 
869
-                return null;
879
+            if($version < 1 || $version > QRSPEC_VERSION_MAX) {
880
+                            return null;
881
+            }
870 882
 
871 883
             if(!isset(self::$frames[$version])) {
872 884
                 
@@ -884,8 +896,9 @@  discard block
 block discarded – undo
884 896
                 }
885 897
             }
886 898
             
887
-            if(is_null(self::$frames[$version]))
888
-                return null;
899
+            if(is_null(self::$frames[$version])) {
900
+                            return null;
901
+            }
889 902
 
890 903
             return self::$frames[$version];
891 904
         }
@@ -950,7 +963,7 @@  discard block
 block discarded – undo
950 963
                     ImagePng($image, $filename);
951 964
                     header("Content-type: image/png");
952 965
                     ImagePng($image);
953
-                }else{
966
+                } else{
954 967
                     ImagePng($image, $filename);
955 968
                 }
956 969
             }
@@ -1210,8 +1223,9 @@  discard block
 block discarded – undo
1210 1223
         {
1211 1224
             $bits = 0;
1212 1225
 
1213
-            if($version == 0) 
1214
-                $version = 1;
1226
+            if($version == 0) {
1227
+                            $version = 1;
1228
+            }
1215 1229
 
1216 1230
             switch($this->mode) {
1217 1231
                 case QR_MODE_NUM:        $bits = QRinput::estimateBitsModeNum($this->size);    break;
@@ -1270,8 +1284,9 @@  discard block
 block discarded – undo
1270 1284
                             break;
1271 1285
                     }
1272 1286
                     
1273
-                    if($ret < 0)
1274
-                        return -1;
1287
+                    if($ret < 0) {
1288
+                                            return -1;
1289
+                    }
1275 1290
                 }
1276 1291
 
1277 1292
                 return $this->bstream->size();
@@ -1488,8 +1503,9 @@  discard block
 block discarded – undo
1488 1503
         //----------------------------------------------------------------------
1489 1504
         public static function checkModeKanji($size, $data)
1490 1505
         {
1491
-            if($size & 1)
1492
-                return false;
1506
+            if($size & 1) {
1507
+                            return false;
1508
+            }
1493 1509
 
1494 1510
             for($i=0; $i<$size; $i+=2) {
1495 1511
                 $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
@@ -1509,8 +1525,9 @@  discard block
 block discarded – undo
1509 1525
 
1510 1526
         public static function check($mode, $size, $data)
1511 1527
         {
1512
-            if($size <= 0) 
1513
-                return false;
1528
+            if($size <= 0) {
1529
+                            return false;
1530
+            }
1514 1531
 
1515 1532
             switch($mode) {
1516 1533
                 case QR_MODE_NUM:       return self::checkModeNum($size, $data);   break;
@@ -1575,8 +1592,9 @@  discard block
 block discarded – undo
1575 1592
                     $chunks = (int)($payload / 11);
1576 1593
                     $remain = $payload - $chunks * 11;
1577 1594
                     $size = $chunks * 2;
1578
-                    if($remain >= 6) 
1579
-                        $size++;
1595
+                    if($remain >= 6) {
1596
+                                            $size++;
1597
+                    }
1580 1598
                     break;
1581 1599
                 case QR_MODE_8:
1582 1600
                     $size = (int)($payload / 8);
@@ -1593,8 +1611,12 @@  discard block
 block discarded – undo
1593 1611
             }
1594 1612
             
1595 1613
             $maxsize = QRspec::maximumWords($mode, $version);
1596
-            if($size < 0) $size = 0;
1597
-            if($size > $maxsize) $size = $maxsize;
1614
+            if($size < 0) {
1615
+                $size = 0;
1616
+            }
1617
+            if($size > $maxsize) {
1618
+                $size = $maxsize;
1619
+            }
1598 1620
 
1599 1621
             return $size;
1600 1622
         }
@@ -1607,8 +1629,9 @@  discard block
 block discarded – undo
1607 1629
             foreach($this->items as $item) {
1608 1630
                 $bits = $item->encodeBitStream($this->version);
1609 1631
                 
1610
-                if($bits < 0) 
1611
-                    return -1;
1632
+                if($bits < 0) {
1633
+                                    return -1;
1634
+                }
1612 1635
                     
1613 1636
                 $total += $bits;
1614 1637
             }
@@ -1627,8 +1650,9 @@  discard block
 block discarded – undo
1627 1650
             for(;;) {
1628 1651
                 $bits = $this->createBitStream();
1629 1652
                 
1630
-                if($bits < 0) 
1631
-                    return -1;
1653
+                if($bits < 0) {
1654
+                                    return -1;
1655
+                }
1632 1656
                     
1633 1657
                 $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
1634 1658
                 if($ver < 0) {
@@ -1665,8 +1689,9 @@  discard block
 block discarded – undo
1665 1689
             $padding = new QRbitstream();
1666 1690
             $ret = $padding->appendNum($words * 8 - $bits + 4, 0);
1667 1691
             
1668
-            if($ret < 0) 
1669
-                return $ret;
1692
+            if($ret < 0) {
1693
+                            return $ret;
1694
+            }
1670 1695
 
1671 1696
             $padlen = $maxwords - $words;
1672 1697
             
@@ -1679,8 +1704,9 @@  discard block
 block discarded – undo
1679 1704
                 
1680 1705
                 $ret = $padding->appendBytes($padlen, $padbuf);
1681 1706
                 
1682
-                if($ret < 0)
1683
-                    return $ret;
1707
+                if($ret < 0) {
1708
+                                    return $ret;
1709
+                }
1684 1710
                 
1685 1711
             }
1686 1712
 
@@ -1857,13 +1883,15 @@  discard block
 block discarded – undo
1857 1883
         //----------------------------------------------------------------------
1858 1884
         public function appendNum($bits, $num)
1859 1885
         {
1860
-            if ($bits == 0) 
1861
-                return 0;
1886
+            if ($bits == 0) {
1887
+                            return 0;
1888
+            }
1862 1889
 
1863 1890
             $b = QRbitstream::newFromNum($bits, $num);
1864 1891
             
1865
-            if(is_null($b))
1866
-                return -1;
1892
+            if(is_null($b)) {
1893
+                            return -1;
1894
+            }
1867 1895
 
1868 1896
             $ret = $this->append($b);
1869 1897
             unset($b);
@@ -1874,13 +1902,15 @@  discard block
 block discarded – undo
1874 1902
         //----------------------------------------------------------------------
1875 1903
         public function appendBytes($size, $data)
1876 1904
         {
1877
-            if ($size == 0) 
1878
-                return 0;
1905
+            if ($size == 0) {
1906
+                            return 0;
1907
+            }
1879 1908
 
1880 1909
             $b = QRbitstream::newFromBytes($size, $data);
1881 1910
             
1882
-            if(is_null($b))
1883
-                return -1;
1911
+            if(is_null($b)) {
1912
+                            return -1;
1913
+            }
1884 1914
 
1885 1915
             $ret = $this->append($b);
1886 1916
             unset($b);
@@ -1984,8 +2014,9 @@  discard block
 block discarded – undo
1984 2014
         //----------------------------------------------------------------------
1985 2015
         public static function isdigitat($str, $pos)
1986 2016
         {    
1987
-            if ($pos >= strlen($str))
1988
-                return false;
2017
+            if ($pos >= strlen($str)) {
2018
+                            return false;
2019
+            }
1989 2020
             
1990 2021
             return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
1991 2022
         }
@@ -1993,8 +2024,9 @@  discard block
 block discarded – undo
1993 2024
         //----------------------------------------------------------------------
1994 2025
         public static function isalnumat($str, $pos)
1995 2026
         {
1996
-            if ($pos >= strlen($str))
1997
-                return false;
2027
+            if ($pos >= strlen($str)) {
2028
+                            return false;
2029
+            }
1998 2030
                 
1999 2031
             return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
2000 2032
         }
@@ -2002,8 +2034,9 @@  discard block
 block discarded – undo
2002 2034
         //----------------------------------------------------------------------
2003 2035
         public function identifyMode($pos)
2004 2036
         {
2005
-            if ($pos >= strlen($this->dataStr)) 
2006
-                return QR_MODE_NUL;
2037
+            if ($pos >= strlen($this->dataStr)) {
2038
+                            return QR_MODE_NUL;
2039
+            }
2007 2040
                 
2008 2041
             $c = $this->dataStr[$pos];
2009 2042
             
@@ -2057,8 +2090,9 @@  discard block
 block discarded – undo
2057 2090
             }
2058 2091
             
2059 2092
             $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
2060
-            if($ret < 0)
2061
-                return -1;
2093
+            if($ret < 0) {
2094
+                            return -1;
2095
+            }
2062 2096
 
2063 2097
             return $run;
2064 2098
         }
@@ -2104,8 +2138,9 @@  discard block
 block discarded – undo
2104 2138
             }
2105 2139
 
2106 2140
             $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
2107
-            if($ret < 0)
2108
-                return -1;
2141
+            if($ret < 0) {
2142
+                            return -1;
2143
+            }
2109 2144
 
2110 2145
             return $run;
2111 2146
         }
@@ -2120,8 +2155,9 @@  discard block
 block discarded – undo
2120 2155
             }
2121 2156
             
2122 2157
             $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
2123
-            if($ret < 0)
2124
-                return -1;
2158
+            if($ret < 0) {
2159
+                            return -1;
2160
+            }
2125 2161
 
2126 2162
             return $run;
2127 2163
         }
@@ -2175,8 +2211,9 @@  discard block
 block discarded – undo
2175 2211
             $run = $p;
2176 2212
             $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
2177 2213
             
2178
-            if($ret < 0)
2179
-                return -1;
2214
+            if($ret < 0) {
2215
+                            return -1;
2216
+            }
2180 2217
 
2181 2218
             return $run;
2182 2219
         }
@@ -2186,8 +2223,9 @@  discard block
 block discarded – undo
2186 2223
         {
2187 2224
             while (strlen($this->dataStr) > 0)
2188 2225
             {
2189
-                if($this->dataStr == '')
2190
-                    return 0;
2226
+                if($this->dataStr == '') {
2227
+                                    return 0;
2228
+                }
2191 2229
 
2192 2230
                 $mode = $this->identifyMode(0);
2193 2231
                 
@@ -2195,16 +2233,22 @@  discard block
 block discarded – undo
2195 2233
                     case QR_MODE_NUM: $length = $this->eatNum(); break;
2196 2234
                     case QR_MODE_AN:  $length = $this->eatAn(); break;
2197 2235
                     case QR_MODE_KANJI:
2198
-                        if ($this->modeHint == QR_MODE_KANJI)
2199
-                                $length = $this->eatKanji();
2200
-                        else    $length = $this->eat8();
2236
+                        if ($this->modeHint == QR_MODE_KANJI) {
2237
+                                                        $length = $this->eatKanji();
2238
+                        } else {
2239
+                            $length = $this->eat8();
2240
+                        }
2201 2241
                         break;
2202 2242
                     default: $length = $this->eat8(); break;
2203 2243
                 
2204 2244
                 }
2205 2245
 
2206
-                if($length == 0) return 0;
2207
-                if($length < 0)  return -1;
2246
+                if($length == 0) {
2247
+                    return 0;
2248
+                }
2249
+                if($length < 0) {
2250
+                    return -1;
2251
+                }
2208 2252
                 
2209 2253
                 $this->dataStr = substr($this->dataStr, $length);
2210 2254
             }
@@ -2240,8 +2284,9 @@  discard block
 block discarded – undo
2240 2284
 
2241 2285
             $split = new QRsplit($string, $input, $modeHint);
2242 2286
             
2243
-            if(!$casesensitive)
2244
-                $split->toUpper();
2287
+            if(!$casesensitive) {
2288
+                            $split->toUpper();
2289
+            }
2245 2290
                 
2246 2291
             return $split->splitString();
2247 2292
         }
@@ -2318,11 +2363,23 @@  discard block
 block discarded – undo
2318 2363
             $rs = null;
2319 2364
             
2320 2365
             // Check parameter ranges
2321
-            if($symsize < 0 || $symsize > 8)                     return $rs;
2322
-            if($fcr < 0 || $fcr >= (1<<$symsize))                return $rs;
2323
-            if($prim <= 0 || $prim >= (1<<$symsize))             return $rs;
2324
-            if($nroots < 0 || $nroots >= (1<<$symsize))          return $rs; // Can't have more roots than symbol values!
2325
-            if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) return $rs; // Too much padding
2366
+            if($symsize < 0 || $symsize > 8) {
2367
+                return $rs;
2368
+            }
2369
+            if($fcr < 0 || $fcr >= (1<<$symsize)) {
2370
+                return $rs;
2371
+            }
2372
+            if($prim <= 0 || $prim >= (1<<$symsize)) {
2373
+                return $rs;
2374
+            }
2375
+            if($nroots < 0 || $nroots >= (1<<$symsize)) {
2376
+                return $rs;
2377
+            }
2378
+            // Can't have more roots than symbol values!
2379
+            if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) {
2380
+                return $rs;
2381
+            }
2382
+            // Too much padding
2326 2383
 
2327 2384
             $rs = new QRrsItem();
2328 2385
             $rs->mm = $symsize;
@@ -2388,8 +2445,9 @@  discard block
 block discarded – undo
2388 2445
             }
2389 2446
             
2390 2447
             // convert rs->genpoly[] to index form for quicker encoding
2391
-            for ($i = 0; $i <= $nroots; $i++)
2392
-                $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
2448
+            for ($i = 0; $i <= $nroots; $i++) {
2449
+                            $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
2450
+            }
2393 2451
 
2394 2452
             return $rs;
2395 2453
         }
@@ -2447,12 +2505,24 @@  discard block
 block discarded – undo
2447 2505
         public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
2448 2506
         {
2449 2507
             foreach(self::$items as $rs) {
2450
-                if($rs->pad != $pad)       continue;
2451
-                if($rs->nroots != $nroots) continue;
2452
-                if($rs->mm != $symsize)    continue;
2453
-                if($rs->gfpoly != $gfpoly) continue;
2454
-                if($rs->fcr != $fcr)       continue;
2455
-                if($rs->prim != $prim)     continue;
2508
+                if($rs->pad != $pad) {
2509
+                    continue;
2510
+                }
2511
+                if($rs->nroots != $nroots) {
2512
+                    continue;
2513
+                }
2514
+                if($rs->mm != $symsize) {
2515
+                    continue;
2516
+                }
2517
+                if($rs->gfpoly != $gfpoly) {
2518
+                    continue;
2519
+                }
2520
+                if($rs->fcr != $fcr) {
2521
+                    continue;
2522
+                }
2523
+                if($rs->prim != $prim) {
2524
+                    continue;
2525
+                }
2456 2526
 
2457 2527
                 return $rs;
2458 2528
             }
@@ -2591,8 +2661,9 @@  discard block
 block discarded – undo
2591 2661
         {
2592 2662
             $codeArr = array();
2593 2663
             
2594
-            foreach ($bitFrame as $line)
2595
-                $codeArr[] = join('', $line);
2664
+            foreach ($bitFrame as $line) {
2665
+                            $codeArr[] = join('', $line);
2666
+            }
2596 2667
                 
2597 2668
             return gzcompress(join("\n", $codeArr), 9);
2598 2669
         }
@@ -2603,8 +2674,9 @@  discard block
 block discarded – undo
2603 2674
             $codeArr = array();
2604 2675
             
2605 2676
             $codeLines = explode("\n", gzuncompress($code));
2606
-            foreach ($codeLines as $line)
2607
-                $codeArr[] = str_split($line);
2677
+            foreach ($codeLines as $line) {
2678
+                            $codeArr[] = str_split($line);
2679
+            }
2608 2680
             
2609 2681
             return $codeArr;
2610 2682
         }
@@ -2622,16 +2694,18 @@  discard block
 block discarded – undo
2622 2694
                     $bitMask = self::unserial(file_get_contents($fileName));
2623 2695
                 } else {
2624 2696
                     $bitMask = $this->generateMaskNo($maskNo, $width, $s);
2625
-                    if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
2626
-                        mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
2697
+                    if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo)) {
2698
+                                            mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
2699
+                    }
2627 2700
                     file_put_contents($fileName, self::serial($bitMask));
2628 2701
                 }
2629 2702
             } else {
2630 2703
                 $bitMask = $this->generateMaskNo($maskNo, $width, $s);
2631 2704
             }
2632 2705
 
2633
-            if ($maskGenOnly)
2634
-                return;
2706
+            if ($maskGenOnly) {
2707
+                            return;
2708
+            }
2635 2709
                 
2636 2710
             $d = $s;
2637 2711
 
@@ -2698,8 +2772,9 @@  discard block
 block discarded – undo
2698 2772
                 
2699 2773
                 $frameY = $frame[$y];
2700 2774
                 
2701
-                if ($y>0)
2702
-                    $frameYM = $frame[$y-1];
2775
+                if ($y>0) {
2776
+                                    $frameYM = $frame[$y-1];
2777
+                }
2703 2778
                 
2704 2779
                 for($x=0; $x<$width; $x++) {
2705 2780
                     if(($x > 0) && ($y > 0)) {
@@ -2912,14 +2987,17 @@  discard block
 block discarded – undo
2912 2987
                 $blockNo++;
2913 2988
             }
2914 2989
 
2915
-            if(QRspec::rsBlockNum2($spec) == 0)
2916
-                return 0;
2990
+            if(QRspec::rsBlockNum2($spec) == 0) {
2991
+                            return 0;
2992
+            }
2917 2993
 
2918 2994
             $dl = QRspec::rsDataCodes2($spec);
2919 2995
             $el = QRspec::rsEccCodes2($spec);
2920 2996
             $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
2921 2997
             
2922
-            if($rs == NULL) return -1;
2998
+            if($rs == NULL) {
2999
+                return -1;
3000
+            }
2923 3001
             
2924 3002
             for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
2925 3003
                 $ecc = array_slice($this->ecccode,$eccPos);
@@ -3057,7 +3135,9 @@  discard block
 block discarded – undo
3057 3135
             }
3058 3136
 
3059 3137
             $input = new QRinput($version, $level);
3060
-            if($input == NULL) return NULL;
3138
+            if($input == NULL) {
3139
+                return NULL;
3140
+            }
3061 3141
 
3062 3142
             $ret = $input->append(QR_MODE_8, strlen($string), str_split($string));
3063 3143
             if($ret < 0) {
@@ -3077,7 +3157,9 @@  discard block
 block discarded – undo
3077 3157
             }
3078 3158
 
3079 3159
             $input = new QRinput($version, $level);
3080
-            if($input == NULL) return NULL;
3160
+            if($input == NULL) {
3161
+                return NULL;
3162
+            }
3081 3163
 
3082 3164
             $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
3083 3165
             if($ret < 0) {
@@ -3187,7 +3269,9 @@  discard block
 block discarded – undo
3187 3269
                         }
3188 3270
                     }
3189 3271
                 }
3190
-                if($x < 0 || $y < 0) return null;
3272
+                if($x < 0 || $y < 0) {
3273
+                    return null;
3274
+                }
3191 3275
 
3192 3276
                 $this->x = $x;
3193 3277
                 $this->y = $y;
@@ -3294,8 +3378,9 @@  discard block
 block discarded – undo
3294 3378
                 $err = ob_get_contents();
3295 3379
                 ob_end_clean();
3296 3380
                 
3297
-                if ($err != '')
3298
-                    QRtools::log($outfile, $err);
3381
+                if ($err != '') {
3382
+                                    QRtools::log($outfile, $err);
3383
+                }
3299 3384
                 
3300 3385
                 $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
3301 3386
                 
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.
index.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
26 26
 	require_once "config.php";
27 27
 	require_once "db-prefs.php";
28 28
 
29
-	if (!init_plugins()) return;
29
+	if (!init_plugins()) {
30
+	    return;
31
+	}
30 32
 
31 33
 	login_sequence();
32 34
 
Please login to merge, or discard this patch.
prefs.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
 	require_once "config.php";
20 20
 	require_once "db-prefs.php";
21 21
 
22
-	if (!init_plugins()) return;
22
+	if (!init_plugins()) {
23
+	    return;
24
+	}
23 25
 
24 26
 	login_sequence();
25 27
 
Please login to merge, or discard this patch.
classes/rpc.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
 		$_SESSION["profile"] = (int) clean($_REQUEST["id"]);
12 12
 
13 13
 		// default value
14
-		if (!$_SESSION["profile"]) $_SESSION["profile"] = null;
14
+		if (!$_SESSION["profile"]) {
15
+		    $_SESSION["profile"] = null;
16
+		}
15 17
 	}
16 18
 
17 19
 	public function remprofiles() {
@@ -173,7 +175,9 @@  discard block
 block discarded – undo
173 175
 				if ($row = $sth->fetch()) {
174 176
 					$feed_id = $row["id"];
175 177
 				} else {
176
-					if (!$title) $title = '[Unknown]';
178
+					if (!$title) {
179
+					    $title = '[Unknown]';
180
+					}
177 181
 
178 182
 					$sth = $this->pdo->prepare("INSERT INTO ttrss_feeds
179 183
 							(owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method)
@@ -216,7 +220,9 @@  discard block
 block discarded – undo
216 220
 	private function archive_article($id, $owner_uid) {
217 221
 		$this->pdo->beginTransaction();
218 222
 
219
-		if (!$owner_uid) $owner_uid = $_SESSION['uid'];
223
+		if (!$owner_uid) {
224
+		    $owner_uid = $_SESSION['uid'];
225
+		}
220 226
 
221 227
 		$sth = $this->pdo->prepare("SELECT feed_id FROM ttrss_user_entries
222 228
 			WHERE ref_id = ? AND owner_uid = ?");
@@ -278,8 +284,9 @@  discard block
 block discarded – undo
278 284
 			'seq' => $seq
279 285
 		];
280 286
 
281
-		if ($seq % 2 == 0)
282
-			$reply['runtime-info'] = make_runtime_info();
287
+		if ($seq % 2 == 0) {
288
+					$reply['runtime-info'] = make_runtime_info();
289
+		}
283 290
 
284 291
 		print json_encode($reply);
285 292
 	}
@@ -353,7 +360,9 @@  discard block
 block discarded – undo
353 360
 		$payload = json_decode(clean($_REQUEST["payload"]), false);
354 361
 		$mode = clean($_REQUEST["mode"]);
355 362
 
356
-		if (!$payload || !is_array($payload)) return;
363
+		if (!$payload || !is_array($payload)) {
364
+		    return;
365
+		}
357 366
 
358 367
 		if ($mode == 1) {
359 368
 			foreach ($payload as $feed) {
Please login to merge, or discard this patch.
classes/article.php 1 patch
Braces   +90 added lines, -53 removed lines patch added patch discarded remove patch
@@ -57,10 +57,16 @@  discard block
 block discarded – undo
57 57
 
58 58
 		$rc = false;
59 59
 
60
-		if (!$title) $title = $url;
61
-		if (!$title && !$url) return false;
60
+		if (!$title) {
61
+		    $title = $url;
62
+		}
63
+		if (!$title && !$url) {
64
+		    return false;
65
+		}
62 66
 
63
-		if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false;
67
+		if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
68
+		    return false;
69
+		}
64 70
 
65 71
 		$pdo = Db::pdo();
66 72
 
@@ -271,7 +277,9 @@  discard block
 block discarded – undo
271 277
 		$tags_str = $this->format_tags_string($tags);
272 278
 		$tags_str_full = join(", ", $tags);
273 279
 
274
-		if (!$tags_str_full) $tags_str_full = __("no tags");
280
+		if (!$tags_str_full) {
281
+		    $tags_str_full = __("no tags");
282
+		}
275 283
 
276 284
 		print json_encode([
277 285
 			"id" => (int) $id,
@@ -320,10 +328,11 @@  discard block
 block discarded – undo
320 328
 
321 329
 			foreach ($ids as $id) {
322 330
 
323
-				if ($assign)
324
-					Labels::add_article($id, $label, $_SESSION["uid"]);
325
-				else
326
-					Labels::remove_article($id, $label, $_SESSION["uid"]);
331
+				if ($assign) {
332
+									Labels::add_article($id, $label, $_SESSION["uid"]);
333
+				} else {
334
+									Labels::remove_article($id, $label, $_SESSION["uid"]);
335
+				}
327 336
 
328 337
 				$labels = $this->get_article_labels($id, $_SESSION["uid"]);
329 338
 
@@ -384,14 +393,18 @@  discard block
 block discarded – undo
384 393
 				$width = $line["width"];
385 394
 				$height = $line["height"];
386 395
 
387
-				if (!$ctype) $ctype = __("unknown type");
396
+				if (!$ctype) {
397
+				    $ctype = __("unknown type");
398
+				}
388 399
 
389 400
 				//$filename = substr($url, strrpos($url, "/")+1);
390 401
 				$filename = basename($url);
391 402
 
392 403
 				$player = format_inline_player($url, $ctype);
393 404
 
394
-				if ($player) array_push($entries_inline, $player);
405
+				if ($player) {
406
+				    array_push($entries_inline, $player);
407
+				}
395 408
 
396 409
 #				$entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" .
397 410
 #					$filename . " (" . $ctype . ")" . "</a>";
@@ -419,8 +432,9 @@  discard block
 block discarded – undo
419 432
 
420 433
 					foreach ($entries as $entry) {
421 434
 
422
-						foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin)
423
-							$retval = $plugin->hook_render_enclosure($entry, $hide_images);
435
+						foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) {
436
+													$retval = $plugin->hook_render_enclosure($entry, $hide_images);
437
+						}
424 438
 
425 439
 
426 440
 						if ($retval) {
@@ -431,10 +445,12 @@  discard block
 block discarded – undo
431 445
 
432 446
 								if (!$hide_images) {
433 447
 									$encsize = '';
434
-									if ($entry['height'] > 0)
435
-										$encsize .= ' height="' . intval($entry['height']) . '"';
436
-									if ($entry['width'] > 0)
437
-										$encsize .= ' width="' . intval($entry['width']) . '"';
448
+									if ($entry['height'] > 0) {
449
+																			$encsize .= ' height="' . intval($entry['height']) . '"';
450
+									}
451
+									if ($entry['width'] > 0) {
452
+																			$encsize .= ' width="' . intval($entry['width']) . '"';
453
+									}
438 454
 									$rv .= "<p><img
439 455
 										alt=\"".htmlspecialchars($entry["filename"])."\"
440 456
 										src=\"" .htmlspecialchars($entry["url"]) . "\"
@@ -466,15 +482,17 @@  discard block
 block discarded – undo
466 482
 			$rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
467 483
 
468 484
 			foreach ($entries as $entry) {
469
-				if ($entry["title"])
470
-					$title = " &mdash; " . truncate_string($entry["title"], 30);
471
-				else
472
-					$title = "";
485
+				if ($entry["title"]) {
486
+									$title = " &mdash; " . truncate_string($entry["title"], 30);
487
+				} else {
488
+									$title = "";
489
+				}
473 490
 
474
-				if ($entry["filename"])
475
-					$filename = truncate_middle(htmlspecialchars($entry["filename"]), 60);
476
-				else
477
-					$filename = "";
491
+				if ($entry["filename"]) {
492
+									$filename = truncate_middle(htmlspecialchars($entry["filename"]), 60);
493
+				} else {
494
+									$filename = "";
495
+				}
478 496
 
479 497
 				$rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")'
480 498
 					dojoType=\"dijit.MenuItem\">".$filename . $title."</div>";
@@ -492,7 +510,9 @@  discard block
 block discarded – undo
492 510
 
493 511
 		$a_id = $id;
494 512
 
495
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
513
+		if (!$owner_uid) {
514
+		    $owner_uid = $_SESSION["uid"];
515
+		}
496 516
 
497 517
 		$pdo = Db::pdo();
498 518
 
@@ -510,7 +530,9 @@  discard block
 block discarded – undo
510 530
 				WHERE ref_id = ? AND owner_uid = ?");
511 531
 			$csth->execute([$id, $owner_uid]);
512 532
 
513
-			if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"];
533
+			if ($row = $csth->fetch()) {
534
+			    $tag_cache = $row["tag_cache"];
535
+			}
514 536
 		}
515 537
 
516 538
 		if ($tag_cache) {
@@ -551,8 +573,9 @@  discard block
 block discarded – undo
551 573
 
552 574
 			$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2);
553 575
 
554
-			if (count($tags) > $maxtags)
555
-				$tags_str .= ", &hellip;";
576
+			if (count($tags) > $maxtags) {
577
+							$tags_str .= ", &hellip;";
578
+			}
556 579
 
557 580
 			return $tags_str;
558 581
 		}
@@ -560,7 +583,9 @@  discard block
 block discarded – undo
560 583
 
561 584
 	public static function format_article_labels($labels) {
562 585
 
563
-		if (!is_array($labels)) return '';
586
+		if (!is_array($labels)) {
587
+		    return '';
588
+		}
564 589
 
565 590
 		$labels_str = "";
566 591
 
@@ -618,10 +643,11 @@  discard block
 block discarded – undo
618 643
 
619 644
         // purge orphaned posts in main content table
620 645
 
621
-        if (DB_TYPE == "mysql")
622
-            $limit_qpart = "LIMIT 5000";
623
-        else
624
-            $limit_qpart = "";
646
+        if (DB_TYPE == "mysql") {
647
+                    $limit_qpart = "LIMIT 5000";
648
+        } else {
649
+                    $limit_qpart = "";
650
+        }
625 651
 
626 652
         $pdo = Db::pdo();
627 653
         $res = $pdo->query("DELETE FROM ttrss_entries WHERE
@@ -635,7 +661,9 @@  discard block
 block discarded – undo
635 661
 
636 662
 	public static function catchupArticlesById($ids, $cmode, $owner_uid = false) {
637 663
 
638
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
664
+		if (!$owner_uid) {
665
+		    $owner_uid = $_SESSION["uid"];
666
+		}
639 667
 
640 668
 		$pdo = Db::pdo();
641 669
 
@@ -685,7 +713,9 @@  discard block
 block discarded – undo
685 713
 	public static function get_article_labels($id, $owner_uid = false) {
686 714
 		$rv = array();
687 715
 
688
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
716
+		if (!$owner_uid) {
717
+		    $owner_uid = $_SESSION["uid"];
718
+		}
689 719
 
690 720
 		$pdo = Db::pdo();
691 721
 
@@ -699,10 +729,11 @@  discard block
 block discarded – undo
699 729
 			if ($label_cache) {
700 730
 				$tmp = json_decode($label_cache, true);
701 731
 
702
-				if (!$tmp || $tmp["no-labels"] == 1)
703
-					return $rv;
704
-				else
705
-					return $tmp;
732
+				if (!$tmp || $tmp["no-labels"] == 1) {
733
+									return $rv;
734
+				} else {
735
+									return $tmp;
736
+				}
706 737
 			}
707 738
 		}
708 739
 
@@ -721,10 +752,11 @@  discard block
 block discarded – undo
721 752
 			array_push($rv, $rk);
722 753
 		}
723 754
 
724
-		if (count($rv) > 0)
725
-			Labels::update_cache($owner_uid, $id, $rv);
726
-		else
727
-			Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
755
+		if (count($rv) > 0) {
756
+					Labels::update_cache($owner_uid, $id, $rv);
757
+		} else {
758
+					Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
759
+		}
728 760
 
729 761
 		return $rv;
730 762
 	}
@@ -772,28 +804,33 @@  discard block
 block discarded – undo
772 804
 				}
773 805
 			}
774 806
 
775
-			if (!$article_image)
776
-				foreach ($enclosures as $enc) {
807
+			if (!$article_image) {
808
+							foreach ($enclosures as $enc) {
777 809
 					if (strpos($enc["content_type"], "image/") !== FALSE) {
778 810
 						$article_image = $enc["content_url"];
811
+			}
779 812
 						break;
780 813
 					}
781 814
 				}
782 815
 
783
-			if ($article_image)
784
-				$article_image = rewrite_relative_url($site_url, $article_image);
816
+			if ($article_image) {
817
+							$article_image = rewrite_relative_url($site_url, $article_image);
818
+			}
785 819
 
786
-			if ($article_stream)
787
-				$article_stream = rewrite_relative_url($site_url, $article_stream);
820
+			if ($article_stream) {
821
+							$article_stream = rewrite_relative_url($site_url, $article_stream);
822
+			}
788 823
 		}
789 824
 
790 825
 		$cache = new DiskCache("images");
791 826
 
792
-		if ($article_image && $cache->exists(sha1($article_image)))
793
-			$article_image = $cache->getUrl(sha1($article_image));
827
+		if ($article_image && $cache->exists(sha1($article_image))) {
828
+					$article_image = $cache->getUrl(sha1($article_image));
829
+		}
794 830
 
795
-		if ($article_stream && $cache->exists(sha1($article_stream)))
796
-			$article_stream = $cache->getUrl(sha1($article_stream));
831
+		if ($article_stream && $cache->exists(sha1($article_stream))) {
832
+					$article_stream = $cache->getUrl(sha1($article_stream));
833
+		}
797 834
 
798 835
 		return [$article_image, $article_stream];
799 836
 	}
Please login to merge, or discard this patch.
classes/api.php 1 patch
Braces   +47 added lines, -28 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
 		$password = clean($_REQUEST["password"]);
58 58
 		$password_base64 = base64_decode(clean($_REQUEST["password"]));
59 59
 
60
-		if (SINGLE_USER_MODE) $login = "admin";
60
+		if (SINGLE_USER_MODE) {
61
+		    $login = "admin";
62
+		}
61 63
 
62 64
 		$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE login = ?");
63 65
 		$sth->execute([$login]);
@@ -134,10 +136,11 @@  discard block
 block discarded – undo
134 136
 
135 137
 		// TODO do not return empty categories, return Uncategorized and standard virtual cats
136 138
 
137
-		if ($enable_nested)
138
-			$nested_qpart = "parent_cat IS NULL";
139
-		else
140
-			$nested_qpart = "true";
139
+		if ($enable_nested) {
140
+					$nested_qpart = "parent_cat IS NULL";
141
+		} else {
142
+					$nested_qpart = "true";
143
+		}
141 144
 
142 145
 		$sth = $this->pdo->prepare("SELECT
143 146
 				id, title, order_id, (SELECT COUNT(id) FROM
@@ -156,8 +159,9 @@  discard block
 block discarded – undo
156 159
 			if ($include_empty || $line["num_feeds"] > 0 || $line["num_cats"] > 0) {
157 160
 				$unread = getFeedUnread($line["id"], true);
158 161
 
159
-				if ($enable_nested)
160
-					$unread += Feeds::getCategoryChildrenUnread($line["id"]);
162
+				if ($enable_nested) {
163
+									$unread += Feeds::getCategoryChildrenUnread($line["id"]);
164
+				}
161 165
 
162 166
 				if ($unread || !$unread_only) {
163 167
 					array_push($cats, array("id" => $line["id"],
@@ -188,11 +192,15 @@  discard block
 block discarded – undo
188 192
 		$feed_id = clean($_REQUEST["feed_id"]);
189 193
 		if ($feed_id !== "") {
190 194
 
191
-			if (is_numeric($feed_id)) $feed_id = (int) $feed_id;
195
+			if (is_numeric($feed_id)) {
196
+			    $feed_id = (int) $feed_id;
197
+			}
192 198
 
193 199
 			$limit = (int)clean($_REQUEST["limit"]);
194 200
 
195
-			if (!$limit || $limit >= 200) $limit = 200;
201
+			if (!$limit || $limit >= 200) {
202
+			    $limit = 200;
203
+			}
196 204
 
197 205
 			$offset = (int)clean($_REQUEST["skip"]);
198 206
 			$filter = clean($_REQUEST["filter"]);
@@ -287,7 +295,9 @@  discard block
 block discarded – undo
287 295
 				break;
288 296
 		}
289 297
 
290
-		if ($field == "note") $set_to = $this->pdo->quote($data);
298
+		if ($field == "note") {
299
+		    $set_to = $this->pdo->quote($data);
300
+		}
291 301
 
292 302
 		if ($field && $set_to && count($article_ids) > 0) {
293 303
 
@@ -443,10 +453,11 @@  discard block
 block discarded – undo
443 453
 			WHERE owner_uid = ? ORDER BY caption");
444 454
 		$sth->execute([$_SESSION['uid']]);
445 455
 
446
-		if ($article_id)
447
-			$article_labels = Article::get_article_labels($article_id);
448
-		else
449
-			$article_labels = array();
456
+		if ($article_id) {
457
+					$article_labels = Article::get_article_labels($article_id);
458
+		} else {
459
+					$article_labels = array();
460
+		}
450 461
 
451 462
 		while ($line = $sth->fetch()) {
452 463
 
@@ -483,10 +494,11 @@  discard block
 block discarded – undo
483 494
 
484 495
 			foreach ($article_ids as $id) {
485 496
 
486
-				if ($assign)
487
-					Labels::add_article($id, $label, $_SESSION["uid"]);
488
-				else
489
-					Labels::remove_article($id, $label, $_SESSION["uid"]);
497
+				if ($assign) {
498
+									Labels::add_article($id, $label, $_SESSION["uid"]);
499
+				} else {
500
+									Labels::remove_article($id, $label, $_SESSION["uid"]);
501
+				}
490 502
 
491 503
 				++$num_updated;
492 504
 
@@ -738,14 +750,17 @@  discard block
 block discarded – undo
738 750
 						$label_cache = json_decode($label_cache, true);
739 751
 
740 752
 						if ($label_cache) {
741
-							if ($label_cache["no-labels"] == 1)
742
-								$labels = array();
743
-							else
744
-								$labels = $label_cache;
753
+							if ($label_cache["no-labels"] == 1) {
754
+															$labels = array();
755
+							} else {
756
+															$labels = $label_cache;
757
+							}
745 758
 						}
746 759
 					}
747 760
 
748
-					if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]);
761
+					if (!is_array($labels)) {
762
+					    $labels = Article::get_article_labels($line["id"]);
763
+					}
749 764
 
750 765
 					$headline_row = array(
751 766
 						"id" => (int)$line["id"],
@@ -763,11 +778,13 @@  discard block
 block discarded – undo
763 778
 
764 779
 					$enclosures = Article::get_article_enclosures($line['id']);
765 780
 
766
-					if ($include_attachments)
767
-						$headline_row['attachments'] = $enclosures;
781
+					if ($include_attachments) {
782
+											$headline_row['attachments'] = $enclosures;
783
+					}
768 784
 
769
-					if ($show_excerpt)
770
-						$headline_row["excerpt"] = $line["content_preview"];
785
+					if ($show_excerpt) {
786
+											$headline_row["excerpt"] = $line["content_preview"];
787
+					}
771 788
 
772 789
 					if ($show_content) {
773 790
 
@@ -782,7 +799,9 @@  discard block
 block discarded – undo
782 799
 					}
783 800
 
784 801
 					// unify label output to ease parsing
785
-					if ($labels["no-labels"] == 1) $labels = array();
802
+					if ($labels["no-labels"] == 1) {
803
+					    $labels = array();
804
+					}
786 805
 
787 806
 					$headline_row["labels"] = $labels;
788 807
 
Please login to merge, or discard this patch.
classes/handler/public.php 1 patch
Braces   +24 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 			"padding : 5px; border-style : dashed; border-color : #e7d796;".
13 13
 			"margin-bottom : 1em; color : #9a8c59;";
14 14
 
15
-		if (!$limit) $limit = 60;
15
+		if (!$limit) {
16
+		    $limit = 60;
17
+		}
16 18
 
17 19
 		$date_sort_field = "date_entered DESC, updated DESC";
18 20
 
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
 			"/public.php?op=rss&id=$feed&key=" .
78 80
 			Feeds::get_feed_access_key($feed, false, $owner_uid);
79 81
 
80
-		if (!$feed_site_url) $feed_site_url = get_self_url_prefix();
82
+		if (!$feed_site_url) {
83
+		    $feed_site_url = get_self_url_prefix();
84
+		}
81 85
 
82 86
 		if ($format == 'atom') {
83 87
 			$tpl = new MiniTemplator;
@@ -207,8 +211,12 @@  discard block
 block discarded – undo
207 211
 				$article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]);
208 212
 				$article['updated'] = date('c', strtotime($line["updated"]));
209 213
 
210
-				if ($line['note']) $article['note'] = $line['note'];
211
-				if ($article['author']) $article['author'] = $line['author'];
214
+				if ($line['note']) {
215
+				    $article['note'] = $line['note'];
216
+				}
217
+				if ($article['author']) {
218
+				    $article['author'] = $line['author'];
219
+				}
212 220
 
213 221
 				$tags = Article::get_article_tags($line["id"], $owner_uid);
214 222
 
@@ -459,7 +467,9 @@  discard block
 block discarded – undo
459 467
 		$format = clean($_REQUEST['format']);
460 468
 		$orig_guid = clean($_REQUEST["orig_guid"]);
461 469
 
462
-		if (!$format) $format = 'atom';
470
+		if (!$format) {
471
+		    $format = 'atom';
472
+		}
463 473
 
464 474
 		if (SINGLE_USER_MODE) {
465 475
 			authenticate_user("admin", null);
@@ -472,8 +482,9 @@  discard block
 block discarded – undo
472 482
 				ttrss_access_keys WHERE access_key = ? AND feed_id = ?");
473 483
 			$sth->execute([$key, $feed]);
474 484
 
475
-			if ($row = $sth->fetch())
476
-				$owner_id = $row["owner_uid"];
485
+			if ($row = $sth->fetch()) {
486
+							$owner_id = $row["owner_uid"];
487
+			}
477 488
 		}
478 489
 
479 490
 		if ($owner_id) {
@@ -683,8 +694,9 @@  discard block
 block discarded – undo
683 694
 				// start an empty session to deliver login error message
684 695
 				@session_start();
685 696
 
686
-				if (!isset($_SESSION["login_error_msg"]))
687
-					$_SESSION["login_error_msg"] = __("Incorrect username or password");
697
+				if (!isset($_SESSION["login_error_msg"])) {
698
+									$_SESSION["login_error_msg"] = __("Incorrect username or password");
699
+				}
688 700
 
689 701
 				user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
690 702
 			}
@@ -1007,7 +1019,9 @@  discard block
 block discarded – undo
1007 1019
 							"subject" => __("[tt-rss] Password reset request"),
1008 1020
 							"message" => $message]);
1009 1021
 
1010
-						if (!$rc) print_error($mailer->error());
1022
+						if (!$rc) {
1023
+						    print_error($mailer->error());
1024
+						}
1011 1025
 
1012 1026
 						$resetpass_token_full = time() . ":" . $resetpass_token;
1013 1027
 
Please login to merge, or discard this patch.
classes/ccache.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@  discard block
 block discarded – undo
66 66
 
67 67
 		// "" (null) is valid and should be cast to 0 (uncategorized)
68 68
 		// everything else i.e. tags are not
69
-		if (!is_numeric($feed_id) && $feed_id)
70
-			return;
69
+		if (!is_numeric($feed_id) && $feed_id) {
70
+					return;
71
+		}
71 72
 
72 73
 		$feed_id = (int) $feed_id;
73 74
 
@@ -102,8 +103,9 @@  discard block
 block discarded – undo
102 103
 
103 104
 		// "" (null) is valid and should be cast to 0 (uncategorized)
104 105
 		// everything else i.e. tags are not
105
-		if (!is_numeric($feed_id) && $feed_id)
106
-			return;
106
+		if (!is_numeric($feed_id) && $feed_id) {
107
+					return;
108
+		}
107 109
 
108 110
 		$feed_id = (int) $feed_id;
109 111
 
@@ -182,7 +184,9 @@  discard block
 block discarded – undo
182 184
 			$sth->execute([$feed_id, $unread, $owner_uid]);
183 185
 		}
184 186
 
185
-		if (!$tr_in_progress) $pdo->commit();
187
+		if (!$tr_in_progress) {
188
+		    $pdo->commit();
189
+		}
186 190
 
187 191
 		if ($feed_id > 0 && $prev_unread != $unread) {
188 192
 
Please login to merge, or discard this patch.