//start_topcaches.include
 $rstr = sql("SELECT `user`.`user_id` `user_id`,\n                `user`.`username` `username`,\n                `caches`.`cache_id` `cache_id`,\n                `caches`.`name` `name`,\n                `caches`.`longitude` `longitude`,\n                `caches`.`latitude` `latitude`,\n                `caches`.`date_hidden` `date`,\n                `caches`.`date_created` `date_created`,\n                `caches`.`country` `country`,\n                `caches`.`difficulty` `difficulty`,\n                `caches`.`terrain` `terrain`,\n                `cache_type`.`icon_large` `icon_large`,\n                count(`cache_rating`.`cache_id`) `toprate`\n        FROM local_caches `caches` INNER JOIN `user` ON (`caches`.`user_id`=`user`.`user_id`) LEFT JOIN `cache_rating` ON (`caches`.`cache_id`=`cache_rating`.`cache_id`), `cache_type`\n        WHERE `caches`.`type`!=6\n            AND `cache_rating`.`cache_id`=`caches`.`cache_id`\n              AND `caches`.`status`=1\n              AND `caches`.`type`=`cache_type`.`id`\n              GROUP BY `caches`.`cache_id`\n            ORDER BY `toprate` DESC, `caches`.`name` ASC LIMIT 0 , 10");
 $rstr1 = sql("SELECT `user`.`user_id` `user_id`,\n                `user`.`username` `username`,\n                `caches`.`cache_id` `cache_id`,\n                `caches`.`name` `name`,\n                `caches`.`longitude` `longitude`,\n                `caches`.`latitude` `latitude`,\n                `caches`.`date_hidden` `date`,\n                `caches`.`date_created` `date_created`,\n                `caches`.`country` `country`,\n                `caches`.`difficulty` `difficulty`,\n                `caches`.`terrain` `terrain`,\n                `cache_type`.`icon_large` `icon_large`,\n                count(`cache_rating`.`cache_id`) `toprate`\n        FROM local_caches `caches` INNER JOIN `user` ON (`caches`.`user_id`=`user`.`user_id`) LEFT JOIN `cache_rating` ON (`caches`.`cache_id`=`cache_rating`.`cache_id`), `cache_type`\n        WHERE `caches`.`type`!=6\n            AND `cache_rating`.`cache_id`=`caches`.`cache_id`\n              AND `caches`.`status`=1\n              AND `caches`.`type`=`cache_type`.`id`\n              GROUP BY `caches`.`cache_id`\n            ORDER BY `toprate` DESC, `caches`.`name` ASC");
 if (mysql_num_rows($rstr1) > 10) {
     tpl_set_var('more_topcaches', '<a class="links" href="myn_topcaches.php">[' . tr("show_more") . '...]</a>');
 }
 mysql_free_result($rstr1);
 if (mysql_num_rows($rstr) == 0) {
     $file_content = "<p>&nbsp;&nbsp;&nbsp;&nbsp;<b>" . tr('list_of_caches_is_empty') . "</b></p><br>";
 } else {
     $cacheline = '<li class="newcache_list_multi" style="margin-bottom:8px;">' . '<img src="{cacheicon}" class="icon16" alt="Cache" title="Cache" />&nbsp;{date}&nbsp;' . '<a id="newcache{nn}" class="links" href="viewcache.php?cacheid={cacheid}" onmouseover="Lite({nn})" onmouseout="Unlite()" maphref="{smallmapurl}">{cachename}</a>&nbsp;<span style="font-weight:bold;color: green;">[{toprate}]</span>&nbsp;<img src="tpl/stdstyle/images/blue/arrow.png" alt="" title="user" />&nbsp;&nbsp;<a class="links" href="viewprofile.php?userid={userid}">{username}</a></b>';
     $file_content = '<ul style="font-size: 11px;">';
     for ($i = 0; $i < mysql_num_rows($rstr); $i++) {
         $record = sql_fetch_array($rstr);
         //          $loc = cacheToLocation($record['cache_id']);
         $cacheicon = 'tpl/stdstyle/images/' . getSmallCacheIcon($record['icon_large']);
         $thisline = $cacheline;
         //      $thisline = mb_ereg_replace('{nn}', $i, $thisline);
         //      $thisline = mb_ereg_replace('{location}',join(" > ", array_slice($loc, 0, 2)), $thisline);
         $thisline = mb_ereg_replace('{date}', htmlspecialchars(date($dateFormat, strtotime($record['date'])), ENT_COMPAT, 'UTF-8'), $thisline);
         $thisline = mb_ereg_replace('{cacheid}', urlencode($record['cache_id']), $thisline);
         //      $thisline = mb_ereg_replace('{cache_count}',$i, $thisline);
         $thisline = mb_ereg_replace('{cachename}', htmlspecialchars($record['name'], ENT_COMPAT, 'UTF-8'), $thisline);
         $thisline = mb_ereg_replace('{userid}', urlencode($record['user_id']), $thisline);
         $thisline = mb_ereg_replace('{username}', htmlspecialchars($record['username'], ENT_COMPAT, 'UTF-8'), $thisline);
         $thisline = mb_ereg_replace('{cacheicon}', $cacheicon, $thisline);
         $thisline = mb_ereg_replace('{toprate}', $record['toprate'], $thisline);
         //      $thisline = mb_ereg_replace('{smallmapurl}', create_map_url($markerpositions, $i,$latitude,$longitude), $thisline);
         $file_content .= $thisline . "\n";
     }
 }
