$data = str_replace("\n", " ", $data); $file_content .= $data; $file_content .= '\',OFFSETY, 25, OFFSETX, -135, PADDING,5, WIDTH,280,SHADOW,true)" onmouseout="UnTip()"><img src="tpl/stdstyle/images/' . $r_log['icon_small'] . '" border="0" alt=""/></a></b></td>'; $file_content .= '<td> <b><a class="links" href="viewprofile.php?userid=' . htmlspecialchars($r_log['user_id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($r_log['user_name'], ENT_COMPAT, 'UTF-8') . '</a></b></td>'; } else { $file_content .= '<td style="width: 80px;"> </td><td width="22"> </td><td> </td>'; } $file_content .= "</tr>"; $content .= $file_content; XDb::xFreeResults($rs_log); } } } XDb::xFreeResults($rs); tpl_set_var('file_content', $content); $count = XDb::xSimpleQueryValue('SELECT COUNT(*) `count` FROM `caches` WHERE type=6 AND status=1', 0); $frompage = $startat / 100 - 3; if ($frompage < 1) { $frompage = 1; } $topage = $frompage + 8; if (($topage - 1) * $perpage > $count) { $topage = ceil($count / $perpage); } $thissite = $startat / 100 + 1; $pages = ''; if ($startat > 0) { $pages .= '<a href="newevents.php?startat=0">{first_img}</a> <a href="newevents.php?startat=' . ($startat - 100) . '">{prev_img}</a> '; } else { $pages .= '{first_img_inactive} {prev_img_inactive} '; }
} //include template handling require_once $rootpath . 'lib/common.inc.php'; setlocale(LC_TIME, 'pl_PL.UTF-8'); $tops = array(); echo '<center><table style="padding-left:32px; padding-bottom:32px; line-heigh: 1.6em; font-size: 12px;">'; echo '<tr><td align="center" style="font-size: 16px;"><b>' . tr('index_01') . '</b><br /></td></tr>'; echo '<tr><td>' . tr('index_02') . '<br /> <br /><img src="images/rating-star.png" border="0" alt="Recommendations" /> ' . tr('index_03') . '<br /><br /><img src="tpl/stdstyle/images/log/16x16-found.png" class="icon16" alt="Found" /> ' . tr('index_04') . '<br /><br /> ' . tr('index_05') . '</td></tr>'; echo '<tr><td align="center"><img src="images/tops-formula.png" border="0" alt="Formula" /></td></tr></table></center>'; echo '<table border="0" cellspacing="2" cellpadding="1" style="margin-left: 10px;line-high: 1.6em; font-size: 12px;" width="97%"><tr><td> </td><td><strong>' . tr('index_06') . '</strong></td><td><img src="images/rating-star.png" border="0" alt="" /></td><td><img src="tpl/stdstyle/images/log/16x16-found.png" class="icon16" alt="" /></td><td><strong>Cache</strong></td><td><strong>' . tr('user') . '</strong></td></tr><tr><td colspan="6"><hr></hr></td></tr>'; XDb::xSql("CREATE TEMPORARY TABLE topFounds (`cache_id` INT(11) PRIMARY KEY, `founds` INT(11))\n SELECT `caches`.`cache_id`,\n COUNT(`cache_logs`.`cache_id`) `founds`\n FROM `caches`\n LEFT JOIN `cache_logs` ON `caches`.`cache_id`=`cache_logs`.`cache_id`\n AND `cache_logs`.`type`=1\n AND `cache_logs`.`deleted`=0\n GROUP BY `caches`.`cache_id`"); XDb::xSql("UPDATE `topFounds` SET `founds`=0 WHERE ISNULL(`founds`)"); XDb::xSql("CREATE TEMPORARY TABLE topRatings (`cache_id` INT(11) PRIMARY KEY, `ratings` INT(11))\n SELECT `cache_rating`.`cache_id`, COUNT(`cache_rating`.`cache_id`) AS `ratings`\n FROM `cache_rating`\n INNER JOIN `caches` ON `cache_rating`.`cache_id`=`caches`.`cache_id`\n WHERE `cache_rating`.`user_id`!=`caches`.`user_id`\n GROUP BY `cache_rating`.`cache_id`"); XDb::xSql("CREATE TEMPORARY TABLE topResult (`idx` INT(11), `cache_id` INT(11) PRIMARY KEY, `ratings` INT(11), `founds` INT(11))\n SELECT (`topRatings`.`ratings`+1)*(topRatings.`ratings`+1)/(IFNULL(`topFounds`.`founds`,0)/10+1)*100 AS `idx`,\n `topFounds`.`cache_id`, `topRatings`.`ratings`, `topFounds`.`founds`\n FROM `topFounds`\n INNER JOIN `topRatings` ON `topFounds`.`cache_id`=`topRatings`.`cache_id`\n INNER JOIN `caches` ON `topFounds`.`cache_id`=`caches`.`cache_id`\n ORDER BY `idx` DESC"); if (10 < XDb::xSimpleQueryValue("SELECT COUNT(*) FROM `topResult`", 0)) { $min_idx = XDb::xSimpleQueryValue("SELECT `idx` FROM `topResult` ORDER BY `idx` DESC LIMIT 99999, 1", 0); XDb::xSql("DELETE FROM `topResult` WHERE `idx`< ? ", $min_idx); } $rsCaches = XDb::xSql("SELECT `topResult`.`idx`, `topResult`.`ratings`, `caches`.`founds`,\n `topResult`.`founds` AS `foundAfterRating`, `topResult`.`cache_id`,\n `caches`.`name`, `caches`.`wp_oc` AS `wpoc`, `user`.`username`,\n `user`.`user_id` AS `userid`\n FROM `topResult`\n INNER JOIN `caches` ON `topResult`.`cache_id`=`caches`.`cache_id`\n INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\n WHERE `topResult`.`cache_id` = `caches`.`cache_id`\n AND `caches`.`type` <> 6\n AND `caches`.`status` = 1\n ORDER BY `idx` DESC"); $items = array(); while ($rCaches = XDb::xFetchArray($rsCaches)) { $widthB = round(100 * ($rCaches['idx'] / 200) / 1, 0); $line = '<tr><td> </td><td><span class="content-title-noshade txt-blue08" >{index}</span></td><td><span class="content-title-noshade txt-green10">{rating}</span></td><td><span class="content-title-noshade txt-green10">{fbr}</span></td><td><a class="links" href="viewcache.php?cacheid={cacheid}" target="_blank">{name}</a></td><td><a class="links" href="viewprofile.php?userid={userid}" target="_blank">{username}</a></td></tr>'; $line = str_replace('{index}', $rCaches['idx'], $line); $line = str_replace('{rating}', $rCaches['ratings'], $line); $line = str_replace('{fbr}', $rCaches['founds'], $line); $line = str_replace('{far}', $rCaches['foundAfterRating'], $line); $line = str_replace('{username}', $rCaches['username'], $line); $line = str_replace('{widthB}', $widthB, $line); $line = str_replace('{userid}', $rCaches['userid'], $line); $line = str_replace('{cacheid}', $rCaches['cache_id'], $line);
if ($r_log['encrypt'] == 1 && $r_log['cache_owner'] != $usr['userid'] && $r_log['luser_id'] != $usr['userid']) { //crypt the log ROT13, but keep HTML-Tags and Entities $data = str_rot13_html($data); } else { $file_content .= "<br/>"; } $file_content .= $data; $file_content .= '\',OFFSETY, 25, OFFSETX, -135, PADDING,5, WIDTH,280,SHADOW,true)" onmouseout="UnTip()"><img src="tpl/stdstyle/images/' . $r_log['icon_small'] . '" border="0" alt=""/></a></b></td>'; $file_content .= '<td> <b><a class="links" href="viewprofile.php?userid=' . htmlspecialchars($r_log['user_id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($r_log['user_name'], ENT_COMPAT, 'UTF-8') . '</a></b></td>'; } XDb::xFreeResults($rs_log); $file_content .= "</tr>"; } XDb::xFreeResults($rs); tpl_set_var('file_content', $file_content); $count = XDb::xSimpleQueryValue('SELECT COUNT(*) `count` FROM (local_caches' . $user_id . ' caches)', 0); $frompage = $startat / 100 - 3; if ($frompage < 1) { $frompage = 1; } $topage = $frompage + 8; if (($topage - 1) * $perpage > $count) { $topage = ceil($count / $perpage); } $thissite = $startat / 100 + 1; $pages = ''; if ($startat > 0) { $pages .= '<a href="myn_topcaches.php?startat=0">{first_img}</a> <a href="myn_topcaches.php?startat=' . ($startat - 100) . '">{prev_img}</a> '; } else { $pages .= '{first_img_inactive} {prev_img_inactive} '; }
require $stylepath . '/lib/icons.inc.php'; $tplname = 'myhome'; tpl_set_var('username', htmlspecialchars($usr['username'], ENT_COMPAT, 'UTF-8')); tpl_set_var('userid', htmlspecialchars($usr['userid'], ENT_COMPAT, 'UTF-8')); //get user record $userid = $usr['userid']; $query = "SELECT COUNT(*) FROM caches WHERE user_id='{$userid}'"; $hidden_count = XDb::xSimpleQueryValue($query, 0); $query = "SELECT COUNT(*) founds_count\n FROM cache_logs\n WHERE user_id={$userid} AND type=1 AND deleted=0"; $founds_count = XDb::xSimpleQueryValue($query, 0); $query = "SELECT COUNT(*) events_count\n FROM cache_logs\n WHERE user_id={$userid} AND type=7 AND deleted=0"; $events_count = XDb::xSimpleQueryValue($query, 0); $query = "SELECT COUNT(*) notfounds_count\n FROM cache_logs\n WHERE user_id={$userid} AND type=2 AND deleted=0"; $notfounds_count = XDb::xSimpleQueryValue($query, 0); $query = "SELECT COUNT(*) log_notes_count\n FROM cache_logs\n WHERE user_id={$userid} AND type=3 AND deleted=0"; $log_notes_count = XDb::xSimpleQueryValue($query, 0); if ($events_count > 0) { $events = tr('you_have_participated_in') . " " . $events_count . " " . tr('found_x_events') . "."; } else { $events = ""; } if (date('m') == 4 and date('d') == 1) { tpl_set_var('founds', tr('you_have_found') . " " . rand(0, 13) . " " . tr('found_beer_caches') . "."); tpl_set_var('hidden', $hidden_count); tpl_set_var('events', $events); } else { tpl_set_var('founds', tr('you_have_found') . " " . $founds_count . " " . tr('found_x_caches') . "."); tpl_set_var('hidden', $hidden_count); tpl_set_var('events', $events); } //get last logs
use Utils\Database\XDb; use Utils\Database\OcDb; global $dateFormat; require_once './lib/common.inc.php'; $tplname = 'cache_titled'; $usrid = -1; if ($usr != false) { $usrid = $usr['userid']; } $dbcLocCache = OcDb::instance(); $query = "SELECT\n caches.type cache_type, caches.name cacheName, caches.cache_id cache_id,\n user.username userName, user.user_id user_id,\n cache_location.adm3 cacheRegion, cache_titled.date_alg dateAlg\n\n FROM cache_titled\n JOIN caches on caches.cache_id = cache_titled.cache_id\n JOIN user on user.user_id = caches.user_id\n JOIN cache_location ON cache_location.cache_id = cache_titled.cache_id\n WHERE caches.status=1"; if (isset($_REQUEST['type'])) { $latitude = XDb::xSimpleQueryValue("SELECT `latitude` FROM user WHERE user_id='" . XDb::xEscape($usr['userid']) . "'", 0); $longitude = XDb::xSimpleQueryValue("SELECT `longitude` FROM user WHERE user_id='" . XDb::xEscape($usr['userid']) . "'", 0); $distance = XDb::xSimpleQueryValue("SELECT `notify_radius` FROM user WHERE user_id='" . XDb::xEscape($usr['userid']) . "'", 0); localCachesInc::createLocalCaches($dbcLocCache, $longitude, $latitude, $distance, $usrid); $query .= " JOIN local_caches on cache_titled.cache_id = local_caches.cache_id "; } $s = $dbcLocCache->simpleQuery($query); $content = ""; for ($i = 0; $i < $dbcLocCache->rowCount($s); $i++) { $record = $dbcLocCache->dbResultFetch($s); $cacheId = $record['cache_id']; $cacheName = str_replace("'", "-", $record['cacheName']); $cacheName = str_replace("\"", " ", $cacheName); $cacheNameRef = '<a href="viewcache.php?cacheid={cacheId}">{cacheName}<a>'; $cacheNameRef = str_replace('{cacheId}', $cacheId, $cacheNameRef); $cacheNameRef = str_replace('{cacheName}', $cacheName, $cacheNameRef); $cacheRegion = $record['cacheRegion']; $ownId = $record['user_id'];
$rootpath = './'; } //include template handling require_once $rootpath . 'lib/common.inc.php'; setlocale(LC_TIME, 'pl_PL.UTF-8'); # This page took >60 seconds to render! Added daily caching. $cache_key = "t6.php-result-" . $lang; $result = apc_fetch($cache_key); if ($result === false) { ob_start(); $rsUs["count"] = XDb::xSimpleQueryValue('SELECT COUNT(*) `count` FROM ( SELECT COUNT(caches.user_id) FROM `caches` WHERE `status`=1 GROUP BY `user_id` ) `users_with_founds`', 0); $fCt["count"] = XDb::xSimpleQueryValue('SELECT COUNT(*) `count` FROM `caches` WHERE `status`=1', 0); $rsfCR = XDb::xSql("SELECT COUNT(*) `count`, `cache_location`.`adm3` region, `cache_location`.`code3` code_region\n FROM `cache_location`\n INNER JOIN caches ON cache_location.cache_id=caches.cache_id\n WHERE `cache_location`.`code1`='PL'\n AND `caches`.`status`=1 AND `caches`.`type`<>6\n AND `cache_location`.`adm3`!=''\n GROUP BY `cache_location`.`code3`\n ORDER BY count DESC"); echo '<table width="97%"><tr><td align="center"><center><b> ' . tr('Stats_t6_01') . '</b> <br />' . tr('Stats_t6_02') . '<br /> ' . tr('Stats_t6_03') . ': '; echo $rsUs["count"]; echo ' .::. ' . tr('Stats_t6_04') . ': '; echo $fCt["count"]; echo '<br /><br />(' . tr('Stats_t6_05') . ')</center></td></tr></table><br><table border="1" bgcolor="white" width="97%">' . "\n"; echo ' <tr class="bgcolor2"> <td width="20%" align="right"> <b>' . tr('Stats_t6_06') . '</b> </td> <td align="right"> <b>' . tr('Stats_t6_07') . '</b> </td> </tr><tr><td height="2"></td></tr>';
<?php use Utils\Database\XDb; global $lang, $rootpath; if (!isset($rootpath)) { $rootpath = './'; } //include template handling require_once $rootpath . 'lib/common.inc.php'; setlocale(LC_TIME, 'pl_PL.UTF-8'); $userscount = XDb::xSimpleQueryValue('SELECT COUNT(DISTINCT user_id) FROM caches WHERE (status=1 OR `status`=2 OR `status`=3)', 0); $cachescount = XDb::xSimpleQueryValue('SELECT COUNT(*) FROM `caches` WHERE (`status`=1 OR `status`=2 OR `status`=3) AND `caches`.`type`<>6', 0); echo '<table width="97%"><tr><td align="center"><center><b> ' . tr('ranking_by_number_of_created_caches') . '</b><br><br /> ' . tr('users_who_created_caches') . ':'; echo $userscount; echo ' .::. ' . tr('number_of_caches') . ': '; echo $cachescount; echo '</center><br /></td></tr></table><table border="1" bgcolor="white" width="97%">' . "\n"; $r = XDb::xSql("SELECT COUNT(*) `count`, `user`.`username` `username`, `user`.`user_id` `user_id`\n FROM `caches`\n INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\n WHERE (`caches`.`status`=1 OR `caches`.`status`=2 OR `caches`.`status`=3 )\n AND `caches`.`type`<>6 AND user.stat_ban = 0\n GROUP BY `user`.`user_id`\n ORDER BY `count` DESC, `user`.`username` ASC"); echo '<tr class="bgcolor2"><td align="right"> <b>' . tr('ranking') . '</b> </td><td align="center"> <b>' . tr('number_of_caches') . '</b> </td><td align="center"> <b>' . tr('username') . '</b> </td></tr>'; echo '<tr><td height="2">'; $l2 = ""; $licznik = 0; while ($line = XDb::xFetchArray($r)) { $l1 = $line['count']; $licznik++; if ($l2 != $l1) { echo '</td></tr>'; echo '<tr class="bgcolor2"><td align="right"> <b>' . $licznik . '</b> </td><td align="right"> <b>' . $l1 . '</b> </td><td><a href="viewprofile.php?userid=' . $line['user_id'] . '">' . htmlspecialchars($line['username']) . '</a>'; $l2 = $l1; } else { echo ', <a href="viewprofile.php?userid=' . $line['user_id'] . '">' . htmlspecialchars($line['username']) . '</a>';
<?php use Utils\Database\XDb; global $lang, $rootpath; if (!isset($rootpath)) { $rootpath = './'; } //include template handling require_once $rootpath . 'lib/common.inc.php'; setlocale(LC_TIME, 'pl_PL.UTF-8'); $userscount = XDb::xSimpleQueryValue('SELECT COUNT(DISTINCT user_id) FROM caches WHERE status=1', 0); $cachescount = XDb::xSimpleQueryValue('SELECT COUNT(*) FROM `caches` WHERE `status`=1', 0); echo '<table width="97%"><tr><td align="center"><center><b> ' . tr('ranking_by_number_of_created_active_caches') . '</b><br><br /> ' . tr('users_who_created_caches_active') . ':'; echo $userscount; echo ' .::. ' . tr('number_of_active_caches') . ': '; echo $cachescount; echo '</center><br /></td></tr></table><table border="1" bgcolor="white" width="97%">' . "\n"; $r = XDb::xSql("SELECT COUNT(*) `count`, `user`.`username` `username`, `user`.`user_id` `user_id`\n FROM `caches`\n INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\n WHERE `caches`.`status`=1\n AND `caches`.`type`<>6\n AND user.stat_ban = 0\n GROUP BY `user`.`user_id`\n ORDER BY `count` DESC, `user`.`username` ASC"); echo '<tr class="bgcolor2"><td align="right"> <b>' . tr('ranking') . '</b> </td><td align="center"> <b>' . tr('number_of_caches') . '</b> </td><td align="center"> <b>' . tr('username') . '</b> </td></tr>'; echo '<tr><td height="2">'; $l2 = ""; $licznik = 0; while ($line = XDb::xFetchArray($r)) { $l1 = $line['count']; $licznik++; if ($l2 != $l1) { echo '</td></tr>'; echo '<tr class="bgcolor2"><td align="right"> <b>' . $licznik . '</b> </td><td align="right"> <b>' . $l1 . '</b> </td><td><a href="viewprofile.php?userid=' . $line['user_id'] . '">' . htmlspecialchars($line['username']) . '</a>'; $l2 = $l1; } else { echo ', <a href="viewprofile.php?userid=' . $line['user_id'] . '">' . htmlspecialchars($line['username']) . '</a>';
$wp_lat = $coords_lat_h + $coords_lat_min / 60; if ($coords_latNS == 'S') { $wp_lat = -$wp_lat; } $wp_lon = $coords_lon_h + $coords_lon_min / 60; if ($coords_lonEW == 'W') { $wp_lon = -$wp_lon; } // $wp_desc=nl2br($wp_desc); //save to DB XDb::xSql("UPDATE `waypoints` SET `longitude`=?, `latitude`=?, `type`=?,`status`=?,\n `stage`= ?,`desc`= ?, `opensprawdzacz`= ? WHERE `wp_id`= ?", $wp_lon, $wp_lat, $wp_type, $wp_status, $wp_stage, $wp_desc, $opensprawdzacz_taknie, $wp_id); XDb::xSql("UPDATE `caches` SET `last_modified`=NOW() WHERE `cache_id`= ? ", $cache_id); // ==== opensprawdzacz =============================================== // add/update active status to/in opensprawdzacz table if ($opensprawdzacz_taknie == 1 && $wp_type == 3) { $proba = XDb::xSimpleQueryValue("SELECT count(*) FROM `opensprawdzacz` WHERE `cache_id` = '{$cache_id}'", ''); if ($proba == 0) { XDb::xSql("INSERT INTO `opensprawdzacz`(\n `id`,\n `cache_id`,\n `proby`,\n `sukcesy`)\n VALUES ('', '{$cache_id}', 0, 0)"); } } // ==== opensprawdzacz end =========================================== //display cache-page tpl_redirect('editcache.php?cacheid=' . urlencode($cache_id)); exit; } } tpl_set_var('selLatN', $coords_latNS == 'N' ? ' selected="selected"' : ''); tpl_set_var('selLatS', $coords_latNS == 'S' ? ' selected="selected"' : ''); tpl_set_var('selLonE', $coords_lonEW == 'E' ? ' selected="selected"' : ''); tpl_set_var('selLonW', $coords_lonEW == 'W' ? ' selected="selected"' : ''); tpl_set_var('lat_h', htmlspecialchars($coords_lat_h, ENT_COMPAT, 'UTF-8'));
global $lang, $rootpath, $usr, $dateFormat; if (!isset($rootpath)) { $rootpath = ''; } require_once $rootpath . 'lib/common.inc.php'; require_once $rootpath . 'lib/cache_icon.inc.php'; require_once __DIR__ . '/lib/myn.inc.php'; require_once $stylepath . '/lib/icons.inc.php'; //Preprocessing if ($error == false) { //get the news $tplname = 'myn_newlogs'; require $stylepath . '/newlogs.inc.php'; $LOGS_PER_PAGE = 50; $PAGES_LISTED = 10; $total_logs = XDb::xSimpleQueryValue("SELECT COUNT(id) FROM cache_logs WHERE deleted=0", 0); $pages = ""; $total_pages = ceil($total_logs / $LOGS_PER_PAGE); if (!isset($_GET['start']) || intval($_GET['start']) < 0 || intval($_GET['start']) > $total_logs) { $start = 0; } else { $start = intval($_GET['start']); } $startat = max(0, floor(($start / $LOGS_PER_PAGE + 1) / $PAGES_LISTED) * $PAGES_LISTED); if ($start > 0) { $pages .= '<a href="myn_newlogs.php?start=' . max(0, ($startat - $PAGES_LISTED - 1) * $LOGS_PER_PAGE) . '">{first_img}</a> '; $pages .= '<a href="myn_newlogs.php?start=' . max(0, $start - $LOGS_PER_PAGE) . '">{prev_img}</a> '; } else { $pages .= "{first_img_inactive} {prev_img_inactive} "; } for ($i = max(1, $startat); $i < $startat + $PAGES_LISTED; $i++) {
$thisline = mb_ereg_replace('{cachename}', htmlspecialchars($r['cachename'], ENT_COMPAT, 'UTF-8'), $thisline); $thisline = mb_ereg_replace('{username}', htmlspecialchars($r['username'], ENT_COMPAT, 'UTF-8'), $thisline); // if ($r['country']=='PL') { $thisline = mb_ereg_replace('{region}', htmlspecialchars($r['region'], ENT_COMPAT, 'UTF-8'), $thisline); // else { $thisline = mb_ereg_replace('{region}', '', $thisline);} $thisline = mb_ereg_replace('{date}', date($dateFormat, strtotime($r['date'])), $thisline); $thisline = mb_ereg_replace('{country}', htmlspecialchars(strtolower($r['country']), ENT_COMPAT, 'UTF-8'), $thisline); $cacheicon = myninc::checkCacheStatusByUser($r, $usr['userid']); $thisline = mb_ereg_replace('{imglink}', $cacheicon, $thisline); $thisline = mb_ereg_replace('{country_name}', htmlspecialchars($rr['country_name'], ENT_COMPAT, 'UTF-8'), $thisline); $content .= $thisline . "\n"; XDb::xFreeResults($rs_log); } XDb::xFreeResults($rs); tpl_set_var('newcaches', $content); $count = XDb::xSimpleQueryValue('SELECT COUNT(*) FROM `caches`', 0); $frompage = $startat / 100 - 3; if ($frompage < 1) { $frompage = 1; } $topage = $frompage + 8; if (($topage - 1) * $perpage > $count) { $topage = ceil($count / $perpage); } $thissite = $startat / 100 + 1; $pages = ''; if ($startat > 0) { $pages .= '<a href="newcaches.php?startat=0">{first_img}</a> <a href="newcaches.php?startat=' . ($startat - 100) . '">{prev_img}</a> '; } else { $pages .= '{first_img_inactive} {prev_img_inactive} '; }
<?php use Utils\Database\XDb; $rootpath = '../'; header('Content-type: text/html; charset=utf-8'); require '../lib/common.inc.php'; echo XDb::xSimpleQueryValue('SELECT NOW()', 'DB_ERROR!');
if (!isset($rootpath)) { $rootpath = ''; } require_once './lib/common.inc.php'; //Preprocessing if ($error == false) { //user logged in? if ($usr == false) { $target = urlencode(tpl_get_current_page()); tpl_redirect('login.php?target=' . $target); } else { $tplname = 'cacheguides'; global $usr; global $get_userid; $uLat = XDb::xSimpleQueryValue("SELECT `user`.`latitude` FROM `user` WHERE `user_id`='" . XDb::xEscape($usr['userid']) . "'", 0); $uLon = XDb::xSimpleQueryValue("SELECT `user`.`longitude` FROM `user` WHERE `user_id`='" . XDb::xEscape($usr['userid']) . "'", 0); if (($uLat == NULL || $uLat == 0) && ($uLon == NULL || $uLon == 0)) { tpl_set_var('mapzoom', 6); tpl_set_var('mapcenterLat', $main_page_map_center_lat); tpl_set_var('mapcenterLon', $main_page_map_center_lon); } else { tpl_set_var('mapzoom', 11); tpl_set_var('mapcenterLat', $uLat); tpl_set_var('mapcenterLon', $uLon); } $rscp = XDb::xSql("SELECT `user`.`latitude` `latitude`,`user`.`longitude` `longitude`,`user`.`username` `username`,\n `user`.`user_id` `userid` FROM `user`\n WHERE `user`.`guru`!=0\n AND (\n user.user_id IN (\n SELECT cache_logs.user_id FROM cache_logs\n WHERE `cache_logs`.`type`=1 AND `cache_logs`.`date_created`>DATE_ADD(NOW(), INTERVAL -90 DAY)\n )\n OR user.user_id IN (\n SELECT caches.user_id FROM caches\n WHERE (`caches`.`status`=1 OR `caches`.`status`=2 OR `caches`.`status`=3)\n AND `caches`.`date_created`>DATE_ADD(NOW(), INTERVAL -90 DAY)\n )\n )\n AND `user`.`longitude` IS NOT NULL\n AND `user`.`latitude` IS NOT NULL GROUP BY user.username"); $point = ""; $nrows = 0; while ($record = XDb::xFetchArray($rscp)) { $nrows++; $username = $record['username'];
function setCacheWaypoint($cacheid, $ocWP) { $r['maxwp'] = XDb::xSimpleQueryValue('SELECT MAX(`wp_oc`) `maxwp` FROM `caches`', null); if ($r['maxwp'] == null) { $sWP = $ocWP . "0001"; } else { $sWP = generateNextWaypoint($r['maxwp'], $ocWP); } XDb::xSql("UPDATE `caches` SET `wp_oc`= ?\n WHERE `cache_id`= ? AND ISNULL(`wp_oc`)", $sWP, $cacheid); }
if (mb_strlen($sCode) == 3) { $code2 = $sCode; $adm2 = XDb::xSimpleQueryValue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0); $sCode = mb_substr($sCode, 0, 2); } if (mb_strlen($sCode) == 2) { $code1 = $sCode; if (checkField('countries', 'list_default_' . $lang)) { $lang_db = $lang; } else { $lang_db = "en"; } // try to get localised name first $adm1 = XDb::xSimpleQueryValue("SELECT `countries`.`{$lang}`\n FROM `countries`\n WHERE `countries`.`short`='{$sCode}'", 0); if ($adm1 == null) { $adm1 = XDb::xSimpleQueryValue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0); } } XDb::xSql("INSERT INTO `cache_location` (`cache_id`, `adm1`, `adm2`, `adm3`, `adm4`, `code1`, `code2`, `code3`, `code4`)\n VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON DUPLICATE KEY UPDATE `adm1`= ?, `adm2`= ?, `adm3`= ?, `adm4`= ?,\n `code1`= ?, `code2`= ?, `code3`= ?, `code4`= ?", $rCache['cache_id'], $adm1, $adm2, $adm3, $adm4, $code1, $code2, $code3, $code4, $adm1, $adm2, $adm3, $adm4, $code1, $code2, $code3, $code4); } else { if (checkField('countries', 'list_default_' . $lang)) { $lang_db = $lang; } else { $lang_db = "en"; } $sCountry = XDb::xSimpleQueryValue("SELECT `countries`.`pl` FROM `caches`\n INNER JOIN `countries` ON `caches`.`country`=`countries`.`short`\n WHERE `caches`.`cache_id`='{$rCache['cache_id']}'", 0); $sCode1 = XDb::xMultiVariableQueryValue("SELECT `caches`.`country` FROM `caches`\n WHERE `caches`.`cache_id`=:1", null, $rCache['cache_id']); XDb::xSql("INSERT INTO `cache_location` (`cache_id`, `adm1`, `code1`)\n VALUES ( ?, ?, ?) ON DUPLICATE KEY UPDATE\n `adm1`= ?, `adm2`=NULL, `adm3`=NULL, `adm4`=NULL, `code1`= ?,\n `code2`=NULL, `code3`=NULL, `code4`=NULL", $rCache['cache_id'], $sCountry, $sCode1, $sCountry, $sCode1); } } XDb::xFreeResults($rsCache);
<?php use Utils\Database\XDb; global $lang, $rootpath; if (!isset($rootpath)) { $rootpath = './'; } //include template handling require_once $rootpath . 'lib/common.inc.php'; setlocale(LC_TIME, 'pl_PL.UTF-8'); $userscount = XDb::xSimpleQueryValue('SELECT COUNT( DISTINCT user_id) FROM cache_logs WHERE type=1 AND `deleted`=0', 0); $cachelogscount = XDb::xSimpleQueryValue('SELECT COUNT(*) FROM `cache_logs` WHERE type=1 AND `deleted`=0', 0); echo '<center><table width="97%" border="0"><tr><td align="center"><center><b>' . tr('ranking_by_number_of_finds') . '</b><br />' . tr('total_amount_loggers'); echo $userscount; echo ' .::. ' . tr('total_amount_logs'); echo $cachelogscount; echo '</center></td></tr>'; echo '<tr><td class="bgcolor2"><b>' . tr('filter_out_caches') . '</b><br /><form action="articles.php" method="GET">'; $res_q = XDb::xSql('SELECT id, pl FROM cache_type WHERE id != 6'); $no_types = 0; $typ = ""; while ($res = XDb::xFetchArray($res_q)) { $no_types++; if (isset($_GET[$res['id']]) && $_GET[$res['id']] == 1) { $checked = 'checked'; if ($typ == '') { $typ = ' AND caches.type NOT IN (' . $res['id']; } else { $typ .= ', ' . $res['id']; } } else {
$lineFound->SetWeight(2); $lineFound->SetStepStyle(); $graph->AddY2($lineFound); // // Infotexte einfuegen // $txtStat1 = new Text(tr('graph_statistics_04') . strftime('%d-%m-%Y', time())); $txtStat1->SetPos(55, 55); $txtStat1->SetFont(FF_ARIAL, FS_NORMAL, 10); $lineHeight = $txtStat1->GetFontHeight($graph->img); $hiddenCaches = XDb::xSimpleQueryValue("SELECT COUNT(*) FROM `caches` WHERE (`status`=1 OR `status`=2 OR `status`=3)", 0); $txtStat2 = new Text(tr('graph_statistics_05') . str_replace(',', '.', number_format($hiddenCaches))); $txtStat2->SetPos(55, 55 + $lineHeight * 1.5); $txtStat2->SetFont(FF_ARIAL, FS_NORMAL, 8); $txtStat2->SetColor('blue'); $activeCaches = XDb::xSimpleQueryValue("SELECT COUNT(*) FROM `caches` WHERE `status`=1", 0); $txtStat3 = new Text(tr('graph_statistics_06') . str_replace(',', '.', number_format($activeCaches))); $txtStat3->SetPos(55, 55 + $lineHeight * 2.5); $txtStat3->SetFont(FF_ARIAL, FS_NORMAL, 8); $txtStat3->SetColor('blue'); $foundEntries = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM `cache_logs` WHERE `type`=1 AND `deleted`=0", 0); $txtStat5 = new Text(tr('graph_statistics_07') . str_replace(',', '.', number_format($foundEntries))); $txtStat5->SetPos(55, 55 + $lineHeight * 5.0); $txtStat5->SetFont(FF_ARIAL, FS_NORMAL, 8); $txtStat5->SetColor('darkgreen'); $graph->AddText($txtStat1); $graph->AddText($txtStat2); $graph->AddText($txtStat3); $graph->AddText($txtStat5); // // Display the graph
if (!isset($rootpath)) { $rootpath = './'; } //include template handling require_once $rootpath . 'lib/common.inc.php'; setlocale(LC_TIME, 'pl_PL.UTF-8'); # This page took >60 seconds to render! Added daily caching. $cache_key = "t7.php-result" . $lang; $result = apc_fetch($cache_key); if ($result === false) { ob_start(); $fCt["count"] = XDb::xSimpleQueryValue('SELECT COUNT(*) `count` FROM `cache_logs` WHERE (`type`=1 OR `type`=2 OR `type`=7) AND `deleted`=0', 0); $r['users'] = XDb::xSimpleQueryValue('SELECT COUNT(*) AS `users` FROM ( SELECT DISTINCT `user_id` FROM `cache_logs` WHERE (`type`=1 OR `type`=2) AND `deleted`=0 UNION DISTINCT SELECT DISTINCT `user_id` FROM `caches` ) AS `t`', 0); $rsfCR = XDb::xSql("SELECT COUNT(*) `count`, `cache_location`.`adm3` region, `cache_location`.`code3` code_region\n FROM `cache_location`\n INNER JOIN cache_logs ON cache_location.cache_id=cache_logs.cache_id\n WHERE `cache_location`.`code1`='PL'\n AND (cache_logs.type='1' OR cache_logs.type='2')\n AND cache_logs.deleted='0'\n GROUP BY `cache_location`.`code3`\n ORDER BY count DESC"); echo '<table width="97%"><tr><td align="center"><center><b> ' . tr('Stats_t7_01') . '</b> <br /><br /> ' . tr('Stats_t7_02') . ':<b> '; echo $fCt["count"]; echo ' </b><br />' . tr('Stats_t7_03') . ':<b> '; echo $r['users']; echo '</b><br /><br />(' . tr('Stats_t7_04') . ')</center></td></tr></table><br><table border="1" bgcolor="white" width="97%">' . "\n"; echo ' <tr class="bgcolor2"> <td width="20%"> <center><b>' . tr('Stats_t7_05') . '</b></center> </td> <td align="right">
contact : kkarczmarczyk@gmail.com description : It's the new version of geokrety.org synchronization for opencaching nodes. This code uses a dedicated method export_oc.php - see: http://geokrety.org/api.php for more information. The old method that is used in geokrety.class.php is deprecated. * ************************************************************************* */ $rootpath = '../../'; require_once $rootpath . 'lib/ClassPathDictionary.php'; require_once $rootpath . 'okapi/facade.php'; \okapi\Facade::disable_error_handling(); /* database connection */ /* last synchro check */ $last_updated = XDb::xSimpleQueryValue("SELECT value FROM sysconfig WHERE name='geokrety_lastupdate'", 0); $modifiedsince = strtotime($last_updated); /* new OC dedicated geokrety XML export */ $url = 'http://geokrety.org/export_oc.php?modifiedsince=' . date('YmdHis', $modifiedsince - 1); $xmlString = file_get_contents($url); $gkxml = @simplexml_load_string($xmlString); // $gkxml=@simplexml_load_file($url); if (!$gkxml) { print $xmlString; die("Geokrety export error! Failed to load XML file [simplexml_load_file()]: " . $url); } /* read geokrety data */ foreach ($gkxml->geokret as $geokret) { /* for safety */ $id = XDb::xEscape($geokret['id']); $name = XDb::xEscape($geokret->name);