okapi r810

This commit is contained in:
following
2013-05-30 14:15:55 +02:00
parent b68e6105bb
commit 0c1f881477
4 changed files with 31 additions and 9 deletions

View File

@@ -202,10 +202,17 @@ class OkapiExceptionHandler
$exception_info .= (isset($_SERVER['REQUEST_URI']) ? "--- OKAPI method called ---\n".
preg_replace("/([?&])/", "\n$1", $_SERVER['REQUEST_URI'])."\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"; },
array_keys(getallheaders()), array_values(getallheaders())
));
# This if-condition will solve some (but not all) problems when trying to execute
# 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;
}
@@ -799,7 +806,7 @@ class Okapi
{
public static $data_store;
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;
/** Get a variable stored in okapi_vars. If variable not found, return $default. */

View File

@@ -3,6 +3,7 @@
namespace okapi\services\caches\geocaches;
use Exception;
use ArrayObject;
use okapi\Okapi;
use okapi\Db;
use okapi\Settings;
@@ -208,7 +209,7 @@ class WebService
");
}
$results = array();
$results = new ArrayObject();
$cacheid2wptcode = array();
$owner_ids = array();
while ($row = mysql_fetch_assoc($rs))
@@ -1058,7 +1059,7 @@ class WebService
# See issue#97. PHP dictionaries (assoc arrays) are ordered structures,
# so we just have to rewrite it (sequentially).
$ordered_results = array();
$ordered_results = new ArrayObject();
foreach ($cache_codes as $cache_code)
$ordered_results[$cache_code] = $results[$cache_code];

View File

@@ -24,7 +24,7 @@ class WebService
private static $valid_field_names = array(
'uuid', 'cache_code', 'date', 'user', 'type', 'was_recommended', 'comment',
'images', 'internal_id',
'images', 'internal_id', 'oc_team_entry',
);
public static function call(OkapiRequest $request)
@@ -50,9 +50,14 @@ class WebService
if (!in_array($field, self::$valid_field_names))
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("
select
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,
u.uuid as user_uuid, u.username, u.user_id,
if(cr.user_id is null, 0, 1) as was_recommended
@@ -89,6 +94,8 @@ class WebService
'images' => array(),
'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'];
}
mysql_free_result($rs);

View File

@@ -67,7 +67,14 @@
</ul>
</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>
</li>
<li><b>comment</b> - HTML string, text entered with the log entry,</li>