@@ -31,7 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | $newlist_public = isset($_REQUEST['newlist_public']); |
33 | 33 | $newlist_watch = isset($_REQUEST['newlist_watch']); |
34 | -$default_list = isset($_REQUEST['listid']) ? (int) $_REQUEST['listid'] : cachelist::getMyLastAddedToListId(); |
|
34 | +$default_list = isset($_REQUEST['listid']) ? (int)$_REQUEST['listid'] : cachelist::getMyLastAddedToListId(); |
|
35 | 35 | |
36 | 36 | if (isset($_REQUEST['save']) && isset($_REQUEST['listid'])) { |
37 | 37 | $listid = $_REQUEST['listid'] + 0; |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | define('RE_TYPE_FLOAT', 5); |
17 | 17 | define('RE_TYPE_DOUBLE', 6); |
18 | 18 | |
19 | -define('RE_INSERT_NOTHING', 0); // |
|
20 | -define('RE_INSERT_OVERWRITE', 1); // ignore given values and use function |
|
21 | -define('RE_INSERT_IGNORE', 2); // dont use this column on insert |
|
19 | +define('RE_INSERT_NOTHING', 0); // |
|
20 | +define('RE_INSERT_OVERWRITE', 1); // ignore given values and use function |
|
21 | +define('RE_INSERT_IGNORE', 2); // dont use this column on insert |
|
22 | 22 | define('RE_INSERT_AUTOINCREMENT', 4); // column is an auto increment column |
23 | -define('RE_INSERT_AUTOUUID', 8); // if empty, UUID is generated by before insert trigger (not supported for primary key fields) |
|
24 | -define('RE_INSERT_NOW', 16); // NOW() |
|
23 | +define('RE_INSERT_AUTOUUID', 8); // if empty, UUID is generated by before insert trigger (not supported for primary key fields) |
|
24 | +define('RE_INSERT_NOW', 16); // NOW() |
|
25 | 25 | |
26 | 26 | define('EUROPEAN_LETTERS', 'A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'); |
27 | 27 | // ASCII + ISO-8859-1 0xC0..0xFF |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | define('REGEX_FIRST_NAME', REGEX_LAST_NAME); |
32 | 32 | define('REGEX_STATPIC_TEXT', '^[' . EUROPEAN_LETTERS . '0-9\.\-_ @=)(\/\\\&*\$+~#!§%;,-?:\[\]{}¹²³\'\"`\|µ°\%]{0,30}$'); |
33 | 33 | |
34 | -define('ADMIN_TRANSLATE', 1); // edit translation |
|
35 | -define('ADMIN_MAINTAINANCE', 2); // check table etc. |
|
36 | -define('ADMIN_USER', 4); // drop users, caches etc. |
|
37 | -define('ADMIN_NEWS', 8); // obsolete / reserved |
|
38 | -define('ADMIN_RESTORE', 16); // restore vandalized listings |
|
39 | -define('ADMIN_ROOT', 128 | 127); // root + all previous rights |
|
40 | -define('ADMIN_LISTING', 1024); // can edit any cache listings |
|
34 | +define('ADMIN_TRANSLATE', 1); // edit translation |
|
35 | +define('ADMIN_MAINTAINANCE', 2); // check table etc. |
|
36 | +define('ADMIN_USER', 4); // drop users, caches etc. |
|
37 | +define('ADMIN_NEWS', 8); // obsolete / reserved |
|
38 | +define('ADMIN_RESTORE', 16); // restore vandalized listings |
|
39 | +define('ADMIN_ROOT', 128 | 127); // root + all previous rights |
|
40 | +define('ADMIN_LISTING', 1024); // can edit any cache listings |
|
41 | 41 | |
42 | 42 | define('ATTRIB_SELECTED', 1); |
43 | 43 | define('ATTRIB_UNSELECTED', 2); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | define('USR_OPT_GMZOOM', 1); |
69 | 69 | define('USR_OPT_SHOWSTATS', 5); |
70 | 70 | define('USR_OPT_MAP_MENU', 6); |
71 | -define('USR_OPT_MAP_OVERVIEW', 7); // obsolete, no longer supported since Google Maps 3.22 |
|
71 | +define('USR_OPT_MAP_OVERVIEW', 7); // obsolete, no longer supported since Google Maps 3.22 |
|
72 | 72 | define('USR_OPT_MAP_MAXCACHES', 8); |
73 | 73 | define('USR_OPT_MAP_ICONSET', 9); |
74 | 74 | define('USR_OPT_MAP_PREVIEW', 10); |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | // ID 15 was temporarily used and is reserved, see commit dda7ef0. Continue with 16. |
80 | 80 | |
81 | 81 | // user.data_license values |
82 | -define('OLD_DATA_LICSENSE', 0); // before deadline |
|
83 | -define('NEW_DATA_LICENSE_ACTIVELY_DECLINED', 1); // declined license |
|
84 | -define('NEW_DATA_LICENSE_ACTIVELY_ACCEPTED', 2); // accepted new license on registration |
|
85 | -define('NEW_DATA_LICENSE_PASSIVELY_ACCEPTED', 3); // did not decline license until deadline |
|
86 | -define('NEW_DATA_LICENSE_PASSIVELY_DECLINED', 4); // could not accept/decline because disabled |
|
82 | +define('OLD_DATA_LICSENSE', 0); // before deadline |
|
83 | +define('NEW_DATA_LICENSE_ACTIVELY_DECLINED', 1); // declined license |
|
84 | +define('NEW_DATA_LICENSE_ACTIVELY_ACCEPTED', 2); // accepted new license on registration |
|
85 | +define('NEW_DATA_LICENSE_PASSIVELY_ACCEPTED', 3); // did not decline license until deadline |
|
86 | +define('NEW_DATA_LICENSE_PASSIVELY_DECLINED', 4); // could not accept/decline because disabled |
|
87 | 87 | |
88 | 88 | //picture upload/resize parameters |
89 | 89 | define('PICTURE_QUALITY', 85); |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | * $opt['locale'] |
18 | 18 | ***************************************************************************/ |
19 | 19 | |
20 | -define('OC_LOCALE_ACTIVE', 2); // enable language and show language button in header line |
|
21 | -define('OC_LOCALE_HIDDEN', 1); // enable language but hide language button in header line |
|
22 | -define('OC_LOCALE_DISABLED', 0); // disable language |
|
20 | +define('OC_LOCALE_ACTIVE', 2); // enable language and show language button in header line |
|
21 | +define('OC_LOCALE_HIDDEN', 1); // enable language but hide language button in header line |
|
22 | +define('OC_LOCALE_DISABLED', 0); // disable language |
|
23 | 23 | |
24 | 24 | $opt['template']['locales']['DE']['status'] = OC_LOCALE_ACTIVE; |
25 | 25 | $opt['template']['locales']['DE']['flag'] = 'images/flag/DE.png'; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $opt['locale']['DE']['page']['license'] = '<a rel="license" href="%1"><img alt="Creative Commons Lizenzvertrag" style="border-width:0" src="resource2/ocstyle/images/media/cc-by-nc-nd-small.png" /></a><div style="text-align:center; margin:8px 0 0 6px;">Die <a href="articles.php?page=impressum#datalicense">Inhalte</a> von {site} stehen unter der Creative-Commons-Lizenz <a rel="license" href="%1">BY-NC-ND 3.0 DE</a>.</div>'; |
132 | 132 | $opt['locale']['DE']['helpwiki'] = 'http://wiki.opencaching.de/index.php/'; |
133 | 133 | $opt['locale']['DE']['mostly_translated'] = true; |
134 | -$opt['locale']['DE']['what3words'] = true; // "beta" |
|
134 | +$opt['locale']['DE']['what3words'] = true; // "beta" |
|
135 | 135 | |
136 | 136 | $opt['locale']['IT']['format']['dateshort'] = '%d/%m/%y'; |
137 | 137 | $opt['locale']['IT']['format']['dm'] = '%d/%m'; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $opt['locale']['SV']['page']['subtitle1'] = 'Geocaching med Opencaching'; |
234 | 234 | $opt['locale']['SV']['page']['subtitle2'] = ''; |
235 | 235 | $opt['locale']['SV']['mostly_translated'] = false; |
236 | -$opt['locale']['SV']['what3words'] = true; // "beta" |
|
236 | +$opt['locale']['SV']['what3words'] = true; // "beta" |
|
237 | 237 | |
238 | 238 | $opt['locale']['NO']['format']['dateshort'] = '%d.%m.%y'; |
239 | 239 | $opt['locale']['NO']['format']['dm'] = '%d.%m.'; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $opt['locale']['RU']['country'] = 'RU'; |
284 | 284 | $opt['locale']['RU']['primary_lang_of'] = ['RU']; |
285 | 285 | $opt['locale']['RU']['mostly_translated'] = false; |
286 | -$opt['locale']['RU']['what3words'] = true; // "beta" |
|
286 | +$opt['locale']['RU']['what3words'] = true; // "beta" |
|
287 | 287 | |
288 | 288 | $opt['locale']['DA']['format']['dateshort'] = '%d.%m.%y'; |
289 | 289 | $opt['locale']['DA']['format']['dm'] = '%d.%m.'; |
@@ -144,7 +144,7 @@ |
||
144 | 144 | |
145 | 145 | /* default locale |
146 | 146 | */ |
147 | -$opt['template']['default']['locale'] = 'DE'; // can be overwritten by $opt['domain'][<domain>]['locale'] |
|
147 | +$opt['template']['default']['locale'] = 'DE'; // can be overwritten by $opt['domain'][<domain>]['locale'] |
|
148 | 148 | |
149 | 149 | // include all locale settings |
150 | 150 | require_once $rootpath . 'config2/locale.inc.php'; |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | // muss dieses & ersetzt werden, oder ist es escaped? |
240 | 240 | $escapesCount = 0; |
241 | 241 | while ((($nextarg - $escapesCount - 1) > 0) && (mb_substr($sql, $nextarg - $escapesCount - 1, 1) == '\\')) { |
242 | - $escapesCount ++; |
|
242 | + $escapesCount++; |
|
243 | 243 | } |
244 | 244 | if (($escapesCount % 2) == 1) { |
245 | - $nextarg ++; |
|
245 | + $nextarg++; |
|
246 | 246 | } else { |
247 | 247 | $nextchar = mb_substr($sql, $nextarg + 1, 1); |
248 | 248 | if (is_numeric($nextchar)) { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | while (mb_ereg_match('^[0-9]{1}', $nextchar) == 1) { |
254 | 254 | $arg .= $nextchar; |
255 | 255 | |
256 | - $arglength ++; |
|
256 | + $arglength++; |
|
257 | 257 | $nextchar = mb_substr($sql, $nextarg + $arglength + 1, 1); |
258 | 258 | } |
259 | 259 | |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | // Anführungszeichen weg machen und NULL einsetzen |
286 | 286 | $filtered_sql = mb_substr($filtered_sql, 0, mb_strlen($filtered_sql) - 1); |
287 | 287 | $filtered_sql .= 'NULL'; |
288 | - $sqlpos ++; |
|
288 | + $sqlpos++; |
|
289 | 289 | } else { |
290 | 290 | $filtered_sql .= 'NULL'; |
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | - $sqlpos ++; |
|
294 | + $sqlpos++; |
|
295 | 295 | } else { |
296 | 296 | $arglength = 0; |
297 | 297 | $arg = ''; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | while (mb_ereg_match('^[a-zA-Z0-9]{1}', $nextchar) == 1) { |
301 | 301 | $arg .= $nextchar; |
302 | 302 | |
303 | - $arglength ++; |
|
303 | + $arglength++; |
|
304 | 304 | $nextchar = mb_substr($sql, $nextarg + $arglength + 1, 1); |
305 | 305 | } |
306 | 306 | |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | $escapesCount = 0; |
330 | 330 | while ((($nextarg - $escapesCount - 1) > 0) && |
331 | 331 | (mb_substr($filtered_sql, $nextarg - $escapesCount - 1, 1) == '\\')) { |
332 | - $escapesCount ++; |
|
332 | + $escapesCount++; |
|
333 | 333 | } |
334 | 334 | if (($escapesCount % 2) == 0) { |
335 | 335 | // \& ersetzen durch & |
336 | 336 | $filtered_sql = mb_substr($filtered_sql, 0, $nextarg) . '&' . mb_substr($filtered_sql, $nextarg + 2); |
337 | - $nextarg --; |
|
337 | + $nextarg--; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | $nextarg = mb_strpos($filtered_sql, '\&', $nextarg + 2); |
@@ -43,7 +43,7 @@ |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | $process = new Process($cmd, $this->rootPath, null, null, 9600); |
46 | - $process->run(function ($type, $buffer) { |
|
46 | + $process->run(function($type, $buffer) { |
|
47 | 47 | echo $buffer; |
48 | 48 | }); |
49 | 49 |
@@ -54,7 +54,7 @@ |
||
54 | 54 | ] |
55 | 55 | ); |
56 | 56 | |
57 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { |
|
57 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { |
|
58 | 58 | $data = $event->getData(); |
59 | 59 | $form = $event->getForm(); |
60 | 60 |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | // & escaped? |
182 | 182 | $escapesCount = 0; |
183 | 183 | while ((($nextarg - $escapesCount - 1) > 0) && (substr($sql, $nextarg - $escapesCount - 1, 1) == '\\')) { |
184 | - $escapesCount ++; |
|
184 | + $escapesCount++; |
|
185 | 185 | } |
186 | 186 | if (($escapesCount % 2) === 1) { |
187 | 187 | $nextarg++; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | while (preg_match('/^[0-9]{1}/', $nextchar) === 1) { |
196 | 196 | $arg .= $nextchar; |
197 | 197 | |
198 | - $arglength ++; |
|
198 | + $arglength++; |
|
199 | 199 | $nextchar = substr($sql, $nextarg + $arglength + 1, 1); |
200 | 200 | } |
201 | 201 | |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | // strip apostroph and insert NULL |
222 | 222 | $filtered_sql = substr($filtered_sql, 0, strlen($filtered_sql) - 1); |
223 | 223 | $filtered_sql .= 'NULL'; |
224 | - $sqlpos ++; |
|
224 | + $sqlpos++; |
|
225 | 225 | } else { |
226 | 226 | $filtered_sql .= 'NULL'; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - $sqlpos ++; |
|
230 | + $sqlpos++; |
|
231 | 231 | } else { |
232 | 232 | $arglength = 0; |
233 | 233 | $arg = ''; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | while (preg_match('/^[a-zA-Z0-9_]{1}/', $nextchar) == 1) { |
238 | 238 | $arg .= $nextchar; |
239 | 239 | |
240 | - $arglength ++; |
|
240 | + $arglength++; |
|
241 | 241 | $nextchar = substr($sql, $nextarg + $arglength + 1, 1); |
242 | 242 | } |
243 | 243 | |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | $escapesCount = 0; |
285 | 285 | while ((($nextarg - $escapesCount - 1) > 0) |
286 | 286 | && (substr($filtered_sql, $nextarg - $escapesCount - 1, 1) == '\\')) { |
287 | - $escapesCount ++; |
|
287 | + $escapesCount++; |
|
288 | 288 | } |
289 | 289 | if (($escapesCount % 2) == 0) { |
290 | 290 | // strip escapes of & |
291 | 291 | $filtered_sql = substr($filtered_sql, 0, $nextarg) . '&' . substr($filtered_sql, $nextarg + 2); |
292 | - $nextarg --; |
|
292 | + $nextarg--; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $nextarg = strpos($filtered_sql, '\&', $nextarg + 2); |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | AND `online`= 1 |
827 | 827 | AND (TIMESTAMP(NOW())-TIMESTAMP(`last_check`)+`time_diff`<'&1') |
828 | 828 | ORDER BY `w` DESC LIMIT 1", |
829 | - - 1, |
|
829 | + -1, |
|
830 | 830 | $nMaxTimeDiff |
831 | 831 | ); |
832 | 832 |
@@ -29,164 +29,164 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @param resource $img |
31 | 31 | */ |
32 | -function imagebmp($img,$file="",$RLE=0) |
|
32 | +function imagebmp($img, $file = "", $RLE = 0) |
|
33 | 33 | { |
34 | 34 | |
35 | 35 | |
36 | -$ColorCount=imagecolorstotal($img); |
|
36 | +$ColorCount = imagecolorstotal($img); |
|
37 | 37 | |
38 | -$Transparent=imagecolortransparent($img); |
|
39 | -$IsTransparent=$Transparent!=-1; |
|
38 | +$Transparent = imagecolortransparent($img); |
|
39 | +$IsTransparent = $Transparent != -1; |
|
40 | 40 | |
41 | 41 | |
42 | -if($IsTransparent) $ColorCount--; |
|
42 | +if ($IsTransparent) $ColorCount--; |
|
43 | 43 | |
44 | -if($ColorCount==0) {$ColorCount=0; $BitCount=24;}; |
|
45 | -if(($ColorCount>0)and($ColorCount<=2)) {$ColorCount=2; $BitCount=1;}; |
|
46 | -if(($ColorCount>2)and($ColorCount<=16)) { $ColorCount=16; $BitCount=4;}; |
|
47 | -if(($ColorCount>16)and($ColorCount<=256)) { $ColorCount=0; $BitCount=8;}; |
|
44 | +if ($ColorCount == 0) {$ColorCount = 0; $BitCount = 24; }; |
|
45 | +if (($ColorCount > 0) and ($ColorCount <= 2)) {$ColorCount = 2; $BitCount = 1; }; |
|
46 | +if (($ColorCount > 2) and ($ColorCount <= 16)) { $ColorCount = 16; $BitCount = 4; }; |
|
47 | +if (($ColorCount > 16) and ($ColorCount <= 256)) { $ColorCount = 0; $BitCount = 8; }; |
|
48 | 48 | |
49 | 49 | |
50 | - $Width=imagesx($img); |
|
51 | - $Height=imagesy($img); |
|
50 | + $Width = imagesx($img); |
|
51 | + $Height = imagesy($img); |
|
52 | 52 | |
53 | - $Zbytek=(4-($Width/(8/$BitCount))%4)%4; |
|
53 | + $Zbytek = (4 - ($Width / (8 / $BitCount)) % 4) % 4; |
|
54 | 54 | |
55 | - if($BitCount<24) $palsize=pow(2,$BitCount)*4; |
|
55 | + if ($BitCount < 24) $palsize = pow(2, $BitCount) * 4; |
|
56 | 56 | |
57 | - $size=(floor($Width/(8/$BitCount))+$Zbytek)*$Height+54; |
|
58 | - $size+=$palsize; |
|
59 | - $offset=54+$palsize; |
|
57 | + $size = (floor($Width / (8 / $BitCount)) + $Zbytek) * $Height + 54; |
|
58 | + $size += $palsize; |
|
59 | + $offset = 54 + $palsize; |
|
60 | 60 | |
61 | 61 | // Bitmap File Header |
62 | - $ret = 'BM'; // header (2b) |
|
63 | - $ret .= int_to_dword($size); // size of file (4b) |
|
64 | - $ret .= int_to_dword(0); // reserved (4b) |
|
65 | - $ret .= int_to_dword($offset); // byte location in the file which is first byte of IMAGE (4b) |
|
62 | + $ret = 'BM'; // header (2b) |
|
63 | + $ret .= int_to_dword($size); // size of file (4b) |
|
64 | + $ret .= int_to_dword(0); // reserved (4b) |
|
65 | + $ret .= int_to_dword($offset); // byte location in the file which is first byte of IMAGE (4b) |
|
66 | 66 | // Bitmap Info Header |
67 | - $ret .= int_to_dword(40); // Size of BITMAPINFOHEADER (4b) |
|
68 | - $ret .= int_to_dword($Width); // width of bitmap (4b) |
|
69 | - $ret .= int_to_dword($Height); // height of bitmap (4b) |
|
70 | - $ret .= int_to_word(1); // biPlanes = 1 (2b) |
|
71 | - $ret .= int_to_word($BitCount); // biBitCount = {1 (mono) or 4 (16 clr ) or 8 (256 clr) or 24 (16 Mil)} (2b) |
|
72 | - $ret .= int_to_dword($RLE); // RLE COMPRESSION (4b) |
|
73 | - $ret .= int_to_dword(0); // width x height (4b) |
|
74 | - $ret .= int_to_dword(0); // biXPelsPerMeter (4b) |
|
75 | - $ret .= int_to_dword(0); // biYPelsPerMeter (4b) |
|
76 | - $ret .= int_to_dword(0); // Number of palettes used (4b) |
|
77 | - $ret .= int_to_dword(0); // Number of important colour (4b) |
|
67 | + $ret .= int_to_dword(40); // Size of BITMAPINFOHEADER (4b) |
|
68 | + $ret .= int_to_dword($Width); // width of bitmap (4b) |
|
69 | + $ret .= int_to_dword($Height); // height of bitmap (4b) |
|
70 | + $ret .= int_to_word(1); // biPlanes = 1 (2b) |
|
71 | + $ret .= int_to_word($BitCount); // biBitCount = {1 (mono) or 4 (16 clr ) or 8 (256 clr) or 24 (16 Mil)} (2b) |
|
72 | + $ret .= int_to_dword($RLE); // RLE COMPRESSION (4b) |
|
73 | + $ret .= int_to_dword(0); // width x height (4b) |
|
74 | + $ret .= int_to_dword(0); // biXPelsPerMeter (4b) |
|
75 | + $ret .= int_to_dword(0); // biYPelsPerMeter (4b) |
|
76 | + $ret .= int_to_dword(0); // Number of palettes used (4b) |
|
77 | + $ret .= int_to_dword(0); // Number of important colour (4b) |
|
78 | 78 | // image data |
79 | 79 | |
80 | - $CC=$ColorCount; |
|
81 | - $sl1=strlen($ret); |
|
82 | - if($CC==0) $CC=256; |
|
83 | - if($BitCount<24) |
|
80 | + $CC = $ColorCount; |
|
81 | + $sl1 = strlen($ret); |
|
82 | + if ($CC == 0) $CC = 256; |
|
83 | + if ($BitCount < 24) |
|
84 | 84 | { |
85 | - $ColorTotal=imagecolorstotal($img); |
|
86 | - if($IsTransparent) $ColorTotal--; |
|
85 | + $ColorTotal = imagecolorstotal($img); |
|
86 | + if ($IsTransparent) $ColorTotal--; |
|
87 | 87 | |
88 | - for($p=0;$p<$ColorTotal;$p++) |
|
88 | + for ($p = 0; $p < $ColorTotal; $p++) |
|
89 | 89 | { |
90 | - $color=imagecolorsforindex($img,$p); |
|
91 | - $ret.=inttobyte($color["blue"]); |
|
92 | - $ret.=inttobyte($color["green"]); |
|
93 | - $ret.=inttobyte($color["red"]); |
|
94 | - $ret.=inttobyte(0); //RESERVED |
|
90 | + $color = imagecolorsforindex($img, $p); |
|
91 | + $ret .= inttobyte($color["blue"]); |
|
92 | + $ret .= inttobyte($color["green"]); |
|
93 | + $ret .= inttobyte($color["red"]); |
|
94 | + $ret .= inttobyte(0); //RESERVED |
|
95 | 95 | }; |
96 | 96 | |
97 | - $CT=$ColorTotal; |
|
98 | - for($p=$ColorTotal;$p<$CC;$p++) |
|
97 | + $CT = $ColorTotal; |
|
98 | + for ($p = $ColorTotal; $p < $CC; $p++) |
|
99 | 99 | { |
100 | - $ret.=inttobyte(0); |
|
101 | - $ret.=inttobyte(0); |
|
102 | - $ret.=inttobyte(0); |
|
103 | - $ret.=inttobyte(0); //RESERVED |
|
100 | + $ret .= inttobyte(0); |
|
101 | + $ret .= inttobyte(0); |
|
102 | + $ret .= inttobyte(0); |
|
103 | + $ret .= inttobyte(0); //RESERVED |
|
104 | 104 | }; |
105 | 105 | }; |
106 | 106 | |
107 | 107 | |
108 | -if($BitCount<=8) |
|
108 | +if ($BitCount <= 8) |
|
109 | 109 | { |
110 | 110 | |
111 | - for($y=$Height-1;$y>=0;$y--) |
|
111 | + for ($y = $Height - 1; $y >= 0; $y--) |
|
112 | 112 | { |
113 | - $bWrite=""; |
|
114 | - for($x=0;$x<$Width;$x++) |
|
113 | + $bWrite = ""; |
|
114 | + for ($x = 0; $x < $Width; $x++) |
|
115 | 115 | { |
116 | - $color=imagecolorat($img,$x,$y); |
|
117 | - $bWrite.=decbinx($color,$BitCount); |
|
118 | - if(strlen($bWrite)==8) |
|
116 | + $color = imagecolorat($img, $x, $y); |
|
117 | + $bWrite .= decbinx($color, $BitCount); |
|
118 | + if (strlen($bWrite) == 8) |
|
119 | 119 | { |
120 | - $retd.=inttobyte(bindec($bWrite)); |
|
121 | - $bWrite=""; |
|
120 | + $retd .= inttobyte(bindec($bWrite)); |
|
121 | + $bWrite = ""; |
|
122 | 122 | }; |
123 | 123 | }; |
124 | 124 | |
125 | - if((strlen($bWrite)<8)and(strlen($bWrite)!=0)) |
|
125 | + if ((strlen($bWrite) < 8) and (strlen($bWrite) != 0)) |
|
126 | 126 | { |
127 | - $sl=strlen($bWrite); |
|
128 | - for($t=0;$t<8-$sl;$t++) |
|
129 | - $sl.="0"; |
|
130 | - $retd.=inttobyte(bindec($bWrite)); |
|
127 | + $sl = strlen($bWrite); |
|
128 | + for ($t = 0; $t < 8 - $sl; $t++) |
|
129 | + $sl .= "0"; |
|
130 | + $retd .= inttobyte(bindec($bWrite)); |
|
131 | 131 | }; |
132 | - for($z=0;$z<$Zbytek;$z++) |
|
133 | - $retd.=inttobyte(0); |
|
132 | + for ($z = 0; $z < $Zbytek; $z++) |
|
133 | + $retd .= inttobyte(0); |
|
134 | 134 | }; |
135 | 135 | }; |
136 | 136 | |
137 | -if(($RLE==1)and($BitCount==8)) |
|
137 | +if (($RLE == 1) and ($BitCount == 8)) |
|
138 | 138 | { |
139 | - for($t=0;$t<strlen($retd);$t+=4) |
|
139 | + for ($t = 0; $t < strlen($retd); $t += 4) |
|
140 | 140 | { |
141 | - if($t!=0) |
|
142 | - if(($t)%$Width==0) |
|
143 | - $ret.=chr(0).chr(0); |
|
141 | + if ($t != 0) |
|
142 | + if (($t) % $Width == 0) |
|
143 | + $ret .= chr(0) . chr(0); |
|
144 | 144 | |
145 | - if(($t+5)%$Width==0) |
|
145 | + if (($t + 5) % $Width == 0) |
|
146 | 146 | { |
147 | - $ret.=chr(0).chr(5).substr($retd,$t,5).chr(0); |
|
148 | - $t+=1; |
|
147 | + $ret .= chr(0) . chr(5) . substr($retd, $t, 5) . chr(0); |
|
148 | + $t += 1; |
|
149 | 149 | } |
150 | - if(($t+6)%$Width==0) |
|
150 | + if (($t + 6) % $Width == 0) |
|
151 | 151 | { |
152 | - $ret.=chr(0).chr(6).substr($retd,$t,6); |
|
153 | - $t+=2; |
|
152 | + $ret .= chr(0) . chr(6) . substr($retd, $t, 6); |
|
153 | + $t += 2; |
|
154 | 154 | } |
155 | 155 | else |
156 | 156 | { |
157 | - $ret.=chr(0).chr(4).substr($retd,$t,4); |
|
157 | + $ret .= chr(0) . chr(4) . substr($retd, $t, 4); |
|
158 | 158 | }; |
159 | 159 | }; |
160 | - $ret.=chr(0).chr(1); |
|
160 | + $ret .= chr(0) . chr(1); |
|
161 | 161 | } |
162 | 162 | else |
163 | 163 | { |
164 | -$ret.=$retd; |
|
164 | +$ret .= $retd; |
|
165 | 165 | }; |
166 | 166 | |
167 | 167 | |
168 | - if($BitCount==24) |
|
168 | + if ($BitCount == 24) |
|
169 | 169 | { |
170 | - for($z=0;$z<$Zbytek;$z++) |
|
171 | - $Dopl.=chr(0); |
|
170 | + for ($z = 0; $z < $Zbytek; $z++) |
|
171 | + $Dopl .= chr(0); |
|
172 | 172 | |
173 | - for($y=$Height-1;$y>=0;$y--) |
|
173 | + for ($y = $Height - 1; $y >= 0; $y--) |
|
174 | 174 | { |
175 | - for($x=0;$x<$Width;$x++) |
|
175 | + for ($x = 0; $x < $Width; $x++) |
|
176 | 176 | { |
177 | - $color=imagecolorsforindex($img,ImageColorAt($img,$x,$y)); |
|
178 | - $ret.=chr($color["blue"]).chr($color["green"]).chr($color["red"]); |
|
177 | + $color = imagecolorsforindex($img, ImageColorAt($img, $x, $y)); |
|
178 | + $ret .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]); |
|
179 | 179 | } |
180 | - $ret.=$Dopl; |
|
180 | + $ret .= $Dopl; |
|
181 | 181 | }; |
182 | 182 | |
183 | 183 | }; |
184 | 184 | |
185 | - if($file!="") |
|
185 | + if ($file != "") |
|
186 | 186 | { |
187 | - $r=($f=fopen($file,"w")); |
|
188 | - $r=$r and fwrite($f,$ret); |
|
189 | - $r=$r and fclose($f); |
|
187 | + $r = ($f = fopen($file, "w")); |
|
188 | + $r = $r and fwrite($f, $ret); |
|
189 | + $r = $r and fclose($f); |
|
190 | 190 | return $r; |
191 | 191 | } |
192 | 192 | else |
@@ -211,58 +211,58 @@ discard block |
||
211 | 211 | { |
212 | 212 | global $CurrentBit, $echoMode; |
213 | 213 | |
214 | -$f=fopen($file,"r"); |
|
215 | -$Header=fread($f,2); |
|
214 | +$f = fopen($file, "r"); |
|
215 | +$Header = fread($f, 2); |
|
216 | 216 | |
217 | -if($Header=="BM") |
|
217 | +if ($Header == "BM") |
|
218 | 218 | { |
219 | - $Size=freaddword($f); |
|
220 | - $Reserved1=freadword($f); |
|
221 | - $Reserved2=freadword($f); |
|
222 | - $FirstByteOfImage=freaddword($f); |
|
223 | - |
|
224 | - $SizeBITMAPINFOHEADER=freaddword($f); |
|
225 | - $Width=freaddword($f); |
|
226 | - $Height=freaddword($f); |
|
227 | - $biPlanes=freadword($f); |
|
228 | - $biBitCount=freadword($f); |
|
229 | - $RLECompression=freaddword($f); |
|
230 | - $WidthxHeight=freaddword($f); |
|
231 | - $biXPelsPerMeter=freaddword($f); |
|
232 | - $biYPelsPerMeter=freaddword($f); |
|
233 | - $NumberOfPalettesUsed=freaddword($f); |
|
234 | - $NumberOfImportantColors=freaddword($f); |
|
235 | - |
|
236 | -if($biBitCount<24) |
|
219 | + $Size = freaddword($f); |
|
220 | + $Reserved1 = freadword($f); |
|
221 | + $Reserved2 = freadword($f); |
|
222 | + $FirstByteOfImage = freaddword($f); |
|
223 | + |
|
224 | + $SizeBITMAPINFOHEADER = freaddword($f); |
|
225 | + $Width = freaddword($f); |
|
226 | + $Height = freaddword($f); |
|
227 | + $biPlanes = freadword($f); |
|
228 | + $biBitCount = freadword($f); |
|
229 | + $RLECompression = freaddword($f); |
|
230 | + $WidthxHeight = freaddword($f); |
|
231 | + $biXPelsPerMeter = freaddword($f); |
|
232 | + $biYPelsPerMeter = freaddword($f); |
|
233 | + $NumberOfPalettesUsed = freaddword($f); |
|
234 | + $NumberOfImportantColors = freaddword($f); |
|
235 | + |
|
236 | +if ($biBitCount < 24) |
|
237 | 237 | { |
238 | - $img=imagecreate($Width,$Height); |
|
239 | - $Colors=pow(2,$biBitCount); |
|
240 | - for($p=0;$p<$Colors;$p++) |
|
238 | + $img = imagecreate($Width, $Height); |
|
239 | + $Colors = pow(2, $biBitCount); |
|
240 | + for ($p = 0; $p < $Colors; $p++) |
|
241 | 241 | { |
242 | - $B=freadbyte($f); |
|
243 | - $G=freadbyte($f); |
|
244 | - $R=freadbyte($f); |
|
245 | - $Reserved=freadbyte($f); |
|
246 | - $Palette[]=imagecolorallocate($img,$R,$G,$B); |
|
242 | + $B = freadbyte($f); |
|
243 | + $G = freadbyte($f); |
|
244 | + $R = freadbyte($f); |
|
245 | + $Reserved = freadbyte($f); |
|
246 | + $Palette[] = imagecolorallocate($img, $R, $G, $B); |
|
247 | 247 | }; |
248 | 248 | |
249 | 249 | |
250 | 250 | |
251 | 251 | |
252 | -if($RLECompression==0) |
|
252 | +if ($RLECompression == 0) |
|
253 | 253 | { |
254 | - $Zbytek=(4-ceil(($Width/(8/$biBitCount)))%4)%4; |
|
254 | + $Zbytek = (4 - ceil(($Width / (8 / $biBitCount))) % 4) % 4; |
|
255 | 255 | |
256 | -for($y=$Height-1;$y>=0;$y--) |
|
256 | +for ($y = $Height - 1; $y >= 0; $y--) |
|
257 | 257 | { |
258 | - $CurrentBit=0; |
|
259 | - for($x=0;$x<$Width;$x++) |
|
258 | + $CurrentBit = 0; |
|
259 | + for ($x = 0; $x < $Width; $x++) |
|
260 | 260 | { |
261 | - $C=freadbits($f,$biBitCount); |
|
262 | - imagesetpixel($img,$x,$y,$Palette[$C]); |
|
261 | + $C = freadbits($f, $biBitCount); |
|
262 | + imagesetpixel($img, $x, $y, $Palette[$C]); |
|
263 | 263 | }; |
264 | - if($CurrentBit!=0) {freadbyte($f);}; |
|
265 | - for($g=0;$g<$Zbytek;$g++) |
|
264 | + if ($CurrentBit != 0) {freadbyte($f); }; |
|
265 | + for ($g = 0; $g < $Zbytek; $g++) |
|
266 | 266 | freadbyte($f); |
267 | 267 | }; |
268 | 268 | |
@@ -270,142 +270,142 @@ discard block |
||
270 | 270 | }; |
271 | 271 | |
272 | 272 | |
273 | -if($RLECompression==1) //$BI_RLE8 |
|
273 | +if ($RLECompression == 1) //$BI_RLE8 |
|
274 | 274 | { |
275 | -$y=$Height; |
|
275 | +$y = $Height; |
|
276 | 276 | |
277 | -$pocetb=0; |
|
277 | +$pocetb = 0; |
|
278 | 278 | |
279 | -while(true) |
|
279 | +while (true) |
|
280 | 280 | { |
281 | 281 | $y--; |
282 | -$prefix=freadbyte($f); |
|
283 | -$suffix=freadbyte($f); |
|
284 | -$pocetb+=2; |
|
282 | +$prefix = freadbyte($f); |
|
283 | +$suffix = freadbyte($f); |
|
284 | +$pocetb += 2; |
|
285 | 285 | |
286 | -$echoit=false; |
|
286 | +$echoit = false; |
|
287 | 287 | |
288 | -if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
289 | -if(($prefix==0)and($suffix==1)) break; |
|
290 | -if(feof($f)) break; |
|
288 | +if ($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
289 | +if (($prefix == 0) and ($suffix == 1)) break; |
|
290 | +if (feof($f)) break; |
|
291 | 291 | |
292 | -while(!(($prefix==0)and($suffix==0))) |
|
292 | +while (!(($prefix == 0) and ($suffix == 0))) |
|
293 | 293 | { |
294 | - if($prefix==0) |
|
294 | + if ($prefix == 0) |
|
295 | 295 | { |
296 | - $pocet=$suffix; |
|
297 | - $Data.=fread($f,$pocet); |
|
298 | - $pocetb+=$pocet; |
|
299 | - if($pocetb%2==1) {freadbyte($f); $pocetb++;}; |
|
296 | + $pocet = $suffix; |
|
297 | + $Data .= fread($f, $pocet); |
|
298 | + $pocetb += $pocet; |
|
299 | + if ($pocetb % 2 == 1) {freadbyte($f); $pocetb++; }; |
|
300 | 300 | }; |
301 | - if($prefix>0) |
|
301 | + if ($prefix > 0) |
|
302 | 302 | { |
303 | - $pocet=$prefix; |
|
304 | - for($r=0;$r<$pocet;$r++) |
|
305 | - $Data.=chr($suffix); |
|
303 | + $pocet = $prefix; |
|
304 | + for ($r = 0; $r < $pocet; $r++) |
|
305 | + $Data .= chr($suffix); |
|
306 | 306 | }; |
307 | - $prefix=freadbyte($f); |
|
308 | - $suffix=freadbyte($f); |
|
309 | - $pocetb+=2; |
|
310 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
307 | + $prefix = freadbyte($f); |
|
308 | + $suffix = freadbyte($f); |
|
309 | + $pocetb += 2; |
|
310 | + if ($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
311 | 311 | }; |
312 | 312 | |
313 | -for($x=0;$x<strlen($Data);$x++) |
|
313 | +for ($x = 0; $x < strlen($Data); $x++) |
|
314 | 314 | { |
315 | - imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); |
|
315 | + imagesetpixel($img, $x, $y, $Palette[ord($Data[$x])]); |
|
316 | 316 | }; |
317 | -$Data=""; |
|
317 | +$Data = ""; |
|
318 | 318 | |
319 | 319 | }; |
320 | 320 | |
321 | 321 | }; |
322 | 322 | |
323 | 323 | |
324 | -if($RLECompression==2) //$BI_RLE4 |
|
324 | +if ($RLECompression == 2) //$BI_RLE4 |
|
325 | 325 | { |
326 | -$y=$Height; |
|
327 | -$pocetb=0; |
|
326 | +$y = $Height; |
|
327 | +$pocetb = 0; |
|
328 | 328 | |
329 | 329 | /*while(!feof($f)) |
330 | 330 | echo freadbyte($f)."_".freadbyte($f)."<BR>";*/ |
331 | -while(true) |
|
331 | +while (true) |
|
332 | 332 | { |
333 | 333 | //break; |
334 | 334 | $y--; |
335 | -$prefix=freadbyte($f); |
|
336 | -$suffix=freadbyte($f); |
|
337 | -$pocetb+=2; |
|
335 | +$prefix = freadbyte($f); |
|
336 | +$suffix = freadbyte($f); |
|
337 | +$pocetb += 2; |
|
338 | 338 | |
339 | -$echoit=false; |
|
339 | +$echoit = false; |
|
340 | 340 | |
341 | -if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
342 | -if(($prefix==0)and($suffix==1)) break; |
|
343 | -if(feof($f)) break; |
|
341 | +if ($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
342 | +if (($prefix == 0) and ($suffix == 1)) break; |
|
343 | +if (feof($f)) break; |
|
344 | 344 | |
345 | -while(!(($prefix==0)and($suffix==0))) |
|
345 | +while (!(($prefix == 0) and ($suffix == 0))) |
|
346 | 346 | { |
347 | - if($prefix==0) |
|
347 | + if ($prefix == 0) |
|
348 | 348 | { |
349 | - $pocet=$suffix; |
|
350 | - |
|
351 | - $CurrentBit=0; |
|
352 | - for($h=0;$h<$pocet;$h++) |
|
353 | - $Data.=chr(freadbits($f,4)); |
|
354 | - if($CurrentBit!=0) freadbits($f,4); |
|
355 | - $pocetb+=ceil(($pocet/2)); |
|
356 | - if($pocetb%2==1) {freadbyte($f); $pocetb++;}; |
|
349 | + $pocet = $suffix; |
|
350 | + |
|
351 | + $CurrentBit = 0; |
|
352 | + for ($h = 0; $h < $pocet; $h++) |
|
353 | + $Data .= chr(freadbits($f, 4)); |
|
354 | + if ($CurrentBit != 0) freadbits($f, 4); |
|
355 | + $pocetb += ceil(($pocet / 2)); |
|
356 | + if ($pocetb % 2 == 1) {freadbyte($f); $pocetb++; }; |
|
357 | 357 | }; |
358 | - if($prefix>0) |
|
358 | + if ($prefix > 0) |
|
359 | 359 | { |
360 | - $pocet=$prefix; |
|
361 | - $i=0; |
|
362 | - for($r=0;$r<$pocet;$r++) |
|
360 | + $pocet = $prefix; |
|
361 | + $i = 0; |
|
362 | + for ($r = 0; $r < $pocet; $r++) |
|
363 | 363 | { |
364 | - if($i%2==0) |
|
364 | + if ($i % 2 == 0) |
|
365 | 365 | { |
366 | - $Data.=chr($suffix%16); |
|
366 | + $Data .= chr($suffix % 16); |
|
367 | 367 | } |
368 | 368 | else |
369 | 369 | { |
370 | - $Data.=chr(floor($suffix/16)); |
|
370 | + $Data .= chr(floor($suffix / 16)); |
|
371 | 371 | }; |
372 | 372 | $i++; |
373 | 373 | }; |
374 | 374 | }; |
375 | - $prefix=freadbyte($f); |
|
376 | - $suffix=freadbyte($f); |
|
377 | - $pocetb+=2; |
|
378 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
375 | + $prefix = freadbyte($f); |
|
376 | + $suffix = freadbyte($f); |
|
377 | + $pocetb += 2; |
|
378 | + if ($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
379 | 379 | }; |
380 | 380 | |
381 | -for($x=0;$x<strlen($Data);$x++) |
|
381 | +for ($x = 0; $x < strlen($Data); $x++) |
|
382 | 382 | { |
383 | - imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); |
|
383 | + imagesetpixel($img, $x, $y, $Palette[ord($Data[$x])]); |
|
384 | 384 | }; |
385 | -$Data=""; |
|
385 | +$Data = ""; |
|
386 | 386 | |
387 | 387 | }; |
388 | 388 | |
389 | 389 | }; |
390 | 390 | |
391 | 391 | |
392 | - if($biBitCount==24) |
|
392 | + if ($biBitCount == 24) |
|
393 | 393 | { |
394 | - $img=imagecreatetruecolor($Width,$Height); |
|
395 | - $Zbytek=$Width%4; |
|
394 | + $img = imagecreatetruecolor($Width, $Height); |
|
395 | + $Zbytek = $Width % 4; |
|
396 | 396 | |
397 | - for($y=$Height-1;$y>=0;$y--) |
|
397 | + for ($y = $Height - 1; $y >= 0; $y--) |
|
398 | 398 | { |
399 | - for($x=0;$x<$Width;$x++) |
|
399 | + for ($x = 0; $x < $Width; $x++) |
|
400 | 400 | { |
401 | - $B=freadbyte($f); |
|
402 | - $G=freadbyte($f); |
|
403 | - $R=freadbyte($f); |
|
404 | - $color=imagecolorexact($img,$R,$G,$B); |
|
405 | - if($color==-1) $color=imagecolorallocate($img,$R,$G,$B); |
|
406 | - imagesetpixel($img,$x,$y,$color); |
|
401 | + $B = freadbyte($f); |
|
402 | + $G = freadbyte($f); |
|
403 | + $R = freadbyte($f); |
|
404 | + $color = imagecolorexact($img, $R, $G, $B); |
|
405 | + if ($color == -1) $color = imagecolorallocate($img, $R, $G, $B); |
|
406 | + imagesetpixel($img, $x, $y, $color); |
|
407 | 407 | } |
408 | - for($z=0;$z<$Zbytek;$z++) |
|
408 | + for ($z = 0; $z < $Zbytek; $z++) |
|
409 | 409 | freadbyte($f); |
410 | 410 | }; |
411 | 411 | }; |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | |
442 | 442 | function freadbyte($f) |
443 | 443 | { |
444 | - return ord(fread($f,1)); |
|
444 | + return ord(fread($f, 1)); |
|
445 | 445 | }; |
446 | 446 | |
447 | 447 | function freadword($f) |
448 | 448 | { |
449 | - $b1=freadbyte($f); |
|
450 | - $b2=freadbyte($f); |
|
451 | - return $b2*256+$b1; |
|
449 | + $b1 = freadbyte($f); |
|
450 | + $b2 = freadbyte($f); |
|
451 | + return $b2 * 256 + $b1; |
|
452 | 452 | }; |
453 | 453 | |
454 | 454 | |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | |
460 | 460 | function freaddword($f) |
461 | 461 | { |
462 | - $b1=freadword($f); |
|
463 | - $b2=freadword($f); |
|
464 | - return $b2*65536+$b1; |
|
462 | + $b1 = freadword($f); |
|
463 | + $b2 = freadword($f); |
|
464 | + return $b2 * 65536 + $b1; |
|
465 | 465 | }; |
466 | 466 | |
467 | 467 | |
@@ -469,51 +469,51 @@ discard block |
||
469 | 469 | /** |
470 | 470 | * @param integer $byte |
471 | 471 | */ |
472 | -function RetBits($byte,$start,$len) |
|
472 | +function RetBits($byte, $start, $len) |
|
473 | 473 | { |
474 | -$bin=decbin8($byte); |
|
475 | -$r=bindec(substr($bin,$start,$len)); |
|
474 | +$bin = decbin8($byte); |
|
475 | +$r = bindec(substr($bin, $start, $len)); |
|
476 | 476 | return $r; |
477 | 477 | |
478 | 478 | }; |
479 | 479 | |
480 | 480 | |
481 | 481 | |
482 | -$CurrentBit=0; |
|
482 | +$CurrentBit = 0; |
|
483 | 483 | /** |
484 | 484 | * @param resource $f |
485 | 485 | * @param integer $count |
486 | 486 | */ |
487 | -function freadbits($f,$count) |
|
487 | +function freadbits($f, $count) |
|
488 | 488 | { |
489 | - global $CurrentBit,$SMode; |
|
490 | - $Byte=freadbyte($f); |
|
491 | - $LastCBit=$CurrentBit; |
|
492 | - $CurrentBit+=$count; |
|
493 | - if($CurrentBit==8) |
|
489 | + global $CurrentBit, $SMode; |
|
490 | + $Byte = freadbyte($f); |
|
491 | + $LastCBit = $CurrentBit; |
|
492 | + $CurrentBit += $count; |
|
493 | + if ($CurrentBit == 8) |
|
494 | 494 | { |
495 | - $CurrentBit=0; |
|
495 | + $CurrentBit = 0; |
|
496 | 496 | } |
497 | 497 | else |
498 | 498 | { |
499 | - fseek($f,ftell($f)-1); |
|
499 | + fseek($f, ftell($f) - 1); |
|
500 | 500 | }; |
501 | - return RetBits($Byte,$LastCBit,$count); |
|
501 | + return RetBits($Byte, $LastCBit, $count); |
|
502 | 502 | }; |
503 | 503 | |
504 | 504 | |
505 | 505 | |
506 | -function RGBToHex($Red,$Green,$Blue) |
|
506 | +function RGBToHex($Red, $Green, $Blue) |
|
507 | 507 | { |
508 | - $hRed=dechex($Red);if(strlen($hRed)==1) $hRed="0$hRed"; |
|
509 | - $hGreen=dechex($Green);if(strlen($hGreen)==1) $hGreen="0$hGreen"; |
|
510 | - $hBlue=dechex($Blue);if(strlen($hBlue)==1) $hBlue="0$hBlue"; |
|
511 | - return($hRed.$hGreen.$hBlue); |
|
508 | + $hRed = dechex($Red); if (strlen($hRed) == 1) $hRed = "0$hRed"; |
|
509 | + $hGreen = dechex($Green); if (strlen($hGreen) == 1) $hGreen = "0$hGreen"; |
|
510 | + $hBlue = dechex($Blue); if (strlen($hBlue) == 1) $hBlue = "0$hBlue"; |
|
511 | + return($hRed . $hGreen . $hBlue); |
|
512 | 512 | }; |
513 | 513 | |
514 | 514 | function int_to_dword($n) |
515 | 515 | { |
516 | - return chr($n & 255).chr(($n >> 8) & 255).chr(($n >> 16) & 255).chr(($n >> 24) & 255); |
|
516 | + return chr($n & 255) . chr(($n >> 8) & 255) . chr(($n >> 16) & 255) . chr(($n >> 24) & 255); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | /** |
@@ -521,24 +521,24 @@ discard block |
||
521 | 521 | */ |
522 | 522 | function int_to_word($n) |
523 | 523 | { |
524 | - return chr($n & 255).chr(($n >> 8) & 255); |
|
524 | + return chr($n & 255) . chr(($n >> 8) & 255); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
528 | 528 | function decbin8($d) |
529 | 529 | { |
530 | -return decbinx($d,8); |
|
530 | +return decbinx($d, 8); |
|
531 | 531 | }; |
532 | 532 | |
533 | 533 | /** |
534 | 534 | * @param integer $n |
535 | 535 | */ |
536 | -function decbinx($d,$n) |
|
536 | +function decbinx($d, $n) |
|
537 | 537 | { |
538 | -$bin=decbin($d); |
|
539 | -$sbin=strlen($bin); |
|
540 | -for($j=0;$j<$n-$sbin;$j++) |
|
541 | - $bin="0$bin"; |
|
538 | +$bin = decbin($d); |
|
539 | +$sbin = strlen($bin); |
|
540 | +for ($j = 0; $j < $n - $sbin; $j++) |
|
541 | + $bin = "0$bin"; |
|
542 | 542 | return $bin; |
543 | 543 | }; |
544 | 544 |