Passed
Pull Request — master (#322)
by Mirko
08:41
created
htdocs/lib2/logic/cache.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                 if (!$newcoord) {
522 522
                     $newcoord = $coords[$coordpos];
523 523
                 }
524
-                ++ $coordpos;
524
+                ++$coordpos;
525 525
             }
526 526
             if ($newcoord) {
527 527
                 $distance = geomath::calcDistance(
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             $original = count($coords) - 1;
555 555
             $lastlogdate = $logs[count($logs) - 1]['order_date'];
556 556
             while ($original > 0 && $coords[$original - 1]['date'] < $lastlogdate) {
557
-                -- $original;
557
+                --$original;
558 558
             }
559 559
             $coord = new coordinate($coords[$original]['latitude'], $coords[$original]['longitude']);
560 560
             $logs[] = [
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
             $logTypes[$i]['selected'] = ($logtype == $defaultLogType) ? true : false;
956 956
             $logTypes[$i]['name'] = $logtypeNames[$logtype];
957 957
             $logTypes[$i]['id'] = $logtype;
958
-            $i ++;
958
+            $i++;
959 959
         }
960 960
 
961 961
         // return
Please login to merge, or discard this patch.
htdocs/lib2/logic/cracklib.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 
35 35
     // min. 4 different chars
36 36
     $chars = array();
37
-    for ($i = 0; $i < mb_strlen($pw); $i ++) {
37
+    for ($i = 0; $i < mb_strlen($pw); $i++) {
38 38
         $chars[mb_substr($pw, $i, 1)] = true;
39 39
     }
40 40
 
Please login to merge, or discard this patch.
htdocs/lib2/logic/mailcheck.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public $sFrom = '[email protected]';
23 23
 
24 24
     public $nConnectTimeout = 15; // (sec)
25
-    public $nReadTimeout = 25;   // (sec)
25
+    public $nReadTimeout = 25; // (sec)
26 26
 
27 27
     /* check if the mailserver of $sAddress
28 28
      * explicit says that the user does not exist
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         // sort MX records
52 52
         $mxs = [];
53
-        for ($i = 0; $i < count($mx_records); $i ++) {
53
+        for ($i = 0; $i < count($mx_records); $i++) {
54 54
             $mxs[$i] = [
55 55
                 'mx' => $mx_records[$i],
56 56
                 'prio' => $mx_weight[$i]
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         reset($mxs);
61 61
 
62 62
         // check address with each MX until one mailserver can be connected
63
-        for ($i = 0; $i < count($mxs); $i ++) {
63
+        for ($i = 0; $i < count($mxs); $i++) {
64 64
             $retval = $this->pCheckAddress($sAddress, $mxs[$i]['mx']);
65 65
             if ($retval != CA_ERROR_CONNECT) {
66 66
                 return $retval;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $s = "";
170 170
         stream_set_timeout($fp, $this->nReadTimeout);
171 171
 
172
-        for ($i = 0; $i < 2; $i ++) {
172
+        for ($i = 0; $i < 2; $i++) {
173 173
             $s .= fgets($fp, 1024);
174 174
         }
175 175
 
@@ -183,5 +183,5 @@  discard block
 block discarded – undo
183 183
         return 0;
184 184
     }
185 185
 
186
-    return (($a['prio'] + 0) < ($b['prio'] + 0)) ? - 1 : 1;
186
+    return (($a['prio'] + 0) < ($b['prio'] + 0)) ? -1 : 1;
187 187
 }
Please login to merge, or discard this patch.
htdocs/lib2/RSSParser.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                                     'description' => $item->description
67 67
                                 );
68 68
                                 // increment counter
69
-                                $i ++;
69
+                                $i++;
70 70
                                 // htmlspecialchars_decode() works around inconsistent HTML encoding
71 71
                                 // e.g. in SMF Forum Threads
72 72
                             } elseif (!in_array(htmlspecialchars_decode($item->title), $headlines) &&
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                                 );
81 81
                                 $headlines[] = "" . htmlspecialchars_decode($item->title);
82 82
                                 // increment counter
83
-                                $i ++;
83
+                                $i++;
84 84
                             }
85 85
                         }
86 86
                     }
Please login to merge, or discard this patch.
htdocs/lib2/translate.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      */
33 33
     public function t($message, $style, $resource_name, $line, $plural = '', $count = 1, $lang = null)
34 34
     {
35
-        global $opt, $locale;    // $locale is for lib1 compatibility
35
+        global $opt, $locale; // $locale is for lib1 compatibility
36 36
 
37 37
         if ($message == '') {
38 38
             return '';
Please login to merge, or discard this patch.
htdocs/lib2/Net/IDNA2.php 1 patch
Spacing   +43 added lines, -47 removed lines patch added patch discarded remove patch
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
      * @access private
273 273
      */
274 274
     private static $_np_prohibit_ranges = array(
275
-        array(0x80,     0x9F    ),
276
-        array(0x2060,   0x206F  ),
277
-        array(0x1D173,  0x1D17A ),
278
-        array(0xE000,   0xF8FF  ),
279
-        array(0xF0000,  0xFFFFD ),
275
+        array(0x80, 0x9F),
276
+        array(0x2060, 0x206F),
277
+        array(0x1D173, 0x1D17A),
278
+        array(0xE000, 0xF8FF),
279
+        array(0xF0000, 0xFFFFD),
280 280
         array(0x100000, 0x10FFFD),
281
-        array(0xFDD0,   0xFDEF  ),
282
-        array(0xD800,   0xDFFF  ),
283
-        array(0x2FF0,   0x2FFB  ),
284
-        array(0xE0020,  0xE007F )
281
+        array(0xFDD0, 0xFDEF),
282
+        array(0xD800, 0xDFFF),
283
+        array(0x2FF0, 0x2FFB),
284
+        array(0xE0020, 0xE007F)
285 285
     );
286 286
 
287 287
     /**
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
                     break;
2283 2283
 
2284 2284
                 default:
2285
-                    throw new InvalidArgumentException('Set Parameter: Unknown parameter '.$v.' for option '.$k);
2285
+                    throw new InvalidArgumentException('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k);
2286 2286
                 }
2287 2287
 
2288 2288
                 break;
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
                 if (in_array($v, array('2003', '2008'))) {
2300 2300
                     $this->_version = $v;
2301 2301
                 } else {
2302
-                    throw new InvalidArgumentException('Set Parameter: Invalid parameter '.$v.' for option '.$k);
2302
+                    throw new InvalidArgumentException('Set Parameter: Invalid parameter ' . $v . ' for option ' . $k);
2303 2303
                 }
2304 2304
                 break;
2305 2305
 
@@ -2328,8 +2328,7 @@  discard block
 block discarded – undo
2328 2328
         // Forcing conversion of input to UCS4 array
2329 2329
         // If one time encoding is given, use this, else the objects property
2330 2330
         switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
2331
-        case 'utf8':
2332
-            $decoded = $this->_utf8_to_ucs4($decoded);
2331
+        case 'utf8' : $decoded = $this->_utf8_to_ucs4($decoded);
2333 2332
             break;
2334 2333
         case 'ucs4_string':
2335 2334
             $decoded = $this->_ucs4_string_to_ucs4($decoded);
@@ -2349,7 +2348,7 @@  discard block
 block discarded – undo
2349 2348
 
2350 2349
         foreach ($decoded as $k => $v) {
2351 2350
             // Make sure to use just the plain dot
2352
-            switch($v) {
2351
+            switch ($v) {
2353 2352
             case 0x3002:
2354 2353
             case 0xFF0E:
2355 2354
             case 0xFF61:
@@ -2370,11 +2369,11 @@  discard block
 block discarded – undo
2370 2369
                 // Skip first char
2371 2370
                 if ($k) {
2372 2371
                     $encoded = '';
2373
-                    $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin)));
2372
+                    $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k) - $last_begin)));
2374 2373
                     if ($encoded) {
2375 2374
                         $output .= $encoded;
2376 2375
                     } else {
2377
-                        $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin)));
2376
+                        $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k) - $last_begin)));
2378 2377
                     }
2379 2378
                     $output .= chr($decoded[$k]);
2380 2379
                 }
@@ -2385,11 +2384,11 @@  discard block
 block discarded – undo
2385 2384
         if ($last_begin) {
2386 2385
             $inp_len = sizeof($decoded);
2387 2386
             $encoded = '';
2388
-            $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin)));
2387
+            $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len) - $last_begin)));
2389 2388
             if ($encoded) {
2390 2389
                 $output .= $encoded;
2391 2390
             } else {
2392
-                $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin)));
2391
+                $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len) - $last_begin)));
2393 2392
             }
2394 2393
             return $output;
2395 2394
         }
@@ -2421,7 +2420,7 @@  discard block
 block discarded – undo
2421 2420
             case 'ucs4_array':
2422 2421
                 break;
2423 2422
             default:
2424
-                throw new InvalidArgumentException('Unknown encoding '.$one_time_encoding);
2423
+                throw new InvalidArgumentException('Unknown encoding ' . $one_time_encoding);
2425 2424
             }
2426 2425
         }
2427 2426
         // Make sure to drop any newline characters around
@@ -2473,8 +2472,7 @@  discard block
 block discarded – undo
2473 2472
         // The output is UTF-8 by default, other output formats need conversion here
2474 2473
         // If one time encoding is given, use this, else the objects property
2475 2474
         switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
2476
-        case 'utf8':
2477
-            return $return;
2475
+        case 'utf8' : return $return;
2478 2476
             break;
2479 2477
         case 'ucs4_string':
2480 2478
             return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));
@@ -2629,9 +2627,8 @@  discard block
 block discarded – undo
2629 2627
                     $delta++;
2630 2628
                 } else if ($decoded[$i] == $cur_code) {
2631 2629
                     for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) {
2632
-                        $t = ($k <= $bias)?
2633
-                            $this->_tmin :
2634
-                            (($k >= $bias + $this->_tmax)? $this->_tmax : $k - $bias);
2630
+                        $t = ($k <= $bias) ?
2631
+                            $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias);
2635 2632
 
2636 2633
                         if ($q < $t) {
2637 2634
                             break;
@@ -2699,14 +2696,13 @@  discard block
 block discarded – undo
2699 2696
         $idx      = 0;
2700 2697
         $char     = $this->_initial_n;
2701 2698
 
2702
-        for ($enco_idx = ($delim_pos)? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
2703
-            for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) {
2699
+        for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
2700
+            for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) {
2704 2701
                 $digit = $this->_decodeDigit($encoded{$enco_idx++});
2705 2702
                 $idx += $digit * $w;
2706 2703
 
2707 2704
                 $t = ($k <= $bias) ?
2708
-                    $this->_tmin :
2709
-                    (($k >= $bias + $this->_tmax)? $this->_tmax : ($k - $bias));
2705
+                    $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias));
2710 2706
 
2711 2707
                 if ($digit < $t) {
2712 2708
                     break;
@@ -2717,7 +2713,7 @@  discard block
 block discarded – undo
2717 2713
 
2718 2714
             $bias      = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first);
2719 2715
             $is_first  = false;
2720
-            $char     += (int) ($idx / ($deco_len + 1));
2716
+            $char     += (int)($idx / ($deco_len + 1));
2721 2717
             $idx      %= ($deco_len + 1);
2722 2718
 
2723 2719
             if ($deco_len > 0) {
@@ -2745,14 +2741,14 @@  discard block
 block discarded – undo
2745 2741
      */
2746 2742
     private function _adapt($delta, $npoints, $is_first)
2747 2743
     {
2748
-        $delta = (int) ($is_first ? ($delta / $this->_damp) : ($delta / 2));
2749
-        $delta += (int) ($delta / $npoints);
2744
+        $delta = (int)($is_first ? ($delta / $this->_damp) : ($delta / 2));
2745
+        $delta += (int)($delta / $npoints);
2750 2746
 
2751 2747
         for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) {
2752
-            $delta = (int) ($delta / ($this->_base - $this->_tmin));
2748
+            $delta = (int)($delta / ($this->_base - $this->_tmin));
2753 2749
         }
2754 2750
 
2755
-        return (int) ($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew));
2751
+        return (int)($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew));
2756 2752
     }
2757 2753
 
2758 2754
     /**
@@ -2779,7 +2775,7 @@  discard block
 block discarded – undo
2779 2775
     private function _decodeDigit($cp)
2780 2776
     {
2781 2777
         $cp = ord($cp);
2782
-        return ($cp - 48 < 10)? $cp - 22 : (($cp - 65 < 26)? $cp - 65 : (($cp - 97 < 26)? $cp - 97 : $this->_base));
2778
+        return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base));
2783 2779
     }
2784 2780
 
2785 2781
     /**
@@ -2862,7 +2858,7 @@  discard block
 block discarded – undo
2862 2858
                     // Rewind the for loop by one, since there can be more possible compositions
2863 2859
                     $i--;
2864 2860
                     $out_len--;
2865
-                    $last_class = ($i == $last_starter)? 0 : $this->_getCombiningClass($output[$i - 1]);
2861
+                    $last_class = ($i == $last_starter) ? 0 : $this->_getCombiningClass($output[$i - 1]);
2866 2862
 
2867 2863
                     continue;
2868 2864
                 }
@@ -2899,7 +2895,7 @@  discard block
 block discarded – undo
2899 2895
 
2900 2896
         $result   = array();
2901 2897
         $T        = $this->_tbase + $sindex % $this->_tcount;
2902
-        $result[] = (int)($this->_lbase +  $sindex / $this->_ncount);
2898
+        $result[] = (int)($this->_lbase + $sindex / $this->_ncount);
2903 2899
         $result[] = (int)($this->_vbase + ($sindex % $this->_ncount) / $this->_tcount);
2904 2900
 
2905 2901
         if ($T != $this->_tbase) {
@@ -2985,7 +2981,7 @@  discard block
 block discarded – undo
2985 2981
      */
2986 2982
     private function _getCombiningClass($char)
2987 2983
     {
2988
-        return isset(self::$_np_norm_combcls[$char])? self::$_np_norm_combcls[$char] : 0;
2984
+        return isset(self::$_np_norm_combcls[$char]) ? self::$_np_norm_combcls[$char] : 0;
2989 2985
     }
2990 2986
 
2991 2987
     /**
@@ -3119,7 +3115,7 @@  discard block
 block discarded – undo
3119 3115
                 $output[$out_len] = $v;
3120 3116
                 ++$out_len;
3121 3117
                 if ('add' == $mode) {
3122
-                    throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
3118
+                    throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k);
3123 3119
                 }
3124 3120
                 continue;
3125 3121
             }
@@ -3143,10 +3139,10 @@  discard block
 block discarded – undo
3143 3139
                     $next_byte = 4;
3144 3140
                     $v = ($v - 252) << 30;
3145 3141
                 } else {
3146
-                    throw new UnexpectedValueException('This might be UTF-8, but I don\'t understand it at byte '.$k);
3142
+                    throw new UnexpectedValueException('This might be UTF-8, but I don\'t understand it at byte ' . $k);
3147 3143
                 }
3148 3144
                 if ('add' == $mode) {
3149
-                    $output[$out_len] = (int) $v;
3145
+                    $output[$out_len] = (int)$v;
3150 3146
                     ++$out_len;
3151 3147
                     continue;
3152 3148
                 }
@@ -3155,7 +3151,7 @@  discard block
 block discarded – undo
3155 3151
                 if (!$this->_allow_overlong && $test == 'range') {
3156 3152
                     $test = 'none';
3157 3153
                     if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) {
3158
-                        throw new OutOfRangeException('Bogus UTF-8 character detected (out of legal range) at byte '.$k);
3154
+                        throw new OutOfRangeException('Bogus UTF-8 character detected (out of legal range) at byte ' . $k);
3159 3155
                     }
3160 3156
                 }
3161 3157
                 if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx
@@ -3163,7 +3159,7 @@  discard block
 block discarded – undo
3163 3159
                     $output[($out_len - 1)] += $v;
3164 3160
                     --$next_byte;
3165 3161
                 } else {
3166
-                    throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
3162
+                    throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k);
3167 3163
                 }
3168 3164
                 if ($next_byte < 0) {
3169 3165
                     $mode = 'next';
@@ -3205,14 +3201,14 @@  discard block
 block discarded – undo
3205 3201
                 // 4 bytes
3206 3202
                 $output .= chr(240 + ($v >> 18))
3207 3203
                     . chr(128 + (($v >> 12) & 63))
3208
-                    . chr(128 + (($v >>  6) & 63))
3204
+                    . chr(128 + (($v >> 6) & 63))
3209 3205
                     . chr(128 + ($v & 63));
3210 3206
             } else if ($v < 1 << 26) {
3211 3207
                 // 5 bytes
3212 3208
                 $output .= chr(248 + ($v >> 24))
3213 3209
                     . chr(128 + (($v >> 18) & 63))
3214 3210
                     . chr(128 + (($v >> 12) & 63))
3215
-                    . chr(128 + (($v >>  6) & 63))
3211
+                    . chr(128 + (($v >> 6) & 63))
3216 3212
                     . chr(128 + ($v & 63));
3217 3213
             } else if ($v < 1 << 31) {
3218 3214
                 // 6 bytes
@@ -3220,7 +3216,7 @@  discard block
 block discarded – undo
3220 3216
                     . chr(128 + (($v >> 24) & 63))
3221 3217
                     . chr(128 + (($v >> 18) & 63))
3222 3218
                     . chr(128 + (($v >> 12) & 63))
3223
-                    . chr(128 + (($v >>  6) & 63))
3219
+                    . chr(128 + (($v >> 6) & 63))
3224 3220
                     . chr(128 + ($v & 63));
3225 3221
             } else {
3226 3222
                 throw new UnexpectedValueException('Conversion from UCS-4 to UTF-8 failed: malformed input');
@@ -3280,7 +3276,7 @@  discard block
 block discarded – undo
3280 3276
                 $out_len++;
3281 3277
                 $output[$out_len] = 0;
3282 3278
             }
3283
-            $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
3279
+            $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4)));
3284 3280
         }
3285 3281
         return $output;
3286 3282
     }
@@ -3331,7 +3327,7 @@  discard block
 block discarded – undo
3331 3327
         $return = '';
3332 3328
 
3333 3329
         for ($i = $w; $i > -1; $i--) {
3334
-            $return .= ($octet & (1 << $i))? '1' : '0';
3330
+            $return .= ($octet & (1 << $i)) ? '1' : '0';
3335 3331
         }
3336 3332
 
3337 3333
         return $return;
Please login to merge, or discard this patch.
htdocs/lib2/errorhandler.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
     $errorlog_dir = $opt['rootpath'] . 'var/errorlog';
113 113
     $errorlog_path = $errorlog_dir . "/errorlog-" . date("Y-m-d");
114 114
 
115
-    $error_mail_limit = 32768;    // send max 32 KB = ca. 5-20 errors per day/logfile
115
+    $error_mail_limit = 32768; // send max 32 KB = ca. 5-20 errors per day/logfile
116 116
 
117 117
     // All errors which may happen here are ignored, to avoid error recursions.
118 118
 
Please login to merge, or discard this patch.
htdocs/lib2/imagebmp.inc.php 1 patch
Spacing   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -26,164 +26,164 @@  discard block
 block discarded – undo
26 26
 *           Returns: if $file specified - true if OK
27 27
                      if $file not specified - image data
28 28
 */
29
-function imagebmp($img,$file="",$RLE=0)
29
+function imagebmp($img, $file = "", $RLE = 0)
30 30
 {
31 31
 
32 32
 
33
-$ColorCount=imagecolorstotal($img);
33
+$ColorCount = imagecolorstotal($img);
34 34
 
35
-$Transparent=imagecolortransparent($img);
36
-$IsTransparent=$Transparent!=-1;
35
+$Transparent = imagecolortransparent($img);
36
+$IsTransparent = $Transparent != -1;
37 37
 
38 38
 
39
-if($IsTransparent) $ColorCount--;
39
+if ($IsTransparent) $ColorCount--;
40 40
 
41
-if($ColorCount==0) {$ColorCount=0; $BitCount=24;};
42
-if(($ColorCount>0)and($ColorCount<=2)) {$ColorCount=2; $BitCount=1;};
43
-if(($ColorCount>2)and($ColorCount<=16)) { $ColorCount=16; $BitCount=4;};
44
-if(($ColorCount>16)and($ColorCount<=256)) { $ColorCount=0; $BitCount=8;};
41
+if ($ColorCount == 0) {$ColorCount = 0; $BitCount = 24; };
42
+if (($ColorCount > 0) and ($ColorCount <= 2)) {$ColorCount = 2; $BitCount = 1; };
43
+if (($ColorCount > 2) and ($ColorCount <= 16)) { $ColorCount = 16; $BitCount = 4; };
44
+if (($ColorCount > 16) and ($ColorCount <= 256)) { $ColorCount = 0; $BitCount = 8; };
45 45
 
46 46
 
47
-                $Width=imagesx($img);
48
-                $Height=imagesy($img);
47
+                $Width = imagesx($img);
48
+                $Height = imagesy($img);
49 49
 
50
-                $Zbytek=(4-($Width/(8/$BitCount))%4)%4;
50
+                $Zbytek = (4 - ($Width / (8 / $BitCount)) % 4) % 4;
51 51
 
52
-                if($BitCount<24) $palsize=pow(2,$BitCount)*4;
52
+                if ($BitCount < 24) $palsize = pow(2, $BitCount) * 4;
53 53
 
54
-                $size=(floor($Width/(8/$BitCount))+$Zbytek)*$Height+54;
55
-                $size+=$palsize;
56
-                $offset=54+$palsize;
54
+                $size = (floor($Width / (8 / $BitCount)) + $Zbytek) * $Height + 54;
55
+                $size += $palsize;
56
+                $offset = 54 + $palsize;
57 57
 
58 58
                 // Bitmap File Header
59
-                $ret = 'BM';                        // header (2b)
60
-                $ret .= int_to_dword($size);        // size of file (4b)
61
-                $ret .= int_to_dword(0);        // reserved (4b)
62
-                $ret .= int_to_dword($offset);        // byte location in the file which is first byte of IMAGE (4b)
59
+                $ret = 'BM'; // header (2b)
60
+                $ret .= int_to_dword($size); // size of file (4b)
61
+                $ret .= int_to_dword(0); // reserved (4b)
62
+                $ret .= int_to_dword($offset); // byte location in the file which is first byte of IMAGE (4b)
63 63
                 // Bitmap Info Header
64
-                $ret .= int_to_dword(40);        // Size of BITMAPINFOHEADER (4b)
65
-                $ret .= int_to_dword($Width);        // width of bitmap (4b)
66
-                $ret .= int_to_dword($Height);        // height of bitmap (4b)
67
-                $ret .= int_to_word(1);        // biPlanes = 1 (2b)
68
-                $ret .= int_to_word($BitCount);        // biBitCount = {1 (mono) or 4 (16 clr ) or 8 (256 clr) or 24 (16 Mil)} (2b)
69
-                $ret .= int_to_dword($RLE);        // RLE COMPRESSION (4b)
70
-                $ret .= int_to_dword(0);        // width x height (4b)
71
-                $ret .= int_to_dword(0);        // biXPelsPerMeter (4b)
72
-                $ret .= int_to_dword(0);        // biYPelsPerMeter (4b)
73
-                $ret .= int_to_dword(0);        // Number of palettes used (4b)
74
-                $ret .= int_to_dword(0);        // Number of important colour (4b)
64
+                $ret .= int_to_dword(40); // Size of BITMAPINFOHEADER (4b)
65
+                $ret .= int_to_dword($Width); // width of bitmap (4b)
66
+                $ret .= int_to_dword($Height); // height of bitmap (4b)
67
+                $ret .= int_to_word(1); // biPlanes = 1 (2b)
68
+                $ret .= int_to_word($BitCount); // biBitCount = {1 (mono) or 4 (16 clr ) or 8 (256 clr) or 24 (16 Mil)} (2b)
69
+                $ret .= int_to_dword($RLE); // RLE COMPRESSION (4b)
70
+                $ret .= int_to_dword(0); // width x height (4b)
71
+                $ret .= int_to_dword(0); // biXPelsPerMeter (4b)
72
+                $ret .= int_to_dword(0); // biYPelsPerMeter (4b)
73
+                $ret .= int_to_dword(0); // Number of palettes used (4b)
74
+                $ret .= int_to_dword(0); // Number of important colour (4b)
75 75
                 // image data
76 76
 
77
-                $CC=$ColorCount;
78
-                $sl1=strlen($ret);
79
-                if($CC==0) $CC=256;
80
-                if($BitCount<24)
77
+                $CC = $ColorCount;
78
+                $sl1 = strlen($ret);
79
+                if ($CC == 0) $CC = 256;
80
+                if ($BitCount < 24)
81 81
                    {
82
-                    $ColorTotal=imagecolorstotal($img);
83
-                     if($IsTransparent) $ColorTotal--;
82
+                    $ColorTotal = imagecolorstotal($img);
83
+                     if ($IsTransparent) $ColorTotal--;
84 84
 
85
-                     for($p=0;$p<$ColorTotal;$p++)
85
+                     for ($p = 0; $p < $ColorTotal; $p++)
86 86
                      {
87
-                      $color=imagecolorsforindex($img,$p);
88
-                       $ret.=inttobyte($color["blue"]);
89
-                       $ret.=inttobyte($color["green"]);
90
-                       $ret.=inttobyte($color["red"]);
91
-                       $ret.=inttobyte(0); //RESERVED
87
+                      $color = imagecolorsforindex($img, $p);
88
+                       $ret .= inttobyte($color["blue"]);
89
+                       $ret .= inttobyte($color["green"]);
90
+                       $ret .= inttobyte($color["red"]);
91
+                       $ret .= inttobyte(0); //RESERVED
92 92
                      };
93 93
 
94
-                    $CT=$ColorTotal;
95
-                  for($p=$ColorTotal;$p<$CC;$p++)
94
+                    $CT = $ColorTotal;
95
+                  for ($p = $ColorTotal; $p < $CC; $p++)
96 96
                        {
97
-                      $ret.=inttobyte(0);
98
-                      $ret.=inttobyte(0);
99
-                      $ret.=inttobyte(0);
100
-                      $ret.=inttobyte(0); //RESERVED
97
+                      $ret .= inttobyte(0);
98
+                      $ret .= inttobyte(0);
99
+                      $ret .= inttobyte(0);
100
+                      $ret .= inttobyte(0); //RESERVED
101 101
                      };
102 102
                    };
103 103
 
104 104
 
105
-if($BitCount<=8)
105
+if ($BitCount <= 8)
106 106
 {
107 107
 
108
- for($y=$Height-1;$y>=0;$y--)
108
+ for ($y = $Height - 1; $y >= 0; $y--)
109 109
  {
110
-  $bWrite="";
111
-  for($x=0;$x<$Width;$x++)
110
+  $bWrite = "";
111
+  for ($x = 0; $x < $Width; $x++)
112 112
    {
113
-   $color=imagecolorat($img,$x,$y);
114
-   $bWrite.=decbinx($color,$BitCount);
115
-   if(strlen($bWrite)==8)
113
+   $color = imagecolorat($img, $x, $y);
114
+   $bWrite .= decbinx($color, $BitCount);
115
+   if (strlen($bWrite) == 8)
116 116
     {
117
-     $retd.=inttobyte(bindec($bWrite));
118
-     $bWrite="";
117
+     $retd .= inttobyte(bindec($bWrite));
118
+     $bWrite = "";
119 119
     };
120 120
    };
121 121
 
122
-  if((strlen($bWrite)<8)and(strlen($bWrite)!=0))
122
+  if ((strlen($bWrite) < 8) and (strlen($bWrite) != 0))
123 123
     {
124
-     $sl=strlen($bWrite);
125
-     for($t=0;$t<8-$sl;$t++)
126
-      $sl.="0";
127
-     $retd.=inttobyte(bindec($bWrite));
124
+     $sl = strlen($bWrite);
125
+     for ($t = 0; $t < 8 - $sl; $t++)
126
+      $sl .= "0";
127
+     $retd .= inttobyte(bindec($bWrite));
128 128
     };
129
- for($z=0;$z<$Zbytek;$z++)
130
-   $retd.=inttobyte(0);
129
+ for ($z = 0; $z < $Zbytek; $z++)
130
+   $retd .= inttobyte(0);
131 131
  };
132 132
 };
133 133
 
134
-if(($RLE==1)and($BitCount==8))
134
+if (($RLE == 1) and ($BitCount == 8))
135 135
 {
136
- for($t=0;$t<strlen($retd);$t+=4)
136
+ for ($t = 0; $t < strlen($retd); $t += 4)
137 137
   {
138
-   if($t!=0)
139
-   if(($t)%$Width==0)
140
-    $ret.=chr(0).chr(0);
138
+   if ($t != 0)
139
+   if (($t) % $Width == 0)
140
+    $ret .= chr(0) . chr(0);
141 141
 
142
-   if(($t+5)%$Width==0)
142
+   if (($t + 5) % $Width == 0)
143 143
    {
144
-     $ret.=chr(0).chr(5).substr($retd,$t,5).chr(0);
145
-     $t+=1;
144
+     $ret .= chr(0) . chr(5) . substr($retd, $t, 5) . chr(0);
145
+     $t += 1;
146 146
    }
147
-   if(($t+6)%$Width==0)
147
+   if (($t + 6) % $Width == 0)
148 148
     {
149
-     $ret.=chr(0).chr(6).substr($retd,$t,6);
150
-     $t+=2;
149
+     $ret .= chr(0) . chr(6) . substr($retd, $t, 6);
150
+     $t += 2;
151 151
     }
152 152
     else
153 153
     {
154
-     $ret.=chr(0).chr(4).substr($retd,$t,4);
154
+     $ret .= chr(0) . chr(4) . substr($retd, $t, 4);
155 155
     };
156 156
   };
157
-  $ret.=chr(0).chr(1);
157
+  $ret .= chr(0) . chr(1);
158 158
 }
159 159
 else
160 160
 {
161
-$ret.=$retd;
161
+$ret .= $retd;
162 162
 };
163 163
 
164 164
 
165
-                if($BitCount==24)
165
+                if ($BitCount == 24)
166 166
                 {
167
-                for($z=0;$z<$Zbytek;$z++)
168
-                 $Dopl.=chr(0);
167
+                for ($z = 0; $z < $Zbytek; $z++)
168
+                 $Dopl .= chr(0);
169 169
 
170
-                for($y=$Height-1;$y>=0;$y--)
170
+                for ($y = $Height - 1; $y >= 0; $y--)
171 171
                  {
172
-                 for($x=0;$x<$Width;$x++)
172
+                 for ($x = 0; $x < $Width; $x++)
173 173
                         {
174
-                           $color=imagecolorsforindex($img,ImageColorAt($img,$x,$y));
175
-                           $ret.=chr($color["blue"]).chr($color["green"]).chr($color["red"]);
174
+                           $color = imagecolorsforindex($img, ImageColorAt($img, $x, $y));
175
+                           $ret .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]);
176 176
                         }
177
-                 $ret.=$Dopl;
177
+                 $ret .= $Dopl;
178 178
                  };
179 179
 
180 180
                  };
181 181
 
182
-  if($file!="")
182
+  if ($file != "")
183 183
    {
184
-    $r=($f=fopen($file,"w"));
185
-    $r=$r and fwrite($f,$ret);
186
-    $r=$r and fclose($f);
184
+    $r = ($f = fopen($file, "w"));
185
+    $r = $r and fwrite($f, $ret);
186
+    $r = $r and fclose($f);
187 187
     return $r;
188 188
    }
189 189
   else
@@ -208,58 +208,58 @@  discard block
 block discarded – undo
208 208
 {
209 209
 global  $CurrentBit, $echoMode;
210 210
 
211
-$f=fopen($file,"r");
212
-$Header=fread($f,2);
211
+$f = fopen($file, "r");
212
+$Header = fread($f, 2);
213 213
 
214
-if($Header=="BM")
214
+if ($Header == "BM")
215 215
 {
216
- $Size=freaddword($f);
217
- $Reserved1=freadword($f);
218
- $Reserved2=freadword($f);
219
- $FirstByteOfImage=freaddword($f);
220
-
221
- $SizeBITMAPINFOHEADER=freaddword($f);
222
- $Width=freaddword($f);
223
- $Height=freaddword($f);
224
- $biPlanes=freadword($f);
225
- $biBitCount=freadword($f);
226
- $RLECompression=freaddword($f);
227
- $WidthxHeight=freaddword($f);
228
- $biXPelsPerMeter=freaddword($f);
229
- $biYPelsPerMeter=freaddword($f);
230
- $NumberOfPalettesUsed=freaddword($f);
231
- $NumberOfImportantColors=freaddword($f);
232
-
233
-if($biBitCount<24)
216
+ $Size = freaddword($f);
217
+ $Reserved1 = freadword($f);
218
+ $Reserved2 = freadword($f);
219
+ $FirstByteOfImage = freaddword($f);
220
+
221
+ $SizeBITMAPINFOHEADER = freaddword($f);
222
+ $Width = freaddword($f);
223
+ $Height = freaddword($f);
224
+ $biPlanes = freadword($f);
225
+ $biBitCount = freadword($f);
226
+ $RLECompression = freaddword($f);
227
+ $WidthxHeight = freaddword($f);
228
+ $biXPelsPerMeter = freaddword($f);
229
+ $biYPelsPerMeter = freaddword($f);
230
+ $NumberOfPalettesUsed = freaddword($f);
231
+ $NumberOfImportantColors = freaddword($f);
232
+
233
+if ($biBitCount < 24)
234 234
  {
235
-  $img=imagecreate($Width,$Height);
236
-  $Colors=pow(2,$biBitCount);
237
-  for($p=0;$p<$Colors;$p++)
235
+  $img = imagecreate($Width, $Height);
236
+  $Colors = pow(2, $biBitCount);
237
+  for ($p = 0; $p < $Colors; $p++)
238 238
    {
239
-    $B=freadbyte($f);
240
-    $G=freadbyte($f);
241
-    $R=freadbyte($f);
242
-    $Reserved=freadbyte($f);
243
-    $Palette[]=imagecolorallocate($img,$R,$G,$B);
239
+    $B = freadbyte($f);
240
+    $G = freadbyte($f);
241
+    $R = freadbyte($f);
242
+    $Reserved = freadbyte($f);
243
+    $Palette[] = imagecolorallocate($img, $R, $G, $B);
244 244
    };
245 245
 
246 246
 
247 247
 
248 248
 
249
-if($RLECompression==0)
249
+if ($RLECompression == 0)
250 250
 {
251
-   $Zbytek=(4-ceil(($Width/(8/$biBitCount)))%4)%4;
251
+   $Zbytek = (4 - ceil(($Width / (8 / $biBitCount))) % 4) % 4;
252 252
 
253
-for($y=$Height-1;$y>=0;$y--)
253
+for ($y = $Height - 1; $y >= 0; $y--)
254 254
     {
255
-     $CurrentBit=0;
256
-     for($x=0;$x<$Width;$x++)
255
+     $CurrentBit = 0;
256
+     for ($x = 0; $x < $Width; $x++)
257 257
       {
258
-         $C=freadbits($f,$biBitCount);
259
-       imagesetpixel($img,$x,$y,$Palette[$C]);
258
+         $C = freadbits($f, $biBitCount);
259
+       imagesetpixel($img, $x, $y, $Palette[$C]);
260 260
       };
261
-    if($CurrentBit!=0) {freadbyte($f);};
262
-    for($g=0;$g<$Zbytek;$g++)
261
+    if ($CurrentBit != 0) {freadbyte($f); };
262
+    for ($g = 0; $g < $Zbytek; $g++)
263 263
      freadbyte($f);
264 264
      };
265 265
 
@@ -267,142 +267,142 @@  discard block
 block discarded – undo
267 267
 };
268 268
 
269 269
 
270
-if($RLECompression==1) //$BI_RLE8
270
+if ($RLECompression == 1) //$BI_RLE8
271 271
 {
272
-$y=$Height;
272
+$y = $Height;
273 273
 
274
-$pocetb=0;
274
+$pocetb = 0;
275 275
 
276
-while(true)
276
+while (true)
277 277
 {
278 278
 $y--;
279
-$prefix=freadbyte($f);
280
-$suffix=freadbyte($f);
281
-$pocetb+=2;
279
+$prefix = freadbyte($f);
280
+$suffix = freadbyte($f);
281
+$pocetb += 2;
282 282
 
283
-$echoit=false;
283
+$echoit = false;
284 284
 
285
-if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
286
-if(($prefix==0)and($suffix==1)) break;
287
-if(feof($f)) break;
285
+if ($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
286
+if (($prefix == 0) and ($suffix == 1)) break;
287
+if (feof($f)) break;
288 288
 
289
-while(!(($prefix==0)and($suffix==0)))
289
+while (!(($prefix == 0) and ($suffix == 0)))
290 290
 {
291
- if($prefix==0)
291
+ if ($prefix == 0)
292 292
   {
293
-   $pocet=$suffix;
294
-   $Data.=fread($f,$pocet);
295
-   $pocetb+=$pocet;
296
-   if($pocetb%2==1) {freadbyte($f); $pocetb++;};
293
+   $pocet = $suffix;
294
+   $Data .= fread($f, $pocet);
295
+   $pocetb += $pocet;
296
+   if ($pocetb % 2 == 1) {freadbyte($f); $pocetb++; };
297 297
   };
298
- if($prefix>0)
298
+ if ($prefix > 0)
299 299
   {
300
-   $pocet=$prefix;
301
-   for($r=0;$r<$pocet;$r++)
302
-    $Data.=chr($suffix);
300
+   $pocet = $prefix;
301
+   for ($r = 0; $r < $pocet; $r++)
302
+    $Data .= chr($suffix);
303 303
   };
304
- $prefix=freadbyte($f);
305
- $suffix=freadbyte($f);
306
- $pocetb+=2;
307
- if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
304
+ $prefix = freadbyte($f);
305
+ $suffix = freadbyte($f);
306
+ $pocetb += 2;
307
+ if ($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
308 308
 };
309 309
 
310
-for($x=0;$x<strlen($Data);$x++)
310
+for ($x = 0; $x < strlen($Data); $x++)
311 311
  {
312
-  imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]);
312
+  imagesetpixel($img, $x, $y, $Palette[ord($Data[$x])]);
313 313
  };
314
-$Data="";
314
+$Data = "";
315 315
 
316 316
 };
317 317
 
318 318
 };
319 319
 
320 320
 
321
-if($RLECompression==2) //$BI_RLE4
321
+if ($RLECompression == 2) //$BI_RLE4
322 322
 {
323
-$y=$Height;
324
-$pocetb=0;
323
+$y = $Height;
324
+$pocetb = 0;
325 325
 
326 326
 /*while(!feof($f))
327 327
  echo freadbyte($f)."_".freadbyte($f)."<BR>";*/
328
-while(true)
328
+while (true)
329 329
 {
330 330
 //break;
331 331
 $y--;
332
-$prefix=freadbyte($f);
333
-$suffix=freadbyte($f);
334
-$pocetb+=2;
332
+$prefix = freadbyte($f);
333
+$suffix = freadbyte($f);
334
+$pocetb += 2;
335 335
 
336
-$echoit=false;
336
+$echoit = false;
337 337
 
338
-if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
339
-if(($prefix==0)and($suffix==1)) break;
340
-if(feof($f)) break;
338
+if ($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
339
+if (($prefix == 0) and ($suffix == 1)) break;
340
+if (feof($f)) break;
341 341
 
342
-while(!(($prefix==0)and($suffix==0)))
342
+while (!(($prefix == 0) and ($suffix == 0)))
343 343
 {
344
- if($prefix==0)
344
+ if ($prefix == 0)
345 345
   {
346
-   $pocet=$suffix;
347
-
348
-   $CurrentBit=0;
349
-   for($h=0;$h<$pocet;$h++)
350
-    $Data.=chr(freadbits($f,4));
351
-   if($CurrentBit!=0) freadbits($f,4);
352
-   $pocetb+=ceil(($pocet/2));
353
-   if($pocetb%2==1) {freadbyte($f); $pocetb++;};
346
+   $pocet = $suffix;
347
+
348
+   $CurrentBit = 0;
349
+   for ($h = 0; $h < $pocet; $h++)
350
+    $Data .= chr(freadbits($f, 4));
351
+   if ($CurrentBit != 0) freadbits($f, 4);
352
+   $pocetb += ceil(($pocet / 2));
353
+   if ($pocetb % 2 == 1) {freadbyte($f); $pocetb++; };
354 354
   };
355
- if($prefix>0)
355
+ if ($prefix > 0)
356 356
   {
357
-   $pocet=$prefix;
358
-   $i=0;
359
-   for($r=0;$r<$pocet;$r++)
357
+   $pocet = $prefix;
358
+   $i = 0;
359
+   for ($r = 0; $r < $pocet; $r++)
360 360
     {
361
-    if($i%2==0)
361
+    if ($i % 2 == 0)
362 362
      {
363
-      $Data.=chr($suffix%16);
363
+      $Data .= chr($suffix % 16);
364 364
      }
365 365
      else
366 366
      {
367
-      $Data.=chr(floor($suffix/16));
367
+      $Data .= chr(floor($suffix / 16));
368 368
      };
369 369
     $i++;
370 370
     };
371 371
   };
372
- $prefix=freadbyte($f);
373
- $suffix=freadbyte($f);
374
- $pocetb+=2;
375
- if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
372
+ $prefix = freadbyte($f);
373
+ $suffix = freadbyte($f);
374
+ $pocetb += 2;
375
+ if ($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
376 376
 };
377 377
 
378
-for($x=0;$x<strlen($Data);$x++)
378
+for ($x = 0; $x < strlen($Data); $x++)
379 379
  {
380
-  imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]);
380
+  imagesetpixel($img, $x, $y, $Palette[ord($Data[$x])]);
381 381
  };
382
-$Data="";
382
+$Data = "";
383 383
 
384 384
 };
385 385
 
386 386
 };
387 387
 
388 388
 
389
- if($biBitCount==24)
389
+ if ($biBitCount == 24)
390 390
 {
391
- $img=imagecreatetruecolor($Width,$Height);
392
- $Zbytek=$Width%4;
391
+ $img = imagecreatetruecolor($Width, $Height);
392
+ $Zbytek = $Width % 4;
393 393
 
394
-   for($y=$Height-1;$y>=0;$y--)
394
+   for ($y = $Height - 1; $y >= 0; $y--)
395 395
     {
396
-     for($x=0;$x<$Width;$x++)
396
+     for ($x = 0; $x < $Width; $x++)
397 397
       {
398
-       $B=freadbyte($f);
399
-       $G=freadbyte($f);
400
-       $R=freadbyte($f);
401
-       $color=imagecolorexact($img,$R,$G,$B);
402
-       if($color==-1) $color=imagecolorallocate($img,$R,$G,$B);
403
-       imagesetpixel($img,$x,$y,$color);
398
+       $B = freadbyte($f);
399
+       $G = freadbyte($f);
400
+       $R = freadbyte($f);
401
+       $color = imagecolorexact($img, $R, $G, $B);
402
+       if ($color == -1) $color = imagecolorallocate($img, $R, $G, $B);
403
+       imagesetpixel($img, $x, $y, $color);
404 404
       }
405
-    for($z=0;$z<$Zbytek;$z++)
405
+    for ($z = 0; $z < $Zbytek; $z++)
406 406
      freadbyte($f);
407 407
    };
408 408
 };
@@ -438,14 +438,14 @@  discard block
 block discarded – undo
438 438
 
439 439
 function freadbyte($f)
440 440
 {
441
- return ord(fread($f,1));
441
+ return ord(fread($f, 1));
442 442
 };
443 443
 
444 444
 function freadword($f)
445 445
 {
446
- $b1=freadbyte($f);
447
- $b2=freadbyte($f);
448
- return $b2*256+$b1;
446
+ $b1 = freadbyte($f);
447
+ $b2 = freadbyte($f);
448
+ return $b2 * 256 + $b1;
449 449
 };
450 450
 
451 451
 
@@ -456,72 +456,72 @@  discard block
 block discarded – undo
456 456
 
457 457
 function freaddword($f)
458 458
 {
459
- $b1=freadword($f);
460
- $b2=freadword($f);
461
- return $b2*65536+$b1;
459
+ $b1 = freadword($f);
460
+ $b2 = freadword($f);
461
+ return $b2 * 65536 + $b1;
462 462
 };
463 463
 
464 464
 
465 465
 
466
-function RetBits($byte,$start,$len)
466
+function RetBits($byte, $start, $len)
467 467
 {
468
-$bin=decbin8($byte);
469
-$r=bindec(substr($bin,$start,$len));
468
+$bin = decbin8($byte);
469
+$r = bindec(substr($bin, $start, $len));
470 470
 return $r;
471 471
 
472 472
 };
473 473
 
474 474
 
475 475
 
476
-$CurrentBit=0;
477
-function freadbits($f,$count)
476
+$CurrentBit = 0;
477
+function freadbits($f, $count)
478 478
 {
479
- global $CurrentBit,$SMode;
480
- $Byte=freadbyte($f);
481
- $LastCBit=$CurrentBit;
482
- $CurrentBit+=$count;
483
- if($CurrentBit==8)
479
+ global $CurrentBit, $SMode;
480
+ $Byte = freadbyte($f);
481
+ $LastCBit = $CurrentBit;
482
+ $CurrentBit += $count;
483
+ if ($CurrentBit == 8)
484 484
   {
485
-   $CurrentBit=0;
485
+   $CurrentBit = 0;
486 486
   }
487 487
  else
488 488
   {
489
-   fseek($f,ftell($f)-1);
489
+   fseek($f, ftell($f) - 1);
490 490
   };
491
- return RetBits($Byte,$LastCBit,$count);
491
+ return RetBits($Byte, $LastCBit, $count);
492 492
 };
493 493
 
494 494
 
495 495
 
496
-function RGBToHex($Red,$Green,$Blue)
496
+function RGBToHex($Red, $Green, $Blue)
497 497
   {
498
-   $hRed=dechex($Red);if(strlen($hRed)==1) $hRed="0$hRed";
499
-   $hGreen=dechex($Green);if(strlen($hGreen)==1) $hGreen="0$hGreen";
500
-   $hBlue=dechex($Blue);if(strlen($hBlue)==1) $hBlue="0$hBlue";
501
-   return($hRed.$hGreen.$hBlue);
498
+   $hRed = dechex($Red); if (strlen($hRed) == 1) $hRed = "0$hRed";
499
+   $hGreen = dechex($Green); if (strlen($hGreen) == 1) $hGreen = "0$hGreen";
500
+   $hBlue = dechex($Blue); if (strlen($hBlue) == 1) $hBlue = "0$hBlue";
501
+   return($hRed . $hGreen . $hBlue);
502 502
   };
503 503
 
504 504
         function int_to_dword($n)
505 505
         {
506
-                return chr($n & 255).chr(($n >> 8) & 255).chr(($n >> 16) & 255).chr(($n >> 24) & 255);
506
+                return chr($n & 255) . chr(($n >> 8) & 255) . chr(($n >> 16) & 255) . chr(($n >> 24) & 255);
507 507
         }
508 508
         function int_to_word($n)
509 509
         {
510
-                return chr($n & 255).chr(($n >> 8) & 255);
510
+                return chr($n & 255) . chr(($n >> 8) & 255);
511 511
         }
512 512
 
513 513
 
514 514
 function decbin8($d)
515 515
 {
516
-return decbinx($d,8);
516
+return decbinx($d, 8);
517 517
 };
518 518
 
519
-function decbinx($d,$n)
519
+function decbinx($d, $n)
520 520
 {
521
-$bin=decbin($d);
522
-$sbin=strlen($bin);
523
-for($j=0;$j<$n-$sbin;$j++)
524
- $bin="0$bin";
521
+$bin = decbin($d);
522
+$sbin = strlen($bin);
523
+for ($j = 0; $j < $n - $sbin; $j++)
524
+ $bin = "0$bin";
525 525
 return $bin;
526 526
 };
527 527
 
Please login to merge, or discard this patch.
htdocs/lib2/OcSmarty.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     public $main_template = 'sys_main';
18 18
     public $bench = null;
19 19
     public $compile_id = null;
20
-    public $cache_id = null;    // This is a smarty caching ID, not a caches.cache_id.
20
+    public $cache_id = null; // This is a smarty caching ID, not a caches.cache_id.
21 21
     public $title = '';
22 22
     public $menuitem = null;
23 23
     public $nowpsearch = false;
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 
386 386
         $args = func_get_args();
387 387
         unset($args[0]);
388
-        for ($i = 1; isset($args[$i]); $i ++) {
388
+        for ($i = 1; isset($args[$i]); $i++) {
389 389
             $this->assign('p' . $i, $args[$i]);
390 390
         }
391 391
 
Please login to merge, or discard this patch.