okapi r810
This commit is contained in:
+12
-5
@@ -202,10 +202,17 @@ class OkapiExceptionHandler
|
|||||||
$exception_info .= (isset($_SERVER['REQUEST_URI']) ? "--- OKAPI method called ---\n".
|
$exception_info .= (isset($_SERVER['REQUEST_URI']) ? "--- OKAPI method called ---\n".
|
||||||
preg_replace("/([?&])/", "\n$1", $_SERVER['REQUEST_URI'])."\n\n" : "");
|
preg_replace("/([?&])/", "\n$1", $_SERVER['REQUEST_URI'])."\n\n" : "");
|
||||||
$exception_info .= "--- OKAPI revision ---\n".Okapi::$revision."\n\n";
|
$exception_info .= "--- OKAPI revision ---\n".Okapi::$revision."\n\n";
|
||||||
$exception_info .= "--- Request headers ---\n".implode("\n", array_map(
|
|
||||||
function($k, $v) { return "$k: $v"; },
|
# This if-condition will solve some (but not all) problems when trying to execute
|
||||||
array_keys(getallheaders()), array_values(getallheaders())
|
# OKAPI code from command line;
|
||||||
));
|
# see http://code.google.com/p/opencaching-api/issues/detail?id=243.
|
||||||
|
if (function_exists('getallheaders'))
|
||||||
|
{
|
||||||
|
$exception_info .= "--- Request headers ---\n".implode("\n", array_map(
|
||||||
|
function($k, $v) { return "$k: $v"; },
|
||||||
|
array_keys(getallheaders()), array_values(getallheaders())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
return $exception_info;
|
return $exception_info;
|
||||||
}
|
}
|
||||||
@@ -799,7 +806,7 @@ class Okapi
|
|||||||
{
|
{
|
||||||
public static $data_store;
|
public static $data_store;
|
||||||
public static $server;
|
public static $server;
|
||||||
public static $revision = 798; # This gets replaced in automatically deployed packages
|
public static $revision = 810; # This gets replaced in automatically deployed packages
|
||||||
private static $okapi_vars = null;
|
private static $okapi_vars = null;
|
||||||
|
|
||||||
/** Get a variable stored in okapi_vars. If variable not found, return $default. */
|
/** Get a variable stored in okapi_vars. If variable not found, return $default. */
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace okapi\services\caches\geocaches;
|
namespace okapi\services\caches\geocaches;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use ArrayObject;
|
||||||
use okapi\Okapi;
|
use okapi\Okapi;
|
||||||
use okapi\Db;
|
use okapi\Db;
|
||||||
use okapi\Settings;
|
use okapi\Settings;
|
||||||
@@ -208,7 +209,7 @@ class WebService
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = array();
|
$results = new ArrayObject();
|
||||||
$cacheid2wptcode = array();
|
$cacheid2wptcode = array();
|
||||||
$owner_ids = array();
|
$owner_ids = array();
|
||||||
while ($row = mysql_fetch_assoc($rs))
|
while ($row = mysql_fetch_assoc($rs))
|
||||||
@@ -1058,7 +1059,7 @@ class WebService
|
|||||||
# See issue#97. PHP dictionaries (assoc arrays) are ordered structures,
|
# See issue#97. PHP dictionaries (assoc arrays) are ordered structures,
|
||||||
# so we just have to rewrite it (sequentially).
|
# so we just have to rewrite it (sequentially).
|
||||||
|
|
||||||
$ordered_results = array();
|
$ordered_results = new ArrayObject();
|
||||||
foreach ($cache_codes as $cache_code)
|
foreach ($cache_codes as $cache_code)
|
||||||
$ordered_results[$cache_code] = $results[$cache_code];
|
$ordered_results[$cache_code] = $results[$cache_code];
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class WebService
|
|||||||
|
|
||||||
private static $valid_field_names = array(
|
private static $valid_field_names = array(
|
||||||
'uuid', 'cache_code', 'date', 'user', 'type', 'was_recommended', 'comment',
|
'uuid', 'cache_code', 'date', 'user', 'type', 'was_recommended', 'comment',
|
||||||
'images', 'internal_id',
|
'images', 'internal_id', 'oc_team_entry',
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function call(OkapiRequest $request)
|
public static function call(OkapiRequest $request)
|
||||||
@@ -50,9 +50,14 @@ class WebService
|
|||||||
if (!in_array($field, self::$valid_field_names))
|
if (!in_array($field, self::$valid_field_names))
|
||||||
throw new InvalidParam('fields', "'$field' is not a valid field code.");
|
throw new InvalidParam('fields', "'$field' is not a valid field code.");
|
||||||
|
|
||||||
|
if (Settings::get('OC_BRANCH') == 'oc.de')
|
||||||
|
$teamentry_field = 'cl.oc_team_comment';
|
||||||
|
else
|
||||||
|
$teamentry_field = '(cl.type=12)';
|
||||||
$rs = Db::query("
|
$rs = Db::query("
|
||||||
select
|
select
|
||||||
cl.id, c.wp_oc as cache_code, cl.uuid, cl.type,
|
cl.id, c.wp_oc as cache_code, cl.uuid, cl.type,
|
||||||
|
".$teamentry_field." as oc_team_entry,
|
||||||
unix_timestamp(cl.date) as date, cl.text,
|
unix_timestamp(cl.date) as date, cl.text,
|
||||||
u.uuid as user_uuid, u.username, u.user_id,
|
u.uuid as user_uuid, u.username, u.user_id,
|
||||||
if(cr.user_id is null, 0, 1) as was_recommended
|
if(cr.user_id is null, 0, 1) as was_recommended
|
||||||
@@ -89,6 +94,8 @@ class WebService
|
|||||||
'images' => array(),
|
'images' => array(),
|
||||||
'internal_id' => $row['id'],
|
'internal_id' => $row['id'],
|
||||||
);
|
);
|
||||||
|
if (in_array('oc_team_entry',$fields))
|
||||||
|
$results[$row['uuid']]['oc_team_entry'] = $row['oc_team_entry'] ? true : false;
|
||||||
$log_id2uuid[$row['id']] = $row['uuid'];
|
$log_id2uuid[$row['id']] = $row['uuid'];
|
||||||
}
|
}
|
||||||
mysql_free_result($rs);
|
mysql_free_result($rs);
|
||||||
|
|||||||
@@ -67,7 +67,14 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p><b>was_recommended</b> - true, if the author included his recommendation
|
<p><b>oc_team_entry</b> - <b>true</b> if the log entry has been made by an
|
||||||
|
official OC team member and marked as administrative log; <b>false</b> if it has
|
||||||
|
not been marked.</p>
|
||||||
|
<p>Note: <b>false</b> does NOT mean that it is no administrative log,
|
||||||
|
because this flag can be missing for (mostly old) admin logs.</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><b>was_recommended</b> - <b>true</b>, if the author included his recommendation
|
||||||
in this log entry,</p>
|
in this log entry,</p>
|
||||||
</li>
|
</li>
|
||||||
<li><b>comment</b> - HTML string, text entered with the log entry,</li>
|
<li><b>comment</b> - HTML string, text entered with the log entry,</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user