| @@ -1011,7 +1011,7 @@ | ||
| 1011 | 1011 | } | 
| 1012 | 1012 | $logs_restored = true; | 
| 1013 | 1013 | } | 
| 1014 | - // if it was not already restored by a later restore operation ... | |
| 1014 | + // if it was not already restored by a later restore operation ... | |
| 1015 | 1015 |                      } elseif (sql_value("SELECT `id` FROM `cache_logs` WHERE `id`='&1'", 0, $revert_logid) == 0) { | 
| 1016 | 1016 | // id, uuid, date_created and last_modified are set automatically; | 
| 1017 | 1017 | // picture will be updated automatically on picture-restore | 
| @@ -757,7 +757,8 @@ discard block | ||
| 757 | 757 | $cacheid, | 
| 758 | 758 | $rdate | 
| 759 | 759 | ); | 
| 760 | -            if ($r = sql_fetch_assoc($rs)) { // should always be true ... | |
| 760 | +            if ($r = sql_fetch_assoc($rs)) { | |
| 761 | +// should always be true ... | |
| 761 | 762 |                  if (!$simulate) { | 
| 762 | 763 | sql( | 
| 763 | 764 | "UPDATE `caches` SET `latitude`='&1', `longitude`='&2' WHERE `cache_id`='&3'", | 
| @@ -790,7 +791,8 @@ discard block | ||
| 790 | 791 | $cacheid, | 
| 791 | 792 | $rdate | 
| 792 | 793 | ); | 
| 793 | -            if ($r = sql_fetch_assoc($rs)) { // should always be true ... | |
| 794 | +            if ($r = sql_fetch_assoc($rs)) { | |
| 795 | +// should always be true ... | |
| 794 | 796 |                  if (!$simulate) { | 
| 795 | 797 | sql( | 
| 796 | 798 | "UPDATE `caches` SET `country`='&1' WHERE `cache_id`='&2'", | 
| @@ -827,7 +829,8 @@ discard block | ||
| 827 | 829 | 'wp_nc' => 'waypoints' | 
| 828 | 830 | ]; | 
| 829 | 831 | |
| 830 | -        if ($r = sql_fetch_assoc($rs)) {// can be false | |
| 832 | +        if ($r = sql_fetch_assoc($rs)) { | |
| 833 | +// can be false | |
| 831 | 834 | $setfields = ""; | 
| 832 | 835 |              foreach ($fields as $field => $ropt) { | 
| 833 | 836 |                  if (in_array($ropt, $roptions) && $r[$field] != $cache[$field]) { | 
| @@ -896,13 +899,15 @@ discard block | ||
| 896 | 899 | |
| 897 | 900 |              while ($r = sql_fetch_assoc($rs)) { | 
| 898 | 901 |                  if (!$simulate) { | 
| 899 | -                    if ($r['desc'] === null) { // was newly created -> delete | |
| 902 | +                    if ($r['desc'] === null) { | |
| 903 | +// was newly created -> delete | |
| 900 | 904 | sql( | 
| 901 | 905 | "DELETE FROM `cache_desc` WHERE `cache_id`='&1' AND `language`='&2'", | 
| 902 | 906 | $cacheid, | 
| 903 | 907 | $r['language'] | 
| 904 | 908 | ); | 
| 905 | -                    } else {// id, uuid, date_created and last_modified are set automatically | |
| 909 | +                    } else { | |
| 910 | +// id, uuid, date_created and last_modified are set automatically | |
| 906 | 911 | sql( | 
| 907 | 912 | "INSERT INTO `cache_desc` | 
| 908 | 913 | (`node`, `cache_id`, `language`, `desc`, `desc_html`, `desc_htmledit`, `hint`, `short_desc`) | 
| @@ -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 | } | 
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | global $login; | 
| 31 | 31 | |
| 32 | 32 | $fields = | 
| 33 | - "`pics`.`uuid` AS `pic_uuid`, | |
| 33 | + "`pics`.`uuid` AS `pic_uuid`, | |
| 34 | 34 | `pics`.`url` AS `pic_url`, | 
| 35 | 35 | `pics`.`title`, | 
| 36 | 36 | `pics`.`date_created`, | 
| @@ -78,83 +78,83 @@ discard block | ||
| 78 | 78 | $sl1=strlen($ret); | 
| 79 | 79 | if($CC==0) $CC=256; | 
| 80 | 80 | if($BitCount<24) | 
| 81 | -                   { | |
| 81 | +                    { | |
| 82 | 82 | $ColorTotal=imagecolorstotal($img); | 
| 83 | - if($IsTransparent) $ColorTotal--; | |
| 83 | + if($IsTransparent) $ColorTotal--; | |
| 84 | 84 | |
| 85 | - for($p=0;$p<$ColorTotal;$p++) | |
| 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 | |
| 92 | - }; | |
| 85 | + for($p=0;$p<$ColorTotal;$p++) | |
| 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 | |
| 92 | + }; | |
| 93 | 93 | |
| 94 | 94 | $CT=$ColorTotal; | 
| 95 | - for($p=$ColorTotal;$p<$CC;$p++) | |
| 96 | -                       { | |
| 97 | - $ret.=inttobyte(0); | |
| 98 | - $ret.=inttobyte(0); | |
| 99 | - $ret.=inttobyte(0); | |
| 100 | - $ret.=inttobyte(0); //RESERVED | |
| 101 | - }; | |
| 102 | - }; | |
| 95 | + for($p=$ColorTotal;$p<$CC;$p++) | |
| 96 | +                        { | |
| 97 | + $ret.=inttobyte(0); | |
| 98 | + $ret.=inttobyte(0); | |
| 99 | + $ret.=inttobyte(0); | |
| 100 | + $ret.=inttobyte(0); //RESERVED | |
| 101 | + }; | |
| 102 | + }; | |
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | if($BitCount<=8) | 
| 106 | 106 |  { | 
| 107 | 107 | |
| 108 | - for($y=$Height-1;$y>=0;$y--) | |
| 109 | - { | |
| 110 | - $bWrite=""; | |
| 111 | - for($x=0;$x<$Width;$x++) | |
| 112 | -   { | |
| 113 | - $color=imagecolorat($img,$x,$y); | |
| 114 | - $bWrite.=decbinx($color,$BitCount); | |
| 115 | - if(strlen($bWrite)==8) | |
| 108 | + for($y=$Height-1;$y>=0;$y--) | |
| 109 | +    { | |
| 110 | + $bWrite=""; | |
| 111 | + for($x=0;$x<$Width;$x++) | |
| 116 | 112 |      { | 
| 117 | - $retd.=inttobyte(bindec($bWrite)); | |
| 118 | - $bWrite=""; | |
| 113 | + $color=imagecolorat($img,$x,$y); | |
| 114 | + $bWrite.=decbinx($color,$BitCount); | |
| 115 | + if(strlen($bWrite)==8) | |
| 116 | +    { | |
| 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 | + }; | |
| 129 | + for($z=0;$z<$Zbytek;$z++) | |
| 130 | + $retd.=inttobyte(0); | |
| 128 | 131 | }; | 
| 129 | - for($z=0;$z<$Zbytek;$z++) | |
| 130 | - $retd.=inttobyte(0); | |
| 131 | - }; | |
| 132 | 132 | }; | 
| 133 | 133 | |
| 134 | 134 | if(($RLE==1)and($BitCount==8)) | 
| 135 | 135 |  { | 
| 136 | - for($t=0;$t<strlen($retd);$t+=4) | |
| 137 | -  { | |
| 138 | - if($t!=0) | |
| 139 | - if(($t)%$Width==0) | |
| 136 | + for($t=0;$t<strlen($retd);$t+=4) | |
| 137 | +    { | |
| 138 | + if($t!=0) | |
| 139 | + if(($t)%$Width==0) | |
| 140 | 140 | $ret.=chr(0).chr(0); | 
| 141 | 141 | |
| 142 | - if(($t+5)%$Width==0) | |
| 143 | -   { | |
| 144 | - $ret.=chr(0).chr(5).substr($retd,$t,5).chr(0); | |
| 145 | - $t+=1; | |
| 146 | - } | |
| 147 | - if(($t+6)%$Width==0) | |
| 142 | + if(($t+5)%$Width==0) | |
| 143 | +    { | |
| 144 | + $ret.=chr(0).chr(5).substr($retd,$t,5).chr(0); | |
| 145 | + $t+=1; | |
| 146 | + } | |
| 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 |  { | 
| @@ -165,31 +165,31 @@ discard block | ||
| 165 | 165 | if($BitCount==24) | 
| 166 | 166 |                  { | 
| 167 | 167 | for($z=0;$z<$Zbytek;$z++) | 
| 168 | - $Dopl.=chr(0); | |
| 168 | + $Dopl.=chr(0); | |
| 169 | 169 | |
| 170 | 170 | for($y=$Height-1;$y>=0;$y--) | 
| 171 | -                 { | |
| 172 | - for($x=0;$x<$Width;$x++) | |
| 171 | +                    { | |
| 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; | |
| 178 | - }; | |
| 177 | + $ret.=$Dopl; | |
| 178 | + }; | |
| 179 | 179 | |
| 180 | - }; | |
| 180 | + }; | |
| 181 | 181 | |
| 182 | - if($file!="") | |
| 183 | -   { | |
| 182 | + if($file!="") | |
| 183 | +    { | |
| 184 | 184 | $r=($f=fopen($file,"w")); | 
| 185 | 185 | $r=$r and fwrite($f,$ret); | 
| 186 | 186 | $r=$r and fclose($f); | 
| 187 | 187 | return $r; | 
| 188 | - } | |
| 189 | - else | |
| 190 | -  { | |
| 191 | - echo $ret; | |
| 192 | - }; | |
| 188 | + } | |
| 189 | + else | |
| 190 | +    { | |
| 191 | + echo $ret; | |
| 192 | + }; | |
| 193 | 193 | }; | 
| 194 | 194 | |
| 195 | 195 | |
| @@ -213,57 +213,57 @@ discard block | ||
| 213 | 213 | |
| 214 | 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); | |
| 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 | 232 | |
| 233 | 233 | if($biBitCount<24) | 
| 234 | - { | |
| 235 | - $img=imagecreate($Width,$Height); | |
| 236 | - $Colors=pow(2,$biBitCount); | |
| 237 | - for($p=0;$p<$Colors;$p++) | |
| 238 | -   { | |
| 234 | +    { | |
| 235 | + $img=imagecreate($Width,$Height); | |
| 236 | + $Colors=pow(2,$biBitCount); | |
| 237 | + for($p=0;$p<$Colors;$p++) | |
| 238 | +    { | |
| 239 | 239 | $B=freadbyte($f); | 
| 240 | 240 | $G=freadbyte($f); | 
| 241 | 241 | $R=freadbyte($f); | 
| 242 | 242 | $Reserved=freadbyte($f); | 
| 243 | 243 | $Palette[]=imagecolorallocate($img,$R,$G,$B); | 
| 244 | - }; | |
| 244 | + }; | |
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | |
| 248 | 248 | |
| 249 | 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 | 253 | for($y=$Height-1;$y>=0;$y--) | 
| 254 | 254 |      { | 
| 255 | - $CurrentBit=0; | |
| 256 | - for($x=0;$x<$Width;$x++) | |
| 257 | -      { | |
| 258 | - $C=freadbits($f,$biBitCount); | |
| 259 | - imagesetpixel($img,$x,$y,$Palette[$C]); | |
| 260 | - }; | |
| 255 | + $CurrentBit=0; | |
| 256 | + for($x=0;$x<$Width;$x++) | |
| 257 | +        { | |
| 258 | + $C=freadbits($f,$biBitCount); | |
| 259 | + imagesetpixel($img,$x,$y,$Palette[$C]); | |
| 260 | + }; | |
| 261 | 261 |      if($CurrentBit!=0) {freadbyte($f);}; | 
| 262 | 262 | for($g=0;$g<$Zbytek;$g++) | 
| 263 | - freadbyte($f); | |
| 264 | - }; | |
| 263 | + freadbyte($f); | |
| 264 | + }; | |
| 265 | 265 | |
| 266 | - }; | |
| 266 | + }; | |
| 267 | 267 | }; | 
| 268 | 268 | |
| 269 | 269 | |
| @@ -288,29 +288,29 @@ discard block | ||
| 288 | 288 | |
| 289 | 289 | while(!(($prefix==0)and($suffix==0))) | 
| 290 | 290 |  { | 
| 291 | - if($prefix==0) | |
| 292 | -  { | |
| 293 | - $pocet=$suffix; | |
| 294 | - $Data.=fread($f,$pocet); | |
| 295 | - $pocetb+=$pocet; | |
| 296 | -   if($pocetb%2==1) {freadbyte($f); $pocetb++;}; | |
| 297 | - }; | |
| 298 | - if($prefix>0) | |
| 299 | -  { | |
| 300 | - $pocet=$prefix; | |
| 301 | - for($r=0;$r<$pocet;$r++) | |
| 291 | + if($prefix==0) | |
| 292 | +    { | |
| 293 | + $pocet=$suffix; | |
| 294 | + $Data.=fread($f,$pocet); | |
| 295 | + $pocetb+=$pocet; | |
| 296 | +    if($pocetb%2==1) {freadbyte($f); $pocetb++;}; | |
| 297 | + }; | |
| 298 | + if($prefix>0) | |
| 299 | +    { | |
| 300 | + $pocet=$prefix; | |
| 301 | + for($r=0;$r<$pocet;$r++) | |
| 302 | 302 | $Data.=chr($suffix); | 
| 303 | - }; | |
| 304 | - $prefix=freadbyte($f); | |
| 305 | - $suffix=freadbyte($f); | |
| 306 | - $pocetb+=2; | |
| 307 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 303 | + }; | |
| 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 | 310 | for($x=0;$x<strlen($Data);$x++) | 
| 311 | - { | |
| 312 | - imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); | |
| 313 | - }; | |
| 311 | +    { | |
| 312 | + imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); | |
| 313 | + }; | |
| 314 | 314 | $Data=""; | 
| 315 | 315 | |
| 316 | 316 | }; | 
| @@ -341,44 +341,44 @@ discard block | ||
| 341 | 341 | |
| 342 | 342 | while(!(($prefix==0)and($suffix==0))) | 
| 343 | 343 |  { | 
| 344 | - if($prefix==0) | |
| 345 | -  { | |
| 346 | - $pocet=$suffix; | |
| 344 | + if($prefix==0) | |
| 345 | +    { | |
| 346 | + $pocet=$suffix; | |
| 347 | 347 | |
| 348 | - $CurrentBit=0; | |
| 349 | - for($h=0;$h<$pocet;$h++) | |
| 348 | + $CurrentBit=0; | |
| 349 | + for($h=0;$h<$pocet;$h++) | |
| 350 | 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 | - }; | |
| 355 | - if($prefix>0) | |
| 356 | -  { | |
| 357 | - $pocet=$prefix; | |
| 358 | - $i=0; | |
| 359 | - for($r=0;$r<$pocet;$r++) | |
| 351 | + if($CurrentBit!=0) freadbits($f,4); | |
| 352 | + $pocetb+=ceil(($pocet/2)); | |
| 353 | +    if($pocetb%2==1) {freadbyte($f); $pocetb++;}; | |
| 354 | + }; | |
| 355 | + if($prefix>0) | |
| 356 | +    { | |
| 357 | + $pocet=$prefix; | |
| 358 | + $i=0; | |
| 359 | + for($r=0;$r<$pocet;$r++) | |
| 360 | 360 |      { | 
| 361 | 361 | if($i%2==0) | 
| 362 | -     { | |
| 363 | - $Data.=chr($suffix%16); | |
| 364 | - } | |
| 365 | - else | |
| 366 | -     { | |
| 367 | - $Data.=chr(floor($suffix/16)); | |
| 368 | - }; | |
| 362 | +        { | |
| 363 | + $Data.=chr($suffix%16); | |
| 364 | + } | |
| 365 | + else | |
| 366 | +        { | |
| 367 | + $Data.=chr(floor($suffix/16)); | |
| 368 | + }; | |
| 369 | 369 | $i++; | 
| 370 | 370 | }; | 
| 371 | - }; | |
| 372 | - $prefix=freadbyte($f); | |
| 373 | - $suffix=freadbyte($f); | |
| 374 | - $pocetb+=2; | |
| 375 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 371 | + }; | |
| 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 | 378 | for($x=0;$x<strlen($Data);$x++) | 
| 379 | - { | |
| 380 | - imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); | |
| 381 | - }; | |
| 379 | +    { | |
| 380 | + imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); | |
| 381 | + }; | |
| 382 | 382 | $Data=""; | 
| 383 | 383 | |
| 384 | 384 | }; | 
| @@ -386,25 +386,25 @@ discard block | ||
| 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++) | |
| 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); | |
| 404 | - } | |
| 396 | + for($x=0;$x<$Width;$x++) | |
| 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); | |
| 404 | + } | |
| 405 | 405 | for($z=0;$z<$Zbytek;$z++) | 
| 406 | - freadbyte($f); | |
| 407 | - }; | |
| 406 | + freadbyte($f); | |
| 407 | + }; | |
| 408 | 408 | }; | 
| 409 | 409 | return $img; | 
| 410 | 410 | |
| @@ -438,14 +438,14 @@ discard block | ||
| 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,9 +456,9 @@ discard block | ||
| 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 | |
| @@ -476,30 +476,30 @@ discard block | ||
| 476 | 476 | $CurrentBit=0; | 
| 477 | 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) | |
| 484 | -  { | |
| 485 | - $CurrentBit=0; | |
| 486 | - } | |
| 487 | - else | |
| 488 | -  { | |
| 489 | - fseek($f,ftell($f)-1); | |
| 490 | - }; | |
| 491 | - return RetBits($Byte,$LastCBit,$count); | |
| 479 | + global $CurrentBit,$SMode; | |
| 480 | + $Byte=freadbyte($f); | |
| 481 | + $LastCBit=$CurrentBit; | |
| 482 | + $CurrentBit+=$count; | |
| 483 | + if($CurrentBit==8) | |
| 484 | +    { | |
| 485 | + $CurrentBit=0; | |
| 486 | + } | |
| 487 | + else | |
| 488 | +    { | |
| 489 | + fseek($f,ftell($f)-1); | |
| 490 | + }; | |
| 491 | + return RetBits($Byte,$LastCBit,$count); | |
| 492 | 492 | }; | 
| 493 | 493 | |
| 494 | 494 | |
| 495 | 495 | |
| 496 | 496 | function RGBToHex($Red,$Green,$Blue) | 
| 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); | |
| 502 | - }; | |
| 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); | |
| 502 | + }; | |
| 503 | 503 | |
| 504 | 504 | function int_to_dword($n) | 
| 505 | 505 |          { | 
| @@ -521,7 +521,7 @@ discard block | ||
| 521 | 521 | $bin=decbin($d); | 
| 522 | 522 | $sbin=strlen($bin); | 
| 523 | 523 | for($j=0;$j<$n-$sbin;$j++) | 
| 524 | - $bin="0$bin"; | |
| 524 | + $bin="0$bin"; | |
| 525 | 525 | return $bin; | 
| 526 | 526 | }; | 
| 527 | 527 | |
| @@ -36,7 +36,9 @@ discard block | ||
| 36 | 36 | $IsTransparent=$Transparent!=-1; | 
| 37 | 37 | |
| 38 | 38 | |
| 39 | -if($IsTransparent) $ColorCount--; | |
| 39 | +if($IsTransparent) { | |
| 40 | + $ColorCount--; | |
| 41 | +} | |
| 40 | 42 | |
| 41 | 43 |  if($ColorCount==0) {$ColorCount=0; $BitCount=24;}; | 
| 42 | 44 |  if(($ColorCount>0)and($ColorCount<=2)) {$ColorCount=2; $BitCount=1;}; | 
| @@ -49,7 +51,9 @@ discard block | ||
| 49 | 51 | |
| 50 | 52 | $Zbytek=(4-($Width/(8/$BitCount))%4)%4; | 
| 51 | 53 | |
| 52 | - if($BitCount<24) $palsize=pow(2,$BitCount)*4; | |
| 54 | +                if($BitCount<24) { | |
| 55 | + $palsize=pow(2,$BitCount)*4; | |
| 56 | + } | |
| 53 | 57 | |
| 54 | 58 | $size=(floor($Width/(8/$BitCount))+$Zbytek)*$Height+54; | 
| 55 | 59 | $size+=$palsize; | 
| @@ -76,14 +80,16 @@ discard block | ||
| 76 | 80 | |
| 77 | 81 | $CC=$ColorCount; | 
| 78 | 82 | $sl1=strlen($ret); | 
| 79 | - if($CC==0) $CC=256; | |
| 80 | - if($BitCount<24) | |
| 81 | -                   { | |
| 83 | +                if($CC==0) { | |
| 84 | + $CC=256; | |
| 85 | + } | |
| 86 | +                if($BitCount<24) { | |
| 82 | 87 | $ColorTotal=imagecolorstotal($img); | 
| 83 | - if($IsTransparent) $ColorTotal--; | |
| 88 | +                     if($IsTransparent) { | |
| 89 | + $ColorTotal--; | |
| 90 | + } | |
| 84 | 91 | |
| 85 | - for($p=0;$p<$ColorTotal;$p++) | |
| 86 | -                     { | |
| 92 | +                     for($p=0;$p<$ColorTotal;$p++) { | |
| 87 | 93 | $color=imagecolorsforindex($img,$p); | 
| 88 | 94 | $ret.=inttobyte($color["blue"]); | 
| 89 | 95 | $ret.=inttobyte($color["green"]); | 
| @@ -92,8 +98,7 @@ discard block | ||
| 92 | 98 | }; | 
| 93 | 99 | |
| 94 | 100 | $CT=$ColorTotal; | 
| 95 | - for($p=$ColorTotal;$p<$CC;$p++) | |
| 96 | -                       { | |
| 101 | +                  for($p=$ColorTotal;$p<$CC;$p++) { | |
| 97 | 102 | $ret.=inttobyte(0); | 
| 98 | 103 | $ret.=inttobyte(0); | 
| 99 | 104 | $ret.=inttobyte(0); | 
| @@ -102,75 +107,63 @@ discard block | ||
| 102 | 107 | }; | 
| 103 | 108 | |
| 104 | 109 | |
| 105 | -if($BitCount<=8) | |
| 106 | -{ | |
| 110 | +if($BitCount<=8) { | |
| 107 | 111 | |
| 108 | - for($y=$Height-1;$y>=0;$y--) | |
| 109 | - { | |
| 112 | + for($y=$Height-1;$y>=0;$y--) { | |
| 110 | 113 | $bWrite=""; | 
| 111 | - for($x=0;$x<$Width;$x++) | |
| 112 | -   { | |
| 114 | +  for($x=0;$x<$Width;$x++) { | |
| 113 | 115 | $color=imagecolorat($img,$x,$y); | 
| 114 | 116 | $bWrite.=decbinx($color,$BitCount); | 
| 115 | - if(strlen($bWrite)==8) | |
| 116 | -    { | |
| 117 | +   if(strlen($bWrite)==8) { | |
| 117 | 118 | $retd.=inttobyte(bindec($bWrite)); | 
| 118 | 119 | $bWrite=""; | 
| 119 | 120 | }; | 
| 120 | 121 | }; | 
| 121 | 122 | |
| 122 | - if((strlen($bWrite)<8)and(strlen($bWrite)!=0)) | |
| 123 | -    { | |
| 123 | +  if((strlen($bWrite)<8)and(strlen($bWrite)!=0)) { | |
| 124 | 124 | $sl=strlen($bWrite); | 
| 125 | - for($t=0;$t<8-$sl;$t++) | |
| 126 | - $sl.="0"; | |
| 125 | +     for($t=0;$t<8-$sl;$t++) { | |
| 126 | + $sl.="0"; | |
| 127 | + } | |
| 127 | 128 | $retd.=inttobyte(bindec($bWrite)); | 
| 128 | 129 | }; | 
| 129 | - for($z=0;$z<$Zbytek;$z++) | |
| 130 | - $retd.=inttobyte(0); | |
| 130 | + for($z=0;$z<$Zbytek;$z++) { | |
| 131 | + $retd.=inttobyte(0); | |
| 132 | + } | |
| 131 | 133 | }; | 
| 132 | 134 | }; | 
| 133 | 135 | |
| 134 | -if(($RLE==1)and($BitCount==8)) | |
| 135 | -{ | |
| 136 | - for($t=0;$t<strlen($retd);$t+=4) | |
| 137 | -  { | |
| 138 | - if($t!=0) | |
| 139 | - if(($t)%$Width==0) | |
| 136 | +if(($RLE==1)and($BitCount==8)) { | |
| 137 | + for($t=0;$t<strlen($retd);$t+=4) { | |
| 138 | +   if($t!=0) { | |
| 139 | + if(($t)%$Width==0) | |
| 140 | 140 | $ret.=chr(0).chr(0); | 
| 141 | + } | |
| 141 | 142 | |
| 142 | - if(($t+5)%$Width==0) | |
| 143 | -   { | |
| 143 | +   if(($t+5)%$Width==0) { | |
| 144 | 144 | $ret.=chr(0).chr(5).substr($retd,$t,5).chr(0); | 
| 145 | 145 | $t+=1; | 
| 146 | 146 | } | 
| 147 | - if(($t+6)%$Width==0) | |
| 148 | -    { | |
| 147 | +   if(($t+6)%$Width==0) { | |
| 149 | 148 | $ret.=chr(0).chr(6).substr($retd,$t,6); | 
| 150 | 149 | $t+=2; | 
| 151 | - } | |
| 152 | - else | |
| 153 | -    { | |
| 150 | +    } else { | |
| 154 | 151 | $ret.=chr(0).chr(4).substr($retd,$t,4); | 
| 155 | 152 | }; | 
| 156 | 153 | }; | 
| 157 | 154 | $ret.=chr(0).chr(1); | 
| 158 | -} | |
| 159 | -else | |
| 160 | -{ | |
| 155 | +} else { | |
| 161 | 156 | $ret.=$retd; | 
| 162 | 157 | }; | 
| 163 | 158 | |
| 164 | 159 | |
| 165 | - if($BitCount==24) | |
| 166 | -                { | |
| 167 | - for($z=0;$z<$Zbytek;$z++) | |
| 168 | - $Dopl.=chr(0); | |
| 160 | +                if($BitCount==24) { | |
| 161 | +                for($z=0;$z<$Zbytek;$z++) { | |
| 162 | + $Dopl.=chr(0); | |
| 163 | + } | |
| 169 | 164 | |
| 170 | - for($y=$Height-1;$y>=0;$y--) | |
| 171 | -                 { | |
| 172 | - for($x=0;$x<$Width;$x++) | |
| 173 | -                        { | |
| 165 | +                for($y=$Height-1;$y>=0;$y--) { | |
| 166 | +                 for($x=0;$x<$Width;$x++) { | |
| 174 | 167 | $color=imagecolorsforindex($img,ImageColorAt($img,$x,$y)); | 
| 175 | 168 | $ret.=chr($color["blue"]).chr($color["green"]).chr($color["red"]); | 
| 176 | 169 | } | 
| @@ -179,15 +172,12 @@ discard block | ||
| 179 | 172 | |
| 180 | 173 | }; | 
| 181 | 174 | |
| 182 | - if($file!="") | |
| 183 | -   { | |
| 175 | +  if($file!="") { | |
| 184 | 176 | $r=($f=fopen($file,"w")); | 
| 185 | 177 | $r=$r and fwrite($f,$ret); | 
| 186 | 178 | $r=$r and fclose($f); | 
| 187 | 179 | return $r; | 
| 188 | - } | |
| 189 | - else | |
| 190 | -  { | |
| 180 | +   } else { | |
| 191 | 181 | echo $ret; | 
| 192 | 182 | }; | 
| 193 | 183 | }; | 
| @@ -211,8 +201,7 @@ discard block | ||
| 211 | 201 | $f=fopen($file,"r"); | 
| 212 | 202 | $Header=fread($f,2); | 
| 213 | 203 | |
| 214 | -if($Header=="BM") | |
| 215 | -{ | |
| 204 | +if($Header=="BM") { | |
| 216 | 205 | $Size=freaddword($f); | 
| 217 | 206 | $Reserved1=freadword($f); | 
| 218 | 207 | $Reserved2=freadword($f); | 
| @@ -230,12 +219,10 @@ discard block | ||
| 230 | 219 | $NumberOfPalettesUsed=freaddword($f); | 
| 231 | 220 | $NumberOfImportantColors=freaddword($f); | 
| 232 | 221 | |
| 233 | -if($biBitCount<24) | |
| 234 | - { | |
| 222 | +if($biBitCount<24) { | |
| 235 | 223 | $img=imagecreate($Width,$Height); | 
| 236 | 224 | $Colors=pow(2,$biBitCount); | 
| 237 | - for($p=0;$p<$Colors;$p++) | |
| 238 | -   { | |
| 225 | +  for($p=0;$p<$Colors;$p++) { | |
| 239 | 226 | $B=freadbyte($f); | 
| 240 | 227 | $G=freadbyte($f); | 
| 241 | 228 | $R=freadbyte($f); | 
| @@ -246,35 +233,34 @@ discard block | ||
| 246 | 233 | |
| 247 | 234 | |
| 248 | 235 | |
| 249 | -if($RLECompression==0) | |
| 250 | -{ | |
| 236 | +if($RLECompression==0) { | |
| 251 | 237 | $Zbytek=(4-ceil(($Width/(8/$biBitCount)))%4)%4; | 
| 252 | 238 | |
| 253 | -for($y=$Height-1;$y>=0;$y--) | |
| 254 | -    { | |
| 239 | +for($y=$Height-1;$y>=0;$y--) { | |
| 255 | 240 | $CurrentBit=0; | 
| 256 | - for($x=0;$x<$Width;$x++) | |
| 257 | -      { | |
| 241 | +     for($x=0;$x<$Width;$x++) { | |
| 258 | 242 | $C=freadbits($f,$biBitCount); | 
| 259 | 243 | imagesetpixel($img,$x,$y,$Palette[$C]); | 
| 260 | 244 | }; | 
| 261 | 245 |      if($CurrentBit!=0) {freadbyte($f);}; | 
| 262 | - for($g=0;$g<$Zbytek;$g++) | |
| 263 | - freadbyte($f); | |
| 246 | +    for($g=0;$g<$Zbytek;$g++) { | |
| 247 | + freadbyte($f); | |
| 248 | + } | |
| 264 | 249 | }; | 
| 265 | 250 | |
| 266 | 251 | }; | 
| 267 | 252 | }; | 
| 268 | 253 | |
| 269 | 254 | |
| 270 | -if($RLECompression==1) //$BI_RLE8 | |
| 255 | +if($RLECompression==1) { | |
| 256 | + //$BI_RLE8 | |
| 271 | 257 |  { | 
| 272 | 258 | $y=$Height; | 
| 259 | +} | |
| 273 | 260 | |
| 274 | 261 | $pocetb=0; | 
| 275 | 262 | |
| 276 | -while(true) | |
| 277 | -{ | |
| 263 | +while(true) { | |
| 278 | 264 | $y--; | 
| 279 | 265 | $prefix=freadbyte($f); | 
| 280 | 266 | $suffix=freadbyte($f); | 
| @@ -282,33 +268,38 @@ discard block | ||
| 282 | 268 | |
| 283 | 269 | $echoit=false; | 
| 284 | 270 | |
| 285 | -if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 286 | -if(($prefix==0)and($suffix==1)) break; | |
| 287 | -if(feof($f)) break; | |
| 271 | +if($echoit) { | |
| 272 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 273 | +} | |
| 274 | +if(($prefix==0)and($suffix==1)) { | |
| 275 | + break; | |
| 276 | +} | |
| 277 | +if(feof($f)) { | |
| 278 | + break; | |
| 279 | +} | |
| 288 | 280 | |
| 289 | -while(!(($prefix==0)and($suffix==0))) | |
| 290 | -{ | |
| 291 | - if($prefix==0) | |
| 292 | -  { | |
| 281 | +while(!(($prefix==0)and($suffix==0))) { | |
| 282 | + if($prefix==0) { | |
| 293 | 283 | $pocet=$suffix; | 
| 294 | 284 | $Data.=fread($f,$pocet); | 
| 295 | 285 | $pocetb+=$pocet; | 
| 296 | 286 |     if($pocetb%2==1) {freadbyte($f); $pocetb++;}; | 
| 297 | 287 | }; | 
| 298 | - if($prefix>0) | |
| 299 | -  { | |
| 288 | + if($prefix>0) { | |
| 300 | 289 | $pocet=$prefix; | 
| 301 | - for($r=0;$r<$pocet;$r++) | |
| 302 | - $Data.=chr($suffix); | |
| 290 | +   for($r=0;$r<$pocet;$r++) { | |
| 291 | + $Data.=chr($suffix); | |
| 292 | + } | |
| 303 | 293 | }; | 
| 304 | 294 | $prefix=freadbyte($f); | 
| 305 | 295 | $suffix=freadbyte($f); | 
| 306 | 296 | $pocetb+=2; | 
| 307 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 308 | -}; | |
| 297 | + if($echoit) { | |
| 298 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 299 | + } | |
| 300 | + }; | |
| 309 | 301 | |
| 310 | -for($x=0;$x<strlen($Data);$x++) | |
| 311 | - { | |
| 302 | +for($x=0;$x<strlen($Data);$x++) { | |
| 312 | 303 | imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); | 
| 313 | 304 | }; | 
| 314 | 305 | $Data=""; | 
| @@ -318,15 +309,16 @@ discard block | ||
| 318 | 309 | }; | 
| 319 | 310 | |
| 320 | 311 | |
| 321 | -if($RLECompression==2) //$BI_RLE4 | |
| 312 | +if($RLECompression==2) { | |
| 313 | + //$BI_RLE4 | |
| 322 | 314 |  { | 
| 323 | 315 | $y=$Height; | 
| 316 | +} | |
| 324 | 317 | $pocetb=0; | 
| 325 | 318 | |
| 326 | 319 | /*while(!feof($f)) | 
| 327 | 320 | echo freadbyte($f)."_".freadbyte($f)."<BR>";*/ | 
| 328 | -while(true) | |
| 329 | -{ | |
| 321 | +while(true) { | |
| 330 | 322 | //break; | 
| 331 | 323 | $y--; | 
| 332 | 324 | $prefix=freadbyte($f); | 
| @@ -335,35 +327,37 @@ discard block | ||
| 335 | 327 | |
| 336 | 328 | $echoit=false; | 
| 337 | 329 | |
| 338 | -if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 339 | -if(($prefix==0)and($suffix==1)) break; | |
| 340 | -if(feof($f)) break; | |
| 330 | +if($echoit) { | |
| 331 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 332 | +} | |
| 333 | +if(($prefix==0)and($suffix==1)) { | |
| 334 | + break; | |
| 335 | +} | |
| 336 | +if(feof($f)) { | |
| 337 | + break; | |
| 338 | +} | |
| 341 | 339 | |
| 342 | -while(!(($prefix==0)and($suffix==0))) | |
| 343 | -{ | |
| 344 | - if($prefix==0) | |
| 345 | -  { | |
| 340 | +while(!(($prefix==0)and($suffix==0))) { | |
| 341 | + if($prefix==0) { | |
| 346 | 342 | $pocet=$suffix; | 
| 347 | 343 | |
| 348 | 344 | $CurrentBit=0; | 
| 349 | - for($h=0;$h<$pocet;$h++) | |
| 350 | - $Data.=chr(freadbits($f,4)); | |
| 351 | - if($CurrentBit!=0) freadbits($f,4); | |
| 345 | +   for($h=0;$h<$pocet;$h++) { | |
| 346 | + $Data.=chr(freadbits($f,4)); | |
| 347 | + } | |
| 348 | +   if($CurrentBit!=0) { | |
| 349 | + freadbits($f,4); | |
| 350 | + } | |
| 352 | 351 | $pocetb+=ceil(($pocet/2)); | 
| 353 | 352 |     if($pocetb%2==1) {freadbyte($f); $pocetb++;}; | 
| 354 | 353 | }; | 
| 355 | - if($prefix>0) | |
| 356 | -  { | |
| 354 | + if($prefix>0) { | |
| 357 | 355 | $pocet=$prefix; | 
| 358 | 356 | $i=0; | 
| 359 | - for($r=0;$r<$pocet;$r++) | |
| 360 | -    { | |
| 361 | - if($i%2==0) | |
| 362 | -     { | |
| 357 | +   for($r=0;$r<$pocet;$r++) { | |
| 358 | +    if($i%2==0) { | |
| 363 | 359 | $Data.=chr($suffix%16); | 
| 364 | - } | |
| 365 | - else | |
| 366 | -     { | |
| 360 | +     } else { | |
| 367 | 361 | $Data.=chr(floor($suffix/16)); | 
| 368 | 362 | }; | 
| 369 | 363 | $i++; | 
| @@ -372,11 +366,12 @@ discard block | ||
| 372 | 366 | $prefix=freadbyte($f); | 
| 373 | 367 | $suffix=freadbyte($f); | 
| 374 | 368 | $pocetb+=2; | 
| 375 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 376 | -}; | |
| 369 | + if($echoit) { | |
| 370 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; | |
| 371 | + } | |
| 372 | + }; | |
| 377 | 373 | |
| 378 | -for($x=0;$x<strlen($Data);$x++) | |
| 379 | - { | |
| 374 | +for($x=0;$x<strlen($Data);$x++) { | |
| 380 | 375 | imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); | 
| 381 | 376 | }; | 
| 382 | 377 | $Data=""; | 
| @@ -386,24 +381,24 @@ discard block | ||
| 386 | 381 | }; | 
| 387 | 382 | |
| 388 | 383 | |
| 389 | - if($biBitCount==24) | |
| 390 | -{ | |
| 384 | + if($biBitCount==24) { | |
| 391 | 385 | $img=imagecreatetruecolor($Width,$Height); | 
| 392 | 386 | $Zbytek=$Width%4; | 
| 393 | 387 | |
| 394 | - for($y=$Height-1;$y>=0;$y--) | |
| 395 | -    { | |
| 396 | - for($x=0;$x<$Width;$x++) | |
| 397 | -      { | |
| 388 | +   for($y=$Height-1;$y>=0;$y--) { | |
| 389 | +     for($x=0;$x<$Width;$x++) { | |
| 398 | 390 | $B=freadbyte($f); | 
| 399 | 391 | $G=freadbyte($f); | 
| 400 | 392 | $R=freadbyte($f); | 
| 401 | 393 | $color=imagecolorexact($img,$R,$G,$B); | 
| 402 | - if($color==-1) $color=imagecolorallocate($img,$R,$G,$B); | |
| 394 | +       if($color==-1) { | |
| 395 | + $color=imagecolorallocate($img,$R,$G,$B); | |
| 396 | + } | |
| 403 | 397 | imagesetpixel($img,$x,$y,$color); | 
| 404 | 398 | } | 
| 405 | - for($z=0;$z<$Zbytek;$z++) | |
| 406 | - freadbyte($f); | |
| 399 | +    for($z=0;$z<$Zbytek;$z++) { | |
| 400 | + freadbyte($f); | |
| 401 | + } | |
| 407 | 402 | }; | 
| 408 | 403 | }; | 
| 409 | 404 | return $img; | 
| @@ -480,12 +475,9 @@ discard block | ||
| 480 | 475 | $Byte=freadbyte($f); | 
| 481 | 476 | $LastCBit=$CurrentBit; | 
| 482 | 477 | $CurrentBit+=$count; | 
| 483 | - if($CurrentBit==8) | |
| 484 | -  { | |
| 478 | + if($CurrentBit==8) { | |
| 485 | 479 | $CurrentBit=0; | 
| 486 | - } | |
| 487 | - else | |
| 488 | -  { | |
| 480 | +  } else { | |
| 489 | 481 | fseek($f,ftell($f)-1); | 
| 490 | 482 | }; | 
| 491 | 483 | return RetBits($Byte,$LastCBit,$count); | 
| @@ -494,10 +486,16 @@ discard block | ||
| 494 | 486 | |
| 495 | 487 | |
| 496 | 488 | function RGBToHex($Red,$Green,$Blue) | 
| 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"; | |
| 489 | +{ | |
| 490 | +   $hRed=dechex($Red);if(strlen($hRed)==1) { | |
| 491 | + $hRed="0$hRed"; | |
| 492 | + } | |
| 493 | +   $hGreen=dechex($Green);if(strlen($hGreen)==1) { | |
| 494 | + $hGreen="0$hGreen"; | |
| 495 | + } | |
| 496 | +   $hBlue=dechex($Blue);if(strlen($hBlue)==1) { | |
| 497 | + $hBlue="0$hBlue"; | |
| 498 | + } | |
| 501 | 499 | return($hRed.$hGreen.$hBlue); | 
| 502 | 500 | }; | 
| 503 | 501 | |
| @@ -520,8 +518,9 @@ discard block | ||
| 520 | 518 |  { | 
| 521 | 519 | $bin=decbin($d); | 
| 522 | 520 | $sbin=strlen($bin); | 
| 523 | -for($j=0;$j<$n-$sbin;$j++) | |
| 521 | +for($j=0;$j<$n-$sbin;$j++) { | |
| 524 | 522 | $bin="0$bin"; | 
| 523 | +} | |
| 525 | 524 | return $bin; | 
| 526 | 525 | }; | 
| 527 | 526 | |
| @@ -7,34 +7,34 @@ | ||
| 7 | 7 | * Common error messages | 
| 8 | 8 | ***************************************************************************/ | 
| 9 | 9 | |
| 10 | - define('ERROR_UNKNOWN', 1000); | |
| 11 | - define('ERROR_TEMPLATE_NOT_FOUND', 1001); | |
| 12 | - define('ERROR_COMPILATION_FAILED', 1002); | |
| 13 | - define('ERROR_NO_ACCESS', 1003); | |
| 14 | - define('ERROR_INVALID_OPERATION', 1004); | |
| 15 | - define('ERROR_LOGIN_REQUIRED', 1005); | |
| 16 | - define('ERROR_MAIL_TEMPLATE_NOT_FOUND', 1006); | |
| 17 | - define('ERROR_NO_COOKIES', 1007); | |
| 18 | - define('ERROR_ALREADY_LOGGEDIN', 1008); | |
| 19 | - define('ERROR_USER_NOT_ACTIVE', 1009); | |
| 20 | - define('ERROR_USER_NO_EMAIL', 1010); | |
| 21 | - define('ERROR_CACHE_NOT_PUBLISHED', 1011); | |
| 22 | - define('ERROR_CACHE_LOCKED', 1012); | |
| 10 | +    define('ERROR_UNKNOWN', 1000); | |
| 11 | +    define('ERROR_TEMPLATE_NOT_FOUND', 1001); | |
| 12 | +    define('ERROR_COMPILATION_FAILED', 1002); | |
| 13 | +    define('ERROR_NO_ACCESS', 1003); | |
| 14 | +    define('ERROR_INVALID_OPERATION', 1004); | |
| 15 | +    define('ERROR_LOGIN_REQUIRED', 1005); | |
| 16 | +    define('ERROR_MAIL_TEMPLATE_NOT_FOUND', 1006); | |
| 17 | +    define('ERROR_NO_COOKIES', 1007); | |
| 18 | +    define('ERROR_ALREADY_LOGGEDIN', 1008); | |
| 19 | +    define('ERROR_USER_NOT_ACTIVE', 1009); | |
| 20 | +    define('ERROR_USER_NO_EMAIL', 1010); | |
| 21 | +    define('ERROR_CACHE_NOT_PUBLISHED', 1011); | |
| 22 | +    define('ERROR_CACHE_LOCKED', 1012); | |
| 23 | 23 | |
| 24 | - define('ERROR_SEARCHPLUGIN_WAYPOINT_FORMAT', 1013); | |
| 25 | - define('ERROR_SEARCHPLUGIN_WAYPOINT_MANY', 1014); | |
| 26 | - define('ERROR_SEARCHPLUGIN_WAYPOINT_NOTFOUND', 1015); | |
| 24 | +    define('ERROR_SEARCHPLUGIN_WAYPOINT_FORMAT', 1013); | |
| 25 | +    define('ERROR_SEARCHPLUGIN_WAYPOINT_MANY', 1014); | |
| 26 | +    define('ERROR_SEARCHPLUGIN_WAYPOINT_NOTFOUND', 1015); | |
| 27 | 27 | |
| 28 | - define('ERROR_DB_COULD_NOT_RECONNECT', 1016); | |
| 29 | - define('ERROR_DB_NO_ROOT', 1017); | |
| 28 | +    define('ERROR_DB_COULD_NOT_RECONNECT', 1016); | |
| 29 | +    define('ERROR_DB_NO_ROOT', 1017); | |
| 30 | 30 | |
| 31 | - define('ERROR_USER_NOT_EXISTS', 1018); | |
| 32 | - define('ERROR_CACHE_NOT_EXISTS', 1019); | |
| 33 | - define('ERROR_CACHELOG_NOT_EXISTS', 1020); | |
| 34 | - define('ERROR_PICTURE_NOT_EXISTS', 1021); | |
| 31 | +    define('ERROR_USER_NOT_EXISTS', 1018); | |
| 32 | +    define('ERROR_CACHE_NOT_EXISTS', 1019); | |
| 33 | +    define('ERROR_CACHELOG_NOT_EXISTS', 1020); | |
| 34 | +    define('ERROR_PICTURE_NOT_EXISTS', 1021); | |
| 35 | 35 | |
| 36 | - define('ERROR_UPLOAD_ERR_NO_FILE', 1022); | |
| 37 | - define('ERROR_UPLOAD_ERR_SIZE', 1023); | |
| 38 | - define('ERROR_UPLOAD_ERR_TYPE', 1024); | |
| 39 | - define('ERROR_UPLOAD_UNKNOWN', 1025); | |
| 40 | - define('ERROR_UPLOAD_ERR_BAD_FORMAT', 1026); | |
| 36 | +    define('ERROR_UPLOAD_ERR_NO_FILE', 1022); | |
| 37 | +    define('ERROR_UPLOAD_ERR_SIZE', 1023); | |
| 38 | +    define('ERROR_UPLOAD_ERR_TYPE', 1024); | |
| 39 | +    define('ERROR_UPLOAD_UNKNOWN', 1025); | |
| 40 | +    define('ERROR_UPLOAD_ERR_BAD_FORMAT', 1026); | |
| @@ -14,40 +14,40 @@ | ||
| 14 | 14 | * set template specific language variables | 
| 15 | 15 | ****************************************************************************/ | 
| 16 | 16 | |
| 17 | - $firstcache_note = t('If this is your first cache on %1, be sure to check out the <a href="articles.php?page=cacheinfo">description</a> of the individual fields.'); | |
| 18 | - | |
| 19 | - $submit = t('Submit cache'); | |
| 20 | - $default_country = t('EN'); | |
| 21 | - $default_lang = t('EN'); | |
| 22 | - $show_all = t('Show all'); | |
| 23 | - $default_NS = 'N'; | |
| 24 | - $default_EW = 'E'; | |
| 25 | - $date_time_format_message = ' ' . t('Format: DD-MM-YYYY'); | |
| 26 | - | |
| 27 | - $error_general = "<tr><td class='error' colspan='2'><b>" . t('Some errors occured, please check the marked fields.') . "</b></td></tr>"; | |
| 28 | - $error_long_not_ok = '<span class="errormsg">' . t('Your chosen coordinated are invalid') . '</span>'; | |
| 29 | - $error_lat_not_ok = $error_long_not_ok . "<br />"; | |
| 30 | - $error_duplicate_coords = '<span class="errormsg">' . t('Another cache (<a href="viewcache.php?wp=%1">%1</a>) exists at these coords. Maybe you pressed "submit cache" twice. To publish a cache with identical coords, enter other coords first, then edit the listing and change coords.') . '</span>'; | |
| 31 | - $time_not_ok_message = '<span class="errormsg">' . t('The entered time is invalid.') . '</span>'; | |
| 32 | - $way_length_not_ok_message = '<span class="errormsg">' . t('The entered distance is invalid, Format: aa.aaa') . '</span>'; | |
| 33 | - $date_not_ok_message = '<span class="errormsg">' . t('Invalid date, format:DD-MM-JJJJ') . '</span>'; | |
| 34 | - $name_not_ok_message = ' <span class="errormsg">' . t('Cachename is invalid') . '</span>'; | |
| 35 | - $tos_not_ok_message = '<br/><span class="errormsg">' . t('The cache can only be adopted if you agree our terms of use.') . '</span>'; | |
| 36 | - $type_not_ok_message = ' <span class="errormsg">' . t('No cache-type is chosen.') . '</span>'; | |
| 37 | - $size_not_ok_message = ' <span class="errormsg">' . t('No cache-size is chosen.') . '</span>'; | |
| 38 | - $diff_not_ok_message = ' <span class="errormsg">' . t('Choose both valuations!') . '</span>'; | |
| 39 | - $sizemismatch_message = ' <span class="errormsg">' . t('For virtual and webcam caches, the cache size has to be -no container-!') . '</span>'; | |
| 40 | - $safari_not_allowed_message = '<span class="errormsg">' . t('Only virtual caches can be safari caches.') . '</span>'; | |
| 41 | - $bad_wpgc_message = '<span class="errormsg">' . t('GC waypoint is invalid, must be GCxxxxx') . '</span>'; | |
| 42 | - | |
| 43 | - $cache_submitted = t('Your cache is successfully added to the database. You will be redirected to the cache page, now.'); | |
| 44 | - | |
| 45 | - $sel_message = t('Select'); | |
| 46 | - | |
| 47 | - $cache_attrib_js = "new Array({id}, {selected}, '{img_undef}', '{img_large}')"; | |
| 48 | - $cache_attrib_pic = '<img id="attr{attrib_id}" src="{attrib_pic}" border="0" onmousedown="toggleAttr({attrib_id})" onmouseover="Tip(\'{html_desc}\', TITLE, \'{name}\', TITLEBGCOLOR, \'{color}\', TITLEFONTCOLOR, \'#000000\', BGCOLOR, \'#FFFFFF\', BORDERCOLOR, \'{color}\', CLICKCLOSE, true, DELAY, 0, FADEIN, false, FADEOUT, false, FONTCOLOR, \'#000080\', WIDTH, 500)" onmouseout="UnTip()" /> '; | |
| 49 | - | |
| 50 | - $cache_attrib_group = | |
| 17 | +    $firstcache_note = t('If this is your first cache on %1, be sure to check out the <a href="articles.php?page=cacheinfo">description</a> of the individual fields.'); | |
| 18 | + | |
| 19 | +    $submit = t('Submit cache'); | |
| 20 | +    $default_country = t('EN'); | |
| 21 | +    $default_lang = t('EN'); | |
| 22 | +    $show_all = t('Show all'); | |
| 23 | + $default_NS = 'N'; | |
| 24 | + $default_EW = 'E'; | |
| 25 | +    $date_time_format_message = ' ' . t('Format: DD-MM-YYYY'); | |
| 26 | + | |
| 27 | +    $error_general = "<tr><td class='error' colspan='2'><b>" . t('Some errors occured, please check the marked fields.') . "</b></td></tr>"; | |
| 28 | +    $error_long_not_ok = '<span class="errormsg">' . t('Your chosen coordinated are invalid') . '</span>'; | |
| 29 | + $error_lat_not_ok = $error_long_not_ok . "<br />"; | |
| 30 | +    $error_duplicate_coords = '<span class="errormsg">' . t('Another cache (<a href="viewcache.php?wp=%1">%1</a>) exists at these coords. Maybe you pressed "submit cache" twice. To publish a cache with identical coords, enter other coords first, then edit the listing and change coords.') . '</span>'; | |
| 31 | +    $time_not_ok_message = '<span class="errormsg">' . t('The entered time is invalid.') . '</span>'; | |
| 32 | +    $way_length_not_ok_message = '<span class="errormsg">' . t('The entered distance is invalid, Format: aa.aaa') . '</span>'; | |
| 33 | +    $date_not_ok_message = '<span class="errormsg">' . t('Invalid date, format:DD-MM-JJJJ') . '</span>'; | |
| 34 | +    $name_not_ok_message = ' <span class="errormsg">' . t('Cachename is invalid') . '</span>'; | |
| 35 | +    $tos_not_ok_message = '<br/><span class="errormsg">' . t('The cache can only be adopted if you agree our terms of use.') . '</span>'; | |
| 36 | +    $type_not_ok_message = ' <span class="errormsg">' . t('No cache-type is chosen.') . '</span>'; | |
| 37 | +    $size_not_ok_message = ' <span class="errormsg">' . t('No cache-size is chosen.') . '</span>'; | |
| 38 | +    $diff_not_ok_message = ' <span class="errormsg">' . t('Choose both valuations!') . '</span>'; | |
| 39 | +    $sizemismatch_message = ' <span class="errormsg">' . t('For virtual and webcam caches, the cache size has to be -no container-!') . '</span>'; | |
| 40 | +    $safari_not_allowed_message = '<span class="errormsg">' . t('Only virtual caches can be safari caches.') . '</span>'; | |
| 41 | +    $bad_wpgc_message = '<span class="errormsg">' . t('GC waypoint is invalid, must be GCxxxxx') . '</span>'; | |
| 42 | + | |
| 43 | +    $cache_submitted = t('Your cache is successfully added to the database. You will be redirected to the cache page, now.'); | |
| 44 | + | |
| 45 | +    $sel_message = t('Select'); | |
| 46 | + | |
| 47 | +    $cache_attrib_js = "new Array({id}, {selected}, '{img_undef}', '{img_large}')"; | |
| 48 | +    $cache_attrib_pic = '<img id="attr{attrib_id}" src="{attrib_pic}" border="0" onmousedown="toggleAttr({attrib_id})" onmouseover="Tip(\'{html_desc}\', TITLE, \'{name}\', TITLEBGCOLOR, \'{color}\', TITLEFONTCOLOR, \'#000000\', BGCOLOR, \'#FFFFFF\', BORDERCOLOR, \'{color}\', CLICKCLOSE, true, DELAY, 0, FADEIN, false, FADEOUT, false, FONTCOLOR, \'#000080\', WIDTH, 500)" onmouseout="UnTip()" /> '; | |
| 49 | + | |
| 50 | + $cache_attrib_group = | |
| 51 | 51 | '<div class="attribgroup"><table cellspacing="0" style="display:inline;border-spacing:0px;"> | 
| 52 | 52 |           <tr><td bgcolor="{color}" style="line-height:9px;padding-top:2px;margin:0 0 0 0;border-left:1px solid gray;border-right:1px solid gray;border-top:1px solid gray;"><font size="1">{name}</font></td></tr> | 
| 53 | 53 |           <tr><td bgcolor="#F8F8F8" style="margin:0 0 0 0;border-left:1px solid gray;border-right:1px solid gray;border-bottom:1px solid gray;">{attribs}</td></tr> | 
| @@ -15,8 +15,8 @@ | ||
| 15 | 15 | |
| 16 | 16 | ****************************************************************************/ | 
| 17 | 17 | |
| 18 | - $error_wrong_node = t('This log entry has been created on another Opencaching website. The cache can only be edited there.'); | |
| 19 | - $removed_message_end = '---'; | |
| 18 | +    $error_wrong_node = t('This log entry has been created on another Opencaching website. The cache can only be edited there.'); | |
| 19 | + $removed_message_end = '---'; | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | function removed_log_subject($lang) | 
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | |
| 16 | 16 | ****************************************************************************/ | 
| 17 | 17 | |
| 18 | - $error_wrong_node = t('this description was created on another Opencaching-webserver and can only be deleted there.'); | |
| 18 | +    $error_wrong_node = t('this description was created on another Opencaching-webserver and can only be deleted there.'); | |
| 19 | 19 | |
| 20 | - $commit = t('the cache description has been deleted'); | |
| 21 | - $commit_title = t('delete this cache-description'); | |
| 20 | +    $commit = t('the cache description has been deleted'); | |
| 21 | +    $commit_title = t('delete this cache-description'); | |
| @@ -71,7 +71,7 @@ | ||
| 71 | 71 | $error_suffix = '</span>'; | 
| 72 | 72 | |
| 73 | 73 | $htmlnotice = | 
| 74 | - '<tr><td class="spacer" colspan="2"></td></tr> | |
| 74 | + '<tr><td class="spacer" colspan="2"></td></tr> | |
| 75 | 75 | <tr> | 
| 76 | 76 | <td class="help" colspan="2"> | 
| 77 | 77 |              <img src="lang/de/ocstyle/images/misc/hint.gif" border="0" width="15" height="11" alt="' . t('Notice') . '" title="' . t('Notice') . '" /> |