@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | 'is_deprecated' => (isset($attrs['class']) && (strpos($attrs['class'], 'deprecated') !== false)), |
| 31 | 31 | 'class' => 'public', |
| 32 | 32 | 'description' => |
| 33 | - (isset($attrs['default']) ? ("<p>Default value: <b>".$attrs['default']."</b></p>") : ""). |
|
| 33 | + (isset($attrs['default']) ? ("<p>Default value: <b>" . $attrs['default'] . "</b></p>") : "") . |
|
| 34 | 34 | self::get_inner_xml($arg_node), |
| 35 | 35 | |
| 36 | 36 | ); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | switch ($plugin_name) { |
| 97 | 97 | case 'docurl': |
| 98 | 98 | $fragment = $arr[1]; |
| 99 | - return Settings::get('SITE_URL')."okapi/introduction.html#".$fragment; |
|
| 99 | + return Settings::get('SITE_URL') . "okapi/introduction.html#" . $fragment; |
|
| 100 | 100 | case 'methodref': |
| 101 | 101 | case 'methodargref': |
| 102 | 102 | case 'methodretref': |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $result = ''; |
| 105 | 105 | if ($elements[0] != '') |
| 106 | 106 | { |
| 107 | - $result .= Settings::get('SITE_URL')."okapi/".$elements[0].'.html'; |
|
| 107 | + $result .= Settings::get('SITE_URL') . "okapi/" . $elements[0] . '.html'; |
|
| 108 | 108 | } |
| 109 | 109 | if (count($elements) > 1) |
| 110 | 110 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | return $result; |
| 123 | 123 | default: |
| 124 | - throw new Exception("Unknown plugin: ".$input); |
|
| 124 | + throw new Exception("Unknown plugin: " . $input); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $result = array( |
| 143 | 143 | 'name' => $methodname, |
| 144 | 144 | 'short_name' => end($exploded), |
| 145 | - 'ref_url' => Settings::get('SITE_URL')."okapi/$methodname.html", |
|
| 145 | + 'ref_url' => Settings::get('SITE_URL') . "okapi/$methodname.html", |
|
| 146 | 146 | 'auth_options' => array( |
| 147 | 147 | 'min_auth_level' => $options['min_auth_level'], |
| 148 | 148 | 'oauth_consumer' => $options['min_auth_level'] >= 2, |
@@ -184,15 +184,15 @@ discard block |
||
| 184 | 184 | continue; |
| 185 | 185 | if (($include_list === null) && (count($exclude_list) == 0)) |
| 186 | 186 | { |
| 187 | - $arg['description'] = "<i>Inherited from <a href='".$referenced_method_info['ref_url']. |
|
| 188 | - "#arg_". $arg['name'] . "'>".$referenced_method_info['name']."</a> method.</i>"; |
|
| 187 | + $arg['description'] = "<i>Inherited from <a href='" . $referenced_method_info['ref_url'] . |
|
| 188 | + "#arg_" . $arg['name'] . "'>" . $referenced_method_info['name'] . "</a> method.</i>"; |
|
| 189 | 189 | } |
| 190 | 190 | elseif ( |
| 191 | 191 | (($include_list === null) || in_array($arg['name'], $include_list)) |
| 192 | 192 | && (!in_array($arg['name'], $exclude_list)) |
| 193 | 193 | ) { |
| 194 | - $arg['description'] = "<i>Same as in the <a href='".$referenced_method_info['ref_url']. |
|
| 195 | - "#arg_". $arg['name'] . "'>".$referenced_method_info['name']."</a> method.</i>"; |
|
| 194 | + $arg['description'] = "<i>Same as in the <a href='" . $referenced_method_info['ref_url'] . |
|
| 195 | + "#arg_" . $arg['name'] . "'>" . $referenced_method_info['name'] . "</a> method.</i>"; |
|
| 196 | 196 | } else { |
| 197 | 197 | continue; |
| 198 | 198 | } |
@@ -207,21 +207,21 @@ discard block |
||
| 207 | 207 | 'is_required' => false, |
| 208 | 208 | 'is_deprecated' => false, |
| 209 | 209 | 'class' => 'common-formatting', |
| 210 | - 'description' => "<i>Standard <a href='".Settings::get('SITE_URL')."okapi/introduction.html#common-formatting'>common formatting</a> argument.</i>" |
|
| 210 | + 'description' => "<i>Standard <a href='" . Settings::get('SITE_URL') . "okapi/introduction.html#common-formatting'>common formatting</a> argument.</i>" |
|
| 211 | 211 | ); |
| 212 | 212 | $result['arguments'][] = array( |
| 213 | 213 | 'name' => 'callback', |
| 214 | 214 | 'is_required' => false, |
| 215 | 215 | 'is_deprecated' => false, |
| 216 | 216 | 'class' => 'common-formatting', |
| 217 | - 'description' => "<i>Standard <a href='".Settings::get('SITE_URL')."okapi/introduction.html#common-formatting'>common formatting</a> argument.</i>" |
|
| 217 | + 'description' => "<i>Standard <a href='" . Settings::get('SITE_URL') . "okapi/introduction.html#common-formatting'>common formatting</a> argument.</i>" |
|
| 218 | 218 | ); |
| 219 | 219 | } |
| 220 | 220 | foreach ($result['arguments'] as &$arg_ref) |
| 221 | 221 | if ($arg_ref['is_deprecated']) |
| 222 | 222 | $arg_ref['class'] .= " deprecated"; |
| 223 | 223 | if (!$docs->returns) |
| 224 | - throw new Exception("Missing <returns> element in the $methodname.xml file. ". |
|
| 224 | + throw new Exception("Missing <returns> element in the $methodname.xml file. " . |
|
| 225 | 225 | "If your method does not return anything, you should document in nonetheless."); |
| 226 | 226 | $result['returns'] = self::get_inner_xml($docs->returns); |
| 227 | 227 | return Okapi::formatted_response($request, $result); |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | 'when', "'$tmp' is not in a valid format or is not a valid date." |
| 71 | 71 | ); |
| 72 | 72 | } |
| 73 | - if ($when > time() + 5*60) { |
|
| 73 | + if ($when > time() + 5 * 60) { |
|
| 74 | 74 | throw new CannotPublishException(_( |
| 75 | - "You are trying to publish a log entry with a date in ". |
|
| 76 | - "future. Cache log entries are allowed to be published in ". |
|
| 75 | + "You are trying to publish a log entry with a date in " . |
|
| 76 | + "future. Cache log entries are allowed to be published in " . |
|
| 77 | 77 | "the past, but NOT in the future." |
| 78 | 78 | )); |
| 79 | 79 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $rating = $request->get_parameter('rating'); |
| 94 | - if ($rating !== null && (!in_array($rating, array(1,2,3,4,5)))) { |
|
| 94 | + if ($rating !== null && (!in_array($rating, array(1, 2, 3, 4, 5)))) { |
|
| 95 | 95 | throw new InvalidParam( |
| 96 | 96 | 'rating', "If present, it must be an integer in the 1..5 scale." |
| 97 | 97 | ); |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | # (which will be returned IF the rest of the query will meet all the |
| 108 | 108 | # requirements). |
| 109 | 109 | |
| 110 | - self::$success_message .= " ".sprintf(_( |
|
| 111 | - "However, your cache rating was ignored, because %s does not ". |
|
| 110 | + self::$success_message .= " " . sprintf(_( |
|
| 111 | + "However, your cache rating was ignored, because %s does not " . |
|
| 112 | 112 | "have a rating system." |
| 113 | 113 | ), Okapi::get_normalized_site_name()); |
| 114 | 114 | $rating = null; |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | # (which will be returned IF the rest of the query will meet all the |
| 133 | 133 | # requirements). |
| 134 | 134 | |
| 135 | - self::$success_message .= " ".sprintf(_( |
|
| 136 | - "However, your cache recommendation was ignored, because ". |
|
| 135 | + self::$success_message .= " " . sprintf(_( |
|
| 136 | + "However, your cache recommendation was ignored, because " . |
|
| 137 | 137 | "%s does not allow recommending event caches." |
| 138 | 138 | ), Okapi::get_normalized_site_name()); |
| 139 | 139 | $recommend = null; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $needs_maintenance2 = $request->get_parameter('needs_maintenance2'); |
| 148 | 148 | if ($needs_maintenance && $needs_maintenance2) { |
| 149 | 149 | throw new BadRequest( |
| 150 | - "You cannot use both of these parameters at the same time: ". |
|
| 150 | + "You cannot use both of these parameters at the same time: " . |
|
| 151 | 151 | "needs_maintenance and needs_maintenance2." |
| 152 | 152 | ); |
| 153 | 153 | } |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | ) { |
| 182 | 182 | # If not supported, just ignore it. |
| 183 | 183 | |
| 184 | - self::$success_message .= " ".sprintf(_( |
|
| 185 | - "However, your \"does not need maintenance\" flag was ignored, because ". |
|
| 184 | + self::$success_message .= " " . sprintf(_( |
|
| 185 | + "However, your \"does not need maintenance\" flag was ignored, because " . |
|
| 186 | 186 | "%s does not yet support this feature." |
| 187 | 187 | ), Okapi::get_normalized_site_name()); |
| 188 | 188 | $needs_maintenance2 = 'null'; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | if (!in_array($logtype, array('Will attend', 'Attended', 'Comment'))) { |
| 214 | 214 | throw new CannotPublishException(_( |
| 215 | - 'This cache is an Event cache. You cannot "Find" it (but '. |
|
| 215 | + 'This cache is an Event cache. You cannot "Find" it (but ' . |
|
| 216 | 216 | 'you can attend it, or comment on it)!' |
| 217 | 217 | )); |
| 218 | 218 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | { |
| 222 | 222 | if (in_array($logtype, array('Will attend', 'Attended'))) { |
| 223 | 223 | throw new CannotPublishException(_( |
| 224 | - 'This cache is NOT an Event cache. You cannot "Attend" it '. |
|
| 224 | + 'This cache is NOT an Event cache. You cannot "Attend" it ' . |
|
| 225 | 225 | '(but you can find it, or comment on it)!' |
| 226 | 226 | )); |
| 227 | 227 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $valid_password = Db::select_value(" |
| 243 | 243 | select logpw |
| 244 | 244 | from caches |
| 245 | - where cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 245 | + where cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 246 | 246 | "); |
| 247 | 247 | $supplied_password = $request->get_parameter('password'); |
| 248 | 248 | if (!$supplied_password) { |
@@ -358,8 +358,8 @@ discard block |
||
| 358 | 358 | select 1 |
| 359 | 359 | from cache_logs |
| 360 | 360 | where |
| 361 | - user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 362 | - and cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 361 | + user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 362 | + and cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 363 | 363 | for update |
| 364 | 364 | "); |
| 365 | 365 | |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | select uuid |
| 379 | 379 | from cache_logs |
| 380 | 380 | where |
| 381 | - user_id = '".Db::escape_string($request->token->user_id)."' |
|
| 382 | - and cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 383 | - and type = '".Db::escape_string(Okapi::logtypename2id($logtype))."' |
|
| 384 | - and date = from_unixtime('".Db::escape_string($when)."') |
|
| 385 | - and text = '".Db::escape_string($formatted_comment)."' |
|
| 386 | - ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "and deleted = 0" : "")." |
|
| 381 | + user_id = '".Db::escape_string($request->token->user_id) . "' |
|
| 382 | + and cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 383 | + and type = '".Db::escape_string(Okapi::logtypename2id($logtype)) . "' |
|
| 384 | + and date = from_unixtime('".Db::escape_string($when) . "') |
|
| 385 | + and text = '".Db::escape_string($formatted_comment) . "' |
|
| 386 | + ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "and deleted = 0" : "") . " |
|
| 387 | 387 | limit 1 |
| 388 | 388 | "); |
| 389 | 389 | if ($duplicate_uuid != null) |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | elseif ($on_duplicate == 'user_error') |
| 397 | 397 | { |
| 398 | 398 | throw new CannotPublishException(_( |
| 399 | - "You have already submitted a log entry with exactly ". |
|
| 399 | + "You have already submitted a log entry with exactly " . |
|
| 400 | 400 | "the same contents." |
| 401 | 401 | )); |
| 402 | 402 | } |
@@ -416,20 +416,20 @@ discard block |
||
| 416 | 416 | select 1 |
| 417 | 417 | from cache_logs |
| 418 | 418 | where |
| 419 | - user_id = '".Db::escape_string($user['internal_id'])."' |
|
| 420 | - and cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 421 | - and type = '".Db::escape_string(Okapi::logtypename2id("Found it"))."' |
|
| 422 | - and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true")." |
|
| 419 | + user_id = '".Db::escape_string($user['internal_id']) . "' |
|
| 420 | + and cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 421 | + and type = '".Db::escape_string(Okapi::logtypename2id("Found it")) . "' |
|
| 422 | + and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true") . " |
|
| 423 | 423 | "); |
| 424 | 424 | if ($has_already_found_it) { |
| 425 | 425 | throw new CannotPublishException(_( |
| 426 | - "You have already submitted a \"Found it\" log entry once. ". |
|
| 426 | + "You have already submitted a \"Found it\" log entry once. " . |
|
| 427 | 427 | "Now you may submit \"Comments\" only!" |
| 428 | 428 | )); |
| 429 | 429 | } |
| 430 | 430 | if ($user['uuid'] == $cache['owner']['uuid']) { |
| 431 | 431 | throw new CannotPublishException(_( |
| 432 | - "You are the owner of this cache. You may submit ". |
|
| 432 | + "You are the owner of this cache. You may submit " . |
|
| 433 | 433 | "\"Comments\" only!" |
| 434 | 434 | )); |
| 435 | 435 | } |
@@ -446,12 +446,12 @@ discard block |
||
| 446 | 446 | select 1 |
| 447 | 447 | from scores |
| 448 | 448 | where |
| 449 | - user_id = '".Db::escape_string($user['internal_id'])."' |
|
| 450 | - and cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 449 | + user_id = '".Db::escape_string($user['internal_id']) . "' |
|
| 450 | + and cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 451 | 451 | "); |
| 452 | 452 | if ($has_already_rated) { |
| 453 | 453 | throw new CannotPublishException(_( |
| 454 | - "You have already rated this cache once. Your rating ". |
|
| 454 | + "You have already rated this cache once. Your rating " . |
|
| 455 | 455 | "cannot be changed." |
| 456 | 456 | )); |
| 457 | 457 | } |
@@ -467,8 +467,8 @@ discard block |
||
| 467 | 467 | select 1 |
| 468 | 468 | from cache_rating |
| 469 | 469 | where |
| 470 | - user_id = '".Db::escape_string($user['internal_id'])."' |
|
| 471 | - and cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 470 | + user_id = '".Db::escape_string($user['internal_id']) . "' |
|
| 471 | + and cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 472 | 472 | "); |
| 473 | 473 | if ($already_recommended) { |
| 474 | 474 | throw new CannotPublishException(_( |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | # Check the number of recommendations. |
| 480 | 480 | |
| 481 | - $founds = $user['caches_found'] + 1; // +1, because he'll find THIS ONE in a moment |
|
| 481 | + $founds = $user['caches_found'] + 1; // +1, because he'll find THIS ONE in a moment |
|
| 482 | 482 | |
| 483 | 483 | # Note: caches_found includes the number of attended events (both on |
| 484 | 484 | # OCDE and OCPL). OCPL does not allow recommending events, but the |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $rcmds_left = floor($founds / 10.0) - $user['rcmds_given']; |
| 489 | 489 | if ($rcmds_left <= 0) { |
| 490 | 490 | throw new CannotPublishException(_( |
| 491 | - "You don't have any recommendations to give. Find more ". |
|
| 491 | + "You don't have any recommendations to give. Find more " . |
|
| 492 | 492 | "caches first!" |
| 493 | 493 | )); |
| 494 | 494 | } |
@@ -615,17 +615,17 @@ discard block |
||
| 615 | 615 | update caches |
| 616 | 616 | set |
| 617 | 617 | score = ( |
| 618 | - score*votes + '".Db::escape_string($db_score)."' |
|
| 618 | + score*votes + '".Db::escape_string($db_score) . "' |
|
| 619 | 619 | ) / (votes + 1), |
| 620 | 620 | votes = votes + 1 |
| 621 | - where cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 621 | + where cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 622 | 622 | "); |
| 623 | 623 | Db::execute(" |
| 624 | 624 | insert into scores (user_id, cache_id, score) |
| 625 | 625 | values ( |
| 626 | - '".Db::escape_string($user['internal_id'])."', |
|
| 627 | - '".Db::escape_string($cache['internal_id'])."', |
|
| 628 | - '".Db::escape_string($db_score)."' |
|
| 626 | + '".Db::escape_string($user['internal_id']) . "', |
|
| 627 | + '".Db::escape_string($cache['internal_id']) . "', |
|
| 628 | + '".Db::escape_string($db_score) . "' |
|
| 629 | 629 | ); |
| 630 | 630 | "); |
| 631 | 631 | } |
@@ -639,9 +639,9 @@ discard block |
||
| 639 | 639 | Db::execute(" |
| 640 | 640 | insert into cache_rating (user_id, cache_id, rating_date) |
| 641 | 641 | values ( |
| 642 | - '".Db::escape_string($user['internal_id'])."', |
|
| 643 | - '".Db::escape_string($cache['internal_id'])."', |
|
| 644 | - from_unixtime('".Db::escape_string($when)."') |
|
| 642 | + '".Db::escape_string($user['internal_id']) . "', |
|
| 643 | + '".Db::escape_string($cache['internal_id']) . "', |
|
| 644 | + from_unixtime('".Db::escape_string($when) . "') |
|
| 645 | 645 | ); |
| 646 | 646 | "); |
| 647 | 647 | } |
@@ -650,8 +650,8 @@ discard block |
||
| 650 | 650 | Db::execute(" |
| 651 | 651 | insert into cache_rating (user_id, cache_id) |
| 652 | 652 | values ( |
| 653 | - '".Db::escape_string($user['internal_id'])."', |
|
| 654 | - '".Db::escape_string($cache['internal_id'])."' |
|
| 653 | + '".Db::escape_string($user['internal_id']) . "', |
|
| 654 | + '".Db::escape_string($cache['internal_id']) . "' |
|
| 655 | 655 | ); |
| 656 | 656 | "); |
| 657 | 657 | } |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | # We need to delete the copy of stats-picture for this user. Otherwise, |
| 665 | 665 | # the legacy OC code won't detect that the picture needs to be refreshed. |
| 666 | 666 | |
| 667 | - $filepath = Okapi::get_var_dir().'/images/statpics/statpic'.$user['internal_id'].'.jpg'; |
|
| 667 | + $filepath = Okapi::get_var_dir() . '/images/statpics/statpic' . $user['internal_id'] . '.jpg'; |
|
| 668 | 668 | if (file_exists($filepath)) { |
| 669 | 669 | unlink($filepath); |
| 670 | 670 | } |
@@ -732,9 +732,9 @@ discard block |
||
| 732 | 732 | founds = founds + 1, |
| 733 | 733 | last_found = greatest( |
| 734 | 734 | ifnull(last_found, 0), |
| 735 | - from_unixtime('".Db::escape_string($when)."') |
|
| 735 | + from_unixtime('".Db::escape_string($when) . "') |
|
| 736 | 736 | ) |
| 737 | - where cache_id = '".Db::escape_string($cache_internal_id)."' |
|
| 737 | + where cache_id = '".Db::escape_string($cache_internal_id) . "' |
|
| 738 | 738 | "); |
| 739 | 739 | } |
| 740 | 740 | elseif ($logtype == "Didn't find it") |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | Db::execute(" |
| 743 | 743 | update caches |
| 744 | 744 | set notfounds = notfounds + 1 |
| 745 | - where cache_id = '".Db::escape_string($cache_internal_id)."' |
|
| 745 | + where cache_id = '".Db::escape_string($cache_internal_id) . "' |
|
| 746 | 746 | "); |
| 747 | 747 | } |
| 748 | 748 | elseif ($logtype == 'Comment') |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | Db::execute(" |
| 751 | 751 | update caches |
| 752 | 752 | set notes = notes + 1 |
| 753 | - where cache_id = '".Db::escape_string($cache_internal_id)."' |
|
| 753 | + where cache_id = '".Db::escape_string($cache_internal_id) . "' |
|
| 754 | 754 | "); |
| 755 | 755 | } |
| 756 | 756 | else |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | Db::execute(" |
| 784 | 784 | update user |
| 785 | 785 | set $field_to_increment = $field_to_increment + 1 |
| 786 | - where user_id = '".Db::escape_string($user_internal_id)."' |
|
| 786 | + where user_id = '" . Db::escape_string($user_internal_id) . "' |
|
| 787 | 787 | "); |
| 788 | 788 | } |
| 789 | 789 | } |
@@ -812,19 +812,19 @@ discard block |
||
| 812 | 812 | Db::execute(" |
| 813 | 813 | insert into cache_logs ( |
| 814 | 814 | uuid, cache_id, user_id, type, date, text, text_html, |
| 815 | - last_modified, date_created, node".$needs_maintenance_field_SQL." |
|
| 815 | + last_modified, date_created, node".$needs_maintenance_field_SQL . " |
|
| 816 | 816 | ) values ( |
| 817 | - '".Db::escape_string($log_uuid)."', |
|
| 818 | - '".Db::escape_string($cache_internal_id)."', |
|
| 819 | - '".Db::escape_string($user_internal_id)."', |
|
| 820 | - '".Db::escape_string(Okapi::logtypename2id($logtype))."', |
|
| 821 | - from_unixtime('".Db::escape_string($when)."'), |
|
| 822 | - '".Db::escape_string($formatted_comment)."', |
|
| 823 | - '".Db::escape_string($text_html)."', |
|
| 817 | + '".Db::escape_string($log_uuid) . "', |
|
| 818 | + '".Db::escape_string($cache_internal_id) . "', |
|
| 819 | + '".Db::escape_string($user_internal_id) . "', |
|
| 820 | + '".Db::escape_string(Okapi::logtypename2id($logtype)) . "', |
|
| 821 | + from_unixtime('".Db::escape_string($when) . "'), |
|
| 822 | + '".Db::escape_string($formatted_comment) . "', |
|
| 823 | + '".Db::escape_string($text_html) . "', |
|
| 824 | 824 | now(), |
| 825 | 825 | now(), |
| 826 | - '".Db::escape_string(Settings::get('OC_NODE_ID'))."' |
|
| 827 | - ".$needs_maintenance_SQL." |
|
| 826 | + '".Db::escape_string(Settings::get('OC_NODE_ID')) . "' |
|
| 827 | + ".$needs_maintenance_SQL . " |
|
| 828 | 828 | ); |
| 829 | 829 | "); |
| 830 | 830 | $log_internal_id = Db::last_insert_id(); |
@@ -835,9 +835,9 @@ discard block |
||
| 835 | 835 | Db::execute(" |
| 836 | 836 | insert into okapi_submitted_objects (object_type, object_id, consumer_key) |
| 837 | 837 | values ( |
| 838 | - ".Okapi::OBJECT_TYPE_CACHE_LOG.", |
|
| 839 | - '".Db::escape_string($log_internal_id)."', |
|
| 840 | - '".Db::escape_string($consumer_key)."' |
|
| 838 | + ".Okapi::OBJECT_TYPE_CACHE_LOG . ", |
|
| 839 | + '".Db::escape_string($log_internal_id) . "', |
|
| 840 | + '".Db::escape_string($consumer_key) . "' |
|
| 841 | 841 | ); |
| 842 | 842 | "); |
| 843 | 843 | |
@@ -52,8 +52,8 @@ |
||
| 52 | 52 | c.wp_oc as cache_code |
| 53 | 53 | from cache_logs cl, caches c |
| 54 | 54 | where |
| 55 | - cl.user_id = '".Db::escape_string($user['internal_id'])."' |
|
| 56 | - and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "cl.deleted = 0" : "true")." |
|
| 55 | + cl.user_id = '".Db::escape_string($user['internal_id']) . "' |
|
| 56 | + and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "cl.deleted = 0" : "true") . " |
|
| 57 | 57 | and c.status in (1,2,3) |
| 58 | 58 | and cl.cache_id = c.cache_id |
| 59 | 59 | order by cl.date desc |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | select uuid |
| 51 | 51 | from cache_logs |
| 52 | 52 | where |
| 53 | - cache_id = '".Db::escape_string($cache['internal_id'])."' |
|
| 54 | - and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true")." |
|
| 53 | + cache_id = '".Db::escape_string($cache['internal_id']) . "' |
|
| 54 | + and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true") . " |
|
| 55 | 55 | order by date desc |
| 56 | 56 | limit $offset, $limit |
| 57 | 57 | "); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | && Settings::get('OCPL_ENABLE_GEOCACHE_ACCESS_LOGS') |
| 75 | 75 | && (count($log_uuids) > 0) |
| 76 | 76 | ) { |
| 77 | - require_once($GLOBALS['rootpath'].'okapi/lib/ocpl_access_logs.php'); |
|
| 77 | + require_once($GLOBALS['rootpath'] . 'okapi/lib/ocpl_access_logs.php'); |
|
| 78 | 78 | \okapi\OCPLAccessLogs::log_geocache_access($request, $cache['internal_id']); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | $rs = Db::query(" |
| 54 | 54 | select id, node, user_id |
| 55 | 55 | from cache_logs |
| 56 | - where uuid = '".Db::escape_string($log_uuid)."'" |
|
| 56 | + where uuid = '".Db::escape_string($log_uuid) . "'" |
|
| 57 | 57 | ); |
| 58 | 58 | $row = Db::fetch_assoc($rs); |
| 59 | 59 | Db::free_result($rs); |
| 60 | 60 | if (!$row) |
| 61 | - throw new InvalidParam('log_uuid', "There is no log entry with uuid '".$log_uuid."'."); |
|
| 61 | + throw new InvalidParam('log_uuid', "There is no log entry with uuid '" . $log_uuid . "'."); |
|
| 62 | 62 | if ($row['node'] != Settings::get('OC_NODE_ID')) { |
| 63 | 63 | throw new Exception( |
| 64 | 64 | "This site's database contains the log entry '$log_uuid' which has been" |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | throw new InvalidParam('image', "bad base64 encoding"); |
| 117 | 117 | |
| 118 | 118 | try { |
| 119 | - $image_properties = getimagesizefromstring($image); # can throw |
|
| 119 | + $image_properties = getimagesizefromstring($image); # can throw |
|
| 120 | 120 | if (!$image_properties) |
| 121 | 121 | throw new Exception(); |
| 122 | 122 | list($width, $height, $image_type) = $image_properties; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | )); |
| 149 | 149 | } |
| 150 | 150 | try { |
| 151 | - $image = imagecreatefromstring($image); # can throw |
|
| 151 | + $image = imagecreatefromstring($image); # can throw |
|
| 152 | 152 | if (!$image) throw new Exception(); |
| 153 | 153 | } |
| 154 | 154 | catch (Exception $e) { |
@@ -167,23 +167,23 @@ discard block |
||
| 167 | 167 | # - eliminate any data flaws which have may been in the source files. |
| 168 | 168 | |
| 169 | 169 | $image_uuid = Okapi::create_uuid(); |
| 170 | - $imagepath = Settings::get('IMAGES_DIR').'/'.$image_uuid; |
|
| 170 | + $imagepath = Settings::get('IMAGES_DIR') . '/' . $image_uuid; |
|
| 171 | 171 | switch ($image_type) |
| 172 | 172 | { |
| 173 | 173 | case IMAGETYPE_JPEG: |
| 174 | 174 | $file_ext = '.jpg'; |
| 175 | 175 | $quality = Settings::get('JPEG_QUALITY'); |
| 176 | - $result = imagejpeg($image, $imagepath.$file_ext, $quality); |
|
| 176 | + $result = imagejpeg($image, $imagepath . $file_ext, $quality); |
|
| 177 | 177 | break; |
| 178 | 178 | |
| 179 | 179 | case IMAGETYPE_PNG: |
| 180 | 180 | $file_ext = '.png'; |
| 181 | - $result = imagepng($image, $imagepath.$file_ext); |
|
| 181 | + $result = imagepng($image, $imagepath . $file_ext); |
|
| 182 | 182 | break; |
| 183 | 183 | |
| 184 | 184 | case IMAGETYPE_GIF: |
| 185 | 185 | $file_ext = '.gif'; |
| 186 | - $result = imagegif($image, $imagepath.$file_ext); |
|
| 186 | + $result = imagegif($image, $imagepath . $file_ext); |
|
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | default: |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $result = false; |
| 192 | 192 | } |
| 193 | 193 | if (!$result) |
| 194 | - throw new Exception("could not save image file '".$imagepath.$file_ext."'"); |
|
| 194 | + throw new Exception("could not save image file '" . $imagepath . $file_ext . "'"); |
|
| 195 | 195 | |
| 196 | 196 | # insert image into database |
| 197 | 197 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | # (which is very unlikely, and will just add a bit more of garbage |
| 209 | 209 | # to that which is already present in the images directory). |
| 210 | 210 | |
| 211 | - try { unlink($imagepath.$file_ext); } |
|
| 211 | + try { unlink($imagepath . $file_ext); } |
|
| 212 | 212 | catch (Exception $e2) {} |
| 213 | 213 | throw $e; |
| 214 | 214 | } |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | private static function max_pixels($base64_image) |
| 226 | 226 | { |
| 227 | - $bytes_per_pixel = 5; # GD needs 5 bytes per pixel for "true color" |
|
| 227 | + $bytes_per_pixel = 5; # GD needs 5 bytes per pixel for "true color" |
|
| 228 | 228 | $available_memory = Okapi::php_ini_get_bytes('memory_limit') - memory_get_usage(); |
| 229 | - $available_memory -= 16 * 1024 * 1024; # reserve |
|
| 230 | - $available_memory -= strlen($base64_image); # will be copied for EXIF processing |
|
| 231 | - $available_memory -= 3 * $bytes_per_pixel * Settings::get('IMAGE_MAX_PIXEL_COUNT'); # processing buffers |
|
| 229 | + $available_memory -= 16 * 1024 * 1024; # reserve |
|
| 230 | + $available_memory -= strlen($base64_image); # will be copied for EXIF processing |
|
| 231 | + $available_memory -= 3 * $bytes_per_pixel * Settings::get('IMAGE_MAX_PIXEL_COUNT'); # processing buffers |
|
| 232 | 232 | return floor($available_memory / $bytes_per_pixel); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -312,15 +312,15 @@ discard block |
||
| 312 | 312 | set seq = seq + 1 |
| 313 | 313 | where |
| 314 | 314 | object_type = 1 |
| 315 | - and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 316 | - and seq >= '".Db::escape_string($seq)."' |
|
| 315 | + and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 316 | + and seq >= '".Db::escape_string($seq) . "' |
|
| 317 | 317 | order by seq desc |
| 318 | 318 | "); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | if (Settings::get('OC_BRANCH') == 'oc.de') { |
| 322 | 322 | $local_fields_SQL = "seq"; |
| 323 | - $local_values_escaped_SQL = "'".Db::escape_string($seq)."'"; |
|
| 323 | + $local_values_escaped_SQL = "'" . Db::escape_string($seq) . "'"; |
|
| 324 | 324 | # All other fields are set by trigger or defaults for OCDE. |
| 325 | 325 | } else { |
| 326 | 326 | # These are the additional fields that OCPL newpic.php supplies |
@@ -328,27 +328,27 @@ discard block |
||
| 328 | 328 | $local_fields_SQL = |
| 329 | 329 | "date_created, last_modified, description, desc_html, last_url_check, user_id"; |
| 330 | 330 | $local_values_escaped_SQL = |
| 331 | - "NOW(), NOW(), '', 0, NOW(), '".Db::escape_string($user_id)."'"; |
|
| 331 | + "NOW(), NOW(), '', 0, NOW(), '" . Db::escape_string($user_id) . "'"; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | Db::execute(" |
| 335 | 335 | insert into pictures ( |
| 336 | 336 | uuid, node, local, title, spoiler, url, object_type, object_id, |
| 337 | 337 | unknown_format, display, |
| 338 | - ".$local_fields_SQL." |
|
| 338 | + ".$local_fields_SQL . " |
|
| 339 | 339 | ) |
| 340 | 340 | values ( |
| 341 | - '".Db::escape_string($image_uuid)."', |
|
| 342 | - '".Db::escape_string(Settings::get('OC_NODE_ID'))."', |
|
| 341 | + '".Db::escape_string($image_uuid) . "', |
|
| 342 | + '".Db::escape_string(Settings::get('OC_NODE_ID')) . "', |
|
| 343 | 343 | 1, |
| 344 | - '".Db::escape_string($caption)."', |
|
| 345 | - '".($is_spoiler == 'true' ? 1 : 0)."', |
|
| 346 | - '".Db::escape_string(Settings::get('IMAGES_URL').$image_uuid.$file_ext)."', |
|
| 344 | + '".Db::escape_string($caption) . "', |
|
| 345 | + '".($is_spoiler == 'true' ? 1 : 0) . "', |
|
| 346 | + '".Db::escape_string(Settings::get('IMAGES_URL') . $image_uuid . $file_ext) . "', |
|
| 347 | 347 | 1, |
| 348 | - '".Db::escape_string($log_internal_id)."', |
|
| 348 | + '".Db::escape_string($log_internal_id) . "', |
|
| 349 | 349 | 0, |
| 350 | 350 | 1, |
| 351 | - ".$local_values_escaped_SQL." |
|
| 351 | + ".$local_values_escaped_SQL . " |
|
| 352 | 352 | ) |
| 353 | 353 | "); |
| 354 | 354 | $image_internal_id = Db::last_insert_id(); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | set |
| 366 | 366 | picturescount = picturescount + 1, |
| 367 | 367 | last_modified = NOW() |
| 368 | - where id = '".Db::escape_string($log_internal_id)."' |
|
| 368 | + where id = '".Db::escape_string($log_internal_id) . "' |
|
| 369 | 369 | "); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | Db::execute(" |
| 376 | 376 | insert into okapi_submitted_objects (object_type, object_id, consumer_key) |
| 377 | 377 | values ( |
| 378 | - '".Okapi::OBJECT_TYPE_CACHE_LOG_IMAGE."', |
|
| 379 | - '".Db::escape_string($image_internal_id)."', |
|
| 380 | - '".Db::escape_string($consumer_key)."' |
|
| 378 | + '".Okapi::OBJECT_TYPE_CACHE_LOG_IMAGE . "', |
|
| 379 | + '".Db::escape_string($image_internal_id) . "', |
|
| 380 | + '".Db::escape_string($consumer_key) . "' |
|
| 381 | 381 | ); |
| 382 | 382 | "); |
| 383 | 383 | |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | $image_row = Db::select_row(" |
| 32 | 32 | select id, node, url, local |
| 33 | 33 | from pictures |
| 34 | - where uuid = '".$image_uuid_escaped."' |
|
| 34 | + where uuid = '".$image_uuid_escaped . "' |
|
| 35 | 35 | "); |
| 36 | 36 | Db::execute(" |
| 37 | - delete from pictures where uuid = '".$image_uuid_escaped."' |
|
| 37 | + delete from pictures where uuid = '".$image_uuid_escaped . "' |
|
| 38 | 38 | "); |
| 39 | 39 | |
| 40 | 40 | # Remember that OCPL picture sequence numbers are always 1, and |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | localID, uuid, type, removed_date, node |
| 53 | 53 | ) |
| 54 | 54 | VALUES ( |
| 55 | - ".$image_row['id']." |
|
| 56 | - '".$image_uuid_escaped."', |
|
| 55 | + ".$image_row['id'] . " |
|
| 56 | + '".$image_uuid_escaped . "', |
|
| 57 | 57 | 6, |
| 58 | 58 | NOW(), |
| 59 | 59 | ".$image_row['node'] |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | set |
| 73 | 73 | picturescount = greatest(0, picturescount - 1), |
| 74 | 74 | last_modified = NOW() |
| 75 | - where id = '".Db::escape_string($log_internal_id)."' |
|
| 75 | + where id = '".Db::escape_string($log_internal_id) . "' |
|
| 76 | 76 | "); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if ($image_row['local']) { |
| 82 | 82 | $filename = basename($image_row['url']); |
| 83 | - unlink(Settings::get('IMAGES_DIR').'/'.$filename); |
|
| 83 | + unlink(Settings::get('IMAGES_DIR') . '/' . $filename); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $result = array( |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | if ($caption !== null) { |
| 82 | 82 | Db::execute(" |
| 83 | 83 | update pictures |
| 84 | - set title = '".Db::escape_string($caption)."' |
|
| 85 | - where uuid = '".$image_uuid_escaped."' |
|
| 84 | + set title = '".Db::escape_string($caption) . "' |
|
| 85 | + where uuid = '".$image_uuid_escaped . "' |
|
| 86 | 86 | "); |
| 87 | 87 | $log_entry_modified = true; |
| 88 | 88 | } |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | if ($is_spoiler !== null) { |
| 92 | 92 | Db::execute(" |
| 93 | 93 | update pictures |
| 94 | - set spoiler = ".($is_spoiler == 'true' ? 1 : 0)." |
|
| 95 | - where uuid = '".$image_uuid_escaped."' |
|
| 94 | + set spoiler = ".($is_spoiler == 'true' ? 1 : 0) . " |
|
| 95 | + where uuid = '".$image_uuid_escaped . "' |
|
| 96 | 96 | "); |
| 97 | 97 | $log_entry_modified = true; |
| 98 | 98 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $image_uuids = Db::select_column(" |
| 109 | 109 | select uuid from pictures |
| 110 | - where object_type = 1 and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 110 | + where object_type = 1 and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 111 | 111 | order by date_created |
| 112 | 112 | "); |
| 113 | 113 | $position = array_search($image_uuid, $image_uuids); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | # For OCDE the pictures table is write locked now. |
| 123 | 123 | |
| 124 | 124 | $old_seq = DB::select_value(" |
| 125 | - select seq from pictures where uuid = '".$image_uuid_escaped."' |
|
| 125 | + select seq from pictures where uuid = '".$image_uuid_escaped . "' |
|
| 126 | 126 | "); |
| 127 | 127 | |
| 128 | 128 | if ($seq != $old_seq) |
@@ -134,13 +134,13 @@ discard block |
||
| 134 | 134 | $max_seq = Db::select_value(" |
| 135 | 135 | select max(seq) |
| 136 | 136 | from pictures |
| 137 | - where object_type = 1 and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 137 | + where object_type = 1 and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 138 | 138 | "); |
| 139 | 139 | |
| 140 | 140 | Db::query(" |
| 141 | 141 | update pictures |
| 142 | - set seq = '".Db::escape_string($max_seq + 1)."' |
|
| 143 | - where uuid = '".$image_uuid_escaped."' |
|
| 142 | + set seq = '".Db::escape_string($max_seq + 1) . "' |
|
| 143 | + where uuid = '".$image_uuid_escaped . "' |
|
| 144 | 144 | "); |
| 145 | 145 | |
| 146 | 146 | # now move the pictures inbetween |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | set seq = seq + 1 |
| 151 | 151 | where |
| 152 | 152 | object_type = 1 |
| 153 | - and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 154 | - and seq >= '".Db::escape_string($seq)."' |
|
| 155 | - and seq < '".Db::escape_string($old_seq)."' |
|
| 153 | + and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 154 | + and seq >= '".Db::escape_string($seq) . "' |
|
| 155 | + and seq < '".Db::escape_string($old_seq) . "' |
|
| 156 | 156 | order by seq desc |
| 157 | 157 | "); |
| 158 | 158 | } else { |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | set seq = seq - 1 |
| 162 | 162 | where |
| 163 | 163 | object_type = 1 |
| 164 | - and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 165 | - and seq <= '".Db::escape_string($seq)."' |
|
| 166 | - and seq > '".Db::escape_string($old_seq)."' |
|
| 164 | + and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 165 | + and seq <= '".Db::escape_string($seq) . "' |
|
| 166 | + and seq > '".Db::escape_string($old_seq) . "' |
|
| 167 | 167 | order by seq asc |
| 168 | 168 | "); |
| 169 | 169 | } |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | # and finally move the edited picture into place |
| 172 | 172 | Db::query(" |
| 173 | 173 | update pictures |
| 174 | - set seq = '".Db::escape_string($seq)."' |
|
| 175 | - where uuid = '".$image_uuid_escaped."' |
|
| 174 | + set seq = '".Db::escape_string($seq) . "' |
|
| 175 | + where uuid = '".$image_uuid_escaped . "' |
|
| 176 | 176 | "); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | Db::query(" |
| 189 | 189 | update cache_logs |
| 190 | 190 | set last_modified = NOW() |
| 191 | - where id = '".Db::escape_string($log_internal_id)."' |
|
| 191 | + where id = '".Db::escape_string($log_internal_id) . "' |
|
| 192 | 192 | "); |
| 193 | 193 | |
| 194 | 194 | # OCPL code currently does not update pictures.last_modified when |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | pictures.node |
| 37 | 37 | from cache_logs |
| 38 | 38 | join pictures on pictures.object_id = cache_logs.id |
| 39 | - where pictures.object_type = 1 and pictures.uuid = '".Db::escape_string($image_uuid)."' |
|
| 39 | + where pictures.object_type = 1 and pictures.uuid = '".Db::escape_string($image_uuid) . "' |
|
| 40 | 40 | "); |
| 41 | 41 | $row = Db::fetch_assoc($rs); |
| 42 | 42 | Db::free_result($rs); |
| 43 | 43 | if (!$row) { |
| 44 | 44 | throw new InvalidParam( |
| 45 | 45 | 'image_uuid', |
| 46 | - "There is no log entry image with uuid '".$image_uuid."'." |
|
| 46 | + "There is no log entry image with uuid '" . $image_uuid . "'." |
|
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | if ($row['node'] != Settings::get('OC_NODE_ID')) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $position = $request->get_parameter('position'); |
| 69 | 69 | if ($position !== null && !preg_match("/^-?[0-9]+$/", $position)) { |
| 70 | - throw new InvalidParam('position', "'".$position."' is not an integer number."); |
|
| 70 | + throw new InvalidParam('position', "'" . $position . "' is not an integer number."); |
|
| 71 | 71 | } |
| 72 | 72 | return $position; |
| 73 | 73 | } |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | Db::execute('lock tables pictures write'); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $log_images_count = Db::select_value(" |
|
| 104 | + $log_images_count = Db::select_value(" |
|
| 105 | 105 | select count(*) |
| 106 | 106 | from pictures |
| 107 | - where object_type = 1 and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 107 | + where object_type = 1 and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 108 | 108 | "); |
| 109 | 109 | |
| 110 | 110 | if (Settings::get('OC_BRANCH') == 'oc.pl') |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $seq = Db::select_value(" |
| 123 | 123 | select max(seq) |
| 124 | 124 | from pictures |
| 125 | - where object_type = 1 and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 125 | + where object_type = 1 and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 126 | 126 | ") + $end_offset; |
| 127 | 127 | } else if ($position <= 0) { |
| 128 | 128 | $position = 0; |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | $seq = Db::select_value(" |
| 132 | 132 | select seq |
| 133 | 133 | from pictures |
| 134 | - where object_type = 1 and object_id = '".Db::escape_string($log_internal_id)."' |
|
| 134 | + where object_type = 1 and object_id = '".Db::escape_string($log_internal_id) . "' |
|
| 135 | 135 | order by seq |
| 136 | - limit ".($position+0).", 1 |
|
| 136 | + limit ".($position + 0) . ", 1 |
|
| 137 | 137 | "); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | $log_uuids = explode("|", $log_uuids); |
| 41 | 41 | |
| 42 | 42 | if ((count($log_uuids) > 500) && (!$request->skip_limits)) |
| 43 | - throw new InvalidParam('log_uuids', "Maximum allowed number of referenced ". |
|
| 44 | - "log entries is 500. You provided ".count($log_uuids)." UUIDs."); |
|
| 43 | + throw new InvalidParam('log_uuids', "Maximum allowed number of referenced " . |
|
| 44 | + "log entries is 500. You provided " . count($log_uuids) . " UUIDs."); |
|
| 45 | 45 | if (count($log_uuids) != count(array_unique($log_uuids))) |
| 46 | 46 | throw new InvalidParam('log_uuids', "Duplicate UUIDs detected (make sure each UUID is referenced only once)."); |
| 47 | 47 | $fields = $request->get_parameter('fields'); |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | $rs = Db::query(" |
| 69 | 69 | select |
| 70 | 70 | cl.id, c.wp_oc as cache_code, cl.uuid, cl.type, |
| 71 | - ".$teamentry_field." as oc_team_entry, |
|
| 72 | - ".$needs_maintenance_SQL." as needs_maintenance2, |
|
| 73 | - ".$listing_is_outdated_SQL." as listing_is_outdated, |
|
| 71 | + ".$teamentry_field . " as oc_team_entry, |
|
| 72 | + ".$needs_maintenance_SQL . " as needs_maintenance2, |
|
| 73 | + ".$listing_is_outdated_SQL . " as listing_is_outdated, |
|
| 74 | 74 | unix_timestamp(cl.date) as date, cl.text, |
| 75 | 75 | u.uuid as user_uuid, u.username, u.user_id, |
| 76 | 76 | if(cr.user_id is null, 0, 1) as was_recommended |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | left join cache_rating cr |
| 82 | 82 | on cr.user_id = u.user_id |
| 83 | 83 | and cr.cache_id = c.cache_id |
| 84 | - ".$ratingdate_condition." |
|
| 84 | + ".$ratingdate_condition . " |
|
| 85 | 85 | and cl.type in ( |
| 86 | - ".Okapi::logtypename2id("Found it").", |
|
| 87 | - ".Okapi::logtypename2id("Attended")." |
|
| 86 | + ".Okapi::logtypename2id("Found it") . ", |
|
| 87 | + ".Okapi::logtypename2id("Attended") . " |
|
| 88 | 88 | ) |
| 89 | 89 | where |
| 90 | - cl.uuid in ('".implode("','", array_map('\okapi\Db::escape_string', $log_uuids))."') |
|
| 91 | - and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "cl.deleted = 0" : "true")." |
|
| 90 | + cl.uuid in ('".implode("','", array_map('\okapi\Db::escape_string', $log_uuids)) . "') |
|
| 91 | + and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "cl.deleted = 0" : "true") . " |
|
| 92 | 92 | and cl.user_id = u.user_id |
| 93 | 93 | and c.cache_id = cl.cache_id |
| 94 | 94 | and c.status in (1,2,3) |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'user' => array( |
| 106 | 106 | 'uuid' => $row['user_uuid'], |
| 107 | 107 | 'username' => $row['username'], |
| 108 | - 'profile_url' => Settings::get('SITE_URL')."viewprofile.php?userid=".$row['user_id'], |
|
| 108 | + 'profile_url' => Settings::get('SITE_URL') . "viewprofile.php?userid=" . $row['user_id'], |
|
| 109 | 109 | ), |
| 110 | 110 | 'type' => Okapi::logtypeid2name($row['type']), |
| 111 | 111 | 'was_recommended' => $row['was_recommended'] ? true : false, |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | from pictures |
| 133 | 133 | where |
| 134 | 134 | object_type = 1 |
| 135 | - and object_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($log_id2uuid)))."') |
|
| 135 | + and object_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($log_id2uuid))) . "') |
|
| 136 | 136 | and display = 1 /* currently is always 1 for logpix */ |
| 137 | 137 | and unknown_format = 0 |
| 138 | 138 | order by seq, date_created |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | array( |
| 149 | 149 | 'uuid' => $row['uuid'], |
| 150 | 150 | 'url' => $row['url'], |
| 151 | - 'thumb_url' => Settings::get('SITE_URL') . 'thumbs.php?'.$object_type_param.'uuid=' . $row['uuid'], |
|
| 151 | + 'thumb_url' => Settings::get('SITE_URL') . 'thumbs.php?' . $object_type_param . 'uuid=' . $row['uuid'], |
|
| 152 | 152 | 'caption' => $row['title'], |
| 153 | 153 | 'is_spoiler' => ($row['spoiler'] ? true : false), |
| 154 | 154 | ); |