@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | select count(*) |
| 29 | 29 | from okapi_stats_temp |
| 30 | 30 | where |
| 31 | - consumer_key = '".Db::escape_string($consumer_key)."' |
|
| 31 | + consumer_key = '".Db::escape_string($consumer_key) . "' |
|
| 32 | 32 | and service_name='services/replicate/fulldump' |
| 33 | 33 | ") |
| 34 | 34 | + |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | select sum(total_calls) |
| 37 | 37 | from okapi_stats_hourly |
| 38 | 38 | where |
| 39 | - consumer_key = '".Db::escape_string($consumer_key)."' |
|
| 39 | + consumer_key = '".Db::escape_string($consumer_key) . "' |
|
| 40 | 40 | and service_name='services/replicate/fulldump' |
| 41 | 41 | and period_start > date_add(now(), interval -$days day) |
| 42 | 42 | limit 1 |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $data = Cache::get("last_fulldump"); |
| 52 | 52 | if ($data == null) |
| 53 | - throw new BadRequest("No fulldump found. Try again later. If this doesn't help ". |
|
| 53 | + throw new BadRequest("No fulldump found. Try again later. If this doesn't help " . |
|
| 54 | 54 | "contact site administrator and/or OKAPI developers."); |
| 55 | 55 | |
| 56 | 56 | # Check consumer's quota |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $response = new OkapiHttpResponse(); |
| 73 | 73 | $response->content_type = $data['meta']['content_type']; |
| 74 | - $response->content_disposition = 'attachment; filename="'.$data['meta']['public_filename'].'"'; |
|
| 74 | + $response->content_disposition = 'attachment; filename="' . $data['meta']['public_filename'] . '"'; |
|
| 75 | 75 | $response->stream_length = $data['meta']['compressed_size']; |
| 76 | 76 | $response->body = fopen($data['meta']['filepath'], "rb"); |
| 77 | 77 | $response->allow_gzip = false; |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | select status |
| 42 | 42 | from okapi_tile_status |
| 43 | 43 | where |
| 44 | - z = '".Db::escape_string($zoom)."' |
|
| 45 | - and x = '".Db::escape_string($x)."' |
|
| 46 | - and y = '".Db::escape_string($y)."' |
|
| 44 | + z = '".Db::escape_string($zoom) . "' |
|
| 45 | + and x = '".Db::escape_string($x) . "' |
|
| 46 | + and y = '".Db::escape_string($y) . "' |
|
| 47 | 47 | "); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | $tile_upper_x = $x << 8; |
| 84 | 84 | $tile_leftmost_y = $y << 8; |
| 85 | 85 | |
| 86 | - $zoom_escaped = "'".Db::escape_string($zoom)."'"; |
|
| 87 | - $tile_upper_x_escaped = "'".Db::escape_string($tile_upper_x)."'"; |
|
| 88 | - $tile_leftmost_y_escaped = "'".Db::escape_string($tile_leftmost_y)."'"; |
|
| 86 | + $zoom_escaped = "'" . Db::escape_string($zoom) . "'"; |
|
| 87 | + $tile_upper_x_escaped = "'" . Db::escape_string($tile_upper_x) . "'"; |
|
| 88 | + $tile_leftmost_y_escaped = "'" . Db::escape_string($tile_leftmost_y) . "'"; |
|
| 89 | 89 | return Db::query(" |
| 90 | 90 | select |
| 91 | 91 | otc.cache_id, |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | okapi_search_results osr |
| 98 | 98 | where |
| 99 | 99 | z = $zoom_escaped |
| 100 | - and x = '".Db::escape_string($x)."' |
|
| 101 | - and y = '".Db::escape_string($y)."' |
|
| 100 | + and x = '" . Db::escape_string($x) . "' |
|
| 101 | + and y = '".Db::escape_string($y) . "' |
|
| 102 | 102 | and otc.cache_id = osr.cache_id |
| 103 | - and osr.set_id = '".Db::escape_string($set_id)."' |
|
| 103 | + and osr.set_id = '".Db::escape_string($set_id) . "' |
|
| 104 | 104 | group by |
| 105 | 105 | z21x >> (3 + (21 - $zoom_escaped)), |
| 106 | 106 | z21y >> (3 + (21 - $zoom_escaped)) |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | # but there is *no need* to - this query is run seldom and is cached. |
| 136 | 136 | |
| 137 | 137 | $params = array(); |
| 138 | - $params['status'] = "Available|Temporarily unavailable|Archived"; # we want them all |
|
| 139 | - $params['limit'] = "10000000"; # no limit |
|
| 138 | + $params['status'] = "Available|Temporarily unavailable|Archived"; # we want them all |
|
| 139 | + $params['limit'] = "10000000"; # no limit |
|
| 140 | 140 | |
| 141 | 141 | $internal_request = new OkapiInternalRequest(new OkapiInternalConsumer(), null, $params); |
| 142 | 142 | $internal_request->skip_limits = true; |
@@ -162,14 +162,14 @@ discard block |
||
| 162 | 162 | z, x, y, cache_id, z21x, z21y, status, type, rating, flags, name_crc |
| 163 | 163 | ) values ( |
| 164 | 164 | 0, 0, 0, |
| 165 | - '".Db::escape_string($row[0])."', |
|
| 166 | - '".Db::escape_string($row[1])."', |
|
| 167 | - '".Db::escape_string($row[2])."', |
|
| 168 | - '".Db::escape_string($row[3])."', |
|
| 169 | - '".Db::escape_string($row[4])."', |
|
| 170 | - ".(($row[5] === null) ? "null" : "'".Db::escape_string($row[5])."'").", |
|
| 171 | - '".Db::escape_string($row[6])."', |
|
| 172 | - '".Db::escape_string($row[7])."' |
|
| 165 | + '".Db::escape_string($row[0]) . "', |
|
| 166 | + '".Db::escape_string($row[1]) . "', |
|
| 167 | + '".Db::escape_string($row[2]) . "', |
|
| 168 | + '".Db::escape_string($row[3]) . "', |
|
| 169 | + '".Db::escape_string($row[4]) . "', |
|
| 170 | + ".(($row[5] === null) ? "null" : "'" . Db::escape_string($row[5]) . "'") . ", |
|
| 171 | + '".Db::escape_string($row[6]) . "', |
|
| 172 | + '".Db::escape_string($row[7]) . "' |
|
| 173 | 173 | ); |
| 174 | 174 | "); |
| 175 | 175 | } |
@@ -229,31 +229,31 @@ discard block |
||
| 229 | 229 | flags, name_crc |
| 230 | 230 | ) |
| 231 | 231 | select |
| 232 | - '".Db::escape_string($zoom)."', |
|
| 233 | - '".Db::escape_string($x)."', |
|
| 234 | - '".Db::escape_string($y)."', |
|
| 232 | + '".Db::escape_string($zoom) . "', |
|
| 233 | + '".Db::escape_string($x) . "', |
|
| 234 | + '".Db::escape_string($y) . "', |
|
| 235 | 235 | cache_id, z21x, z21y, status, type, rating, |
| 236 | 236 | flags, name_crc |
| 237 | 237 | from okapi_tile_caches tc2 |
| 238 | 238 | where |
| 239 | - z = '".Db::escape_string($parent_zoom)."' |
|
| 240 | - and x = '".Db::escape_string($parent_x)."' |
|
| 241 | - and y = '".Db::escape_string($parent_y)."' |
|
| 239 | + z = '".Db::escape_string($parent_zoom) . "' |
|
| 240 | + and x = '".Db::escape_string($parent_x) . "' |
|
| 241 | + and y = '".Db::escape_string($parent_y) . "' |
|
| 242 | 242 | and z21x between $left_z21x and $right_z21x |
| 243 | 243 | and z21y between $top_z21y and $bottom_z21y |
| 244 | 244 | "); |
| 245 | 245 | Db::execute("unlock tables;"); |
| 246 | 246 | } catch (Exception $e) { |
| 247 | - Db::execute("unlock tables"); // No "finally" in PHP 5.3 |
|
| 247 | + Db::execute("unlock tables"); // No "finally" in PHP 5.3 |
|
| 248 | 248 | throw $e; |
| 249 | 249 | } |
| 250 | 250 | $test = Db::select_value(" |
| 251 | 251 | select 1 |
| 252 | 252 | from okapi_tile_caches |
| 253 | 253 | where |
| 254 | - z = '".Db::escape_string($zoom)."' |
|
| 255 | - and x = '".Db::escape_string($x)."' |
|
| 256 | - and y = '".Db::escape_string($y)."' |
|
| 254 | + z = '".Db::escape_string($zoom) . "' |
|
| 255 | + and x = '".Db::escape_string($x) . "' |
|
| 256 | + and y = '".Db::escape_string($y) . "' |
|
| 257 | 257 | limit 1; |
| 258 | 258 | "); |
| 259 | 259 | if ($test) |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | Db::execute(" |
| 269 | 269 | replace into okapi_tile_status (z, x, y, status) |
| 270 | 270 | values ( |
| 271 | - '".Db::escape_string($zoom)."', |
|
| 272 | - '".Db::escape_string($x)."', |
|
| 273 | - '".Db::escape_string($y)."', |
|
| 274 | - '".Db::escape_string($status)."' |
|
| 271 | + '".Db::escape_string($zoom) . "', |
|
| 272 | + '".Db::escape_string($x) . "', |
|
| 273 | + '".Db::escape_string($y) . "', |
|
| 274 | + '".Db::escape_string($status) . "' |
|
| 275 | 275 | ); |
| 276 | 276 | "); |
| 277 | 277 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | { |
| 320 | 320 | $offset = 128 << 21; |
| 321 | 321 | $x = round($offset + ($offset * $lon / 180)); |
| 322 | - $y = round($offset - $offset/pi() * log((1 + sin($lat * pi() / 180)) / (1 - sin($lat * pi() / 180))) / 2); |
|
| 322 | + $y = round($offset - $offset / pi() * log((1 + sin($lat * pi() / 180)) / (1 - sin($lat * pi() / 180))) / 2); |
|
| 323 | 323 | return array($x, $y); |
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | \ No newline at end of file |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | require_once('tiletree.inc.php'); |
| 28 | 28 | require_once('tilerenderer.inc.php'); |
| 29 | -require_once($GLOBALS['rootpath']."okapi/services/caches/search/searching.inc.php"); |
|
| 29 | +require_once($GLOBALS['rootpath'] . "okapi/services/caches/search/searching.inc.php"); |
|
| 30 | 30 | |
| 31 | 31 | class WebService |
| 32 | 32 | { |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | throw new InvalidParam('z', "Maximum value for this parameter is 21."); |
| 89 | 89 | $x = self::require_uint($request, 'x'); |
| 90 | 90 | $y = self::require_uint($request, 'y'); |
| 91 | - if ($x >= 1<<$zoom) |
|
| 92 | - throw new InvalidParam('x', "Should be in 0..".((1<<$zoom) - 1)."."); |
|
| 93 | - if ($y >= 1<<$zoom) |
|
| 94 | - throw new InvalidParam('y', "Should be in 0..".((1<<$zoom) - 1)."."); |
|
| 91 | + if ($x >= 1 << $zoom) |
|
| 92 | + throw new InvalidParam('x', "Should be in 0.." . ((1 << $zoom) - 1) . "."); |
|
| 93 | + if ($y >= 1 << $zoom) |
|
| 94 | + throw new InvalidParam('y', "Should be in 0.." . ((1 << $zoom) - 1) . "."); |
|
| 95 | 95 | |
| 96 | 96 | # Now, we will create a search set (or use one previously created). |
| 97 | 97 | # Instead of creating a new OkapiInternalRequest object, we will pass |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | # Load user-related cache ids. |
| 130 | 130 | |
| 131 | - $cache_key = "tileuser/".$request->token->user_id; |
|
| 131 | + $cache_key = "tileuser/" . $request->token->user_id; |
|
| 132 | 132 | $user = self::$USE_OTHER_CACHE ? Cache::get($cache_key) : null; |
| 133 | 133 | if ($user === null) |
| 134 | 134 | { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $rs = Db::query(" |
| 140 | 140 | select cache_id |
| 141 | 141 | from cache_ignore |
| 142 | - where user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 142 | + where user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 143 | 143 | "); |
| 144 | 144 | $user['ignored'] = array(); |
| 145 | 145 | while (list($cache_id) = Db::fetch_row($rs)) |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | select distinct cache_id |
| 152 | 152 | from cache_logs |
| 153 | 153 | where |
| 154 | - user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 154 | + user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 155 | 155 | and type = 1 |
| 156 | - and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true")." |
|
| 156 | + and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true") . " |
|
| 157 | 157 | "); |
| 158 | 158 | $user['found'] = array(); |
| 159 | 159 | while (list($cache_id) = Db::fetch_row($rs)) |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $rs = Db::query(" |
| 165 | 165 | select distinct cache_id |
| 166 | 166 | from caches |
| 167 | - where user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 167 | + where user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 168 | 168 | "); |
| 169 | 169 | $user['own'] = array(); |
| 170 | 170 | while (list($cache_id) = Db::fetch_row($rs)) |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | # the current user is the owner). |
| 183 | 183 | |
| 184 | 184 | if (isset($user['found'][$row_ref[0]])) |
| 185 | - $row_ref[6] |= TileTree::$FLAG_FOUND; # $row[6] is "flags" |
|
| 185 | + $row_ref[6] |= TileTree::$FLAG_FOUND; # $row[6] is "flags" |
|
| 186 | 186 | if (isset($user['own'][$row_ref[0]])) |
| 187 | - $row_ref[6] |= TileTree::$FLAG_OWN; # $row[6] is "flags" |
|
| 187 | + $row_ref[6] |= TileTree::$FLAG_OWN; # $row[6] is "flags" |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $response = new OkapiHttpResponse(); |
| 200 | 200 | $response->content_type = $tile->get_content_type(); |
| 201 | 201 | $response->cache_control = "Cache-Control: private, max-age=600"; |
| 202 | - $response->etag = 'W/"'.$image_fingerprint.'"'; |
|
| 202 | + $response->etag = 'W/"' . $image_fingerprint . '"'; |
|
| 203 | 203 | $response->allow_gzip = false; // images are usually compressed, prevent compression at Apache level |
| 204 | 204 | |
| 205 | 205 | # Check if the request didn't include the same ETag. |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | # Check if the image was recently rendered and is kept in image cache. |
| 220 | 220 | |
| 221 | - $cache_key = "tile/".$image_fingerprint; |
|
| 221 | + $cache_key = "tile/" . $image_fingerprint; |
|
| 222 | 222 | $response->body = self::$USE_IMAGE_CACHE ? Cache::get($cache_key) : null; |
| 223 | 223 | OkapiServiceRunner::save_stats_extra("caches/map/tile/checkpointC", null, |
| 224 | 224 | microtime(true) - $checkpointC_started); |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | return ob_get_clean(); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - private static function get_image($name, $opacity=1, $brightness=0, |
|
| 105 | - $contrast=0, $r=0, $g=0, $b=0) |
|
| 104 | + private static function get_image($name, $opacity = 1, $brightness = 0, |
|
| 105 | + $contrast = 0, $r = 0, $g = 0, $b = 0) |
|
| 106 | 106 | { |
| 107 | 107 | static $locmem_cache = array(); |
| 108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | try |
| 117 | 117 | { |
| 118 | - $cache_key = "tilesrc/".Okapi::$git_revision."/".self::$VERSION."/".$key; |
|
| 118 | + $cache_key = "tilesrc/" . Okapi::$git_revision . "/" . self::$VERSION . "/" . $key; |
|
| 119 | 119 | $gd2_path = self::$USE_STATIC_IMAGE_CACHE |
| 120 | 120 | ? FileCache::get_file_path($cache_key) : null; |
| 121 | 121 | if ($gd2_path === null) |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | # Miss again (or error decoding). Read the image from PNG. |
| 130 | 130 | |
| 131 | - $locmem_cache[$key] = imagecreatefrompng($GLOBALS['rootpath']."okapi/static/tilemap/$name.png"); |
|
| 131 | + $locmem_cache[$key] = imagecreatefrompng($GLOBALS['rootpath'] . "okapi/static/tilemap/$name.png"); |
|
| 132 | 132 | |
| 133 | 133 | # Apply all wanted effects. |
| 134 | 134 | |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $w = imagesx($im); |
| 166 | 166 | $h = imagesy($im); |
| 167 | 167 | |
| 168 | - for($x = 0; $x < $w; $x++) |
|
| 168 | + for ($x = 0; $x < $w; $x++) |
|
| 169 | 169 | { |
| 170 | - for($y = 0; $y < $h; $y++) |
|
| 170 | + for ($y = 0; $y < $h; $y++) |
|
| 171 | 171 | { |
| 172 | 172 | $color = imagecolorat($im, $x, $y); |
| 173 | 173 | $new_color = ((max(0, floor(127 - ((127 - (($color >> 24) & 0x7f)) * $ratio))) & 0x7f) << 24) | ($color & 0x80ffffff); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | # Put the inner marker (indicates the type). |
| 249 | 249 | |
| 250 | - $inner_marker = self::get_image("large_inner_".self::get_type_suffix( |
|
| 250 | + $inner_marker = self::get_image("large_inner_" . self::get_type_suffix( |
|
| 251 | 251 | $type, true), $a, $br, $c, $r, $g, $b); |
| 252 | 252 | imagecopy($this->im, $inner_marker, $px - 7, $py - 22, 0, 0, 16, 16); |
| 253 | 253 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | if ($found) |
| 289 | 289 | { |
| 290 | - $icon = self::get_image("found", 0.7*$a, $br, $c, $r, $g, $b); |
|
| 290 | + $icon = self::get_image("found", 0.7 * $a, $br, $c, $r, $g, $b); |
|
| 291 | 291 | imagecopy($this->im, $icon, $px - 2, $py - $center_y - 3, 0, 0, 16, 16); |
| 292 | 292 | } |
| 293 | 293 | |
@@ -302,16 +302,16 @@ discard block |
||
| 302 | 302 | $lines = array(); |
| 303 | 303 | $line = ""; |
| 304 | 304 | $nextBonus = ""; |
| 305 | - for ($i=0; ($i<count($words)) || (mb_strlen($nextBonus)>0); $i++) { |
|
| 306 | - $word = isset($words[$i])?$words[$i]:""; |
|
| 305 | + for ($i = 0; ($i < count($words)) || (mb_strlen($nextBonus) > 0); $i++) { |
|
| 306 | + $word = isset($words[$i]) ? $words[$i] : ""; |
|
| 307 | 307 | if (mb_strlen($nextBonus) > 0) |
| 308 | - $word = $nextBonus." ".$word; |
|
| 308 | + $word = $nextBonus . " " . $word; |
|
| 309 | 309 | $nextBonus = ""; |
| 310 | 310 | while (true) { |
| 311 | - $bbox = imagettfbbox($size, 0, $font, $line.$word); |
|
| 312 | - $width = $bbox[2]-$bbox[0]; |
|
| 311 | + $bbox = imagettfbbox($size, 0, $font, $line . $word); |
|
| 312 | + $width = $bbox[2] - $bbox[0]; |
|
| 313 | 313 | if ($width <= $maxWidth) { |
| 314 | - $line .= $word." "; |
|
| 314 | + $line .= $word . " "; |
|
| 315 | 315 | continue 2; |
| 316 | 316 | } |
| 317 | 317 | if (mb_strlen($line) > 0) { |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | $line = ""; |
| 320 | 320 | continue; |
| 321 | 321 | } |
| 322 | - $nextBonus = $word[mb_strlen($word)-1].$nextBonus; |
|
| 323 | - $word = mb_substr($word, 0, mb_strlen($word)-1); |
|
| 322 | + $nextBonus = $word[mb_strlen($word) - 1] . $nextBonus; |
|
| 323 | + $word = mb_substr($word, 0, mb_strlen($word) - 1); |
|
| 324 | 324 | continue; |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -336,16 +336,16 @@ discard block |
||
| 336 | 336 | { |
| 337 | 337 | # Check cache. |
| 338 | 338 | |
| 339 | - $cache_key = "tilecaption/".self::$VERSION."/".$cache_id."/".$name_crc; |
|
| 339 | + $cache_key = "tilecaption/" . self::$VERSION . "/" . $cache_id . "/" . $name_crc; |
|
| 340 | 340 | $gd2 = self::$USE_CAPTIONS_CACHE ? Cache::get($cache_key) : null; |
| 341 | 341 | if ($gd2 === null) |
| 342 | 342 | { |
| 343 | 343 | # We'll work with 16x bigger image to get smoother interpolation. |
| 344 | 344 | |
| 345 | - $im = imagecreatetruecolor(64*4, 26*4); |
|
| 345 | + $im = imagecreatetruecolor(64 * 4, 26 * 4); |
|
| 346 | 346 | imagealphablending($im, false); |
| 347 | 347 | $transparent = imagecolorallocatealpha($im, 255, 255, 255, 127); |
| 348 | - imagefilledrectangle($im, 0, 0, 64*4, 26*4, $transparent); |
|
| 348 | + imagefilledrectangle($im, 0, 0, 64 * 4, 26 * 4, $transparent); |
|
| 349 | 349 | imagealphablending($im, true); |
| 350 | 350 | |
| 351 | 351 | # Get the name of the cache. |
@@ -353,15 +353,15 @@ discard block |
||
| 353 | 353 | $name = Db::select_value(" |
| 354 | 354 | select name |
| 355 | 355 | from caches |
| 356 | - where cache_id = '".Db::escape_string($cache_id)."' |
|
| 356 | + where cache_id = '".Db::escape_string($cache_id) . "' |
|
| 357 | 357 | "); |
| 358 | 358 | |
| 359 | 359 | # Split the name into a couple of lines. |
| 360 | 360 | |
| 361 | 361 | //$font = $GLOBALS['rootpath'].'util.sec/bt.ttf'; |
| 362 | - $font = $GLOBALS['rootpath'].'okapi/static/tilemap/tahoma.ttf'; |
|
| 362 | + $font = $GLOBALS['rootpath'] . 'okapi/static/tilemap/tahoma.ttf'; |
|
| 363 | 363 | $size = 25; |
| 364 | - $lines = explode("\n", self::wordwrap($font, $size, 64*4 - 6*2, $name)); |
|
| 364 | + $lines = explode("\n", self::wordwrap($font, $size, 64 * 4 - 6 * 2, $name)); |
|
| 365 | 365 | |
| 366 | 366 | # For each line, compute its (x, y) so that the text is centered. |
| 367 | 367 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | foreach ($lines as $line) |
| 371 | 371 | { |
| 372 | 372 | $bbox = imagettfbbox($size, 0, $font, $line); |
| 373 | - $width = $bbox[2]-$bbox[0]; |
|
| 373 | + $width = $bbox[2] - $bbox[0]; |
|
| 374 | 374 | $x = 128 - ($width >> 1); |
| 375 | 375 | $positions[] = array($x, $y); |
| 376 | 376 | $y += 36; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $drawer = function($x, $y, $color) use (&$lines, &$positions, &$im, &$size, &$font) |
| 379 | 379 | { |
| 380 | 380 | $len = count($lines); |
| 381 | - for ($i=0; $i<$len; $i++) |
|
| 381 | + for ($i = 0; $i < $len; $i++) |
|
| 382 | 382 | { |
| 383 | 383 | $line = $lines[$i]; |
| 384 | 384 | list($offset_x, $offset_y) = $positions[$i]; |
@@ -389,8 +389,8 @@ discard block |
||
| 389 | 389 | # Draw an outline. |
| 390 | 390 | |
| 391 | 391 | $outline_color = imagecolorallocatealpha($im, 255, 255, 255, 80); |
| 392 | - for ($x=0; $x<=12; $x+=3) |
|
| 393 | - for ($y=$size-3; $y<=$size+9; $y+=3) |
|
| 392 | + for ($x = 0; $x <= 12; $x += 3) |
|
| 393 | + for ($y = $size - 3; $y <= $size + 9; $y += 3) |
|
| 394 | 394 | $drawer($x, $y, $outline_color); |
| 395 | 395 | |
| 396 | 396 | # Add a slight shadow effect (on top of the outline). |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | imagealphablending($im, false); |
| 407 | 407 | $small = imagecreatetruecolor(64, 26); |
| 408 | 408 | imagealphablending($small, false); |
| 409 | - imagecopyresampled($small, $im, 0, 0, 0, 0, 64, 26, 64*4, 26*4); |
|
| 409 | + imagecopyresampled($small, $im, 0, 0, 0, 0, 64, 26, 64 * 4, 26 * 4); |
|
| 410 | 410 | |
| 411 | 411 | # Cache it! |
| 412 | 412 | |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | # Put the marker (indicates the type). |
| 435 | 435 | |
| 436 | - $marker = self::get_image("medium_".self::get_type_suffix($type, false), $a); |
|
| 436 | + $marker = self::get_image("medium_" . self::get_type_suffix($type, false), $a); |
|
| 437 | 437 | $width = 14; |
| 438 | 438 | $height = 14; |
| 439 | 439 | $center_x = 7; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | { |
| 491 | 491 | # Mark found caches with V. |
| 492 | 492 | |
| 493 | - $icon = self::get_image("found", 0.7*$a); |
|
| 493 | + $icon = self::get_image("found", 0.7 * $a); |
|
| 494 | 494 | imagecopy($this->im, $icon, $px - ($center_x - $markercenter_x) - 7, |
| 495 | 495 | $py - ($center_y - $markercenter_y) - 9, 0, 0, 16, 16); |
| 496 | 496 | } |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | $own = $flags & TileTree::$FLAG_OWN; |
| 533 | 533 | $new = $flags & TileTree::$FLAG_NEW; |
| 534 | 534 | |
| 535 | - $marker = self::get_image("tiny_".self::get_type_suffix($type, false)); |
|
| 535 | + $marker = self::get_image("tiny_" . self::get_type_suffix($type, false)); |
|
| 536 | 536 | $width = 10; |
| 537 | 537 | $height = 10; |
| 538 | 538 | $center_x = 5; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | # This is efficient and yields acceptable results. |
| 578 | 578 | |
| 579 | 579 | $matrix = array(); |
| 580 | - for ($i=0; $i<12; $i++) |
|
| 580 | + for ($i = 0; $i < 12; $i++) |
|
| 581 | 581 | $matrix[] = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 582 | 582 | |
| 583 | 583 | foreach ($this->rows_ref as &$row_ref) |
@@ -586,27 +586,27 @@ discard block |
||
| 586 | 586 | $my = ($row_ref[2] + 64) >> 5; |
| 587 | 587 | if (($mx >= 12) || ($my >= 12)) continue; |
| 588 | 588 | if (($matrix[$mx][$my] === 0) && ($row_ref[8] == 1)) # 8 is count |
| 589 | - $matrix[$mx][$my] = $row_ref[0]; # 0 is cache_id |
|
| 589 | + $matrix[$mx][$my] = $row_ref[0]; # 0 is cache_id |
|
| 590 | 590 | else |
| 591 | 591 | $matrix[$mx][$my] = -1; |
| 592 | 592 | } |
| 593 | 593 | $selected_cache_ids = array(); |
| 594 | - for ($mx=1; $mx<11; $mx++) |
|
| 594 | + for ($mx = 1; $mx < 11; $mx++) |
|
| 595 | 595 | { |
| 596 | - for ($my=1; $my<11; $my++) |
|
| 596 | + for ($my = 1; $my < 11; $my++) |
|
| 597 | 597 | { |
| 598 | 598 | if ($matrix[$mx][$my] > 0) # cache_id |
| 599 | 599 | { |
| 600 | 600 | # Check all adjacent squares. |
| 601 | 601 | |
| 602 | - if ( ($matrix[$mx-1][$my-1] === 0) |
|
| 603 | - && ($matrix[$mx-1][$my ] === 0) |
|
| 604 | - && ($matrix[$mx-1][$my+1] === 0) |
|
| 605 | - && ($matrix[$mx ][$my-1] === 0) |
|
| 606 | - && ($matrix[$mx ][$my+1] === 0) |
|
| 607 | - && ($matrix[$mx+1][$my-1] === 0) |
|
| 608 | - && ($matrix[$mx+1][$my ] === 0) |
|
| 609 | - && ($matrix[$mx+1][$my+1] === 0) |
|
| 602 | + if (($matrix[$mx - 1][$my - 1] === 0) |
|
| 603 | + && ($matrix[$mx - 1][$my] === 0) |
|
| 604 | + && ($matrix[$mx - 1][$my + 1] === 0) |
|
| 605 | + && ($matrix[$mx][$my - 1] === 0) |
|
| 606 | + && ($matrix[$mx][$my + 1] === 0) |
|
| 607 | + && ($matrix[$mx + 1][$my - 1] === 0) |
|
| 608 | + && ($matrix[$mx + 1][$my] === 0) |
|
| 609 | + && ($matrix[$mx + 1][$my + 1] === 0) |
|
| 610 | 610 | ) |
| 611 | 611 | $selected_cache_ids[] = $matrix[$mx][$my]; |
| 612 | 612 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | from okapi_tile_caches |
| 74 | 74 | where |
| 75 | 75 | z=0 |
| 76 | - and cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 76 | + and cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 77 | 77 | ")); |
| 78 | 78 | |
| 79 | 79 | # Caches near the poles caused our computations to break here. We will |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | Db::execute(" |
| 124 | 124 | delete from okapi_tile_caches |
| 125 | - where cache_id = '".Db::escape_string($cache_id)."' |
|
| 125 | + where cache_id = '".Db::escape_string($cache_id) . "' |
|
| 126 | 126 | "); |
| 127 | 127 | |
| 128 | 128 | # Note, that after this operation, okapi_tile_status may be out-of-date. |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $z21x = $row[1]; |
| 147 | 147 | $z21y = $row[2]; |
| 148 | - $ex = $z21x >> 8; # initially, z21x / <tile width> |
|
| 149 | - $ey = $z21y >> 8; # initially, z21y / <tile height> |
|
| 148 | + $ex = $z21x >> 8; # initially, z21x / <tile width> |
|
| 149 | + $ey = $z21y >> 8; # initially, z21y / <tile height> |
|
| 150 | 150 | for ($zoom = 21; $zoom >= 0; $zoom--, $ex >>= 1, $ey >>= 1) |
| 151 | 151 | { |
| 152 | 152 | # ($ex, $ey) points to the "exact match" tile. We need to determine |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | # go with the simple approach and check all 1+8 bordering tiles. |
| 155 | 155 | |
| 156 | 156 | $tiles_in_this_region = array(); |
| 157 | - for ($x=$ex-1; $x<=$ex+1; $x++) |
|
| 158 | - for ($y=$ey-1; $y<=$ey+1; $y++) |
|
| 159 | - if (($x >= 0) && ($x < 1<<$zoom) && ($y >= 0) && ($y < 1<<$zoom)) |
|
| 157 | + for ($x = $ex - 1; $x <= $ex + 1; $x++) |
|
| 158 | + for ($y = $ey - 1; $y <= $ey + 1; $y++) |
|
| 159 | + if (($x >= 0) && ($x < 1 << $zoom) && ($y >= 0) && ($y < 1 << $zoom)) |
|
| 160 | 160 | $tiles_in_this_region[] = array($x, $y); |
| 161 | 161 | |
| 162 | 162 | foreach ($tiles_in_this_region as $coords) |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | list($x, $y) = $coords; |
| 165 | 165 | |
| 166 | 166 | $scale = 8 + 21 - $zoom; |
| 167 | - $margin = 1 << ($scale - 3); # 32px of current $zoom level, measured in z21 pixels. |
|
| 167 | + $margin = 1 << ($scale - 3); # 32px of current $zoom level, measured in z21 pixels. |
|
| 168 | 168 | |
| 169 | 169 | $left_z21x = ($x << $scale) - $margin; |
| 170 | 170 | $right_z21x = (($x + 1) << $scale) + $margin; |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | list($z, $x, $y) = $coords; |
| 197 | 197 | $alternatives_escaped[] = "( |
| 198 | - z = '".Db::escape_string($z)."' |
|
| 199 | - and x = '".Db::escape_string($x)."' |
|
| 200 | - and y = '".Db::escape_string($y)."' |
|
| 198 | + z = '".Db::escape_string($z) . "' |
|
| 199 | + and x = '".Db::escape_string($x) . "' |
|
| 200 | + and y = '".Db::escape_string($y) . "' |
|
| 201 | 201 | )"; |
| 202 | 202 | } |
| 203 | 203 | if (count($alternatives_escaped) > 0) |
@@ -208,17 +208,17 @@ discard block |
||
| 208 | 208 | ) |
| 209 | 209 | select |
| 210 | 210 | z, x, y, |
| 211 | - '".Db::escape_string($row[0])."', |
|
| 212 | - '".Db::escape_string($row[1])."', |
|
| 213 | - '".Db::escape_string($row[2])."', |
|
| 214 | - '".Db::escape_string($row[3])."', |
|
| 215 | - '".Db::escape_string($row[4])."', |
|
| 216 | - ".(($row[5] === null) ? "null" : "'".Db::escape_string($row[5])."'").", |
|
| 217 | - '".Db::escape_string($row[6])."', |
|
| 218 | - '".Db::escape_string($row[7])."' |
|
| 211 | + '".Db::escape_string($row[0]) . "', |
|
| 212 | + '".Db::escape_string($row[1]) . "', |
|
| 213 | + '".Db::escape_string($row[2]) . "', |
|
| 214 | + '".Db::escape_string($row[3]) . "', |
|
| 215 | + '".Db::escape_string($row[4]) . "', |
|
| 216 | + ".(($row[5] === null) ? "null" : "'" . Db::escape_string($row[5]) . "'") . ", |
|
| 217 | + '".Db::escape_string($row[6]) . "', |
|
| 218 | + '".Db::escape_string($row[7]) . "' |
|
| 219 | 219 | from okapi_tile_status |
| 220 | 220 | where |
| 221 | - (".implode(" or ", $alternatives_escaped).") |
|
| 221 | + (".implode(" or ", $alternatives_escaped) . ") |
|
| 222 | 222 | and status in (1,2) |
| 223 | 223 | "); |
| 224 | 224 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | update okapi_tile_status |
| 230 | 230 | set status=2 |
| 231 | 231 | where |
| 232 | - (".implode(" or ", $alternatives_escaped).") |
|
| 232 | + (".implode(" or ", $alternatives_escaped) . ") |
|
| 233 | 233 | and status=1 |
| 234 | 234 | "); |
| 235 | 235 | } |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | Db::execute(" |
| 247 | 247 | update okapi_tile_caches |
| 248 | 248 | set |
| 249 | - status = '".Db::escape_string($row[3])."', |
|
| 250 | - type = '".Db::escape_string($row[4])."', |
|
| 251 | - rating = ".(($row[5] === null) ? "null" : "'".Db::escape_string($row[5])."'").", |
|
| 252 | - flags = '".Db::escape_string($row[6])."', |
|
| 253 | - name_crc = '".Db::escape_string($row[7])."' |
|
| 249 | + status = '".Db::escape_string($row[3]) . "', |
|
| 250 | + type = '".Db::escape_string($row[4]) . "', |
|
| 251 | + rating = ".(($row[5] === null) ? "null" : "'" . Db::escape_string($row[5]) . "'") . ", |
|
| 252 | + flags = '".Db::escape_string($row[6]) . "', |
|
| 253 | + name_crc = '".Db::escape_string($row[7]) . "' |
|
| 254 | 254 | where |
| 255 | - cache_id = '".Db::escape_string($row[0])."' |
|
| 255 | + cache_id = '".Db::escape_string($row[0]) . "' |
|
| 256 | 256 | "); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $cache_id = Db::select_value(" |
| 264 | 264 | select cache_id |
| 265 | 265 | from caches |
| 266 | - where wp_oc='".Db::escape_string($c['object_key']['code'])."' |
|
| 266 | + where wp_oc='".Db::escape_string($c['object_key']['code']) . "' |
|
| 267 | 267 | "); |
| 268 | 268 | self::remove_geocache_from_cached_tiles($cache_id); |
| 269 | 269 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | 'my_notes', 'trackables_count', 'trackables', 'alt_wpts', 'last_found', |
| 35 | 35 | 'last_modified', 'date_created', 'date_hidden', 'internal_id', 'is_watched', |
| 36 | 36 | 'is_ignored', 'willattends', 'country', 'state', 'preview_image', |
| 37 | - 'trip_time', 'trip_distance', 'attribution_note','gc_code', 'hint2', 'hints2', |
|
| 37 | + 'trip_time', 'trip_distance', 'attribution_note', 'gc_code', 'hint2', 'hints2', |
|
| 38 | 38 | 'protection_areas', 'short_description', 'short_descriptions', 'needs_maintenance'); |
| 39 | 39 | |
| 40 | 40 | public static function call(OkapiRequest $request) |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | $cache_codes = explode("|", $cache_codes); |
| 52 | 52 | |
| 53 | 53 | if ((count($cache_codes) > 500) && (!$request->skip_limits)) |
| 54 | - throw new InvalidParam('cache_codes', "Maximum allowed number of referenced ". |
|
| 55 | - "caches is 500. You provided ".count($cache_codes)." cache codes."); |
|
| 54 | + throw new InvalidParam('cache_codes', "Maximum allowed number of referenced " . |
|
| 55 | + "caches is 500. You provided " . count($cache_codes) . " cache codes."); |
|
| 56 | 56 | if (count($cache_codes) != count(array_unique($cache_codes))) |
| 57 | 57 | throw new InvalidParam('cache_codes', "Duplicate codes detected (make sure each cache is referenced only once)."); |
| 58 | 58 | |
| 59 | 59 | $langpref = $request->get_parameter('langpref'); |
| 60 | 60 | if (!$langpref) $langpref = "en"; |
| 61 | - $langpref .= "|".Settings::get('SITELANG'); |
|
| 61 | + $langpref .= "|" . Settings::get('SITELANG'); |
|
| 62 | 62 | $langpref = explode("|", $langpref); |
| 63 | 63 | |
| 64 | 64 | $fields = $request->get_parameter('fields'); |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | throw new InvalidParam('attribution_append'); |
| 100 | 100 | |
| 101 | 101 | $log_fields = $request->get_parameter('log_fields'); |
| 102 | - if (!$log_fields) $log_fields = "uuid|date|user|type|comment"; // validation is done on call |
|
| 102 | + if (!$log_fields) $log_fields = "uuid|date|user|type|comment"; // validation is done on call |
|
| 103 | 103 | |
| 104 | 104 | $user_uuid = $request->get_parameter('user_uuid'); |
| 105 | 105 | if ($user_uuid != null) |
| 106 | 106 | { |
| 107 | - $user_id = Db::select_value("select user_id from user where uuid='".Db::escape_string($user_uuid)."'"); |
|
| 107 | + $user_id = Db::select_value("select user_id from user where uuid='" . Db::escape_string($user_uuid) . "'"); |
|
| 108 | 108 | if ($user_id == null) |
| 109 | 109 | throw new InvalidParam('user_uuid', "User not found."); |
| 110 | 110 | if (($request->token != null) && ($request->token->user_id != $user_id)) |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | throw new BadRequest("When using 'distance' or 'bearing' fields, you have to supply 'my_location' parameter."); |
| 137 | 137 | $parts = explode('|', $tmp); |
| 138 | 138 | if (count($parts) != 2) |
| 139 | - throw new InvalidParam('my_location', "Expecting 2 pipe-separated parts, got ".count($parts)."."); |
|
| 139 | + throw new InvalidParam('my_location', "Expecting 2 pipe-separated parts, got " . count($parts) . "."); |
|
| 140 | 140 | foreach ($parts as &$part_ref) |
| 141 | 141 | { |
| 142 | 142 | if (!preg_match("/^-?[0-9]+(\.?[0-9]*)$/", $part_ref)) |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | caches c |
| 179 | 179 | left join stat_caches as sc on c.cache_id = sc.cache_id |
| 180 | 180 | where |
| 181 | - wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes))."') |
|
| 181 | + wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes)) . "') |
|
| 182 | 182 | and status in (1,2,3) |
| 183 | 183 | "); |
| 184 | 184 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | from |
| 210 | 210 | caches c |
| 211 | 211 | where |
| 212 | - wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes))."') |
|
| 212 | + wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes)) . "') |
|
| 213 | 213 | and c.status in (1,2,3) |
| 214 | 214 | "); |
| 215 | 215 | } |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | break; |
| 240 | 240 | case 'name': $entry['name'] = $row['name']; break; |
| 241 | 241 | case 'names': $entry['names'] = array(Settings::get('SITELANG') => $row['name']); break; // for the future |
| 242 | - case 'location': $entry['location'] = round($row['latitude'], 6)."|".round($row['longitude'], 6); break; |
|
| 242 | + case 'location': $entry['location'] = round($row['latitude'], 6) . "|" . round($row['longitude'], 6); break; |
|
| 243 | 243 | case 'type': $entry['type'] = Okapi::cache_type_id2name($row['type']); break; |
| 244 | 244 | case 'status': $entry['status'] = Okapi::cache_status_id2name($row['status']); break; |
| 245 | 245 | case 'needs_maintenance': $entry['needs_maintenance'] = $row['needs_maintenance'] > 0; break; |
| 246 | - case 'url': $entry['url'] = Settings::get('SITE_URL')."viewcache.php?wp=".$row['wp_oc']; break; |
|
| 246 | + case 'url': $entry['url'] = Settings::get('SITE_URL') . "viewcache.php?wp=" . $row['wp_oc']; break; |
|
| 247 | 247 | case 'owner': |
| 248 | 248 | $owner_ids[$row['wp_oc']] = $row['user_id']; |
| 249 | 249 | /* continued later */ |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | break; |
| 254 | 254 | case 'bearing': |
| 255 | 255 | $tmp = Okapi::get_bearing($center_lat, $center_lon, $row['latitude'], $row['longitude']); |
| 256 | - $entry['bearing'] = ($tmp !== null) ? ((int)(10*$tmp)) / 10.0 : null; |
|
| 256 | + $entry['bearing'] = ($tmp !== null) ? ((int)(10 * $tmp)) / 10.0 : null; |
|
| 257 | 257 | break; |
| 258 | 258 | case 'bearing2': |
| 259 | 259 | $tmp = Okapi::get_bearing($center_lat, $center_lon, $row['latitude'], $row['longitude']); |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | switch (Okapi::cache_sizeid_to_size2($row['size'])) |
| 288 | 288 | { |
| 289 | 289 | case 'none': $entry['size'] = null; break; |
| 290 | - case 'nano': $entry['size'] = 1.0; break; # same as micro |
|
| 290 | + case 'nano': $entry['size'] = 1.0; break; # same as micro |
|
| 291 | 291 | case 'micro': $entry['size'] = 1.0; break; |
| 292 | 292 | case 'small': $entry['size'] = 2.0; break; |
| 293 | 293 | case 'regular': $entry['size'] = 3.0; break; |
| 294 | 294 | case 'large': $entry['size'] = 4.0; break; |
| 295 | 295 | case 'xlarge': $entry['size'] = 5.0; break; |
| 296 | - case 'other': $entry['size'] = null; break; # same as none |
|
| 296 | + case 'other': $entry['size'] = null; break; # same as none |
|
| 297 | 297 | default: throw new Exception(); |
| 298 | 298 | } |
| 299 | 299 | break; |
@@ -304,12 +304,12 @@ discard block |
||
| 304 | 304 | case 'trip_time': |
| 305 | 305 | # search time is entered in hours:minutes and converted to decimal hours, |
| 306 | 306 | # which can produce lots of unneeded decimal places; 2 of them are sufficient here |
| 307 | - $entry['trip_time'] = $row['trip_time'] === null ? null : round($row['trip_time'],2); break; |
|
| 307 | + $entry['trip_time'] = $row['trip_time'] === null ? null : round($row['trip_time'], 2); break; |
|
| 308 | 308 | break; |
| 309 | 309 | case 'trip_distance': |
| 310 | 310 | # way length is entered in km as decimal fraction, but number conversions can |
| 311 | 311 | # create fake digits which should be stripped; meter precision is sufficient here |
| 312 | - $entry['trip_distance'] = $row['trip_distance'] === null ? null : round($row['trip_distance'],3); break; |
|
| 312 | + $entry['trip_distance'] = $row['trip_distance'] === null ? null : round($row['trip_distance'], 3); break; |
|
| 313 | 313 | break; |
| 314 | 314 | case 'rating': |
| 315 | 315 | if ($row['votes'] < 3) $entry['rating'] = null; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | case 'internal_id': $entry['internal_id'] = $row['cache_id']; break; |
| 349 | 349 | case 'attribution_note': /* handled separately */ break; |
| 350 | 350 | case 'protection_areas': /* handled separately */ break; |
| 351 | - default: throw new Exception("Missing field case: ".$field); |
|
| 351 | + default: throw new Exception("Missing field case: " . $field); |
|
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | $results[$row['wp_oc']] = $entry; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $rs = Db::query(" |
| 365 | 365 | select user_id, uuid, username |
| 366 | 366 | from user |
| 367 | - where user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_values($owner_ids)))."') |
|
| 367 | + where user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_values($owner_ids))) . "') |
|
| 368 | 368 | "); |
| 369 | 369 | $tmp = array(); |
| 370 | 370 | while ($row = Db::fetch_assoc($rs)) |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $result_ref['owner'] = array( |
| 376 | 376 | 'uuid' => $row['uuid'], |
| 377 | 377 | 'username' => $row['username'], |
| 378 | - 'profile_url' => Settings::get('SITE_URL')."viewprofile.php?userid=".$row['user_id'] |
|
| 378 | + 'profile_url' => Settings::get('SITE_URL') . "viewprofile.php?userid=" . $row['user_id'] |
|
| 379 | 379 | ); |
| 380 | 380 | } |
| 381 | 381 | } |
@@ -394,11 +394,11 @@ discard block |
||
| 394 | 394 | where |
| 395 | 395 | c.cache_id = cl.cache_id |
| 396 | 396 | and cl.type in ( |
| 397 | - '".Db::escape_string(Okapi::logtypename2id("Found it"))."', |
|
| 398 | - '".Db::escape_string(Okapi::logtypename2id("Attended"))."' |
|
| 397 | + '".Db::escape_string(Okapi::logtypename2id("Found it")) . "', |
|
| 398 | + '".Db::escape_string(Okapi::logtypename2id("Attended")) . "' |
|
| 399 | 399 | ) |
| 400 | - and cl.user_id = '".Db::escape_string($user_id)."' |
|
| 401 | - ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "and cl.deleted = 0" : "")." |
|
| 400 | + and cl.user_id = '".Db::escape_string($user_id) . "' |
|
| 401 | + ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "and cl.deleted = 0" : "") . " |
|
| 402 | 402 | "); |
| 403 | 403 | $tmp2 = array(); |
| 404 | 404 | foreach ($tmp as $cache_code) |
@@ -420,9 +420,9 @@ discard block |
||
| 420 | 420 | cache_logs cl |
| 421 | 421 | where |
| 422 | 422 | c.cache_id = cl.cache_id |
| 423 | - and cl.type = '".Db::escape_string(Okapi::logtypename2id("Didn't find it"))."' |
|
| 424 | - and cl.user_id = '".Db::escape_string($user_id)."' |
|
| 425 | - ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "and cl.deleted = 0" : "")." |
|
| 423 | + and cl.type = '".Db::escape_string(Okapi::logtypename2id("Didn't find it")) . "' |
|
| 424 | + and cl.user_id = '".Db::escape_string($user_id) . "' |
|
| 425 | + ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "and cl.deleted = 0" : "") . " |
|
| 426 | 426 | "); |
| 427 | 427 | $tmp2 = array(); |
| 428 | 428 | foreach ($tmp as $cache_code) |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | cache_watches cw |
| 445 | 445 | where |
| 446 | 446 | c.cache_id = cw.cache_id |
| 447 | - and cw.user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 447 | + and cw.user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 448 | 448 | "); |
| 449 | 449 | $tmp2 = array(); |
| 450 | 450 | foreach ($tmp as $cache_code) |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | where |
| 463 | 463 | cli.cache_id = c.cache_id |
| 464 | 464 | and clw.cache_list_id = cli.cache_list_id |
| 465 | - and clw.user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 465 | + and clw.user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 466 | 466 | "); |
| 467 | 467 | foreach ($tmp as $cache_code) |
| 468 | 468 | $tmp2[$cache_code] = true; |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | cache_ignore ci |
| 486 | 486 | where |
| 487 | 487 | c.cache_id = ci.cache_id |
| 488 | - and ci.user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 488 | + and ci.user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 489 | 489 | "); |
| 490 | 490 | $tmp2 = array(); |
| 491 | 491 | foreach ($tmp as $cache_code) |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | $rs = Db::query(" |
| 518 | 518 | select cache_id, language, `desc`, short_desc, hint |
| 519 | 519 | from cache_desc |
| 520 | - where cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."') |
|
| 520 | + where cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "') |
|
| 521 | 521 | "); |
| 522 | 522 | while ($row = Db::fetch_assoc($rs)) |
| 523 | 523 | { |
@@ -534,11 +534,11 @@ discard block |
||
| 534 | 534 | { |
| 535 | 535 | Okapi::gettext_domain_init(array_merge(array($row['language']), $langpref)); |
| 536 | 536 | $tmp = ( |
| 537 | - "<p style='color:#c00000'><strong>". |
|
| 538 | - _('Parts of this geocache listing may be outdated.'). |
|
| 539 | - "</strong> ". |
|
| 540 | - _('See the log entries for more information.'). |
|
| 541 | - "</p>\n". |
|
| 537 | + "<p style='color:#c00000'><strong>" . |
|
| 538 | + _('Parts of this geocache listing may be outdated.') . |
|
| 539 | + "</strong> " . |
|
| 540 | + _('See the log entries for more information.') . |
|
| 541 | + "</p>\n" . |
|
| 542 | 542 | $tmp |
| 543 | 543 | ); |
| 544 | 544 | Okapi::gettext_domain_restore(); |
@@ -546,11 +546,11 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | if ($attribution_append != 'none') |
| 548 | 548 | { |
| 549 | - $tmp .= "\n<p><em>". |
|
| 549 | + $tmp .= "\n<p><em>" . |
|
| 550 | 550 | self::get_cache_attribution_note( |
| 551 | 551 | $row['cache_id'], strtolower($row['language']), $langpref, |
| 552 | 552 | $results[$cache_code]['owner'], $attribution_append |
| 553 | - ). |
|
| 553 | + ) . |
|
| 554 | 554 | "</em></p>"; |
| 555 | 555 | } |
| 556 | 556 | $results[$cache_code]['descriptions'][strtolower($row['language'])] = $tmp; |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | { |
| 564 | 564 | $results[$cache_code]['hints'][strtolower($row['language'])] = $row['hint']; |
| 565 | 565 | $results[$cache_code]['hints2'][strtolower($row['language'])] |
| 566 | - = htmlspecialchars_decode(mb_ereg_replace("<br />", "" , $row['hint']), ENT_COMPAT); |
|
| 566 | + = htmlspecialchars_decode(mb_ereg_replace("<br />", "", $row['hint']), ENT_COMPAT); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | foreach ($results as &$result_ref) |
@@ -601,10 +601,10 @@ discard block |
||
| 601 | 601 | else |
| 602 | 602 | $preview_field = "0"; |
| 603 | 603 | $rs = Db::query(" |
| 604 | - select object_id, uuid, url, title, spoiler, ".$preview_field." as preview |
|
| 604 | + select object_id, uuid, url, title, spoiler, ".$preview_field . " as preview |
|
| 605 | 605 | from pictures |
| 606 | 606 | where |
| 607 | - object_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."') |
|
| 607 | + object_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "') |
|
| 608 | 608 | and display = 1 |
| 609 | 609 | and object_type = 2 |
| 610 | 610 | and unknown_format = 0 |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | $image = array( |
| 631 | 631 | 'uuid' => $row['uuid'], |
| 632 | 632 | 'url' => $row['url'], |
| 633 | - 'thumb_url' => Settings::get('SITE_URL') . 'thumbs.php?'.$object_type_param.'uuid=' . $row['uuid'], |
|
| 633 | + 'thumb_url' => Settings::get('SITE_URL') . 'thumbs.php?' . $object_type_param . 'uuid=' . $row['uuid'], |
|
| 634 | 634 | 'caption' => $row['title'], |
| 635 | 635 | 'unique_caption' => self::get_unique_caption($row['title']), |
| 636 | 636 | 'is_spoiler' => ($row['spoiler'] ? true : false), |
@@ -658,13 +658,13 @@ discard block |
||
| 658 | 658 | |
| 659 | 659 | # Load internal_attr_id => acode mapping. |
| 660 | 660 | |
| 661 | - require_once($GLOBALS['rootpath'].'okapi/services/attrs/attr_helper.inc.php'); |
|
| 661 | + require_once($GLOBALS['rootpath'] . 'okapi/services/attrs/attr_helper.inc.php'); |
|
| 662 | 662 | $internal2acode = AttrHelper::get_internal_id_to_acode_mapping(); |
| 663 | 663 | |
| 664 | 664 | $rs = Db::query(" |
| 665 | 665 | select cache_id, attrib_id |
| 666 | 666 | from caches_attributes |
| 667 | - where cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."') |
|
| 667 | + where cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "') |
|
| 668 | 668 | "); |
| 669 | 669 | while ($row = Db::fetch_assoc($rs)) |
| 670 | 670 | { |
@@ -721,9 +721,9 @@ discard block |
||
| 721 | 721 | select cache_id, uuid |
| 722 | 722 | from cache_logs |
| 723 | 723 | where |
| 724 | - cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."') |
|
| 725 | - and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true")." |
|
| 726 | - order by cache_id, ".$logs_order_field_SQL." desc, date_created desc, id desc |
|
| 724 | + cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "') |
|
| 725 | + and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true") . " |
|
| 726 | + order by cache_id, ".$logs_order_field_SQL . " desc, date_created desc, id desc |
|
| 727 | 727 | "); |
| 728 | 728 | |
| 729 | 729 | $loguuids = array(); |
@@ -808,8 +808,8 @@ discard block |
||
| 808 | 808 | select cache_id, max(date) as date, group_concat(`desc`) as `desc` |
| 809 | 809 | from cache_notes |
| 810 | 810 | where |
| 811 | - cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."') |
|
| 812 | - and user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 811 | + cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "') |
|
| 812 | + and user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 813 | 813 | group by cache_id |
| 814 | 814 | "); |
| 815 | 815 | } |
@@ -822,8 +822,8 @@ discard block |
||
| 822 | 822 | from coordinates |
| 823 | 823 | where |
| 824 | 824 | type = 2 -- personal note |
| 825 | - and cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."') |
|
| 826 | - and user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 825 | + and cache_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "') |
|
| 826 | + and user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 827 | 827 | group by cache_id |
| 828 | 828 | "); |
| 829 | 829 | } |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | gk_item gki |
| 850 | 850 | where |
| 851 | 851 | gkiw.id = gki.id |
| 852 | - and gkiw.wp in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes))."') |
|
| 852 | + and gkiw.wp in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes)) . "') |
|
| 853 | 853 | "); |
| 854 | 854 | $trs = array(); |
| 855 | 855 | while ($row = Db::fetch_assoc($rs)) |
@@ -862,9 +862,9 @@ discard block |
||
| 862 | 862 | foreach ($trs[$cache_code] as $t) |
| 863 | 863 | { |
| 864 | 864 | $result_ref['trackables'][] = array( |
| 865 | - 'code' => 'GK'.str_pad(strtoupper(dechex($t['gk_id'])), 4, "0", STR_PAD_LEFT), |
|
| 865 | + 'code' => 'GK' . str_pad(strtoupper(dechex($t['gk_id'])), 4, "0", STR_PAD_LEFT), |
|
| 866 | 866 | 'name' => $t['name'], |
| 867 | - 'url' => 'http://geokrety.org/konkret.php?id='.$t['gk_id'] |
|
| 867 | + 'url' => 'http://geokrety.org/konkret.php?id=' . $t['gk_id'] |
|
| 868 | 868 | ); |
| 869 | 869 | } |
| 870 | 870 | } |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | $rs = Db::query(" |
| 884 | 884 | select wp as cache_code, count(*) as count |
| 885 | 885 | from gk_item_waypoint |
| 886 | - where wp in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes))."') |
|
| 886 | + where wp in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes)) . "') |
|
| 887 | 887 | group by wp |
| 888 | 888 | "); |
| 889 | 889 | $tr_counts = new ArrayObject(); |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | |
| 937 | 937 | foreach ($results as &$result_ref) |
| 938 | 938 | $result_ref['alt_wpts'] = array(); |
| 939 | - $cache_codes_escaped_and_imploded = "'".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."'"; |
|
| 939 | + $cache_codes_escaped_and_imploded = "'" . implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "'"; |
|
| 940 | 940 | |
| 941 | 941 | if (Settings::get('OC_BRANCH') == 'oc.pl') |
| 942 | 942 | { |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | end as okapi_type |
| 967 | 967 | from waypoints |
| 968 | 968 | where |
| 969 | - cache_id in (".$cache_codes_escaped_and_imploded.") |
|
| 969 | + cache_id in (".$cache_codes_escaped_and_imploded . ") |
|
| 970 | 970 | and status = 1 |
| 971 | 971 | order by cache_id, stage, `desc` |
| 972 | 972 | "); |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | from coordinates |
| 1003 | 1003 | where |
| 1004 | 1004 | type = 1 |
| 1005 | - and cache_id in (".$cache_codes_escaped_and_imploded.") |
|
| 1005 | + and cache_id in (".$cache_codes_escaped_and_imploded . ") |
|
| 1006 | 1006 | order by cache_id, id |
| 1007 | 1007 | "); |
| 1008 | 1008 | } |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | foreach ($cacheid2waypoints as $cache_id => $waypoints) |
| 1011 | 1011 | { |
| 1012 | 1012 | $cache_code = $cacheid2wptcode[$cache_id]; |
| 1013 | - $wpt_format = $cache_code."-%0".strlen(count($waypoints))."d"; |
|
| 1013 | + $wpt_format = $cache_code . "-%0" . strlen(count($waypoints)) . "d"; |
|
| 1014 | 1014 | $index = 0; |
| 1015 | 1015 | foreach ($waypoints as $row) |
| 1016 | 1016 | { |
@@ -1023,11 +1023,11 @@ discard block |
||
| 1023 | 1023 | $index++; |
| 1024 | 1024 | $results[$cache_code]['alt_wpts'][] = array( |
| 1025 | 1025 | 'name' => sprintf($wpt_format, $index), |
| 1026 | - 'location' => round($row['latitude'], 6)."|".round($row['longitude'], 6), |
|
| 1026 | + 'location' => round($row['latitude'], 6) . "|" . round($row['longitude'], 6), |
|
| 1027 | 1027 | 'type' => $row['okapi_type'], |
| 1028 | 1028 | 'type_name' => Okapi::pick_best_language($internal_wpt_type_id2names[$row['internal_type_id']], $langpref), |
| 1029 | 1029 | 'sym' => $row['sym'], |
| 1030 | - 'description' => ($row['stage'] ? _("Stage")." ".$row['stage'].": " : "").$row['desc'], |
|
| 1030 | + 'description' => ($row['stage'] ? _("Stage") . " " . $row['stage'] . ": " : "") . $row['desc'], |
|
| 1031 | 1031 | ); |
| 1032 | 1032 | } |
| 1033 | 1033 | } |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | from cache_mod_cords |
| 1046 | 1046 | where |
| 1047 | 1047 | cache_id in ($cache_codes_escaped_and_imploded) |
| 1048 | - and user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 1048 | + and user_id = '" . Db::escape_string($request->token->user_id) . "' |
|
| 1049 | 1049 | "); |
| 1050 | 1050 | } else { |
| 1051 | 1051 | # oc.de |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | from coordinates |
| 1056 | 1056 | where |
| 1057 | 1057 | cache_id in ($cache_codes_escaped_and_imploded) |
| 1058 | - and user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 1058 | + and user_id = '" . Db::escape_string($request->token->user_id) . "' |
|
| 1059 | 1059 | and type = 2 |
| 1060 | 1060 | and longitude != 0 |
| 1061 | 1061 | and latitude != 0 |
@@ -1068,8 +1068,8 @@ discard block |
||
| 1068 | 1068 | { |
| 1069 | 1069 | # there should be only one user waypoint per cache... |
| 1070 | 1070 | $results[$cache_code]['alt_wpts'][] = array( |
| 1071 | - 'name' => $cache_code.'-USER-COORDS', |
|
| 1072 | - 'location' => round($row['latitude'], 6)."|".round($row['longitude'], 6), |
|
| 1071 | + 'name' => $cache_code . '-USER-COORDS', |
|
| 1072 | + 'location' => round($row['latitude'], 6) . "|" . round($row['longitude'], 6), |
|
| 1073 | 1073 | 'type' => 'user-coords', |
| 1074 | 1074 | 'type_name' => _("User location"), |
| 1075 | 1075 | 'sym' => 'Block, Green', |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | inner join countries on countries.short=c.country |
| 1115 | 1115 | inner join sys_trans_text stt on stt.trans_id = countries.trans_id |
| 1116 | 1116 | where |
| 1117 | - c.wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes))."') |
|
| 1117 | + c.wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes)) . "') |
|
| 1118 | 1118 | "); |
| 1119 | 1119 | $country_codes2names = array(); |
| 1120 | 1120 | while ($row = Db::fetch_assoc($rs)) |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | caches c |
| 1132 | 1132 | left join cache_location cl on c.cache_id = cl.cache_id |
| 1133 | 1133 | where |
| 1134 | - c.wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes))."') |
|
| 1134 | + c.wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes)) . "') |
|
| 1135 | 1135 | "); |
| 1136 | 1136 | while ($row = Db::fetch_assoc($rs)) |
| 1137 | 1137 | { |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | caches c, |
| 1160 | 1160 | cache_location cl |
| 1161 | 1161 | where |
| 1162 | - c.wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes))."') |
|
| 1162 | + c.wp_oc in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_codes)) . "') |
|
| 1163 | 1163 | and c.cache_id = cl.cache_id |
| 1164 | 1164 | "); |
| 1165 | 1165 | while ($row = Db::fetch_assoc($rs)) |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | |
| 1204 | 1204 | if (in_array('protection_areas', $fields)) |
| 1205 | 1205 | { |
| 1206 | - $cache_ids_escaped_and_imploded = "'".implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode)))."'"; |
|
| 1206 | + $cache_ids_escaped_and_imploded = "'" . implode("','", array_map('\okapi\Db::escape_string', array_keys($cacheid2wptcode))) . "'"; |
|
| 1207 | 1207 | |
| 1208 | 1208 | if (Settings::get('OC_BRANCH') == 'oc.de') |
| 1209 | 1209 | { |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | inner join npa_areas on cache_npa_areas.npa_id = npa_areas.id |
| 1219 | 1219 | inner join npa_types on npa_areas.type_id = npa_types.id |
| 1220 | 1220 | where |
| 1221 | - c.cache_id in (".$cache_ids_escaped_and_imploded.") |
|
| 1221 | + c.cache_id in (".$cache_ids_escaped_and_imploded . ") |
|
| 1222 | 1222 | group by npa_areas.type_id, npa_areas.name |
| 1223 | 1223 | order by npa_types.ordinal |
| 1224 | 1224 | "); |
@@ -1233,14 +1233,14 @@ discard block |
||
| 1233 | 1233 | $rs = Db::query(" |
| 1234 | 1234 | select |
| 1235 | 1235 | c.wp_oc as cache_code, |
| 1236 | - '"._('National Park / Landscape')."' as type, |
|
| 1236 | + '"._('National Park / Landscape') . "' as type, |
|
| 1237 | 1237 | CONVERT(parkipl.name USING utf8) as name |
| 1238 | 1238 | from |
| 1239 | 1239 | caches c |
| 1240 | 1240 | inner join cache_npa_areas on cache_npa_areas.cache_id=c.cache_id |
| 1241 | 1241 | inner join parkipl on cache_npa_areas.parki_id=parkipl.id |
| 1242 | 1242 | where |
| 1243 | - c.cache_id in (".$cache_ids_escaped_and_imploded.") |
|
| 1243 | + c.cache_id in (".$cache_ids_escaped_and_imploded . ") |
|
| 1244 | 1244 | and cache_npa_areas.parki_id != 0 |
| 1245 | 1245 | union |
| 1246 | 1246 | select |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | inner join cache_npa_areas on cache_npa_areas.cache_id=c.cache_id |
| 1253 | 1253 | inner join npa_areas on cache_npa_areas.npa_id=npa_areas.id |
| 1254 | 1254 | where |
| 1255 | - c.cache_id in (".$cache_ids_escaped_and_imploded.") |
|
| 1255 | + c.cache_id in (".$cache_ids_escaped_and_imploded . ") |
|
| 1256 | 1256 | and cache_npa_areas.npa_id != 0 |
| 1257 | 1257 | "); |
| 1258 | 1258 | } |
@@ -1321,7 +1321,7 @@ discard block |
||
| 1321 | 1321 | 'description', 'descriptions' |
| 1322 | 1322 | ), $fields)) > 0) |
| 1323 | 1323 | ) { |
| 1324 | - require_once($GLOBALS['rootpath'].'okapi/lib/ocpl_access_logs.php'); |
|
| 1324 | + require_once($GLOBALS['rootpath'] . 'okapi/lib/ocpl_access_logs.php'); |
|
| 1325 | 1325 | \okapi\OCPLAccessLogs::log_geocache_access($request, $cache_ids); |
| 1326 | 1326 | } |
| 1327 | 1327 | } |
@@ -1340,7 +1340,7 @@ discard block |
||
| 1340 | 1340 | # Garmin and cannot determine WHY. That's why we won't use captions until we |
| 1341 | 1341 | # know more. |
| 1342 | 1342 | |
| 1343 | - $caption = self::$caption_no.""; |
|
| 1343 | + $caption = self::$caption_no . ""; |
|
| 1344 | 1344 | self::$caption_no++; |
| 1345 | 1345 | return $caption; |
| 1346 | 1346 | |
@@ -1404,7 +1404,7 @@ discard block |
||
| 1404 | 1404 | # which replicates geocaches! |
| 1405 | 1405 | |
| 1406 | 1406 | $site_name = Okapi::get_normalized_site_name(); |
| 1407 | - $cache_url = $site_url."viewcache.php?cacheid=$cache_id"; |
|
| 1407 | + $cache_url = $site_url . "viewcache.php?cacheid=$cache_id"; |
|
| 1408 | 1408 | |
| 1409 | 1409 | Okapi::gettext_domain_init(array_merge(array($lang), $langpref)); |
| 1410 | 1410 | if (Settings::get('OC_BRANCH') == 'oc.pl') |
@@ -1424,8 +1424,8 @@ discard block |
||
| 1424 | 1424 | { |
| 1425 | 1425 | $note = sprintf( |
| 1426 | 1426 | _( |
| 1427 | - "© <a href='%s'>%s</a>, <a href='%s'>%s</a>, ". |
|
| 1428 | - "<a href='http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.en'>CC-BY-NC-ND</a>, ". |
|
| 1427 | + "© <a href='%s'>%s</a>, <a href='%s'>%s</a>, " . |
|
| 1428 | + "<a href='http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.en'>CC-BY-NC-ND</a>, " . |
|
| 1429 | 1429 | "as of %s; all log entries © their authors" |
| 1430 | 1430 | ), |
| 1431 | 1431 | $owner['profile_url'], $owner['username'], $cache_url, $site_name, strftime('%x') |
@@ -1435,8 +1435,8 @@ discard block |
||
| 1435 | 1435 | { |
| 1436 | 1436 | $note = sprintf( |
| 1437 | 1437 | _( |
| 1438 | - "© <a href='%s'>%s</a>, <a href='%s'>%s</a>, ". |
|
| 1439 | - "<a href='http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.en'>CC-BY-NC-ND</a>; ". |
|
| 1438 | + "© <a href='%s'>%s</a>, <a href='%s'>%s</a>, " . |
|
| 1439 | + "<a href='http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.en'>CC-BY-NC-ND</a>; " . |
|
| 1440 | 1440 | "all log entries © their authors" |
| 1441 | 1441 | ), |
| 1442 | 1442 | $owner['profile_url'], $owner['username'], $cache_url, $site_name |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $langpref = $request->get_parameter('langpref'); |
| 98 | 98 | if (!$langpref) $langpref = "en"; |
| 99 | - $langpref .= "|".Settings::get('SITELANG'); |
|
| 99 | + $langpref .= "|" . Settings::get('SITELANG'); |
|
| 100 | 100 | foreach (array('ns_ground', 'ns_gsak', 'ns_ox', 'latest_logs', 'alt_wpts', 'mark_found') as $param) |
| 101 | 101 | { |
| 102 | 102 | $val = $request->get_parameter($param); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | else $protection_areas = 'none'; |
| 165 | 165 | } |
| 166 | 166 | if (!in_array($protection_areas, array('none', 'desc:text'))) |
| 167 | - throw new InvalidParam('protection_areas',"'$protection_areas'"); |
|
| 167 | + throw new InvalidParam('protection_areas', "'$protection_areas'"); |
|
| 168 | 168 | $vars['protection_areas'] = $protection_areas; |
| 169 | 169 | |
| 170 | 170 | $tmp = $request->get_parameter('trackables'); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | # Make sure location_source has prefix alt_wpt: |
| 195 | 195 | if ($location_source != 'default-coords' && strncmp($location_source, 'alt_wpt:', 8) != 0) |
| 196 | 196 | { |
| 197 | - throw new InvalidParam('location_source', '\''.$location_source.'\''); |
|
| 197 | + throw new InvalidParam('location_source', '\'' . $location_source . '\''); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | # Make sure we have sufficient authorization |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | # Which fields of the services/caches/geocaches method do we need? |
| 207 | 207 | |
| 208 | - $fields = 'code|name|location|date_created|url|type|status|size|size2|oxsize'. |
|
| 209 | - '|difficulty|terrain|description|hint2|rating|owner|url|internal_id'. |
|
| 208 | + $fields = 'code|name|location|date_created|url|type|status|size|size2|oxsize' . |
|
| 209 | + '|difficulty|terrain|description|hint2|rating|owner|url|internal_id' . |
|
| 210 | 210 | '|protection_areas|short_description'; |
| 211 | 211 | if ($vars['images'] != 'none') |
| 212 | 212 | $fields .= "|images"; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | # database; OCPL stores attribute names in a different way and may use |
| 291 | 291 | # different names for equivalent attributes. |
| 292 | 292 | |
| 293 | - $ocde_attrnames = Db::select_group_by('id'," |
|
| 293 | + $ocde_attrnames = Db::select_group_by('id', " |
|
| 294 | 294 | select id, name |
| 295 | 295 | from cache_attrib |
| 296 | 296 | "); |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $rs = Db::query(" |
| 374 | 374 | select uuid, user_id |
| 375 | 375 | from user |
| 376 | - where uuid in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($dict)))."') |
|
| 376 | + where uuid in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($dict))) . "') |
|
| 377 | 377 | "); |
| 378 | 378 | while ($row = Db::fetch_assoc($rs)) |
| 379 | 379 | $dict[$row['uuid']] = $row['user_id']; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | { |
| 394 | 394 | foreach ($cache_ref['alt_wpts'] as $alt_wpt_key => $alt_wpt) |
| 395 | 395 | { |
| 396 | - if ('alt_wpt:'.$alt_wpt['type'] == $location_source) |
|
| 396 | + if ('alt_wpt:' . $alt_wpt['type'] == $location_source) |
|
| 397 | 397 | { |
| 398 | 398 | # Switch locations between primary wpt and alternate wpt. |
| 399 | 399 | # Also alter the cache name and make sure to append a proper |
@@ -401,17 +401,17 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | $original_location = $cache_ref['location']; |
| 403 | 403 | $cache_ref['location'] = $alt_wpt['location']; |
| 404 | - $cache_ref['name_2'] = $location_change_prefix.$cache_ref['name']; |
|
| 404 | + $cache_ref['name_2'] = $location_change_prefix . $cache_ref['name']; |
|
| 405 | 405 | if ($location_source == "alt_wpt:user-coords") { |
| 406 | 406 | # In case of "user-coords", replace the default warning with a custom-tailored one. |
| 407 | 407 | $cache_ref['warning_prefix'] = _( |
| 408 | - "<b>Geocache coordinates have been changed.</b> They have been replaced with ". |
|
| 408 | + "<b>Geocache coordinates have been changed.</b> They have been replaced with " . |
|
| 409 | 409 | "your own custom coordinates which you have provided for this geocache." |
| 410 | 410 | ); |
| 411 | 411 | } else { |
| 412 | 412 | # Default warning |
| 413 | 413 | $cache_ref['warning_prefix'] = _( |
| 414 | - "<b>Geocache coordinates have been changed.</b> Currently they ". |
|
| 414 | + "<b>Geocache coordinates have been changed.</b> Currently they " . |
|
| 415 | 415 | "point to one of the alternate waypoints originally described as:" |
| 416 | 416 | ) . " " . $alt_wpt['description']; |
| 417 | 417 | } |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | if ($vars['alt_wpts']) |
| 422 | 422 | { |
| 423 | 423 | $cache_ref['alt_wpts'][] = array( |
| 424 | - 'name' => $cache_ref['code'].'-DEFAULT-COORDS', |
|
| 424 | + 'name' => $cache_ref['code'] . '-DEFAULT-COORDS', |
|
| 425 | 425 | 'location' => $original_location, |
| 426 | 426 | 'type' => 'default-coords', |
| 427 | 427 | 'type_name' => _("Original geocache location"), |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | $ggz_entry['ratings'] = array(); |
| 466 | 466 | $ratings_ref = &$ggz_entry['ratings']; |
| 467 | - if (isset($cache_ref['rating'])){ |
|
| 467 | + if (isset($cache_ref['rating'])) { |
|
| 468 | 468 | $ratings_ref['awesomeness'] = $cache_ref['rating']; |
| 469 | 469 | } |
| 470 | 470 | $ratings_ref['difficulty'] = $cache_ref['difficulty']; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use \ZipArchive; |
| 20 | 20 | use \Exception; |
| 21 | 21 | |
| 22 | -require_once($GLOBALS['rootpath']."okapi/services/caches/formatters/gpx.php"); |
|
| 22 | +require_once($GLOBALS['rootpath'] . "okapi/services/caches/formatters/gpx.php"); |
|
| 23 | 23 | |
| 24 | 24 | class WebService |
| 25 | 25 | { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | # Geocaching.com (groundspeak:) and Opencaching.com (ox:) extensions. It will |
| 44 | 44 | # also include personal data (if the method was invoked using Level 3 Authentication). |
| 45 | 45 | |
| 46 | - $file_item_name = "data_".time()."_".rand(100000,999999).".gpx"; |
|
| 46 | + $file_item_name = "data_" . time() . "_" . rand(100000, 999999) . ".gpx"; |
|
| 47 | 47 | $ggz_file = array( |
| 48 | 48 | 'name' => $file_item_name, |
| 49 | 49 | 'crc32' => sprintf('%08X', crc32($gpx_result['gpx'])), |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $index_content = ob_get_clean(); |
| 59 | 59 | |
| 60 | 60 | $response->zip->FileAdd("index/com/garmin/geocaches/v0/index.xml", $index_content); |
| 61 | - $response->zip->FileAdd("data/".$file_item_name, $gpx_result['gpx']); |
|
| 61 | + $response->zip->FileAdd("data/" . $file_item_name, $gpx_result['gpx']); |
|
| 62 | 62 | |
| 63 | 63 | unset($gpx_result); |
| 64 | 64 | unset($index_content); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $langpref = $request->get_parameter('langpref'); |
| 41 | 41 | if (!$langpref) $langpref = "en"; |
| 42 | - $langpref .= "|".Settings::get('SITELANG'); |
|
| 42 | + $langpref .= "|" . Settings::get('SITELANG'); |
|
| 43 | 43 | $images = $request->get_parameter('images'); |
| 44 | 44 | if (!$images) $images = "all"; |
| 45 | 45 | if (!in_array($images, array("none", "all", "spoilers", "nonspoilers"))) |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | # also include image references (actual images will be added as separate files later) |
| 61 | 61 | # and personal data (if the method was invoked using Level 3 Authentication). |
| 62 | 62 | |
| 63 | - switch($format) { |
|
| 63 | + switch ($format) { |
|
| 64 | 64 | case 'gpx' : |
| 65 | - $data_filename = "Garmin/GPX/opencaching".time().rand(100000,999999).".gpx"; |
|
| 65 | + $data_filename = "Garmin/GPX/opencaching" . time() . rand(100000, 999999) . ".gpx"; |
|
| 66 | 66 | $data_method = 'services/caches/formatters/gpx'; |
| 67 | 67 | $data_use_compression = true; |
| 68 | 68 | break; |
| 69 | 69 | case 'ggz' : |
| 70 | - $data_filename = "Garmin/GGZ/opencaching".time().rand(100000,999999).".ggz"; |
|
| 70 | + $data_filename = "Garmin/GGZ/opencaching" . time() . rand(100000, 999999) . ".ggz"; |
|
| 71 | 71 | $data_method = 'services/caches/formatters/ggz'; |
| 72 | 72 | $data_use_compression = false; |
| 73 | 73 | break; |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | $imgs = $dict['images']; |
| 108 | 108 | if (count($imgs) == 0) |
| 109 | 109 | continue; |
| 110 | - $dir = "Garmin/GeocachePhotos/".$cache_code[strlen($cache_code) - 1]; |
|
| 111 | - $dir .= "/".$cache_code[strlen($cache_code) - 2]; |
|
| 112 | - $dir .= "/".$cache_code; |
|
| 110 | + $dir = "Garmin/GeocachePhotos/" . $cache_code[strlen($cache_code) - 1]; |
|
| 111 | + $dir .= "/" . $cache_code[strlen($cache_code) - 2]; |
|
| 112 | + $dir .= "/" . $cache_code; |
|
| 113 | 113 | foreach ($imgs as $no => $img) |
| 114 | 114 | { |
| 115 | 115 | if ($images == 'spoilers' && (!$img['is_spoiler'])) |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | $tmp = false; |
| 120 | 120 | foreach ($supported_extensions as $ext) |
| 121 | 121 | { |
| 122 | - if (strtolower(substr($img['url'], strlen($img['url']) - strlen($ext) - 1)) != ".".$ext) |
|
| 122 | + if (strtolower(substr($img['url'], strlen($img['url']) - strlen($ext) - 1)) != "." . $ext) |
|
| 123 | 123 | { |
| 124 | 124 | $tmp = true; |
| 125 | 125 | continue; |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | if (!$tmp) |
| 129 | - continue; # unsupported file extension |
|
| 129 | + continue; # unsupported file extension |
|
| 130 | 130 | |
| 131 | 131 | if ($img['is_spoiler']) { |
| 132 | - $zippath = $dir."/Spoilers/".$img['unique_caption'].".jpg"; |
|
| 132 | + $zippath = $dir . "/Spoilers/" . $img['unique_caption'] . ".jpg"; |
|
| 133 | 133 | } else { |
| 134 | - $zippath = $dir."/".$img['unique_caption'].".jpg"; |
|
| 134 | + $zippath = $dir . "/" . $img['unique_caption'] . ".jpg"; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | # The safest way would be to use the URL, but that would be painfully slow! |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | # Note: Oliver Dietz (oc.de) replied that images with 'local' set to 0 could not |
| 142 | 142 | # be accessed locally. But all the files have 'local' set to 1 anyway. |
| 143 | 143 | |
| 144 | - $syspath = Settings::get('IMAGES_DIR')."/".$img['uuid'].".jpg"; |
|
| 144 | + $syspath = Settings::get('IMAGES_DIR') . "/" . $img['uuid'] . ".jpg"; |
|
| 145 | 145 | if (file_exists($syspath)) |
| 146 | 146 | { |
| 147 | 147 | $response->zip->FileAdd($zippath, $syspath, clsTbsZip::TBSZIP_FILE, false); |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | # If file exists, but does not end with ".jpg", we will create |
| 152 | 152 | # JPEG version of it and store it in the cache. |
| 153 | 153 | |
| 154 | - $cache_key = "jpg#".$img['uuid']; |
|
| 154 | + $cache_key = "jpg#" . $img['uuid']; |
|
| 155 | 155 | $jpeg_contents = Cache::get($cache_key); |
| 156 | 156 | if ($jpeg_contents === null) |
| 157 | 157 | { |
| 158 | 158 | foreach ($supported_extensions as $ext) |
| 159 | 159 | { |
| 160 | - $syspath_other = Settings::get('IMAGES_DIR')."/".$img['uuid'].".".$ext; |
|
| 160 | + $syspath_other = Settings::get('IMAGES_DIR') . "/" . $img['uuid'] . "." . $ext; |
|
| 161 | 161 | if (file_exists($syspath_other)) |
| 162 | 162 | { |
| 163 | 163 | try |