Skip to content
Permalink
Browse files

added OCDE cache list watch status; fixes #334

  • Loading branch information...
following09
following09 committed Jun 29, 2015
1 parent c3ea3aa commit 1280822d630108ffe8f70b217e65ed21d065679b
Showing with 28 additions and 0 deletions.
  1. +19 −0 okapi/services/caches/geocaches.php
  2. +9 −0 okapi/services/caches/search/searching.inc.php
@@ -442,6 +442,25 @@ public static function call(OkapiRequest $request)
$tmp2 = array();
foreach ($tmp as $cache_code)
$tmp2[$cache_code] = true;
# OCDE caches can also be indirectly watched by watching cache lists:
if (Settings::get('OC_BRANCH') == 'oc.de')
{
$tmp = Db::select_column("
select c.wp_oc
from
caches c,
cache_list_items cli,
cache_list_watches clw
where
cli.cache_id = c.cache_id
and clw.cache_list_id = cli.cache_list_id
and clw.user_id = '".mysql_real_escape_string($request->token->user_id)."'
");
foreach ($tmp as $cache_code)
$tmp2[$cache_code] = true;
}
foreach ($results as $cache_code => &$result_ref)
$result_ref['is_watched'] = isset($tmp2[$cache_code]);
}
@@ -435,6 +435,15 @@ public function prepare_common_search_params()
from cache_watches
where user_id = '".mysql_real_escape_string($this->request->token->user_id)."'
");
if (Settings::get('OC_BRANCH') == 'oc.de')
{
$watched_cache_ids = array_merge($watched_cache_ids, Db::select_column("
select cache_id
from cache_list_items cli, cache_list_watches clw
where cli.cache_list_id = clw.cache_list_id
and clw.user_id = '".mysql_real_escape_string($this->request->token->user_id)."'
"));
}
$where_conds[] = "caches.cache_id in ('".implode("','", array_map('mysql_real_escape_string', $watched_cache_ids))."')";
}
}

0 comments on commit 1280822

Please sign in to comment.
You can’t perform that action at this time.