@@ -329,6 +329,9 @@ discard block |
||
329 | 329 | exit; |
330 | 330 | } |
331 | 331 | |
332 | +/** |
|
333 | + * @param string $sql |
|
334 | + */ |
|
332 | 335 | function sqldbg_strip_temptable($sql) |
333 | 336 | { |
334 | 337 | $start = mb_strpos(mb_strtoupper($sql), 'SELECT '); |
@@ -340,6 +343,9 @@ discard block |
||
340 | 343 | return mb_substr($sql, $start); |
341 | 344 | } |
342 | 345 | |
346 | +/** |
|
347 | + * @param string $sql |
|
348 | + */ |
|
343 | 349 | function sqldbg_strip_from($sql) |
344 | 350 | { |
345 | 351 | $start = mb_strpos(mb_strtoupper($sql), 'FROM '); |
@@ -351,6 +357,9 @@ discard block |
||
351 | 357 | return 'SELECT * ' . mb_substr($sql, $start); |
352 | 358 | } |
353 | 359 | |
360 | +/** |
|
361 | + * @param string $sql |
|
362 | + */ |
|
354 | 363 | function sqldbg_insert_nocache($sql) |
355 | 364 | { |
356 | 365 | if (mb_strtoupper(mb_substr($sql, 0, 7)) == 'SELECT ') { |
@@ -468,6 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | /** |
470 | 470 | * @param integer $byte |
471 | + * @param integer $len |
|
471 | 472 | */ |
472 | 473 | function RetBits($byte,$start,$len) |
473 | 474 | { |
@@ -525,6 +526,9 @@ discard block |
||
525 | 526 | } |
526 | 527 | |
527 | 528 | |
529 | +/** |
|
530 | + * @param integer $d |
|
531 | + */ |
|
528 | 532 | function decbin8($d) |
529 | 533 | { |
530 | 534 | return decbinx($d,8); |
@@ -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 |
@@ -485,6 +485,9 @@ |
||
485 | 485 | sql_free_result($rs); |
486 | 486 | } |
487 | 487 | |
488 | +/** |
|
489 | + * @param integer $object_type |
|
490 | + */ |
|
488 | 491 | function ftsearch_delete_entries($object_type, $object_id, $cache_id) |
489 | 492 | { |
490 | 493 | sql("DELETE FROM `search_index` WHERE `object_type`='&1' AND `cache_id`='&2'", $object_type, $cache_id); |
@@ -282,6 +282,9 @@ |
||
282 | 282 | return $start; |
283 | 283 | } |
284 | 284 | |
285 | +/** |
|
286 | + * @param integer $line |
|
287 | + */ |
|
285 | 288 | function smarty_prefilter_t_gettext($message, $attrs, &$smarty, $line) |
286 | 289 | { |
287 | 290 | global $opt, $translate; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'DATA_LICENSE_URL' => $opt['page']['absolute_url'] . $opt['logic']['license']['terms'], |
34 | 34 | 'DEBUG' => ($opt['debug'] & DEBUG_DEVELOPER != 0), |
35 | 35 | 'DEBUG_PREVENT_SEMAPHORES' |
36 | - => !$opt['php']['semaphores'], # not available on old developer system |
|
36 | + => !$opt['php']['semaphores'], # not available on old developer system |
|
37 | 37 | 'DB_SERVER' => $opt['db']['servername'], |
38 | 38 | 'DB_NAME' => $opt['db']['placeholder']['db'], |
39 | 39 | 'DB_USERNAME' => $opt['db']['username'], |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'OC_NODE_ID' => $opt['logic']['node']['id'], |
55 | 55 | 'OC_COOKIE_NAME' => $opt['session']['cookiename'] . 'data', |
56 | 56 | 'OCDE_HTML_PURIFIER_SETTINGS' |
57 | - => $opt['html_purifier'], |
|
57 | + => $opt['html_purifier'], |
|
58 | 58 | 'GITHUB_ACCESS_TOKEN' => $opt['okapi']['github_access_token'], |
59 | 59 | ); |
60 | 60 | } |
@@ -146,8 +146,9 @@ |
||
146 | 146 | <td> |
147 | 147 | <?php |
148 | 148 | foreach ($opt['template']['locales'] AS $k => $lang) { |
149 | - if ($lang['status'] == OC_LOCALE_ACTIVE) |
|
150 | - echo '<a style="text-decoration: none;" href="index.php?locale=' . $k . '"><img src="' . $lang['flag'] . '" alt="' . $lang['name'] . '" title="' . $lang['name'] . '" width="24px" height="18px" /></a> '; |
|
149 | + if ($lang['status'] == OC_LOCALE_ACTIVE) { |
|
150 | + echo '<a style="text-decoration: none;" href="index.php?locale=' . $k . '"><img src="' . $lang['flag'] . '" alt="' . $lang['name'] . '" title="' . $lang['name'] . '" width="24px" height="18px" /></a> '; |
|
151 | + } |
|
151 | 152 | } |
152 | 153 | ?> |
153 | 154 | </td> |