Completed
Branch master (7d3f82)
by Thomas
09:15
created
htdocs/okapi/lib/ocpl_access_logs.php 1 patch
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
             if ($break_next && isset($frame['class']))
29 29
             {
30 30
                 $class_elems = explode('\\', $frame['class']);
31
-                if (count($class_elems) >= 2)
32
-                    $org_caller = $class_elems[count($class_elems)-2];
31
+                if (count($class_elems) >= 2) {
32
+                                    $org_caller = $class_elems[count($class_elems)-2];
33
+                }
33 34
                 break;
34 35
             }
35 36
             if (isset($frame['file']) &&
@@ -50,8 +51,9 @@  discard block
 block discarded – undo
50 51
      */
51 52
     public static function log_geocache_access(OkapiRequest $request, $cache_ids)
52 53
     {
53
-        if (Settings::get('OCPL_ENABLE_GEOCACHE_ACCESS_LOGS') !== true)
54
-            return ;
54
+        if (Settings::get('OCPL_ENABLE_GEOCACHE_ACCESS_LOGS') !== true) {
55
+                    return ;
56
+        }
55 57
 
56 58
         if (Settings::get('OC_BRANCH') == 'oc.pl')
57 59
         {
@@ -67,14 +69,16 @@  discard block
 block discarded – undo
67 69
             $original_caller_escaped = "'" . Db::escape_string(self::get_original_caller()) . "'";
68 70
 
69 71
             $user_id = null;
70
-            if ($request->token != null)
71
-                $user_id = $request->token->user_id;
72
+            if ($request->token != null) {
73
+                            $user_id = $request->token->user_id;
74
+            }
72 75
             $user_id_escaped = $user_id === null ? "null" : "'" . Db::escape_string($user_id) . "'";
73 76
             if (is_array($cache_ids)){
74
-                if (count($cache_ids) == 1)
75
-                    $cache_ids_where = "= '" . Db::escape_string($cache_ids[0]) . "'";
76
-                else
77
-                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids)) . "')";
77
+                if (count($cache_ids) == 1) {
78
+                                    $cache_ids_where = "= '" . Db::escape_string($cache_ids[0]) . "'";
79
+                } else {
80
+                                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids)) . "')";
81
+                }
78 82
             } else {
79 83
                 $cache_ids_where = "= '" . Db::escape_string($cache_ids) . "'";
80 84
             }
@@ -106,12 +110,15 @@  discard block
 block discarded – undo
106 110
 
107 111
             if (is_array($cache_ids)){
108 112
                 $tmp = array();
109
-                foreach ($cache_ids as $cache_id)
110
-                    $tmp[$cache_id] = true;
111
-                foreach ($already_logged_cache_ids as $cache_id)
112
-                    unset($tmp[$cache_id]);
113
-                if (count($tmp) <= 0)
114
-                    return ;
113
+                foreach ($cache_ids as $cache_id) {
114
+                                    $tmp[$cache_id] = true;
115
+                }
116
+                foreach ($already_logged_cache_ids as $cache_id) {
117
+                                    unset($tmp[$cache_id]);
118
+                }
119
+                if (count($tmp) <= 0) {
120
+                                    return ;
121
+                }
115 122
                 $cache_ids_filterd = array_keys($tmp);
116 123
                 unset($tmp);
117 124
             } else {
@@ -119,10 +126,11 @@  discard block
 block discarded – undo
119 126
             }
120 127
 
121 128
             if (is_array($cache_ids_filterd)){
122
-                if (count($cache_ids_filterd) == 1)
123
-                    $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd[0]) . "'";
124
-                else
125
-                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids_filterd)) . "')";
129
+                if (count($cache_ids_filterd) == 1) {
130
+                                    $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd[0]) . "'";
131
+                } else {
132
+                                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids_filterd)) . "')";
133
+                }
126 134
             } else {
127 135
                 $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd) . "'";
128 136
             }
Please login to merge, or discard this patch.
htdocs/okapi/lib/tbszip.php 1 patch
Braces   +111 added lines, -34 removed lines patch added patch discarded remove patch
@@ -26,7 +26,10 @@  discard block
 block discarded – undo
26 26
 
27 27
     function CreateNew($ArchName='new.zip') {
28 28
     // Create a new virtual empty archive, the name will be the default name when the archive is flushed.
29
-        if (!isset($this->Meth8Ok)) $this->__construct();  // for PHP 4 compatibility
29
+        if (!isset($this->Meth8Ok)) {
30
+            $this->__construct();
31
+        }
32
+        // for PHP 4 compatibility
30 33
         $this->Close(); // note that $this->ArchHnd is set to false here
31 34
         $this->Error = false;
32 35
         $this->ArchFile = $ArchName;
@@ -39,7 +42,10 @@  discard block
 block discarded – undo
39 42
 
40 43
     function Open($ArchFile, $UseIncludePath=false) {
41 44
     // Open the zip archive
42
-        if (!isset($this->Meth8Ok)) $this->__construct();  // for PHP 4 compatibility
45
+        if (!isset($this->Meth8Ok)) {
46
+            $this->__construct();
47
+        }
48
+        // for PHP 4 compatibility
43 49
         $this->Close(); // close handle and init info
44 50
         $this->Error = false;
45 51
         $this->ArchIsNew = false;
@@ -53,12 +59,16 @@  discard block
 block discarded – undo
53 59
             $this->ArchHnd = fopen($ArchFile, 'rb', $UseIncludePath);
54 60
         }
55 61
         $ok = !($this->ArchHnd===false);
56
-        if ($ok) $ok = $this->CentralDirRead();
62
+        if ($ok) {
63
+            $ok = $this->CentralDirRead();
64
+        }
57 65
         return $ok;
58 66
     }
59 67
 
