@@ -84,7 +84,8 @@ discard block |
||
| 84 | 84 | $called_by_search = isset($_REQUEST['calledbysearch']) ? $_REQUEST['calledbysearch'] <> 0 : true; |
| 85 | 85 | $called_by_profile_query = false; |
| 86 | 86 | |
| 87 | -if (isset($_REQUEST['queryid']) || isset($_REQUEST['showresult'])) { // Ocprop: showresult, queryid |
|
| 87 | +if (isset($_REQUEST['queryid']) || isset($_REQUEST['showresult'])) { |
|
| 88 | +// Ocprop: showresult, queryid |
|
| 88 | 89 | $bCookieQueryid = false; |
| 89 | 90 | $queryid = isset($_REQUEST['queryid']) ? $_REQUEST['queryid'] : 0; |
| 90 | 91 | if ($queryid && |
@@ -208,7 +209,8 @@ discard block |
||
| 208 | 209 | sql_free_result($rs_name); |
| 209 | 210 | } |
| 210 | 211 | } |
| 211 | -} else { // $queryid == 0 |
|
| 212 | +} else { |
|
| 213 | +// $queryid == 0 |
|
| 212 | 214 | // build search options from GET/POST parameters or default values |
| 213 | 215 | |
| 214 | 216 | // hack |
@@ -287,12 +289,14 @@ discard block |
||
| 287 | 289 | if (!isset($_REQUEST['utf8'])) { |
| 288 | 290 | $options['cachename'] = iconv("ISO-8859-1", "UTF-8", $options['cachename']); |
| 289 | 291 | } |
| 290 | - } elseif (isset($_REQUEST['searchbyowner'])) { // Ocprop |
|
| 292 | + } elseif (isset($_REQUEST['searchbyowner'])) { |
|
| 293 | +// Ocprop |
|
| 291 | 294 | $options['searchtype'] = 'byowner'; |
| 292 | 295 | |
| 293 | 296 | $options['ownerid'] = isset($_REQUEST['ownerid']) ? $_REQUEST['ownerid'] : 0; |
| 294 | 297 | $options['owner'] = isset($_REQUEST['owner']) ? stripslashes($_REQUEST['owner']) : ''; |
| 295 | - } elseif (isset($_REQUEST['searchbyfinder'])) { // Ocprop |
|
| 298 | + } elseif (isset($_REQUEST['searchbyfinder'])) { |
|
| 299 | +// Ocprop |
|
| 296 | 300 | $options['searchtype'] = 'byfinder'; |
| 297 | 301 | |
| 298 | 302 | $options['finderid'] = isset($_REQUEST['finderid']) ? $_REQUEST['finderid'] : 0; |
@@ -437,7 +441,8 @@ discard block |
||
| 437 | 441 | $bRememberQuery = isset($_REQUEST['skipqueryid']) ? !$_REQUEST['skipqueryid'] : true; |
| 438 | 442 | // This is used by the map, which implements its own query-caching. |
| 439 | 443 | if ($bRememberQuery) { |
| 440 | - if ($queryid == 0 && $options['showresult'] != 0) { // 'showresult' = "execute query" |
|
| 444 | + if ($queryid == 0 && $options['showresult'] != 0) { |
|
| 445 | +// 'showresult' = "execute query" |
|
| 441 | 446 | sql( |
| 442 | 447 | "INSERT INTO `queries` (`user_id`, `options`, `last_queried`) VALUES (0, '&1', NOW())", |
| 443 | 448 | serialize($options) |
@@ -854,7 +859,8 @@ discard block |
||
| 854 | 859 | outputSearchForm($options); |
| 855 | 860 | exit; |
| 856 | 861 | } |
| 857 | - } elseif ($options['searchtype'] == 'bydistance') { // Ocprop |
|
| 862 | + } elseif ($options['searchtype'] == 'bydistance') { |
|
| 863 | +// Ocprop |
|
| 858 | 864 | //check the entered data |
| 859 | 865 | if (isset($options['lat']) && isset($options['lon'])) { |
| 860 | 866 | $lat = $options['lat'] + 0; |
@@ -924,7 +930,8 @@ discard block |
||
| 924 | 930 | $sql_innerjoin[] = '`cache_logs` ON `caches`.`cache_id`=`cache_logs`.`cache_id`'; |
| 925 | 931 | $sql_where[] = '`cache_logs`.`user_id`=\'' . sql_escape($finder_id) . '\''; |
| 926 | 932 | |
| 927 | - if ($options['logtype'] != '0') { // 0 = all types |
|
| 933 | + if ($options['logtype'] != '0') { |
|
| 934 | +// 0 = all types |
|
| 928 | 935 | $ids = explode(',', $options['logtype']); |
| 929 | 936 | $idNumbers = '0'; |
| 930 | 937 | foreach ($ids as $id) { |
@@ -1405,7 +1412,8 @@ discard block |
||
| 1405 | 1412 | } |
| 1406 | 1413 | |
| 1407 | 1414 | $count = $caches_per_page; |
| 1408 | - if (isset($_REQUEST['count'])) { // Ocprop |
|
| 1415 | + if (isset($_REQUEST['count'])) { |
|
| 1416 | +// Ocprop |
|
| 1409 | 1417 | $count = floor($_REQUEST['count'] + 0); |
| 1410 | 1418 | } |
| 1411 | 1419 | if ($count == 'max') { |
@@ -1525,7 +1533,8 @@ discard block |
||
| 1525 | 1533 | } else { |
| 1526 | 1534 | exit; |
| 1527 | 1535 | } |
| 1528 | -} else { // $options['showresult'] == 0 |
|
| 1536 | +} else { |
|
| 1537 | +// $options['showresult'] == 0 |
|
| 1529 | 1538 | //============================================================= |
| 1530 | 1539 | // F5. present search options form to the user |
| 1531 | 1540 | //============================================================= |
@@ -1597,7 +1606,8 @@ discard block |
||
| 1597 | 1606 | |
| 1598 | 1607 | if (isset($options['sort'])) { |
| 1599 | 1608 | $bBynameChecked = ($options['sort'] == 'byname'); |
| 1600 | - } else { // Ocprop |
|
| 1609 | + } else { |
|
| 1610 | +// Ocprop |
|
| 1601 | 1611 | $bBynameChecked = (!$login->logged_in()); |
| 1602 | 1612 | } |
| 1603 | 1613 | $tpl->assign('byname_checked', $bBynameChecked); |
@@ -1759,7 +1769,8 @@ discard block |
||
| 1759 | 1769 | } |
| 1760 | 1770 | if ($options['searchtype'] == 'bydistance') { |
| 1761 | 1771 | $dByDistanceChecked = ($options['searchtype'] == 'bydistance'); |
| 1762 | - } else { // Ocprop |
|
| 1772 | + } else { |
|
| 1773 | +// Ocprop |
|
| 1763 | 1774 | $dByDistanceChecked = false; |
| 1764 | 1775 | } |
| 1765 | 1776 | $tpl->assign('dbydistance_checked', $dByDistanceChecked); |
@@ -1800,7 +1811,8 @@ discard block |
||
| 1800 | 1811 | ); |
| 1801 | 1812 | if ($options['searchtype'] == 'bywaypoint') { |
| 1802 | 1813 | $dByWaypointChecked = ($options['searchtype'] == 'bywaypoint'); |
| 1803 | - } else { // Ocprop |
|
| 1814 | + } else { |
|
| 1815 | +// Ocprop |
|
| 1804 | 1816 | $dByWaypointChecked = false; |
| 1805 | 1817 | } |
| 1806 | 1818 | $tpl->assign('dbywaypoint_checked', $dByWaypointChecked); |
@@ -24,7 +24,8 @@ discard block |
||
| 24 | 24 | if ($error == false) { |
| 25 | 25 | //logid |
| 26 | 26 | $log_id = 0; |
| 27 | - if (isset($_REQUEST['logid'])) { // Ocprop |
|
| 27 | + if (isset($_REQUEST['logid'])) { |
|
| 28 | +// Ocprop |
|
| 28 | 29 | $log_id = $_REQUEST['logid']; |
| 29 | 30 | } |
| 30 | 31 | |
@@ -273,7 +274,8 @@ discard block |
||
| 273 | 274 | } |
| 274 | 275 | |
| 275 | 276 | //store? |
| 276 | - if ($date_ok && $logtype_ok && $pw_ok && isset($_POST['submitform'])) { // Ocprop |
|
| 277 | + if ($date_ok && $logtype_ok && $pw_ok && isset($_POST['submitform'])) { |
|
| 278 | +// Ocprop |
|
| 277 | 279 | // 00:00:01 = "00:00 was logged" |
| 278 | 280 | // 00:00:00 = "no time was logged" |
| 279 | 281 | if ("$log_time_hour$log_time_minute" != "" && |
@@ -423,7 +423,8 @@ |
||
| 423 | 423 | { |
| 424 | 424 | global $menu; |
| 425 | 425 | |
| 426 | - if ($mainmenuindex >= 0) { // is -1 e.g. when calling newcache.php as logged-off-user (-> login.tpl.php) |
|
| 426 | + if ($mainmenuindex >= 0) { |
|
| 427 | +// is -1 e.g. when calling newcache.php as logged-off-user (-> login.tpl.php) |
|
| 427 | 428 | echo htmlspecialchars(t($menu[$mainmenuindex]['menustring']), ENT_COMPAT, 'UTF-8'); |
| 428 | 429 | |
| 429 | 430 | if (isset($menu[$mainmenuindex]['submenu']) && ($menu[$mainmenuindex]['siteid'] != $pageid)) { |
@@ -34,10 +34,12 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $uuid = isset($_REQUEST['uuid']) ? $_REQUEST['uuid'] : 0; |
| 36 | 36 | |
| 37 | -if ($action == 'add') { // Ocprop |
|
| 37 | +if ($action == 'add') { |
|
| 38 | +// Ocprop |
|
| 38 | 39 | $picture = new picture(); |
| 39 | 40 | |
| 40 | - if (isset($_REQUEST['cacheuuid'])) { // Ocprop |
|
| 41 | + if (isset($_REQUEST['cacheuuid'])) { |
|
| 42 | +// Ocprop |
|
| 41 | 43 | $cache = cache::fromUUID($_REQUEST['cacheuuid']); |
| 42 | 44 | if ($cache === null) { |
| 43 | 45 | $tpl->error(ERROR_CACHE_NOT_EXISTS); |
@@ -51,7 +53,8 @@ discard block |
||
| 51 | 53 | $picture->setObjectType(OBJECT_CACHE); |
| 52 | 54 | |
| 53 | 55 | $cache = null; |
| 54 | - } elseif (isset($_REQUEST['loguuid'])) {// Ocprop |
|
| 56 | + } elseif (isset($_REQUEST['loguuid'])) { |
|
| 57 | +// Ocprop |
|
| 55 | 58 | $cachelog = cachelog::fromUUID($_REQUEST['loguuid']); |
| 56 | 59 | if ($cachelog === null) { |
| 57 | 60 | $tpl->error(ERROR_CACHELOG_NOT_EXISTS); |
@@ -72,7 +75,8 @@ discard block |
||
| 72 | 75 | } |
| 73 | 76 | |
| 74 | 77 | // uploaded file ok? |
| 75 | - if (isset($_REQUEST['ok'])) { // Ocprop |
|
| 78 | + if (isset($_REQUEST['ok'])) { |
|
| 79 | +// Ocprop |
|
| 76 | 80 | $bError = false; |
| 77 | 81 | |
| 78 | 82 | $picture->setSpoiler(isset($_REQUEST['spoiler']) && $_REQUEST['spoiler'] == '1'); // Ocprop |
@@ -92,7 +96,8 @@ discard block |
||
| 92 | 96 | $tpl->redirect($picture->getPageLink()); |
| 93 | 97 | } |
| 94 | 98 | |
| 95 | - if (!isset($_FILES['file'])) { // Ocprop |
|
| 99 | + if (!isset($_FILES['file'])) { |
|
| 100 | +// Ocprop |
|
| 96 | 101 | $tpl->assign('errorfile', ERROR_UPLOAD_ERR_NO_FILE); |
| 97 | 102 | $bError = true; |
| 98 | 103 | } elseif ($_FILES['file']['error'] == UPLOAD_ERR_NO_FILE) { |
@@ -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`) |
@@ -44,7 +44,8 @@ |
||
| 44 | 44 | $file = fopen($filename, "r"); |
| 45 | 45 | $cnt = 0; |
| 46 | 46 | while ($line = fgets($file, 4096)) { |
| 47 | - if ($cnt ++ == 0) {// skip first line |
|
| 47 | + if ($cnt ++ == 0) { |
|
| 48 | +// skip first line |
|
| 48 | 49 | continue; |
| 49 | 50 | } |
| 50 | 51 | |
@@ -42,7 +42,8 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | for ($n = 1; $n < count($instances); ++ $n) { |
| 45 | - if ($instances[$n]['filesize'] !== false) {// ensure that pic is stored locally |
|
| 45 | + if ($instances[$n]['filesize'] !== false) { |
|
| 46 | +// ensure that pic is stored locally |
|
| 46 | 47 | for ($nn = $n - 1; $nn >= 0; -- $nn) { |
| 47 | 48 | if ($instances[$nn]['filesize'] === $instances[$n]['filesize']) { |
| 48 | 49 | if (file_get_contents($instances[$nn]['pic']->getFilename()) |
@@ -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 | |
@@ -71,7 +71,8 @@ |
||
| 71 | 71 | // e.g. in SMF Forum Threads |
| 72 | 72 | } elseif (!in_array(htmlspecialchars_decode($item->title), $headlines) && |
| 73 | 73 | strpos($item->title, 'VERSCHOBEN') === false |
| 74 | - ) { // hack to exclude forum thread-move messages |
|
| 74 | + ) { |
|
| 75 | +// hack to exclude forum thread-move messages |
|
| 75 | 76 | // fill array |
| 76 | 77 | $rss[] = array( |
| 77 | 78 | 'pubDate' => date('Y-m-d', strtotime($item->pubDate)), |