/*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` \r\n\t FROM `cache_npa_areas` \r\n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id` \r\n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id` \r\n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=0\r\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\r\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` \r\n\t FROM `cache_npa_areas` \r\n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id` \r\n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id` \r\n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=1\r\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\r\n\t ORDER BY `npa_types`.`ordinal` ASC", $cacheid); $tpl->assign_rs('npaareasNoWarning', $rs); sql_free_result($rs); /* attributes */ $tpl->assign('attributes', attribute::getAttrbutesListArrayByCacheId($cacheid)); /* 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 \r\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 \r\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']); } if ($login->userid > 0) { $useropt = new useroptions($login->userid); $tpl->assign('userzoom', $useropt->getOptValue(USR_OPT_GMZOOM)); } else { $tpl->assign('userzoom', 11); } $tpl->display();
$record = sql_fetch_array($rs); sql_free_result($rs); if ($record === false) { $tpl->error(ERROR_USER_NOT_EXISTS); } $rs = sql("SELECT IFNULL(`tt`.`text`, `p`.`name`) AS `name`, `u`.`option_value`, `u`.`option_id` AS `option_id`\r\n\t\t FROM `profile_options` AS `p`\r\n\t\t LEFT JOIN `user_options` AS `u` ON `p`.`id`=`u`.`option_id`\r\n\t\t LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`p`.`trans_id` AND `st`.`text`=`p`.`name`\r\n\t\t LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang` = '&2'\r\n\t\t WHERE `u`.`option_visible`=1\r\n\t\t AND `p`.`internal_use`=0\r\n\t\t AND `u`.`user_id`='&1'\r\n\t\t ORDER BY `p`.`option_order`", $userid, $opt['template']['locale']); $tpl->assign_rs('useroptions', $rs); sql_free_result($rs); $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`\r\n\t\t FROM `caches` AS `c`\r\n\t\t LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`\r\n\t\t LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`\r\n\t\t LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'\r\n\t\t WHERE `c`.`user_id`='&1'\r\n\t\t GROUP BY `t`.`id`\r\n\t\t ORDER BY `anzahl` DESC", $userid, $opt['template']['locale']); $tpl->assign_rs('userstatshidden', $rs); sql_free_result($rs); $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`\r\n\t\t FROM `cache_logs` AS `l`\r\n\t\t LEFT JOIN `caches` AS `c` ON `l`.`cache_id`=`c`.`cache_id`\r\n\t\t LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`\r\n\t\t LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`\r\n\t\t LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'\r\n\t\t WHERE `l`.`user_id`='&1' AND (`l`.`type`=1 OR `l`.`type`=7)\r\n\t\t GROUP BY `t`.`id`\r\n\t\t ORDER BY `anzahl` DESC", $userid, $opt['template']['locale']); $tpl->assign_rs('userstatsfound', $rs); sql_free_result($rs); $useropt = new useroptions($userid); $tpl->assign('show_statistics', $useropt->getOptValue(USR_OPT_SHOWSTATS) == 1); $tpl->assign('username', $record['username']); $tpl->assign('userid', $userid); $tpl->assign('uuid', $record['uuid']); $tpl->assign('founds', $record['found'] <= 0 ? '0' : $record['found']); $tpl->assign('notfound', $record['notfound'] <= 0 ? '0' : $record['notfound']); $tpl->assign('note', $record['note'] <= 0 ? '0' : $record['note']); $tpl->assign('hidden', $record['hidden'] <= 0 ? '0' : $record['hidden']); $tpl->assign('recommended', sql_value("SELECT COUNT(*) FROM `cache_rating` WHERE `user_id`='&1'", 0, $userid)); $tpl->assign('maxrecommended', floor($record['found'] * $opt['logic']['rating']['percentageOfFounds'] / 100)); $tpl->assign('showcountry', strlen(trim($record['country'])) > 0); $tpl->assign('country', $record['country']); $tpl->assign('registered', $record['date_created']); /* set last_login to one of 5 categories * 1 = this month or last month * 2 = between one and 6 months
$tpl->assign('aAttributes', attribute::getSelectableAttrbutesListArray()); $aAttributesDisabled = array(); $maxaid = 0; $rs = sql("SELECT `id` FROM `cache_attrib`"); while ($r = sql_fetch_assoc($rs)) { $aAttributesDisabled[] = $r['id']; if ($r['id'] > $maxaid) { $maxaid = $r['id']; } } sql_free_result($rs); $tpl->assign('aAttributesDisabled', $aAttributesDisabled); $tpl->assign('maxAttributeId', $maxaid); // options $useroptions = new useroptions($login->userid); $tpl->assign('opt_menumap', $useroptions->getOptValue(USR_OPT_MAP_MENU)); $tpl->assign('opt_overview', $useroptions->getOptValue(USR_OPT_MAP_OVERVIEW)); $tpl->assign('opt_maxcaches', $useroptions->getOptValue(USR_OPT_MAP_MAXCACHES)); $tpl->assign('opt_cacheicons', $useroptions->getOptValue(USR_OPT_MAP_ICONSET)); $tpl->assign('opt_pictures', $useroptions->getOptValue(USR_OPT_MAP_PREVIEW)); $tpl->assign('maxrecords', $opt['map']['maxrecords'] + 0); $tpl->assign('min_maxrecords', $opt['map']['min_maxrecords']); $tpl->assign('max_maxrecords', $opt['map']['max_maxrecords']); $tpl->assign('msie', $useragent_msie); $tpl->assign('old_msie', $useragent_msie && $useragent_msie_version <= 6); $tpl->assign('help_oconly', helppagelink("OConly")); $tpl->assign('help_map', helppagelink("*map2")); $tpl->assign('help_wps', helppagelink("additional_waypoints")); $tpl->assign('help_note', helppagelink("usernote")); $tpl->assign('help_previewpics', helppagelink("previewpics")); $tpl->display();
// user data and basic statistics $rs = sql("SELECT `user`.`username`, \n\t\t\t\t\t\t\t\t\t\t`user`.`last_login`, \n\t\t\t\t\t\t\t\t\t\t`user`.`accept_mailing`, \n\t\t\t\t\t\t\t\t\t\t`user`.`pmr_flag`, \n\t\t\t\t\t\t\t\t\t\t`user`.`date_created`, \n\t\t\t\t\t\t\t\t\t\t`user`.`password`, \n\t\t\t\t\t\t\t\t\t\t`user`.`email`, \n\t\t\t\t\t\t\t\t\t\t`user`.`is_active_flag`, \n\t\t\t\t\t\t\t\t\t\t`user`.`latitude`, \n\t\t\t\t\t\t\t\t\t\t`user`.`longitude`,\n\t\t\t\t\t\t\t\t\t\t`user`.`data_license`, \n\t\t\t\t\t\t\t\t\t\tIFNULL(`sys_trans_text`.`text`,`countries`.`name`) AS `country`,\n\t\t\t\t\t\t\t\t\t\t`stat_user`.`hidden`, \n\t\t\t\t\t\t\t\t\t\t`stat_user`.`found`, \n\t\t\t\t\t\t\t\t\t\t`stat_user`.`notfound`, \n\t\t\t\t\t\t\t\t\t\t`stat_user`.`note`, \n\t\t\t\t\t\t\t\t\t\t`stat_user`.`maintenance`,\n\t\t\t\t\t\t\t\t\t\t`user`.`uuid` \n\t\t\t\t\t\t\t FROM `user` \n\t\t\t\t\tLEFT JOIN `stat_user` ON `user`.`user_id`=`stat_user`.`user_id` \n\t\t\t\t\tLEFT JOIN `countries` ON `user`.`country`=`countries`.`short`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` ON `sys_trans_text`.`lang`='&2' AND `sys_trans_text`.`trans_id`=`countries`.`trans_id`\n\t\t\t\t\t\t\tWHERE `user`.`user_id`='&1'", $userid, $opt['template']['locale']); $record = sql_fetch_array($rs); sql_free_result($rs); if ($record === false) { $tpl->error(ERROR_USER_NOT_EXISTS); } $active = sql_value("SELECT COUNT(*) FROM `caches` WHERE `user_id`='&1' AND `status`=1", 0, $userid); $rs = sql("SELECT IFNULL(`tt`.`text`, `p`.`name`) AS `name`, `u`.`option_value`, `u`.`option_id` AS `option_id`\n\t\t FROM `profile_options` AS `p`\n\t\t LEFT JOIN `user_options` AS `u` ON `p`.`id`=`u`.`option_id`\n\t\t LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`p`.`trans_id` AND `st`.`text`=`p`.`name`\n\t\t LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang` = '&2'\n\t\t WHERE `u`.`option_visible`=1\n\t\t AND `p`.`internal_use`=0\n\t\t AND `u`.`user_id`='&1'\n\t\t ORDER BY `p`.`option_order`", $userid, $opt['template']['locale']); $tpl->assign_rs('useroptions', $rs); sql_free_result($rs); $user_desc = sql_value("SELECT `description` FROM `user` WHERE `user_id`='&1'", "", $userid); $user_desc = use_current_protocol_in_html($user_desc); $tpl->assign('description', $user_desc); $useropt = new useroptions($userid); $show_statistics = $useropt->getOptValue(USR_OPT_SHOWSTATS); $show_oconly81 = $useropt->getOptValue(USR_OPT_OCONLY81); if ($show_oconly81) { $tpl->assign('oco81_helplink', helppagelink('oconly81')); } if ($show_statistics) { // detail statistics $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`\n\t\t\t FROM `caches` AS `c`\n\t\t\t LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`\n\t\t\t LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`\n\t\t\t LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'\n\t\t\t LEFT JOIN `cache_status` ON `cache_status`.`id`=`c`.`status`\n\t\t\t WHERE `c`.`user_id`='&1' AND `allow_user_view`='1'\n\t\t\t GROUP BY `t`.`id`\n\t\t\t ORDER BY `anzahl` DESC, `t`.`ordinal` ASC", $userid, $opt['template']['locale']); $tpl->assign_rs('userstatshidden', $rs); sql_free_result($rs); $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`\n\t\t\t FROM `cache_logs` AS `l`\n\t\t\t LEFT JOIN `caches` AS `c` ON `l`.`cache_id`=`c`.`cache_id`\n\t\t\t LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`\n\t\t\t LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`\n\t\t\t LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'\n\t\t\t WHERE `l`.`user_id`='&1' AND (`l`.`type`=1 OR `l`.`type`=7)\n\t\t\t GROUP BY `t`.`id`\n\t\t\t ORDER BY `anzahl` DESC, `t`.`ordinal` ASC", $userid, $opt['template']['locale']); $tpl->assign_rs('userstatsfound', $rs); sql_free_result($rs); $rs = sql("\n\t\t\tSELECT\n\t\t\t\tCOUNT(*) AS `count`,\n\t\t\t\tIFNULL(`stt`.`text`, `caches`.`country`) AS `country`,\n\t\t\t\tIF(`caches`.`country`='&3' AND `cache_location`.`code1`='&3', `cache_location`.`adm2`, NULL) AS `state`,\n\t\t\t\t`caches`.`country` AS `countrycode`,\n\t\t\t\t`cache_location`.`code2` AS `adm2code`\n\t\t\tFROM\n\t\t\t\t`cache_logs`\n\t\t\t\tINNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id`\n\t\t\t\tINNER JOIN `cache_location` ON `cache_location`.`cache_id`=`cache_logs`.`cache_id`\n\t\t\t\tLEFT JOIN `countries` ON `countries`.`short`=`caches`.`country`\n\t\t\t\tLEFT JOIN `sys_trans_text` `stt` ON `stt`.`lang`='&2' AND `stt`.`trans_id`=`countries`.`trans_id`\n\t\t\tWHERE `cache_logs`.`user_id`='&1' AND `cache_logs`.`type` IN (1,7)\n\t\t\tGROUP BY `country`, `state`\n\t\t\tORDER BY `count` DESC, `country`, `state`", $userid, $opt['template']['locale'], $login->getUserCountry()); $tpl->assign_rs('regionstat', $rs); sql_free_result($rs);
} /* logpics */ $tpl->assign('show_logpics', $logpics ? 1 : 0); if ($logpics) { set_paged_pics(LOGPICS_FOR_CACHE_GALLERY, 0, $cacheid, "viewcache.php?cacheid=" . $cacheid . "&logpics=1"); $tpl->assign('subtitle', "<< <a href='viewcache.php?cacheid=" . $cacheid . "'>" . $translate->t('Back to the cache description', '', basename(__FILE__), __LINE__) . "</a>"); } else { $tpl->assign('logpics', get_logpics(LOGPICS_FOR_CACHE_STAT, 0, $cacheid)); } /* process profile settings */ $userzoom = 11; if ($login->userid > 0) { $useropt = new useroptions($login->userid); $userzoom = $useropt->getOptValue(USR_OPT_GMZOOM); $autoload_logs = $useropt->getOptValue(USR_OPT_LOG_AUTOLOAD); } else { $autoload_logs = true; } $tpl->assign('userzoom', $userzoom); $tpl->assign('autoload_logs', $autoload_logs); // get the correct mapkey $sHost = strtolower($_SERVER['HTTP_HOST']); $sGMKey = ''; if (isset($opt['lib']['google']['mapkey'][$sHost])) { $sGMKey = $opt['lib']['google']['mapkey'][$sHost]; } $cachemap['iframe'] = $opt['logic']['cachemaps']['iframe']; $url = $opt['page']['protocol'] . strstr($opt['logic']['cachemaps']['url'], '://'); $url = str_replace('{userzoom}', $userzoom, $url);
private function loadLanguages() { global $login; $options = new useroptions($login->userid); $this->languages = explode(',', $options->getOptValue(USR_OPT_TRANSLANG)); }