60 68
     function Close() {
61
-        if (isset($this->ArchHnd) and ($this->ArchHnd!==false)) fclose($this->ArchHnd);
69
+        if (isset($this->ArchHnd) and ($this->ArchHnd!==false)) {
70
+            fclose($this->ArchHnd);
71
+        }
62 72
         $this->ArchFile = '';
63 73
         $this->ArchHnd = false;
64 74
         $this->CdInfo = array();
@@ -79,12 +89,17 @@  discard block
 block discarded – undo
79 89
 
80 90
     function FileAdd($Name, $Data, $DataType=self::TBSZIP_STRING, $Compress=true) {
81 91
 
82
-        if ($Data===false) return $this->FileCancelModif($Name, false); // Cancel a previously added file
92
+        if ($Data===false) {
93
+            return $this->FileCancelModif($Name, false);
94
+        }
95
+        // Cancel a previously added file
83 96
 
84 97
         // Save information for adding a new file into the archive
85 98
         $Diff = 30 + 46 + 2*strlen($Name); // size of the header + cd info
86 99
         $Ref = $this->_DataCreateNewRef($Data, $DataType, $Compress, $Diff, $Name);
87
-        if ($Ref===false) return false;
100
+        if ($Ref===false) {
101
+            return false;
102
+        }
88 103
         $Ref['name'] = $Name;
89 104
         $this->AddInfo[] = $Ref;
90 105
         return $Ref['res'];
@@ -113,8 +128,12 @@  discard block
 block discarded – undo
113 128
         $this->CdFileNbr = $this->CdInfo['file_nbr_curr'];
114 129
         $this->CdPos = $this->CdInfo['p_cd'];
115 130
 
116
-        if ($this->CdFileNbr<=0) return $this->RaiseError('No header found in the Central Directory.');
117
-        if ($this->CdPos<=0) return $this->RaiseError('No position found for the Central Directory.');
131
+        if ($this->CdFileNbr<=0) {
132
+            return $this->RaiseError('No header found in the Central Directory.');
133
+        }
134
+        if ($this->CdPos<=0) {
135
+            return $this->RaiseError('No position found for the Central Directory.');
136
+        }
118 137
 
119 138
         $this->_MoveTo($this->CdPos);
120 139
         for ($i=0;$i<$this->CdFileNbr;$i++) {
@@ -147,7 +166,9 @@  discard block
 block discarded – undo
147 166
         $b = $this->_ReadData(46);
148 167
 
149 168
         $x = $this->_GetHex($b,0,4);
150
-        if ($x!=='h:02014b50') return $this->RaiseError("Signature of Central Directory Header #".$idx." (file information) expected but not found at position ".$this->_TxtPos(ftell($this->ArchHnd) - 46).".");
169
+        if ($x!=='h:02014b50') {
170
+            return $this->RaiseError("Signature of Central Directory Header #".$idx." (file information) expected but not found at position ".$this->_TxtPos(ftell($this->ArchHnd) - 46).".");
171
+        }
151 172
 
152 173
         $x = array();
153 174
         $x['vers_used'] = $this->_GetDec($b,4,2);
@@ -264,10 +285,14 @@  discard block
 block discarded – undo
264 285
 
265 286
     function FileGetIdxAdd($Name) {
266 287
     // Check if a file name exists in the list of file to add, and return its index
267
-        if (!is_string($Name)) return false;
288
+        if (!is_string($Name)) {
289
+            return false;
290
+        }
268 291
         $idx_lst = array_keys($this->AddInfo);
269 292
         foreach ($idx_lst as $idx) {
270
-            if ($this->AddInfo[$idx]['name']===$Name) return $idx;
293
+            if ($this->AddInfo[$idx]['name']===$Name) {
294
+                return $idx;
295
+            }
271 296
         }
272 297
         return false;
273 298
     }
@@ -278,7 +303,9 @@  discard block
 block discarded – undo
278 303
         $this->LastReadIdx = false;
279 304
 
280 305
         $idx = $this->FileGetIdx($NameOrIdx);
281
-        if ($idx===false) return $this->RaiseError('File "'.$NameOrIdx.'" is not found in the Central Directory.');
306
+        if ($idx===false) {
307
+            return $this->RaiseError('File "'.$NameOrIdx.'" is not found in the Central Directory.');
308
+        }
282 309
 
283 310
         $pos = $this->CdFileLst[$idx]['p_loc'];
284 311
         $this->_MoveTo($pos);
@@ -302,7 +329,9 @@  discard block
 block discarded – undo
302 329
         } elseif($meth==0) {
303 330
             $Comp = 0; // means stored without compression
304 331
         } else {
305
-            if ($Uncompress) $this->RaiseError('Unable to uncompress file "'.$NameOrIdx.'" because it is compressed with method '.$meth.'.');
332
+            if ($Uncompress) {
333
+                $this->RaiseError('Unable to uncompress file "'.$NameOrIdx.'" because it is compressed with method '.$meth.'.');
334
+            }
306 335
         }
307 336
         $this->LastReadComp = $Comp;
308 337
 
@@ -316,7 +345,9 @@  discard block
 block discarded – undo
316 345
         $b = $this->_ReadData(30);
317 346
 
318 347
         $x = $this->_GetHex($b,0,4);
319
-        if ($x!=='h:04034b50') return $this->RaiseError("Signature of Local File Header #".$idx." (data section) expected but not found at position ".$this->_TxtPos(ftell($this->ArchHnd)-30).".");
348
+        if ($x!=='h:04034b50') {
349
+            return $this->RaiseError("Signature of Local File Header #".$idx." (data section) expected but not found at position ".$this->_TxtPos(ftell($this->ArchHnd)-30).".");
350
+        }
320 351
 
321 352
         $x = array();
322 353
         $x['vers'] = $this->_GetDec($b,4,2);
@@ -348,7 +379,9 @@  discard block
 block discarded – undo
348 379
             }
349 380
         } else {
350 381
             $len = $x['l_data_c'];
351
-            if ($len==0) $this->RaiseError("File Data #".$idx." cannt be read because no length is specified in the Local File Header and its Central Directory information has not been found.");
382
+            if ($len==0) {
383
+                $this->RaiseError("File Data #".$idx." cannt be read because no length is specified in the Local File Header and its Central Directory information has not been found.");
384
+            }
352 385
         }
353 386
 
354 387
         if ($ReadData) {
@@ -393,7 +426,9 @@  discard block
 block discarded – undo
393 426
     // Store replacement information.
394 427
 
395 428
         $idx = $this->FileGetIdx($NameOrIdx);
396
-        if ($idx===false) return $this->RaiseError('File "'.$NameOrIdx.'" is not found in the Central Directory.');
429
+        if ($idx===false) {
430
+            return $this->RaiseError('File "'.$NameOrIdx.'" is not found in the Central Directory.');
431
+        }
397 432
 
398 433
         $pos = $this->CdFileLst[$idx]['p_loc'];
399 434
 
@@ -405,7 +440,9 @@  discard block
 block discarded – undo
405 440
             // file to replace
406 441
             $Diff = - $this->CdFileLst[$idx]['l_data_c'];
407 442
             $Ref = $this->_DataCreateNewRef($Data, $DataType, $Compress, $Diff, $NameOrIdx);
408
-            if ($Ref===false) return false;
443
+            if ($Ref===false) {
444
+                return false;
445
+            }
409 446
             $this->ReplInfo[$idx] = $Ref;
410 447
             $Result = $Ref['res'];
411 448
         }
