Completed
Push — master ( e3165f...5e3d65 )
by Markus
03:05 queued 26s
created
htdocs/cimage/img.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 /**
12 12
  * Custom exception handler.
13 13
  */
14
-set_exception_handler(function ($exception) {
14
+set_exception_handler(function($exception) {
15 15
     errorPage(
16 16
         "<p><b>img.php: Uncaught exception:</b> <p>"
17 17
         . $exception->getMessage()
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  * Get configuration options from file, if the file exists, else use $config
29 29
  * if its defined or create an empty $config.
30 30
  */
31
-$configFile = __DIR__.'/'.basename(__FILE__, '.php').'_config.php';
31
+$configFile = __DIR__ . '/' . basename(__FILE__, '.php') . '_config.php';
32 32
 
33 33
 if (is_file($configFile)) {
34 34
     $config = require $configFile;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * Setup the autoloader, but not when using a bundle.
48 48
  */
49 49
 if (!defined("CIMAGE_BUNDLE")) {
50
-    if (!isset($config["autoloader"])) {
50
+    if (!isset($config[ "autoloader" ])) {
51 51
         die("CImage: Missing autoloader.");
52 52
     }
53 53
 
54
-    require $config["autoloader"];
54
+    require $config[ "autoloader" ];
55 55
 }
56 56
 
57 57
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 $allowHotlinking = getConfig('allow_hotlinking', true);
185 185
 $hotlinkingWhitelist = getConfig('hotlinking_whitelist', array());
186 186
 
187
-$serverName  = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
188
-$referer     = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
187
+$serverName  = isset($_SERVER[ 'SERVER_NAME' ]) ? $_SERVER[ 'SERVER_NAME' ] : null;
188
+$referer     = isset($_SERVER[ 'HTTP_REFERER' ]) ? $_SERVER[ 'HTTP_REFERER' ] : null;
189 189
 $refererHost = parse_url($referer, PHP_URL_HOST);
190 190
 
191 191
 if (!$allowHotlinking) {
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 verbose("shortcut = $shortcut");
308 308
 
309 309
 if (isset($shortcut)
310
-    && isset($shortcutConfig[$shortcut])) {
310
+    && isset($shortcutConfig[ $shortcut ])) {
311 311
 
312
-    parse_str($shortcutConfig[$shortcut], $get);
313
-    verbose("shortcut-constant = {$shortcutConfig[$shortcut]}");
312
+    parse_str($shortcutConfig[ $shortcut ], $get);
313
+    verbose("shortcut-constant = {$shortcutConfig[ $shortcut ]}");
314 314
     $_GET = array_merge($_GET, $get);
315 315
 }
316 316
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
  * Manage size constants from config file, use constants to replace values
405 405
  * for width and height.
406 406
  */
407
-$sizeConstant = getConfig('size_constant', function () {
407
+$sizeConstant = getConfig('size_constant', function() {
408 408
 
409 409
     // Set sizes to map constant to value, easier to use with width or height
410 410
     $sizes = array(
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     $gridColumns     = 24;
419 419
 
420 420
     for ($i = 1; $i <= $gridColumns; $i++) {
421
-        $sizes['c' . $i] = ($gridColumnWidth + $gridGutterWidth) * $i - $gridGutterWidth;
421
+        $sizes[ 'c' . $i ] = ($gridColumnWidth + $gridGutterWidth) * $i - $gridGutterWidth;
422 422
     }
423 423
 
424 424
     return $sizes;
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 $maxWidth     = getConfig('max_width', 2000);
436 436
 
437 437
 // Check to replace predefined size
438
-if (isset($sizes[$newWidth])) {
439
-    $newWidth = $sizes[$newWidth];
438
+if (isset($sizes[ $newWidth ])) {
439
+    $newWidth = $sizes[ $newWidth ];
440 440
 }
441 441
 
442 442
 // Support width as % of original width
443
-if ($newWidth[strlen($newWidth)-1] == '%') {
443
+if ($newWidth[ strlen($newWidth) - 1 ] == '%') {
444 444
     is_numeric(substr($newWidth, 0, -1))
445 445
         or errorPage('Width % not numeric.', 404);
446 446
 } else {
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 $maxHeight = getConfig('max_height', 2000);
461 461
 
462 462
 // Check to replace predefined size
463
-if (isset($sizes[$newHeight])) {
464
-    $newHeight = $sizes[$newHeight];
463
+if (isset($sizes[ $newHeight ])) {
464
+    $newHeight = $sizes[ $newHeight ];
465 465
 }
466 466
 
467 467
 // height
468
-if ($newHeight[strlen($newHeight)-1] == '%') {
468
+if ($newHeight[ strlen($newHeight) - 1 ] == '%') {
469 469
     is_numeric(substr($newHeight, 0, -1))
470 470
         or errorPage('Height % out of range.', 404);
471 471
 } else {
@@ -482,25 +482,25 @@  discard block
 block discarded – undo
482 482
  * aspect-ratio, ar - affecting the resulting image width, height and resize options
483 483
  */
484 484
 $aspectRatio         = get(array('aspect-ratio', 'ar'));
485
-$aspectRatioConstant = getConfig('aspect_ratio_constant', function () {
485
+$aspectRatioConstant = getConfig('aspect_ratio_constant', function() {
486 486
     return array(
487
-        '3:1'    => 3/1,
488
-        '3:2'    => 3/2,
489
-        '4:3'    => 4/3,
490
-        '8:5'    => 8/5,
491
-        '16:10'  => 16/10,
492
-        '16:9'   => 16/9,
487
+        '3:1'    => 3 / 1,
488
+        '3:2'    => 3 / 2,
489
+        '4:3'    => 4 / 3,
490
+        '8:5'    => 8 / 5,
491
+        '16:10'  => 16 / 10,
492
+        '16:9'   => 16 / 9,
493 493
         'golden' => 1.618,
494 494
     );
495 495
 });
496 496
 
497 497
 // Check to replace predefined aspect ratio
498 498
 $aspectRatios = call_user_func($aspectRatioConstant);
499
-$negateAspectRatio = ($aspectRatio[0] == '!') ? true : false;
499
+$negateAspectRatio = ($aspectRatio[ 0 ] == '!') ? true : false;
500 500
 $aspectRatio = $negateAspectRatio ? substr($aspectRatio, 1) : $aspectRatio;
501 501
 
502
-if (isset($aspectRatios[$aspectRatio])) {
503
-    $aspectRatio = $aspectRatios[$aspectRatio];
502
+if (isset($aspectRatios[ $aspectRatio ])) {
503
+    $aspectRatio = $aspectRatios[ $aspectRatio ];
504 504
 }
505 505
 
506 506
 if ($negateAspectRatio) {
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 if ($fillToFit !== null) {
569 569
 
570 570
     if (!empty($fillToFit)) {
571
-        $bgColor   = $fillToFit;
571
+        $bgColor = $fillToFit;
572 572
         verbose("fillToFit changed bgColor to = $bgColor");
573 573
     }
574 574
 
@@ -755,13 +755,13 @@  discard block
 block discarded – undo
755 755
 $filters = array();
756 756
 $filter = get(array('filter', 'f'));
757 757
 if ($filter) {
758
-    $filters[] = $filter;
758
+    $filters[ ] = $filter;
759 759
 }
760 760
 
761 761
 for ($i = 0; $i < 10; $i++) {
762 762
     $filter = get(array("filter{$i}", "f{$i}"));
763 763
     if ($filter) {
764
-        $filters[] = $filter;
764
+        $filters[ ] = $filter;
765 765
     }
766 766
 }
767 767
 
@@ -791,25 +791,25 @@  discard block
 block discarded – undo
791 791
     $options = get('ascii');
792 792
     $options = explode(',', $options);
793 793
 
794
-    if (isset($options[0]) && !empty($options[0])) {
795
-        $defaultOptions['characterSet'] = $options[0];
794
+    if (isset($options[ 0 ]) && !empty($options[ 0 ])) {
795
+        $defaultOptions[ 'characterSet' ] = $options[ 0 ];
796 796
     }
797 797
 
798
-    if (isset($options[1]) && !empty($options[1])) {
799
-        $defaultOptions['scale'] = $options[1];
798
+    if (isset($options[ 1 ]) && !empty($options[ 1 ])) {
799
+        $defaultOptions[ 'scale' ] = $options[ 1 ];
800 800
     }
801 801
 
802
-    if (isset($options[2]) && !empty($options[2])) {
803
-        $defaultOptions['luminanceStrategy'] = $options[2];
802
+    if (isset($options[ 2 ]) && !empty($options[ 2 ])) {
803
+        $defaultOptions[ 'luminanceStrategy' ] = $options[ 2 ];
804 804
     }
805 805
 
806 806
     if (count($options) > 3) {
807 807
         // Last option is custom character string
808
-        unset($options[0]);
809
-        unset($options[1]);
810
-        unset($options[2]);
808
+        unset($options[ 0 ]);
809
+        unset($options[ 1 ]);
810
+        unset($options[ 2 ]);
811 811
         $characterString = implode($options);
812
-        $defaultOptions['customCharacterSet'] = $characterString;
812
+        $defaultOptions[ 'customCharacterSet' ] = $characterString;
813 813
     }
814 814
 
815 815
     $img->setAsciiOptions($defaultOptions);
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 if ($status) {
984 984
     $text  = "img.php version = " . CIMAGE_VERSION . "\n";
985 985
     $text .= "PHP version = " . PHP_VERSION . "\n";
986
-    $text .= "Running on: " . $_SERVER['SERVER_SOFTWARE'] . "\n";
986
+    $text .= "Running on: " . $_SERVER[ 'SERVER_SOFTWARE' ] . "\n";
987 987
     $text .= "Allow remote images = $allowRemote\n";
988 988
 
989 989
     $res = $cache->getStatusOfSubdir("");
@@ -1015,10 +1015,10 @@  discard block
 block discarded – undo
1015 1015
     $no = extension_loaded('gd') ? null : 'NOT';
1016 1016
     $text .= "Extension gd is $no loaded.<br>";
1017 1017
 
1018
-    $text .= checkExternalCommand("PNG LOSSY", $postProcessing["png_lossy"], $postProcessing["png_lossy_cmd"]);
1019
-    $text .= checkExternalCommand("PNG FILTER", $postProcessing["png_filter"], $postProcessing["png_filter_cmd"]);
1020
-    $text .= checkExternalCommand("PNG DEFLATE", $postProcessing["png_deflate"], $postProcessing["png_deflate_cmd"]);
1021
-    $text .= checkExternalCommand("JPEG OPTIMIZE", $postProcessing["jpeg_optimize"], $postProcessing["jpeg_optimize_cmd"]);
1018
+    $text .= checkExternalCommand("PNG LOSSY", $postProcessing[ "png_lossy" ], $postProcessing[ "png_lossy_cmd" ]);
1019
+    $text .= checkExternalCommand("PNG FILTER", $postProcessing[ "png_filter" ], $postProcessing[ "png_filter_cmd" ]);
1020
+    $text .= checkExternalCommand("PNG DEFLATE", $postProcessing[ "png_deflate" ], $postProcessing[ "png_deflate_cmd" ]);
1021
+    $text .= checkExternalCommand("JPEG OPTIMIZE", $postProcessing[ "jpeg_optimize" ], $postProcessing[ "jpeg_optimize_cmd" ]);
1022 1022
 
1023 1023
     if (!$no) {
1024 1024
         $text .= print_r(gd_info(), 1);
@@ -1101,12 +1101,12 @@  discard block
 block discarded – undo
1101 1101
  */
1102 1102
 if ($verbose) {
1103 1103
     $query = array();
1104
-    parse_str($_SERVER['QUERY_STRING'], $query);
1105
-    unset($query['verbose']);
1106
-    unset($query['v']);
1107
-    unset($query['nocache']);
1108
-    unset($query['nc']);
1109
-    unset($query['json']);
1104
+    parse_str($_SERVER[ 'QUERY_STRING' ], $query);
1105
+    unset($query[ 'verbose' ]);
1106
+    unset($query[ 'v' ]);
1107
+    unset($query[ 'nocache' ]);
1108
+    unset($query[ 'nc' ]);
1109
+    unset($query[ 'json' ]);
1110 1110
     $url1 = '?' . htmlentities(urldecode(http_build_query($query)));
1111 1111
     $url2 = '?' . urldecode(http_build_query($query));
1112 1112
     echo <<<EOD
Please login to merge, or discard this patch.
view/profile/specific.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,20 +20,26 @@
 block discarded – undo
20 20
 <h3>Questions asked: </h3>
21 21
 <?php if (empty($questions)) : ?>
22 22
     <p>This user hasen't posted any questions yet.</p>
23
-<?php else : ?>
23
+<?php else {
24
+    : ?>
24 25
     <?php foreach ($questions as $question) : ?>
25 26
         <p>
26 27
             <a href="../../forum/question/<?= $question->id ?>"><?= $question->title ?></a>
27 28
         </p>
28
-    <?php endforeach; ?>
29
+    <?php endforeach;
30
+}
31
+?>
29 32
 <?php endif; ?>
30 33
 <h3>Answers posted: </h3>
31 34
 <?php if (empty($answers)) : ?>
32 35
     <p>This user hasn't posted any answers yet.</p>
33
-<?php else: ?>
36
+<?php else {
37
+    : ?>
34 38
     <?php foreach ($answers as $answer) : ?>
35 39
         <p>
36 40
             <a href="../../forum/question/<?= $answer->question_id ?>"><?= $answer->content ?></a>
37 41
         </p>
38
-    <?php endforeach; ?>
42
+    <?php endforeach;
43
+}
44
+?>
39 45
 <?php endif; ?>
Please login to merge, or discard this patch.
view/profile/index.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,19 +24,25 @@
 block discarded – undo
24 24
 <?php endforeach; ?>
25 25
 <?php if (empty($posts)) : ?>
26 26
     <p>You have not made any posts yet.</p>
27
-<?php else : ?>
27
+<?php else {
28
+    : ?>
28 29
     <h3>Questions you have asked: </h3>
29 30
     <?php foreach ($posts as $post) : ?>
30 31
         <p>
31 32
             <a href="forum/question/<?= $post->id ?>"><?= $post->title ?></a>
32 33
         </p>
33
-    <?php endforeach; ?>
34
+    <?php endforeach;
35
+}
36
+?>
34 37
 <?php endif; ?>
35 38
 <?php if (empty($answers)) : ?>
36 39
     <p>You have not posted any answers yet.</p>
37
-<?php else : ?>
40
+<?php else {
41
+    : ?>
38 42
     <h3>Answers you have posted: </h3>
39 43
     <?php foreach ($answers as $answer) : ?>
40 44
         <a href="forum/question/<?= $answer->question_id ?>"><?= $answer->content ?></a>
41
-    <?php endforeach; ?>
45
+    <?php endforeach;
46
+}
47
+?>
42 48
 <?php endif; ?>
Please login to merge, or discard this patch.
view/forum/tags.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 $items = isset($items) ? $items : null;
12 12
 // var_dump($items);
13 13
 // $session = $this->di->get("session");
14
-$tags = [];
14
+$tags = [ ];
15 15
 ?>
16 16
 
17 17
 <?php if (!$items) : ?>
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         <h1>All tags</h1>
26 26
     </header>
27 27
     <?php foreach ($items as $item) : ?>
28
-        <?php $tags = explode(", ", $item->tag);?>
28
+        <?php $tags = explode(", ", $item->tag); ?>
29 29
         <section>
30 30
             <?php foreach ($tags as $tag) : ?>
31 31
                 <a href="tags/tag/<?= $tag ?>"><?= $tag ?></a>
Please login to merge, or discard this patch.
view/forum/specific.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,12 @@
 block discarded – undo
38 38
         <p>
39 39
             <a href="../answer/<?= $item->id ?>">Answer this post</a>
40 40
         </p>
41
-    <?php else : ?>
41
+    <?php else {
42
+    : ?>
42 43
         <p>You have to be logged in to answer on a post!</p>
43
-    <?php endif; ?>
44
+    <?php endif;
45
+}
46
+?>
44 47
     <?php foreach ($answers as $answer) : ?>
45 48
         <h2>Answers:</h2>
46 49
         <?= $filter->doFilter($answer->content, "markdown"); ?>
Please login to merge, or discard this patch.
view/forum/index.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,10 @@
 block discarded – undo
34 34
         <p>
35 35
             <a href="forum/create">Create a new post</a>
36 36
         </p>
37
-    <?php else : ?>
37
+    <?php else {
38
+    : ?>
38 39
         <p>You have to be logged in to create a new post</p>
39
-    <?php endif; ?>
40
+    <?php endif;
41
+}
42
+?>
40 43
 </article>
Please login to merge, or discard this patch.
view/anax/stylechooser/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
                     <?php foreach ($styles as $key => $value) :
24 24
                         $selected = $key === $activeStyle ? "selected=\"selected\"" : null;
25 25
                         ?>
26
-                        <option <?= $selected ?> value="<?= $key ?>"><?= "[ $key ] - {$value["shortDescription"]}" ?></option>
26
+                        <option <?= $selected ?> value="<?= $key ?>"><?= "[ $key ] - {$value[ "shortDescription" ]}" ?></option>
27 27
                     <?php endforeach; ?>
28 28
                 </select>
29 29
             </label>
Please login to merge, or discard this patch.
view/anax/v2/flashmessage/default.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
 //echo showEnvironment(get_defined_vars(), get_defined_functions());
11 11
 
12 12
 // Prepare classes
13
-$classes[] = "flashmessage info";
13
+$classes[ ] = "flashmessage info";
14 14
 if (isset($class)) {
15
-    $classes[] = $class;
15
+    $classes[ ] = $class;
16 16
 }
17 17
 
18 18
 
Please login to merge, or discard this patch.
view/anax/v2/next-previous/default.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 //echo showEnvironment(get_defined_vars(), get_defined_functions());
11 11
 
12 12
 // Prepare classes
13
-$classes[] = "next-previous";
13
+$classes[ ] = "next-previous";
14 14
 if (isset($class)) {
15
-    $classes[] = $class;
15
+    $classes[ ] = $class;
16 16
 }
17 17
 
18 18
 // Prepare titles
19
-$nextTitle = $next["title"];
20
-$prevTitle = $previous["title"];
19
+$nextTitle = $next[ "title" ];
20
+$prevTitle = $previous[ "title" ];
21 21
 
22 22
 if (isset($nextPreviousTitle) && $nextPreviousTitle === false) {
23 23
     $nextTitle = t("Next");
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 
29 29
 ?><div <?= classList($classes) ?>>
30 30
     <?php if (isset($next)) : ?>
31
-        <div class="next"><a href="<?= url($next["route"]) ?>"><?= $nextTitle ?></a> »</div>
31
+        <div class="next"><a href="<?= url($next[ "route" ]) ?>"><?= $nextTitle ?></a> »</div>
32 32
     <?php endif; ?>
33 33
 
34 34
     <?php if (isset($previous)) : ?>
35
-        <div class="previous">« <a href="<?= url($previous["route"]) ?>"><?= $prevTitle ?></a></div>
35
+        <div class="previous">« <a href="<?= url($previous[ "route" ]) ?>"><?= $prevTitle ?></a></div>
36 36
     <?php endif; ?>
37 37
 </div>
Please login to merge, or discard this patch.