sql_temp_table_slave('tmpFTCaches'); sql_slave('CREATE TEMPORARY TABLE &tmpFTCaches (`cache_id` int (11) PRIMARY KEY) ' . $sqlFilter); $sql_select = array(); $sql_from = ''; $sql_innerjoin = array(); $sql_leftjoin = array(); $sql_where = array(); $sql_select[] = '`caches`.`cache_id` `cache_id`'; $sql_from = '&tmpFTCaches'; $sql_innerjoin[] = '`caches` ON `caches`.`cache_id`=&tmpFTCaches.`cache_id`'; } elseif ($options['searchtype'] == 'bynofilter') { $sql_select[] = '`caches`.`cache_id` `cache_id`'; $sql_from = '`caches`'; } elseif ($options['searchtype'] == 'bylist') { sql_temp_table_slave('result_caches'); $list = new cachelist($options['listid']); if ($list->allowView($options['cachelist_pw'])) { $cachesFilter = "CREATE TEMPORARY TABLE &result_caches ENGINE=MEMORY\n\t\t\t\t\t\t\t\t\t\tSELECT `cache_id` FROM `cache_list_items`\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `cache_lists` ON `cache_lists`.`id`=`cache_list_items`.`cache_list_id`\n\t\t\t\t\t\t\t\t\t WHERE `cache_list_id`=" . sql_escape($options['listid']); sql_slave($cachesFilter); sql_slave('ALTER TABLE &result_caches ADD PRIMARY KEY ( `cache_id` )'); $sql_select[] = '&result_caches.`cache_id`'; $sql_from = '&result_caches'; $sql_innerjoin[] = '`caches` ON `caches`.`cache_id`=&result_caches.`cache_id`'; } else { // should not happen, but just for the case ... $sql_select[] = '`caches`.`cache_id` `cache_id`'; $sql_from = '`caches`'; $sql_where[] = 'FALSE'; } } else { if ($options['searchtype'] == 'all') {
* For license information see doc/license.txt * * Unicode Reminder メモ * * Shortcut for cachelist search ***************************************************************************/ require './lib2/web.inc.php'; $id = isset($_REQUEST['id']) ? $_REQUEST['id'] + 0 : 0; $password = isset($_REQUEST['key']) ? $_REQUEST['key'] : ''; $watch = isset($_REQUEST['watch']); $dontwatch = isset($_REQUEST['dontwatch']); $bookmark = isset($_REQUEST['bookmark']); $unbookmark = isset($_REQUEST['unbookmark']); if ($id) { $login->verify(); $list = new cachelist($id); if ($list->exist()) { if ($watch && $list->allowView($password) || $dontwatch) { $list->watch($watch); } if ($bookmark) { $list->bookmark($password); } if ($unbookmark) { $list->unbookmark(); } } $tpl->redirect("search.php?searchto=searchbylist&listid=" . $id . ($password != "" ? "&listkey=" . urlencode($password) : "") . "&showresult=1&f_disabled=0&f_inactive=0&f_ignored=1&sort=byname"); } else { $tpl->redirect("cachelists.php"); }
$listid = $_REQUEST['listid'] + 0; if ($listid == 0) { $cachelist = new cachelist(ID_NEW, $login->userid); $name_error = $cachelist->setNameAndVisibility($newlist_name, $newlist_public ? 2 : 0); if ($name_error) { $tpl->assign('name_error', $name_error); } else { $cachelist->setNode($opt['logic']['node']['id']); if ($cachelist->save()) { $cachelist->addCacheByID($cacheid); if ($newlist_watch) { $cachelist->watch(true); } } $tpl->redirect('viewcache.php?cacheid=' . $cacheid); } } else { $cachelist = new cachelist($listid); if ($cachelist->exist()) { $cachelist->addCacheByID($cacheid); } $tpl->redirect('viewcache.php?cacheid=' . $cacheid); } } $tpl->assign('cachename', sql_value("SELECT `name` FROM `caches` WHERE `cache_id`='&1'", '', $cacheid)); $tpl->assign('cachelists', cachelist::getMyLists()); $tpl->assign('default_list', cachelist::getMyLastAddedToListId()); $tpl->assign('newlist_name', $newlist_name); $tpl->assign('newlist_public', $newlist_public); $tpl->assign('newlist_watch', $newlist_watch); $tpl->display();
* Unicode Reminder メモ ***************************************************************************/ require './lib2/web.inc.php'; require_once './lib2/logic/cachelist.class.php'; require_once './lib2/pager.class.php'; $login->verify(); $tpl->name = 'cachelists'; $tpl->menuitem = MNU_CACHES_LISTS; if (isset($_REQUEST['watchlist'])) { $list = new cachelist($_REQUEST['watchlist'] + 0); if ($list->exist()) { $list->watch(true); } } else { if (isset($_REQUEST['dontwatchlist'])) { $list = new cachelist($_REQUEST['dontwatchlist'] + 0); if ($list->exist()) { $list->watch(false); } } } $MAXITEMS = 30; $startat = isset($_REQUEST['startat']) ? $_REQUEST['startat'] + 0 : 0; $name_filter = isset($_REQUEST['name']) ? $_REQUEST['name'] : ''; $by_filter = isset($_REQUEST['by']) ? $_REQUEST['by'] : ''; $listcount = cachelist::getPublicListCount($name_filter, $by_filter); $tpl->assign('name_filter', $name_filter); $tpl->assign('by_filter', $by_filter); $tpl->assign('cachelists', cachelist::getPublicLists($startat, $MAXITEMS, $name_filter, $by_filter)); $tpl->assign('show_status', false); $tpl->assign('show_user', true);
$options['fulltext'] = isset($_REQUEST['fulltext']) ? $_REQUEST['fulltext'] : ''; } elseif (isset($_REQUEST['searchbycacheid'])) { $options['searchtype'] = 'bycacheid'; $options['cacheid'] = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : 0; if (!is_numeric($options['cacheid'])) { $options['cacheid'] = 0; } } elseif (isset($_REQUEST['searchbywp'])) { $options['searchtype'] = 'bywp'; $options['wp'] = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : ''; } elseif (isset($_REQUEST['searchbynofilter'])) { $options['searchtype'] = 'bynofilter'; } elseif (isset($_REQUEST['searchbylist'])) { $options['searchtype'] = 'bylist'; $options['listid'] = isset($_REQUEST['listid']) ? $_REQUEST['listid'] + 0 : 0; $options['cachelist'] = cachelist::getListById($options['listid']); // null for invalid ID } elseif (isset($_REQUEST['searchall'])) { if (!$login->logged_in()) { // This operation is very expensive and therefore available only // for logged-in users. $tpl->error(ERROR_LOGIN_REQUIRED); } else { $options['searchtype'] = 'all'; } } else { if (isset($_REQUEST['showresult'])) { $tpl->error('unknown search option'); } else { // Set default search type; this prevents errors in outputSearchForm() // when initializing searchtype-dependent options:
static function getListById($listid) { $lists = cachelist::getLists("`id`='" . sql_escape($listid) . "'"); if (count($lists)) { return $lists[0]; } else { return false; } }
$options['fulltext'] = isset($_REQUEST['fulltext']) ? $_REQUEST['fulltext'] : ''; } elseif (isset($_REQUEST['searchbycacheid'])) { $options['searchtype'] = 'bycacheid'; $options['cacheid'] = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : 0; if (!is_numeric($options['cacheid'])) { $options['cacheid'] = 0; } } elseif (isset($_REQUEST['searchbywp'])) { $options['searchtype'] = 'bywp'; $options['wp'] = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : ''; } elseif (isset($_REQUEST['searchbynofilter'])) { $options['searchtype'] = 'bynofilter'; } elseif (isset($_REQUEST['searchbylist'])) { $options['searchtype'] = 'bylist'; $options['listid'] = isset($_REQUEST['listid']) ? $_REQUEST['listid'] + 0 : 0; $list = new cachelist($options['listid']); if (!$list->exist() || !$list->isMyList() && $list->getVisibility() == 0) { $tpl->redirect("cachelists.php"); } $options['cachelist'] = cachelist::getListById($options['listid']); // null for invalid ID } elseif (isset($_REQUEST['searchall'])) { if (!$login->logged_in()) { // This operation is very expensive and therefore available only // for logged-in users. $tpl->error(ERROR_LOGIN_REQUIRED); } else { $options['searchtype'] = 'all'; } } else { if (isset($_REQUEST['showresult'])) {
$tpl->assign('logs', $logs); $tpl->assign('loganz', $loganz); /*end insertion Uwe 20091215*/ /* nature protection areas */ $rs = sql("SELECT `npa_areas`.`id` AS `npaId`, `npa_areas`.`type_id` AS `npaType`, `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName` \n\t FROM `cache_npa_areas` \n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id` \n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id` \n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=0\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\n\t ORDER BY `npa_types`.`ordinal` ASC", $cacheid); $tpl->assign_rs('npaareasWarning', $rs); sql_free_result($rs); $rs = sql("SELECT `npa_areas`.`id` AS `npaId`, `npa_areas`.`type_id` AS `npaType`, `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName` \n\t FROM `cache_npa_areas` \n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id` \n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id` \n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=1\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\n\t ORDER BY `npa_types`.`ordinal` ASC", $cacheid); $tpl->assign_rs('npaareasNoWarning', $rs); sql_free_result($rs); /* attributes and cache lists */ $tpl->assign('attributes', attribute::getAttrbutesListArrayByCacheId($cacheid)); $tpl->assign('cachelists', cachelist::getListsByCacheId($cacheid, $rCache['show_cachelists'])); $tpl->assign('watchclinfo', isset($_REQUEST['watchinfo']) && $_REQUEST['watchinfo'] == 1 && cachelist::watchingCacheByListsCount($login->userid, $cacheid) > 0); /* geokrets */ $rsGeoKret = sql("SELECT `gk_item`.`id`, `gk_item`.`name` AS `itemname`, `gk_user`.`name` AS `username` FROM `gk_item` INNER JOIN `gk_item_waypoint` ON `gk_item`.`id`=`gk_item_waypoint`.`id` INNER JOIN `gk_user` ON `gk_item`.`userid`=`gk_user`.`id` INNER JOIN `caches` ON `gk_item_waypoint`.`wp`=`caches`.`wp_oc` WHERE `caches`.`cache_id`='&1' AND `gk_item`.`typeid`!=2 AND `gk_item`.`stateid` IN (0, 3) AND `gk_item_waypoint`.`wp`!='' UNION \n\t SELECT `gk_item`.`id`, `gk_item`.`name` AS `itemname`, `gk_user`.`name` AS `username` FROM `gk_item` INNER JOIN `gk_item_waypoint` ON `gk_item`.`id`=`gk_item_waypoint`.`id` INNER JOIN `gk_user` ON `gk_item`.`userid`=`gk_user`.`id` INNER JOIN `caches` ON `gk_item_waypoint`.`wp`=`caches`.`wp_gc` WHERE `caches`.`cache_id`='&1' AND `gk_item`.`typeid`!=2 AND `gk_item`.`stateid` IN (0, 3) AND `gk_item_waypoint`.`wp`!='' UNION \n\t SELECT `gk_item`.`id`, `gk_item`.`name` AS `itemname`, `gk_user`.`name` AS `username` FROM `gk_item` INNER JOIN `gk_item_waypoint` ON `gk_item`.`id`=`gk_item_waypoint`.`id` INNER JOIN `gk_user` ON `gk_item`.`userid`=`gk_user`.`id` INNER JOIN `caches` ON `gk_item_waypoint`.`wp`=`caches`.`wp_nc` WHERE `caches`.`cache_id`='&1' AND `gk_item`.`typeid`!=2 AND `gk_item`.`stateid` IN (0, 3) AND `gk_item_waypoint`.`wp`!='' ORDER BY `itemname`", $cacheid); $tpl->assign_rs('geokret', $rsGeoKret); $tpl->assign('geokret_count', sql_num_rows($rsGeoKret)); sql_free_result($rsGeoKret); if (isset($_REQUEST['print']) && $_REQUEST['print'] == 'y') { $tpl->popup = 1; $tpl->assign('print', true); $tpl->name = 'viewcache_print'; $tpl->assign('log', $_REQUEST['log']); } else { $tpl->assign('print', false); } /* logpics
if (isset($_REQUEST['listid'])) { // switching editor mode while editing existing list $list = new cachelist($_REQUEST['listid'] + 0); if ($list->exist() && $list->getUserId() == $login->userid) { $edit_list = true; $tpl->assign('show_editor', true); } } else { // switching desc mode while creating new list $tpl->assign('newlist_mode', true); $tpl->assign('show_editor', true); } } // save data entered in the 'edit list' form if (isset($_REQUEST['save']) && isset($_REQUEST['listid'])) { $list = new cachelist($_REQUEST['listid'] + 0); if ($list->exist() && $list->getUserId() == $login->userid) { $name_error = $list->setNameAndVisibility($list_name, $list_visibility); if ($name_error) { $edit_list = true; } $list->setDescription($desctext, $descMode == 3); $list->save(); $list->watch($watch); if ($list_caches != '') { $result = $list->addCachesByWPs($list_caches); $tpl->assign('invalid_waypoints', $result === true ? false : implode(", ", $result)); $list_caches = ''; } foreach ($_REQUEST as $key => $value) { if (substr($key, 0, 7) == 'remove_') {
static function getListById($listid) { $lists = cachelist::getLists("`id`='" . sql_escape($listid) . "'"); if (count($lists)) { $lists[0]['description_for_display'] = use_current_protocol_in_html($lists[0]['description']); return $lists[0]; } else { return false; } }
<?php /*************************************************************************** * For license information see doc/license.txt * * Unicode Reminder メモ * * Shortcut for cachelist search ***************************************************************************/ require './lib2/web.inc.php'; $id = isset($_REQUEST['id']) ? $_REQUEST['id'] + 0 : 0; $watch = isset($_REQUEST['watch']); $dontwatch = isset($_REQUEST['dontwatch']); if ($id) { if ($watch || $dontwatch) { $list = new cachelist($id); if ($list->exist()) { $list->watch($watch); } } $tpl->redirect("search.php?searchto=searchbylist&listid=" . $id . "&showresult=1&f_disabled=0&f_inactive=0&f_ignored=1&sort=byname"); } else { $tpl->redirect("cachelists.php"); }
} foreach ($_REQUEST as $key => $value) { if (substr($key, 0, 7) == 'remove_') { $list->removeCacheById(substr($key, 7)); } } } } // delete a list if (isset($_REQUEST['delete'])) { sql("DELETE FROM `cache_lists` WHERE `user_id`='&1' AND `id`='&2'", $login->userid, $_REQUEST['delete'] + 0); // All dependent deletion and cleanup is done via trigger. } // unbookmark a list if (isset($_REQUEST['unbookmark'])) { $list = new cachelist($_REQUEST['unbookmark'] + 0); if ($list->exist()) { $list->unbookmark(); } } // redirect to list search output after editing a list from the search output page if ($fromsearch && !$switchDescMode && !$name_error && isset($_REQUEST['listid'])) { $tpl->redirect('cachelist.php?id=' . ($_REQUEST['listid'] + 0)); } // prepare editor and editing if ($descMode == 3) { $tpl->add_header_javascript('resource2/tinymce/tiny_mce_gzip.js'); $tpl->add_header_javascript('resource2/tinymce/config/list.js.php?lang=' . strtolower($opt['template']['locale'])); } $tpl->add_header_javascript(editorJsPath()); if ($edit_list) {