@@ -489,7 +526,9 @@  discard block
 block discarded – undo
489 526
         $date  = $this->_MsDos_Date($now);
490 527
         $time  = $this->_MsDos_Time($now);
491 528
 
492
-        if (!$this->OutputOpen($Render, $File, $ContentType)) return false;
529
+        if (!$this->OutputOpen($Render, $File, $ContentType)) {
530
+            return false;
531
+        }
493 532
 
494 533
         // output modified zipped files and unmodified zipped files that are beetween them
495 534
         ksort($this->ReplByPos);
@@ -497,7 +536,9 @@  discard block
 block discarded – undo
497 536
             // output data from the zip archive which is before the data to replace
498 537
             $this->OutputFromArch($ArchPos, $ReplPos);
499 538
             // get current file information
500
-            if (!isset($this->VisFileLst[$ReplIdx])) $this->_ReadFile($ReplIdx, false);
539
+            if (!isset($this->VisFileLst[$ReplIdx])) {
540
+                $this->_ReadFile($ReplIdx, false);
541
+            }
501 542
             $FileInfo =& $this->VisFileLst[$ReplIdx];
502 543
             $b1 = $FileInfo['bin'];
503 544
             if (isset($FileInfo['desc_bin'])) {
@@ -520,7 +561,10 @@  discard block
 block discarded – undo
520 561
                 $this->_PutDec($b1, $ReplInfo['crc32'], 14, 4); // crc32
521 562
                 $this->_PutDec($b1, $ReplInfo['len_c'], 18, 4); // l_data_c
522 563
                 $this->_PutDec($b1, $ReplInfo['len_u'], 22, 4); // l_data_u
523
-                if ($ReplInfo['meth']!==false) $this->_PutDec($b1, $ReplInfo['meth'], 8, 2); // meth
564
+                if ($ReplInfo['meth']!==false) {
565
+                    $this->_PutDec($b1, $ReplInfo['meth'], 8, 2);
566
+                }
567
+                // meth
524 568
                 // prepare the bottom description if the zipped file, if any
525 569
                 if ($b2!=='') {
526 570
                     $d = (strlen($b2)==16) ? 4 : 0; // offset because of the signature if any
@@ -544,7 +588,10 @@  discard block
 block discarded – undo
544 588
         }
545 589
 
546 590
         // Ouput all the zipped files that remain before the Central Directory listing
547
-        if ($this->ArchHnd!==false) $this->OutputFromArch($ArchPos, $this->CdPos); // ArchHnd is false if CreateNew() has been called
591
+        if ($this->ArchHnd!==false) {
592
+            $this->OutputFromArch($ArchPos, $this->CdPos);
593
+        }
594
+        // ArchHnd is false if CreateNew() has been called
548 595
         $ArchPos = $this->CdPos;
549 596
 
550 597
         // Output file to add
@@ -567,7 +614,10 @@  discard block
 block discarded – undo
567 614
             $b1 = $this->CdFileLst[$i]['bin'];
568 615
             $old_cd_len += strlen($b1);
569 616
             if (!isset($DelLst[$i])) {
570
-                if (isset($FicNewPos[$i])) $this->_PutDec($b1, $FicNewPos[$i], 42, 4);   // p_loc
617
+                if (isset($FicNewPos[$i])) {
618
+                    $this->_PutDec($b1, $FicNewPos[$i], 42, 4);
619
+                }
620
+                // p_loc
571 621
                 if (isset($this->ReplInfo[$i])) {
572 622
                     $ReplInfo =& $this->ReplInfo[$i];
573 623
                     $this->_PutDec($b1, $time, 12, 2); // time
@@ -575,7 +625,10 @@  discard block
 block discarded – undo
575 625
                     $this->_PutDec($b1, $ReplInfo['crc32'], 16, 4); // crc32
576 626
                     $this->_PutDec($b1, $ReplInfo['len_c'], 20, 4); // l_data_c
577 627
                     $this->_PutDec($b1, $ReplInfo['len_u'], 24, 4); // l_data_u
578
-                    if ($ReplInfo['meth']!==false) $this->_PutDec($b1, $ReplInfo['meth'], 10, 2); // meth
628
+                    if ($ReplInfo['meth']!==false) {
629
+                        $this->_PutDec($b1, $ReplInfo['meth'], 10, 2);
630
+                    }
631
+                    // meth
579 632
                 }
580 633
                 $b2 .= $b1;
581 634
             }
@@ -585,7 +638,10 @@  discard block
 block discarded – undo
585 638
         $DeltaCdLen =  $DeltaCdLen + strlen($b2) - $old_cd_len;
586 639
 
587 640
         // Output until "end of central directory record"
588
-        if ($this->ArchHnd!==false) $this->OutputFromArch($ArchPos, $this->CdEndPos); // ArchHnd is false if CreateNew() has been called
641
+        if ($this->ArchHnd!==false) {
642
+            $this->OutputFromArch($ArchPos, $this->CdEndPos);
643
+        }
644
+        // ArchHnd is false if CreateNew() has been called
589 645
 
590 646
         // Output file information of the Central Directory for added files
591 647
         if ($AddNbr>0) {
@@ -629,7 +685,9 @@  discard block
 block discarded – undo
629 685
 
630 686
         if (($Render & self::TBSZIP_FILE)==self::TBSZIP_FILE) {
631 687
             $this->OutputMode = self::TBSZIP_FILE;
632
-            if (''.$File=='') $File = basename($this->ArchFile).'.zip';
688
+            if (''.$File=='') {
689
+                $File = basename($this->ArchFile).'.zip';
690
+            }
633 691
             $this->OutputHandle = @fopen($File, 'w');
634 692
             if ($this->OutputHandle===false) {
635 693
                 return $this->RaiseError('Method Flush() cannot overwrite the target file \''.$File.'\'. This may not be a valid file path or the file may be locked by another process or because of a denied permission.');
@@ -640,11 +698,15 @@  discard block
 block discarded – undo
640 698
         } elseif (($Render & self::TBSZIP_DOWNLOAD)==self::TBSZIP_DOWNLOAD) {
641 699
             $this->OutputMode = self::TBSZIP_DOWNLOAD;
642 700
             // Output the file
643
-            if (''.$File=='') $File = basename($this->ArchFile);
701
+            if (''.$File=='') {
702
+                $File = basename($this->ArchFile);
703
+            }
644 704
             if (($Render & self::TBSZIP_NOHEADER)==self::TBSZIP_NOHEADER) {
645 705
             } else {
646 706
                 header ('Pragma: no-cache');
647
-                if ($ContentType!='') header ('Content-Type: '.$ContentType);
707
+                if ($ContentType!='') {
708
+                    header ('Content-Type: '.$ContentType);
709
+                }
648 710
                 header('Content-Disposition: attachment; filename="'.$File.'"');
649 711
                 header('Expires: 0');
650 712
                 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
@@ -652,7 +714,9 @@  discard block
 block discarded – undo
652 714
                 header('Content-Description: File Transfer');
653 715
                 header('Content-Transfer-Encoding: binary');
654 716
                 $Len = $this->_EstimateNewArchSize();
655
-                if ($Len!==false) header('Content-Length: '.$Len);
717
+                if ($Len!==false) {
718
+                    header('Content-Length: '.$Len);
719
+                }
656 720
             }
657 721
         } else {
658 722
             return $this->RaiseError('Method Flush is called with a unsupported render option.');
@@ -664,7 +728,9 @@  discard block
 block discarded – undo
664 728
 
665 729
     function OutputFromArch($pos, $pos_stop) {
666 730
         $len = $pos_stop - $pos;
667
-        if ($len<0) return;
731
+        if ($len<0) {
732
+            return;
733
+        }
668 734
         $this->_MoveTo($pos);
669 735
         $block = 1024;
670 736
         while ($len>0) {
@@ -719,7 +785,9 @@  discard block
 block discarded – undo
719 785
         $z = 0;
720 786
         for ($i=0;$i<$len;$i++) {
721 787
             $asc = ord($x[$i]);
722
-            if ($asc>0) $z = $z + $asc*pow(256,$i);
788
+            if ($asc>0) {
789
+                $z = $z + $asc*pow(256,$i);
790
+            }
723 791
         }
724 792
         return $z;
725 793
     }
@@ -929,7 +997,9 @@  discard block
 block discarded – undo
929 997
             $fi = stat($path);
930 998
             if ($fi !== false) {
931 999
                 $fz = $fi['size'];
932
-                if ($len_u===false) $len_u = $fz;
1000
+                if ($len_u===false) {
1001
+                    $len_u = $fz;
1002
+                }
933 1003
                 $len_c = ($Compress) ? false : $fz;
934 1004
                 $file_time = $fi['mtime'];
935 1005
             } else {
@@ -948,7 +1018,9 @@  discard block
 block discarded – undo
948 1018
         // TODO: support for data returned from okapi cache
949 1019
         if ($Ref['path']!==false) {
950 1020
             $Ref['data'] = file_get_contents($Ref['path']);
951
-            if ($Ref['crc32']===false) $Ref['crc32'] = crc32($Ref['data']);
1021
+            if ($Ref['crc32']===false) {
1022
+                $Ref['crc32'] = crc32($Ref['data']);
1023
+            }
952 1024
             if ($Ref['len_c']===false) {
953 1025
                 // means the data must be compressed
954 1026
                 $Ref['data'] = gzdeflate($Ref['data']);
@@ -977,13 +1049,18 @@  discard block
 block discarded – undo
977 1049
                 // file to delete
978 1050
                 $Info =& $this->CdFileLst[$i];
979 1051
                 if (!isset($this->VisFileLst[$i])) {
980
-                    if ($Optim) return false; // if $Optimization is set to true, then we d'ont rewind to read information
1052
+                    if ($Optim) {
1053
+                        return false;
1054
+                    }
1055
+                    // if $Optimization is set to true, then we d'ont rewind to read information
981 1056
                     $this->_MoveTo($Info['p_loc']);
982 1057
                     $this->_ReadFile($i, false);
983 1058
                 }
984 1059
                 $Vis =& $this->VisFileLst[$i];
985 1060
                 $Len += -strlen($Vis['bin']) -strlen($Info['bin']) - $Info['l_data_c'];
986
-                if (isset($Vis['desc_bin'])) $Len += -strlen($Vis['desc_bin']);
1061
+                if (isset($Vis['desc_bin'])) {
1062
+                    $Len += -strlen($Vis['desc_bin']);
1063
+                }
987 1064
             } elseif ($Ref['len_c']===false) {
988 1065
                 return false; // information not yet known
989 1066
             } else {
Please login to merge, or discard this patch.
htdocs/okapi/service_runner.php 1 patch
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -71,8 +71,9 @@  discard block
 block discarded – undo
71 71
     /** Get method options (is consumer required etc.). */
72 72
     public static function options($service_name)
73 73
     {
74
-        if (!self::exists($service_name))
75
-            throw new Exception();
74
+        if (!self::exists($service_name)) {
75
+                    throw new Exception();
76
+        }
76 77
         require_once($GLOBALS['rootpath']."okapi/$service_name.php");
77 78
         try
78 79
         {
@@ -92,8 +93,9 @@  discard block
 block discarded – undo
92 93
      */
93 94
     public static function docs($service_name)
94 95
     {
95
-        if (!self::exists($service_name))
96
-            throw new Exception();
96
+        if (!self::exists($service_name)) {
97
+                    throw new Exception();
98
+        }
97 99
         try {
98 100
             return file_get_contents("$service_name.xml", true);
99 101
         } catch (Exception $e) {
@@ -114,8 +116,9 @@  discard block
 block discarded – undo
114 116
     {
115 117
         Okapi::init_internals();
116 118
 
117
-        if (!self::exists($service_name))
118
-            throw new Exception("Method does not exist: '$service_name'");
119
+        if (!self::exists($service_name)) {
120
+                    throw new Exception("Method does not exist: '$service_name'");
121
+        }
119 122
 
120 123
         $options = self::options($service_name);
121 124
         if ($options['min_auth_level'] >= 2 && $request->consumer == null)
@@ -178,18 +181,21 @@  discard block
 block discarded – undo
178 181
         if ($request !== null) {
179 182
             $consumer_key = ($request->consumer != null) ? $request->consumer->key : 'anonymous';
180 183
             $user_id = (($request->token != null) && ($request->token instanceof OkapiAccessToken)) ? $request->token->user_id : -1;
181
-            if ($request->is_http_request() && ($service_name[0] == 's'))  # 's' for "services/", we don't want "extra/" included
184
+            if ($request->is_http_request() && ($service_name[0] == 's')) {
185
+                # 's' for "services/", we don't want "extra/" included
182 186
                 $calltype = 'http';
183
-            else
184
-                $calltype = 'internal';
187
+            } else {
188
+                            $calltype = 'internal';
189
+            }
185 190
         } else {
186 191
             $consumer_key = 'internal';
187 192
             $user_id = -1;
188 193
             $calltype = 'internal';
189 194
         }
190 195
 
191
-        if (Settings::get('OC_BRANCH') == 'oc.de' && $user_id != -1)
192
-            $user_id = 0;
196
+        if (Settings::get('OC_BRANCH') == 'oc.de' && $user_id != -1) {
197
+                    $user_id = 0;
198
+        }
193 199
 
194 200
         Db::execute("
195 201
             insert into okapi_stats_temp (`datetime`, consumer_key, user_id, service_name, calltype, runtime)
Please login to merge, or discard this patch.
htdocs/okapi/cronjobs.php 1 patch
Braces   +80 added lines, -55 removed lines patch added patch discarded remove patch
@@ -54,9 +54,10 @@  discard block
 block discarded – undo
54 54
                 new SearchSetsCleanerJob(),
55 55
                 new TableOptimizerJob(),
56 56
             );
57
-            foreach ($cache as $cronjob)
58
-                if (!in_array($cronjob->get_type(), array('pre-request', 'cron-5')))
57
+            foreach ($cache as $cronjob) {
58
+                            if (!in_array($cronjob->get_type(), array('pre-request', 'cron-5')))
59 59
                     throw new Exception("Cronjob '".$cronjob->get_name()."' has an invalid (unsupported) type.");
60
+            }
60 61
         }
61 62
         return $cache;
62 63
     }
@@ -74,8 +75,9 @@  discard block
 block discarded – undo
74 75
         $lock->acquire();
75 76
 
76 77
         $schedule = Cache::get("cron_schedule");
77
-        if ($schedule == null)
78
-            $schedule = array();
78
+        if ($schedule == null) {
79
+                    $schedule = array();
80
+        }
79 81
         foreach (self::get_enabled_cronjobs() as $cronjob)
80 82
         {
81 83
             $name = $cronjob->get_name();
@@ -84,14 +86,12 @@  discard block
 block discarded – undo
84 86
                 if ($cronjob->get_type() != $type)
85 87
                 {
86 88
                     $next_run = isset($schedule[$name]) ? $schedule[$name] : (time() - 1);
87
-                }
88
-                else
89
+                } else
89 90
                 {
90 91
                     try
91 92
                     {
92 93
                         $cronjob->execute();
93
-                    }
94
-                    catch (Exception $e)
94
+                    } catch (Exception $e)
95 95
                     {
96 96
                         Okapi::mail_admins("Cronjob error: ".$cronjob->get_name(),
97 97
                             OkapiExceptionHandler::get_exception_info($e));
@@ -116,9 +116,10 @@  discard block
 block discarded – undo
116 116
         # Return the nearest scheduled event time.
117 117
 
118 118
         $nearest = time() + 3600;
119
-        foreach ($fixed_schedule as $name => $time)
120
-            if ($time < $nearest)
119
+        foreach ($fixed_schedule as $name => $time) {
120
+                    if ($time < $nearest)
121 121
                 $nearest = $time;
122
+        }
122 123
         Cache::set("cron_schedule", $fixed_schedule, 30*86400);
123 124
         $lock->release();
124 125
         return $nearest;
@@ -150,11 +151,13 @@  discard block
 block discarded – undo
150 151
     public static function reset_job_schedule($job_name)
151 152
     {
152 153
         $thejob = null;
153
-        foreach (self::get_enabled_cronjobs() as $tmp)
154
-            if (($tmp->get_name() == $job_name) || ($tmp->get_name() == "okapi\\cronjobs\\".$job_name))
154
+        foreach (self::get_enabled_cronjobs() as $tmp) {
155
+                    if (($tmp->get_name() == $job_name) || ($tmp->get_name() == "okapi\\cronjobs\\".$job_name))
155 156
                 $thejob = $tmp;
156
-        if ($thejob == null)
157
-            throw new Exception("Could not reset schedule for job $job_name. $jon_name not found.");
157
+        }
158
+        if ($thejob == null) {
159
+                    throw new Exception("Could not reset schedule for job $job_name. $jon_name not found.");
160
+        }
158 161
 
159 162
         # We have to acquire lock on the schedule. This might take some time if cron-5 jobs are
160 163
         # currently being run.
@@ -166,8 +169,9 @@  discard block
 block discarded – undo
166 169
         $schedule = Cache::get("cron_schedule");
167 170
         if ($schedule != null)
168 171
         {
169
-            if (isset($schedule[$thejob->get_name()]))
170
-                unset($schedule[$thejob->get_name()]);
172
+            if (isset($schedule[$thejob->get_name()])) {
173
+                            unset($schedule[$thejob->get_name()]);
174
+            }
171 175
             Cache::set("cron_schedule", $schedule, 30*86400);
172 176
         }
173 177
 
@@ -260,8 +264,9 @@  discard block
 block discarded – undo
260 264
     public function get_period() { return 300; } # 5 minutes
261 265
     public function execute()
262 266
     {
263
-        if (Okapi::$data_store)
264
-            Okapi::$data_store->cleanup();
267
+        if (Okapi::$data_store) {
268
+                    Okapi::$data_store->cleanup();
269
+        }
265 270
     }
266 271
 }
267 272
 
@@ -361,8 +366,9 @@  discard block
 block discarded – undo
361 366
     public function get_period() { return 60; } # 1 minute
362 367
     public function execute()
363 368
     {
364
-        if (Okapi::get_var('db_version', 0) + 0 < 32)
365
-            return;
369
+        if (Okapi::get_var('db_version', 0) + 0 < 32) {
370
+                    return;
371
+        }
366 372
         Db::execute("lock tables okapi_stats_hourly write, okapi_stats_temp write;");
367 373
         try {
368 374
             $rs = Db::query("
@@ -419,8 +425,9 @@  discard block
 block discarded – undo
419 425
     public function get_period() { return 3600; }  # 1 hour
420 426
     public function execute()
421 427
     {
422
-        if (Okapi::get_var('db_version', 0) + 0 < 94)
423
-            return;
428
+        if (Okapi::get_var('db_version', 0) + 0 < 94) {
429
+                    return;
430
+        }
424 431
 
425 432
         # We will process a single month, every time we are being run.
426 433
 
@@ -506,8 +513,10 @@  discard block
 block discarded – undo
506 513
     public function execute()
507 514
     {
508 515
         $last_ping = Cache::get('crontab_last_ping');
509
-        if ($last_ping === null)
510
-            $last_ping = time() - 86400; # if not set, assume 1 day ago.
516
+        if ($last_ping === null) {
517
+                    $last_ping = time() - 86400;
518
+        }
519
+        # if not set, assume 1 day ago.
511 520
         if ($last_ping > time() - 3600)
512 521
         {
513 522
             # There was a ping during the last hour. Everything is okay.
@@ -520,14 +529,14 @@  discard block
 block discarded – undo
520 529
         # There was no ping. Decrement the counter. When reached zero, alert.
521 530
 
522 531
         $counter = Cache::get('crontab_check_counter');
523
-        if ($counter === null)
524
-            $counter = 5;
532
+        if ($counter === null) {
533
+                    $counter = 5;
534
+        }
525 535
         $counter--;
526 536
         if ($counter > 0)
527 537
         {
528 538
             Cache::set('crontab_check_counter', $counter, 86400);
529
-        }
530
-        elseif ($counter == 0)
539
+        } elseif ($counter == 0)
531 540
         {
532 541
             Okapi::mail_admins(
533 542
                 "Crontab not working.",
@@ -605,18 +614,24 @@  discard block
 block discarded – undo
605 614
             # No update necessary.
606 615
         } elseif ($tiletree_revision < $current_clog_revision) {
607 616
             require_once($GLOBALS['rootpath']."okapi/services/caches/map/replicate_listener.inc.php");
608
-            if ($current_clog_revision - $tiletree_revision < 30000)  # In the middle of 2012, OCPL generated 30000 entries per week
617
+            if ($current_clog_revision - $tiletree_revision < 30000) {
618
+                # In the middle of 2012, OCPL generated 30000 entries per week
609 619
             {
610
-                for ($timeout = time() + 240; time() < $timeout; )  # Try to stop after 4 minutes.
620
+                for ($timeout = time() + 240;
621
+            }
622
+            time() < $timeout; ) {
623
+                    # Try to stop after 4 minutes.
611 624
                 {
612 625
                     try {
613 626
                         $response = OkapiServiceRunner::call('services/replicate/changelog', new OkapiInternalRequest(
614 627
                             new OkapiInternalConsumer(), null, array('since' => $tiletree_revision)));
628
+                }
615 629
                         \okapi\services\caches\map\ReplicateListener::receive($response['changelog']);
616 630
                         $tiletree_revision = $response['revision'];
617 631
                         Okapi::set_var('clog_followup_revision', $tiletree_revision);
618
-                        if (!$response['more'])
619
-                            break;
632
+                        if (!$response['more']) {
633
+                                                    break;
634
+                        }
620 635
                     } catch (BadRequest $e) {
621 636
                         # Invalid 'since' parameter? May happen when crontab was
622 637
                         # not working for more than 10 days. Or, just after OKAPI
@@ -647,17 +662,19 @@  discard block
 block discarded – undo
647 662
         $max_revision = ReplicateCommon::get_revision();
648 663
         $cache_key = 'clog_revisions_daily';
649 664
         $data = Cache::get($cache_key);
650
-        if ($data == null)
651
-            $data = array();
665
+        if ($data == null) {
666
+                    $data = array();
667
+        }
652 668
         $data[time()] = $max_revision;
653 669
         $new_min_revision = 1;
654 670
         $new_data = array();
655 671
         foreach ($data as $time => $r)
656 672
         {
657
-            if ($time < time() - 10*86400)
658
-                $new_min_revision = max($new_min_revision, $r);
659
-            else
660
-                $new_data[$time] = $r;
673
+            if ($time < time() - 10*86400) {
674
+                            $new_min_revision = max($new_min_revision, $r);
675
+            } else {
676
+                            $new_data[$time] = $r;
677
+            }
661 678
         }
662 679
         Db::execute("
663 680
             delete from okapi_clog
@@ -721,12 +738,14 @@  discard block
 block discarded – undo
721 738
         foreach ($consumers as $row)
722 739
         {
723 740
             $name = $row['name'];
724
-            if ($row['consumer_key'] == 'anonymous')
725
-                $name = "Anonymous (Level 0 Authentication)";
726
-            elseif ($row['consumer_key'] == 'facade')
727
-                $name = "Internal usage via Facade";
728
-            if (mb_strlen($name) > 35)
729
-                $name = mb_substr($name, 0, 32)."...";
741
+            if ($row['consumer_key'] == 'anonymous') {
742
+                            $name = "Anonymous (Level 0 Authentication)";
743
+            } elseif ($row['consumer_key'] == 'facade') {
744
+                            $name = "Internal usage via Facade";
745
+            }
746
+            if (mb_strlen($name) > 35) {
747
+                            $name = mb_substr($name, 0, 32)."...";
748
+            }
730 749
             print self::mb_str_pad($name, 35, " ", STR_PAD_RIGHT);
731 750
             print str_pad($row['http_calls'], 8, " ", STR_PAD_LEFT);
732 751
             print str_pad(sprintf("%01.2f", $row['http_runtime']), 11, " ", STR_PAD_LEFT)."s\n";
@@ -749,8 +768,9 @@  discard block
 block discarded – undo
749 768
         foreach ($methods as $row)
750 769
         {
751 770
             $name = $row['service_name'];
752
-            if (mb_strlen($name) > 35)
753
-                $name = mb_substr($name, 0, 32)."...";
771
+            if (mb_strlen($name) > 35) {
772
+                            $name = mb_substr($name, 0, 32)."...";
773
+            }
754 774
             print self::mb_str_pad($name, 35, " ", STR_PAD_RIGHT);
755 775
             print str_pad($row['http_calls'], 8, " ", STR_PAD_LEFT);
756 776
             print str_pad(sprintf("%01.2f", $row['http_runtime']), 11, " ", STR_PAD_LEFT)."s";
@@ -777,8 +797,9 @@  discard block
 block discarded – undo
777 797
         foreach ($oauth_users as $row)
778 798
         {
779 799
             $name = $row['name'];
780
-            if (mb_strlen($name) > 35)
781
-                $name = mb_substr($name, 0, 32)."...";
800
+            if (mb_strlen($name) > 35) {
801
+                            $name = mb_substr($name, 0, 32)."...";
802
+            }
782 803
             print self::mb_str_pad($name, 35, " ", STR_PAD_RIGHT);
783 804
             print str_pad($row['users'], 8, " ", STR_PAD_LEFT)."\n";
784 805
         }
@@ -813,11 +834,14 @@  discard block
 block discarded – undo
813 834
         $required = Locales::get_required_locales();
814 835
         $installed = Locales::get_installed_locales();
815 836
         $missing = array();
816
-        foreach ($required as $locale)
817
-            if (!in_array($locale, $installed))
837
+        foreach ($required as $locale) {
838
+                    if (!in_array($locale, $installed))
818 839
                 $missing[] = $locale;
819
-        if (count($missing) == 0)
820
-            return; # okay!
840
+        }
841
+        if (count($missing) == 0) {
842
+                    return;
843
+        }
844
+        # okay!
821 845
         ob_start();
822 846
         print "Hi!\n\n";
823 847
         print "Your system is missing some locales required by OKAPI for proper\n";
@@ -835,14 +859,15 @@  discard block
 block discarded – undo
835 859
         if ((count($missing) == 1) && ($missing[0] == 'POSIX'))
836 860
         {
837 861
             # I don't remember how to install POSIX, probably everyone has it anyway.
838
-        }
839
-        else
862
+        } else
840 863
         {
841 864
             print "On Debian, try the following:\n\n";
842 865
             foreach ($prefixes as $lang)
843 866
             {
844
-                if ($lang != 'PO') # Two first letters cut from POSIX.
867
+                if ($lang != 'PO') {
868
+                    # Two first letters cut from POSIX.
845 869
                     print "sudo apt-get install language-pack-".$lang."-base\n";
870
+                }
846 871
             }
847 872
             print "sudo service apache2 restart\n";
848 873
             print "\n";
Please login to merge, or discard this patch.
htdocs/okapi/controller.php 1 patch
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,20 +37,23 @@  discard block
 block discarded – undo
37 37
     {
38 38
         # Chop off the ?args=... part.
39 39
 
40
-        if (strpos($uri, '?') !== false)
41
-            $uri = substr($uri, 0, strpos($uri, '?'));
40
+        if (strpos($uri, '?') !== false) {
41
+                    $uri = substr($uri, 0, strpos($uri, '?'));
42
+        }
42 43
 
43 44
         # Chop off everything before "/okapi/". This should work for okay for most "weird"
44 45
         # server configurations. It will also address a more subtle issue described here:
45 46
         # http://stackoverflow.com/questions/8040461/request-uri-unexpectedly-contains-fqdn
46 47
 
47
-        if (strpos($uri, "/okapi/") !== false)
48
-            $uri = substr($uri, strpos($uri, "/okapi/"));
48
+        if (strpos($uri, "/okapi/") !== false) {
49
+                    $uri = substr($uri, strpos($uri, "/okapi/"));
50
+        }
49 51
 
50 52
         # Make sure we're in the right directory (.htaccess should make sure of that).
51 53
 
52
-        if (strpos($uri, "/okapi/") !== 0)
53
-            throw new Exception("'$uri' is outside of the /okapi/ path.");
54
+        if (strpos($uri, "/okapi/") !== 0) {
55
+                    throw new Exception("'$uri' is outside of the /okapi/ path.");
56
+        }
54 57
         $uri = substr($uri, 7);
55 58
 
56 59
         # Initializing internals and running pre-request cronjobs (we don't want
@@ -75,13 +78,13 @@  discard block
 block discarded – undo
75 78
                     require_once($GLOBALS['rootpath']."okapi/views/$namespace.php");
76 79
                     $response = call_user_func_array(array('\\okapi\\views\\'.
77 80
                         str_replace('/', '\\', $namespace).'\\View', 'call'), $matches);
78
-                    if ($response)
79
-                        $response->display();
81
+                    if ($response) {
82
+                                            $response->display();
83
+                    }
80 84
                     return;
81 85
                 }
82 86
             }
83
-        }
84
-        catch (Http404 $e)
87
+        } catch (Http404 $e)
85 88
         {
86 89
             /* pass */
87 90
         }
Please login to merge, or discard this patch.
htdocs/okapi/views/update.php 1 patch
Braces   +27 added lines, -25 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
         try
29 29
         {
30 30
             return Okapi::get_var('db_version', 0) + 0;
31
-        }
32
-        catch (Exception $e)
31
+        } catch (Exception $e)
33 32
         {
34
-            if (strpos($e->getMessage(), "okapi_vars' doesn't exist") !== false)
35
-                return 0;
33
+            if (strpos($e->getMessage(), "okapi_vars' doesn't exist") !== false) {
34
+                            return 0;
35
+            }
36 36
             throw $e;
37 37
         }
38 38
     }
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
             if (strpos($name, "ver") === 0)
46 46
             {
47 47
                 $ver = substr($name, 3) + 0;
48
-                if ($ver > $max_db_version)
49
-                    $max_db_version = $ver;
48
+                if ($ver > $max_db_version) {
49
+                                    $max_db_version = $ver;
50
+                }
50 51
             }
51 52
         }
52 53
         return $max_db_version;
@@ -71,8 +72,7 @@  discard block
 block discarded – undo
71 72
         {
72 73
             self::_call();
73 74
             $lock->release();
74
-        }
75
-        catch (Exception $e)
75
+        } catch (Exception $e)
76 76
         {
77 77
             # Error occured. Make sure the lock is released and rethrow.
78 78
 
@@ -98,8 +98,7 @@  discard block
 block discarded – undo
98 98
             try
99 99
             {
100 100
                 Db::select_value("select 1 from caches limit 1");
101
-            }
102
-            catch (Exception $e)
101
+            } catch (Exception $e)
103 102
             {
104 103
                 self::out(
105 104
                     "\n\n".
@@ -110,14 +109,12 @@  discard block
 block discarded – undo
110 109
                 );
111 110
             }
112 111
             return;
113
-        }
114
-        elseif ($max_ver == $current_ver)
112
+        } elseif ($max_ver == $current_ver)
115 113
         {
116 114
             self::out("It is up-to-date.\n\n");
117
-        }
118
-        elseif ($max_ver < $current_ver)
119
-            throw new Exception();
120
-        else
115
+        } elseif ($max_ver < $current_ver) {
116
+                    throw new Exception();
117
+        } else
121 118
         {
122 119
             self::out("Updating to version $max_ver... PLEASE WAIT\n\n");
123 120
 
@@ -340,8 +337,7 @@  discard block
 block discarded – undo
340 337
         try
341 338
         {
342 339
             Db::execute("alter table cache_logs add key `uuid` (`uuid`)");
343
-        }
344
-        catch (Exception $e)
340
+        } catch (Exception $e)
345 341
         {
346 342
             // key exists
347 343
         }
@@ -609,13 +605,18 @@  discard block
 block discarded – undo
609 605
     {
610 606
         # Remove unused locks (these might have been created in previous versions of OKAPI).
611 607
 
612
-        for ($z=0; $z<=2; $z++)
613
-            for ($x=0; $x<(1<<$z); $x++)
614
-                for ($y=0; $y<(1<<$z); $y++)
608
+        for ($z=0; $z<=2; $z++) {
609
+                    for ($x=0;
610
+        }
611
+        $x<(1<<$z); $x++) {
612
+                            for ($y=0;
613
+            }
614
+            $y<(1<<$z); $y++)
615 615
                 {
616 616
                     $lockname = "tile-computation-$z-$x-$y";
617
-                    if (OkapiLock::exists($lockname))
618
-                        OkapiLock::get($lockname)->remove();
617
+                    if (OkapiLock::exists($lockname)) {
618
+                                            OkapiLock::get($lockname)->remove();
619
+                    }
619 620
                 }
620 621
     }
621 622
 
@@ -628,8 +629,9 @@  discard block
 block discarded – undo
628 629
             foreach (array("", "-0", "-1") as $suffix)
629 630
             {
630 631
                 $lockname = "tile-$z$suffix";
631
-                if (OkapiLock::exists($lockname))
632
-                    OkapiLock::get($lockname)->remove();
632
+                if (OkapiLock::exists($lockname)) {
633
+                                    OkapiLock::get($lockname)->remove();
634
+                }
633 635
             }
634 636
         }
635 637
     }
Please login to merge, or discard this patch.
htdocs/okapi/views/changelog_helper.inc.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
                 }
45 45
                 Cache::set($cache_key, $changes_xml, 3600);
46 46
                 Cache::set($cache_backup_key, $changes_xml, 3600*24*30);
47
-            }
48
-            catch (Exception $e)
47
+            } catch (Exception $e)
49 48
             {
50 49
                 # GitHub failed on us. User backup list, if available.
51 50
 
@@ -69,8 +68,7 @@  discard block
 block discarded – undo
69 68
             # We could not retreive the changelog from Github, and there was
70 69
             # no backup key or it expired. Probably we are on a developer
71 70
             # machine. The template will output some error message.
72
-        }
73
-        else
71
+        } else
74 72
         {
75 73
             $commits = array();
76 74
             $versions = array();
Please login to merge, or discard this patch.
htdocs/okapi/views/devel/cronreport.php 1 patch
Braces   +26 added lines, -20 removed lines patch added patch discarded remove patch
@@ -28,19 +28,22 @@  discard block
 block discarded – undo
28 28
 
29 29
         require_once($GLOBALS['rootpath']."okapi/cronjobs.php");
30 30
         $schedule = Cache::get("cron_schedule");
31
-        if ($schedule == null)
32
-            $schedule = array();
31
+        if ($schedule == null) {
32
+                    $schedule = array();
33
+        }
33 34
         print "Nearest event: ";
34
-        if (Okapi::get_var('cron_nearest_event'))
35
-            print "in ".(Okapi::get_var('cron_nearest_event') - time())." seconds.\n\n";
36
-        else
37
-            print "NOT SET\n\n";
35
+        if (Okapi::get_var('cron_nearest_event')) {
36
+                    print "in ".(Okapi::get_var('cron_nearest_event') - time())." seconds.\n\n";
37
+        } else {
38
+                    print "NOT SET\n\n";
39
+        }
38 40
         $cronjobs = CronJobController::get_enabled_cronjobs();
39 41
         usort($cronjobs, function($a, $b) {
40 42
             $cmp = function($a, $b) { return ($a < $b) ? -1 : (($a > $b) ? 1 : 0); };
41 43
             $by_type = $cmp($a->get_type(), $b->get_type());
42
-            if ($by_type != 0)
43
-                return $by_type;
44
+            if ($by_type != 0) {
45
+                            return $by_type;
46
+            }
44 47
             return $cmp($a->get_name(), $b->get_name());
45 48
         });
46 49
         print str_pad("TYPE", 11)."  ".str_pad("NAME", 40)."  SCHEDULE\n";
@@ -50,25 +53,28 @@  discard block
 block discarded – undo
50 53
             $type = $cronjob->get_type();
51 54
             $name = $cronjob->get_name();
52 55
             print str_pad($type, 11)."  ".str_pad($name, 40)."  ";
53
-            if (!isset($schedule[$name]))
54
-                print "NOT YET SCHEDULED\n";
55
-            elseif ($schedule[$name] <= time())
56
-                print "DELAYED: should be run ".(time() - $schedule[$name])." seconds ago\n";
57
-            else
58
-                print "scheduled to run in ".str_pad($schedule[$name] - time(), 6, " ", STR_PAD_LEFT)." seconds\n";
56
+            if (!isset($schedule[$name])) {
57
+                            print "NOT YET SCHEDULED\n";
58
+            } elseif ($schedule[$name] <= time()) {
59
+                            print "DELAYED: should be run ".(time() - $schedule[$name])." seconds ago\n";
60
+            } else {
61
+                            print "scheduled to run in ".str_pad($schedule[$name] - time(), 6, " ", STR_PAD_LEFT)." seconds\n";
62
+            }
59 63
         }
60 64
         print "\n";
61 65
         print "Crontab last ping: ";
62
-        if (Cache::get('crontab_last_ping'))
63
-            print (time() - Cache::get('crontab_last_ping'))." seconds ago";
64
-        else
65
-            print "NEVER";
66
+        if (Cache::get('crontab_last_ping')) {
67
+                    print (time() - Cache::get('crontab_last_ping'))." seconds ago";
68
+        } else {
69
+                    print "NEVER";
70
+        }
66 71
         print " (crontab_check_counter: ".Cache::get('crontab_check_counter').").\n";
67 72
         print "clog_revisions_daily: ";
68 73
         if (Cache::get('clog_revisions_daily'))
69 74
         {
70
-            foreach (Cache::get('clog_revisions_daily') as $time => $rev)
71
-                print "$rev ";
75
+            foreach (Cache::get('clog_revisions_daily') as $time => $rev) {
76
+                            print "$rev ";
77
+            }
72 78
             print "\n";
73 79
         } else {
74 80
             print "NULL\n";
Please login to merge, or discard this patch.
htdocs/okapi/views/devel/tilereport.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@
 block discarded – undo
63 63
             {
64 64
                 $total_calls = $c;
65 65
                 $total_runtime = $r;
66
-            }
67
-            elseif (strpos($name, 'extra/caches/map/tile/checkpoint') === 0)
66
+            } elseif (strpos($name, 'extra/caches/map/tile/checkpoint') === 0)
68 67
             {
69 68
                 $calls[$name[32]] = $c;
70 69
                 $runtime[$name[32]] = $r;
Please login to merge, or discard this patch.