Beispiel #2
0
<?php

/***************************************************************************
 *  You can find the license in the docs directory
 *
 *  Unicode Reminder メモ
 ***************************************************************************/
require './lib2/web.inc.php';
$tpl->name = 'newcaches_withoutown';
$tpl->menuitem = MNU_START_NEWCACHES_WITHOUTOWN;
$tpl->caching = true;
$tpl->cache_lifetime = 3600;
if (!$tpl->is_cached()) {
    require $opt['rootpath'] . 'lib2/logic/cacheIcon.inc.php';
    $newCaches = array();
    sql_temp_table_slave('cachelist');
    sql_slave("CREATE TEMPORARY TABLE &cachelist (`cache_id` INT(11) PRIMARY KEY) SELECT `cache_id` FROM `caches` INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` WHERE `cache_status`.`allow_user_view`=1 AND `country`!='DE' ORDER BY `date_created` DESC LIMIT 200");
    $rsNewCaches = sql_slave("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`) `country_name`, `caches`.`cache_id` `cacheid`, `caches`.`wp_oc` `wpoc`, `user`.`user_id` `userid`, `caches`.`country` `country`, `caches`.`name` `cachename`, `user`.`username` `username`, `caches`.`date_created` `date_created`, `cache_type`.`icon_large` `icon_large` \r\n\t\t                            FROM `caches`\r\n\t\t                      INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\r\n\t\t                      INNER JOIN `cache_type` ON `caches`.`type`=`cache_type`.`id`\r\n\t\t                      INNER JOIN &cachelist ON &cachelist.`cache_id`=`caches`.`cache_id`\r\n\t\t                      INNER JOIN `countries` ON `countries`.`short`=`caches`.`country`\r\n\t\t                       LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id`\r\n\t\t                       LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1'\r\n\t\t                        ORDER BY `country_name`, `caches`.`date_created` DESC LIMIT 200", $opt['template']['locale']);
    while ($rNewCache = sql_fetch_assoc($rsNewCaches)) {
        $rNewCache['icon_large'] = getSmallCacheIcon($rNewCache['icon_large']);
        $newCaches[] = $rNewCache;
    }
    sql_free_result($rsNewCaches);
    sql_drop_temp_table_slave('cachelist');
    $tpl->assign('newCaches', $newCaches);
}
$tpl->display();
                }
                if ($r_log['geokret_in'] != '0') {
                    $thisline = mb_ereg_replace('{gkimage}', '&nbsp;<img src="images/gk.png" border="0" alt="" title="GeoKret" />', $thisline);
                } else {
                    $thisline = mb_ereg_replace('{gkimage}', '&nbsp;', $thisline);
                }
                mysql_free_result($rs_log);
                // PowerTrail vel GeoPath icon
                if (isset($cache_record['PT_ID'])) {
                    $PT_icon = icon_geopath_small($cache_record['PT_ID'], $cache_record['PT_image'], $cache_record['PT_name'], $cache_record['PT_type'], $pt_cache_intro_tr, $pt_icon_title_tr);
                    $thisline = mb_ereg_replace('{GPicon}', $PT_icon, $thisline);
                } else {
                    $thisline = mb_ereg_replace('{GPicon}', '<img src="images/rating-star-empty.png" class="icon16" alt="" title="" />', $thisline);
                }
                $thisline = mb_ereg_replace('{cacheid}', $cache_record['cache_id'], $thisline);
                $thisline = mb_ereg_replace('{userid}', $cache_record['userid'], $thisline);
                $thisline = mb_ereg_replace('{cachename}', htmlspecialchars($cache_record['name'], ENT_COMPAT, 'UTF-8'), $thisline);
                $thisline = mb_ereg_replace('{username}', htmlspecialchars($cache_record['username'], ENT_COMPAT, 'UTF-8'), $thisline);
                $thisline = mb_ereg_replace('{date}', date($dateFormat, strtotime($cache_record['date'])), $thisline);
                $thisline = mb_ereg_replace('{imglink}', 'tpl/stdstyle/images/' . getSmallCacheIcon($cache_record['icon_large']), $thisline);
                //          $thisline = mb_ereg_replace('{{hidden_by}}', htmlspecialchars(tr('created_by'), ENT_COMPAT, 'UTF-8'), $thisline);
                $content .= $thisline . "\n";
            }
            $content .= '<tr><td colspan="5">&nbsp;</td></tr>';
        }
    }
    mysql_free_result($rs);
    tpl_set_var('newcachesrest', $content);
}
//make the template and send it out
tpl_BuildTemplate();
Beispiel #4
0
         AND `caches`.`status` = 1  AND `caches`.`type`=6
     ORDER BY `caches`.`date_hidden` ASC,cache_location.adm3 COLLATE utf8_polish_ci ASC
     LIMIT ' . ($startat + 0) . ', ' . ($perpage + 0));
 while ($record = XDb::xFetchArray($rs)) {
     //group by country
     $newcaches[$record['state']][] = array('name' => $record['cachename'], 'wp_name' => $record['wp_name'], 'userid' => $record['userid'], 'username' => $record['username'], 'cache_id' => $record['cacheid'], 'state' => $record['state'], 'date' => $record['date_hidden'], 'icon_large' => $record['icon_large']);
 }
 if (isset($newcaches)) {
     foreach ($newcaches as $statename => $state_record) {
         $cache_location = '<tr><td colspan="8" class="content-title-noshade-size1">' . htmlspecialchars($statename, ENT_COMPAT, 'UTF-8') . '</td></tr>';
         $content .= $cache_location;
         foreach ($state_record as $cache_record) {
             $file_content = '';
             $file_content .= '<tr>';
             $file_content .= '<td style="width: 90px;">' . date('d-m-Y', strtotime($cache_record['date'])) . '</td>';
             $file_content .= '<td width="22">&nbsp;<img src="tpl/stdstyle/images/' . getSmallCacheIcon($cache_record['icon_large']) . '" border="0" alt=""/></td>';
             $file_content .= '<td><b><a class="links" href="viewcache.php?cacheid=' . htmlspecialchars($cache_record['cache_id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($cache_record['name'], ENT_COMPAT, 'UTF-8') . '</a></b></td>';
             $file_content .= '<td width="32"><b><a class="links" href="viewprofile.php?userid=' . htmlspecialchars($cache_record['userid'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($cache_record['username'], ENT_COMPAT, 'UTF-8') . '</a></b></td>';
             $rs_log = XDb::xSql("SELECT cache_logs.id, cache_logs.cache_id AS cache_id,\n                            cache_logs.text AS log_text, cache_logs.type AS log_type,\n                            cache_logs.date AS log_date, user.username AS user_name,\n                            cache_logs.user_id AS luser_id, user.user_id AS user_id,\n                            log_types.icon_small AS icon_small\n                    FROM (cache_logs INNER JOIN caches ON (caches.cache_id = cache_logs.cache_id))\n                        INNER JOIN user ON (cache_logs.user_id = user.user_id)\n                        INNER JOIN log_types ON (cache_logs.type = log_types.id)\n                    WHERE cache_logs.deleted=0 AND cache_logs.cache_id= ?\n                    GROUP BY cache_logs.id ORDER BY cache_logs.date_created DESC LIMIT 1", $cache_record['cache_id']);
             if ($r_log = XDb::xFetchArray($rs_log)) {
                 $file_content .= '<td style="width: 80px;">' . htmlspecialchars(date("d-m-Y", strtotime($r_log['log_date'])), ENT_COMPAT, 'UTF-8') . '</td>';
                 $file_content .= '<td width="22"><b><a class="links" href="viewlogs.php?logid=' . htmlspecialchars($r_log['id'], ENT_COMPAT, 'UTF-8') . '" onmouseover="Tip(\'';
                 $file_content .= '<b>' . $r_log['user_name'] . '</b>:&nbsp;';
                 $data = cleanup_text(str_replace("\r\n", " ", $r_log['log_text']));
                 $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>&nbsp;&nbsp;<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;">&nbsp;</td><td width="22">&nbsp;</td><td>&nbsp;</td>';
             }