コード例 #1
0
<?php

//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
function onTheList($theArray, $item)
{
    for ($i = 0; $i < count($theArray); $i++) {
        if ($theArray[$i] == $item) {
            return $i;
        }
    }
    return -1;
}
//Preprocessing
if ($error == false) {
    $target = isset($_REQUEST['target']) ? $_REQUEST['target'] : 'mylist.php';
    $cache_id = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : '';
    if ($usr['userid']) {
        if ($cache_id == 'all') {
            unset($_SESSION['print_list']);
            $_SESSION['print_list'] = array();
        } else {
            while (onTheList($_SESSION['print_list'], $cache_id) != -1) {
                unset($_SESSION['print_list'][onTheList($_SESSION['print_list'], $cache_id)]);
            }
            $_SESSION['print_list'] = array_values($_SESSION['print_list']);
        }
    }
    tpl_redirect($target);
}
tpl_BuildTemplate();
コード例 #2
0
         tpl_set_var('zoom', 11);
     }
 }
 if (isset($_REQUEST['print_list']) && $_REQUEST['print_list'] == 'y') {
     // add cache to print (do not duplicate items)
     if (count($_SESSION['print_list']) == 0) {
         $_SESSION['print_list'] = array();
     }
     if (onTheList($_SESSION['print_list'], $_REQUEST['cacheid']) == -1) {
         array_push($_SESSION['print_list'], $_REQUEST['cacheid']);
     }
 }
 if (isset($_REQUEST['print_list']) && $_REQUEST['print_list'] == 'n') {
     // remove cache from print list
     while (onTheList($_SESSION['print_list'], $_REQUEST['cacheid']) != -1) {
         unset($_SESSION['print_list'][onTheList($_SESSION['print_list'], $_REQUEST['cacheid'])]);
     }
     $_SESSION['print_list'] = array_values($_SESSION['print_list']);
 }
 tpl_set_var('coords', $coordsXY);
 tpl_set_var('username', $record[username]);
 $filter = getDBFilter($usr['userid']);
 if (isset($_POST['submit'])) {
     $makeFilterResult = makeDBFilter();
     setDBFilter($usr['userid'], $makeFilterResult);
     $filter = $makeFilterResult;
 }
 /* SET YOUR MAP CODE HERE */
 tpl_set_var('cachemap_header', '<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=' . $googlemap_key . '" type="text/javascript"></script>
 <script language="JavaScript1.2" type="text/javascript">
 <!--
コード例 #3
0
ファイル: marker.php プロジェクト: kojoty/opencaching-pl
        // 15 - RESERVED - DO NOT USE !!!
        if ($i == 16 && $filter[$i] == 0) {
            // T
            $only_active .= " AND caches.status = 1";
        }
        if ($i == 17 && $filter[$i] == 0) {
            // Y
            $only_active .= " AND caches.status = 2";
        }
    }
}
$result = XDb::xSql("SELECT caches.cache_id, caches.name, user.username, caches.wp_oc as wp, caches.votes, caches.score,\n            caches.topratings, caches.latitude, caches.longitude, caches.type, caches.status as status,\n            datediff(now(), caches.date_hidden) as old, caches.user_id,\n            IF(cache_id IN\n                (\n                    SELECT cache_id\n                    FROM cache_logs\n                    WHERE deleted=0 AND user_id= ?\n                        AND (type=1 OR type=8)\n                ), 1, 0\n            ) as found\n    FROM user, caches\n    WHERE (caches.user_id = user.user_id)\n        AND caches.latitude > ? AND caches.latitude < ?\n        AND caches.longitude > ? AND caches.longitude < ?\n        " . XDb::xEscape($only_active) . " " . $filter_by_type_string . "\n    ORDER BY " . XDb::xEscape($ORDERBY) . "\n    LIMIT " . XDb::xEscape($page) . ", " . XDb::xEscape($PER_PAGE), $user_id, $latSW, $latNE, $lonSW, $lonNE);
echo "<?xml version=\"1.0\" encoding=\"" . $ENCODING . "\"?>\n";
echo "<markers>\n";
while ($res = XDb::xFetchArray($result)) {
    if (!isset($_REQUEST['print_list']) || onTheList($_SESSION['print_list'], $res['cache_id']) == -1) {
        $druk = "druk=\"y\"";
    } else {
        $druk = "druk=\"n\"";
    }
    $founds = XDb::xMultiVariableQueryValue("SELECT count(*) FROM cache_logs\n        WHERE deleted=0 AND cache_id = :1\n            AND (type=1 OR type=8)", 0, $res['cache_id']);
    $notfounds = XDb::xMultiVariableQueryValue("SELECT count(*) FROM cache_logs\n        WHERE deleted=0 AND cache_id = :1 AND type=2", 0, $res['cache_id']);
    if ($res['votes'] > 2) {
        $score = $res['score'];
    } else {
        $score = "";
    }
    echo "<marker id=\"" . htmlspecialchars($res['cache_id']) . "\" name=\"" . htmlspecialchars($res['name']) . "\" lat=\"" . htmlspecialchars($res['latitude']) . "\" lng=\"" . htmlspecialchars($res['longitude']) . "\" owner=\"" . htmlspecialchars($res['username']) . "\" owner_id=\"" . htmlspecialchars($res['user_id']) . "\" type=\"" . htmlspecialchars(typeLetter($res['type'])) . "\" found=\"" . $res['found'] . "\" old=\"" . htmlspecialchars($res['old']) . "\" score=\"" . htmlspecialchars($score) . "\" topratings=\"" . htmlspecialchars($res['topratings']) . "\"  notfounds=\"" . htmlspecialchars($notfounds) . "\" votes=\"" . htmlspecialchars($res['votes']) . "\" founds=\"" . htmlspecialchars($founds) . "\" status=\"" . htmlspecialchars($res['status']) . "\" wp=\"" . htmlspecialchars($res['wp']) . "\" " . $druk . "/>\n";
}
$res2['num'] = XDb::xMultiVariableQueryValue("SELECT count(cache_id) as num FROM caches\n    WHERE caches.status = 1\n        AND caches.latitude  > :1\n        AND caches.latitude  < :2\n        AND caches.longitude > :3\n        AND caches.longitude < :4 ", 0, $latSW, $latNE, $lonSW, $lonNE);
$pages = '';
コード例 #4
0
ファイル: marker.php プロジェクト: pawelzielak/opencaching-pl
        // 15 - RESERVED - DO NOT USE !!!
        if ($i == 16 && $filter[$i] == 0) {
            // T
            $only_active_foreign = " AND foreign_caches.status = 1";
        }
        if ($i == 17 && $filter[$i] == 0) {
            // Y
            $only_active_foreign = " AND foreign_caches.status = 2";
        }
    }
}
//$only_active_foreign = " AND foreign_caches.status = 1";
$sql = "SELECT foreign_caches.cache_id, foreign_caches.name, foreign_caches.username, foreign_caches.wp_oc as wp, /*foreign_caches.votes, foreign_caches.score,*/ foreign_caches.topratings, foreign_caches.latitude, foreign_caches.longitude, foreign_caches.type, foreign_caches.status as status, datediff(now(), foreign_caches.date_hidden) as old, foreign_caches.user_id, IF(cache_id IN (SELECT cache_id FROM cache_logs WHERE deleted=0 AND user_id='" . sql_escape($user_id) . "' AND (type=1 OR type=8)), 1, 0) as found FROM foreign_caches WHERE ((foreign_caches.latitude>'" . sql_escape($latSW) . "' AND foreign_caches.latitude<'" . sql_escape($latNE) . "') AND (foreign_caches.longitude>'" . sql_escape($lonSW) . "' AND foreign_caches.longitude<'" . sql_escape($lonNE) . "')) " . $only_active_foreign . " " . $filter_by_type_string_foreign . " ORDER BY " . sql_escape($ORDERBY) . " LIMIT " . sql_escape($page) . ", " . sql_escape($PER_PAGE);
$result = mysql_query($sql);
while ($res = mysql_fetch_array($result)) {
    if (onTheList($_SESSION['print_list'], $res['cache_id']) == -1) {
        $druk = "druk=\"y\"";
    } else {
        $druk = "druk=\"n\"";
    }
    $founds_query = mysql_query("SELECT count(*) FROM cache_logs WHERE deleted=0 AND cache_id = " . sql_escape($res['cache_id']) . " AND (type=1 OR type=8)");
    $founds = mysql_result($founds_query, 0);
    $notfounds_query = mysql_query("SELECT count(*) FROM cache_logs WHERE deleted=0 AND cache_id = " . sql_escape($res['cache_id']) . " AND type=2");
    $notfounds = mysql_result($notfounds_query, 0);
    if ($res['votes'] > 2) {
        $score = $res['score'];
    } else {
        $score = "";
    }
    echo "<marker id=\"" . htmlspecialchars($res['cache_id']) . "\" name=\"" . htmlspecialchars($res['name']) . "\" lat=\"" . htmlspecialchars($res['latitude']) . "\" lng=\"" . htmlspecialchars($res['longitude']) . "\" owner=\"" . htmlspecialchars($res['username']) . "\" owner_id=\"" . htmlspecialchars($res['user_id']) . "\" type=\"" . htmlspecialchars(typeLetter($res['type'])) . "\" found=\"" . $res['found'] . "\" old=\"" . htmlspecialchars($res['old']) . "\" score=\"" . htmlspecialchars($score) . "\" topratings=\"" . htmlspecialchars($res['topratings']) . "\"  notfounds=\"" . htmlspecialchars($notfounds) . "\" votes=\"" . htmlspecialchars($res['votes']) . "\" founds=\"" . htmlspecialchars($founds) . "\" status=\"" . htmlspecialchars($res['status']) . "\" wp=\"" . htmlspecialchars($res['wp']) . "\" " . $druk . "/>\n";
}
コード例 #5
0
                        cache_score = "0";
                }
                else
                        show_score = "";
                        if (cache_topratings == 0)
                        print_topratings = "";
                        else
                {
                print_topratings = "<br /><b>{{recommendations}}: </b>";
                        var gwiazdka = "<img width=\"10\" height=\"10\" src=\"images/rating-star.png\" alt=\"{{recommendation}\" />";
                        var ii;
                        for (ii = 0; ii < cache_topratings; ii++)
                        print_topratings += gwiazdka;
                }
    <?php 
    !isset($_REQUEST['print_list']) || onTheList($_SESSION['print_list'], $cache_id) == -1 ? $yn = 'y' : ($yn = 'n');
    ?>

                if (markers[i].getAttribute("id") == cache_id)
                {
                var infoWindowContent = "";
                        infoWindowContent += "<table border=\"0\" width=\"350\" height=\"120\">";
                        infoWindowContent += "<tr><td colspan=\"2\" width=\"100%\"><table cellspacing=\"0\" width=\"100%\"><tr><td width=\"90%\">";
                        infoWindowContent += "<a href=\"viewcache.php?cacheid=" + cache_id + "\" target=\"_blank\">" + cache_name + "</a>";
                        infoWindowContent += "</td><td width=\"10%\">";
                        infoWindowContent += "<b>" + cache_wp + "</b></td></tr></table>";
                        infoWindowContent += "</td></tr>";
                        infoWindowContent += "<tr><td width=\"70%\" valign=\"top\">";
                        infoWindowContent += "<b>{{created_by}}:</b> " + cache_owner + show_score + print_topratings;
                        infoWindowContent += "</td>";
                        infoWindowContent += "<td valign=\"top\" width=\"30%\"><table cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"100%\">";
コード例 #6
0
     $ignore_label = tr('ignore_not');
     $ignore_icon = 'images/actions/ignore';
 }
 mysql_free_result($rs);
 if ($usr !== false) {
     //user logged in => he can log
     $log_action = mb_ereg_replace('{cacheid}', urlencode($cache_id), $function_log);
     $printt = tr('print');
     $addToPrintList = tr('add_to_list');
     $removeFromPrintList = tr('remove_from_list');
     if (isset($_SESSION['print_list'])) {
         $sesPrintList = $_SESSION['print_list'];
     } else {
         $sesPrintList = array();
     }
     if (onTheList($sesPrintList, $cache_id) == -1) {
         $print_list = "viewcache.php?cacheid={$cache_id}&amp;print_list=y";
         $print_list_label = $addToPrintList;
         $print_list_icon = 'images/actions/list-add';
     } else {
         $print_list = "viewcache.php?cacheid={$cache_id}&amp;print_list=n";
         $print_list_label = $removeFromPrintList;
         $print_list_icon = 'images/actions/list-remove';
     }
     $cache_menu = array('title' => tr('cache_menu'), 'menustring' => tr('cache_menu'), 'siteid' => 'cachelisting', 'navicolor' => '#E8DDE4', 'visible' => false, 'filename' => 'viewcache.php', 'submenu' => array(array('title' => tr('new_log_entry'), 'menustring' => tr('new_log_entry'), 'visible' => true, 'filename' => 'log.php?cacheid=' . $cache_id, 'newwindow' => false, 'siteid' => 'new_log', 'icon' => 'images/actions/new-entry'), array('title' => $watch_label, 'menustring' => $watch_label, 'visible' => true, 'filename' => $is_watched, 'newwindow' => false, 'siteid' => 'observe_cache', 'icon' => 'images/actions/watch'), array('title' => tr('report_problem'), 'menustring' => tr('report_problem'), 'visible' => true, 'filename' => 'reportcache.php?cacheid=' . $cache_id, 'newwindow' => false, 'siteid' => 'report_cache', 'icon' => 'images/actions/report-problem'), array('title' => tr('print'), 'menustring' => tr('print'), 'visible' => true, 'filename' => 'printcache.php?cacheid=' . $cache_id, 'newwindow' => false, 'siteid' => 'print_cache', 'icon' => 'images/actions/print'), array('title' => $print_list_label, 'menustring' => $print_list_label, 'visible' => true, 'filename' => $print_list, 'newwindow' => false, 'siteid' => 'print_list_cache', 'icon' => $print_list_icon), array('title' => $ignore_label, 'menustring' => $ignore_label, 'visible' => true, 'filename' => $is_ignored, 'newwindow' => false, 'siteid' => 'ignored_cache', 'icon' => $ignore_icon), array('title' => tr('edit'), 'menustring' => tr('edit'), 'visible' => $show_edit, 'filename' => 'editcache.php?cacheid=' . $cache_id, 'newwindow' => false, 'siteid' => 'edit_cache', 'icon' => 'images/actions/edit')));
     $report_action = "<li><a href=\"reportcache.php?cacheid={$cache_id}\">" . tr('report_problem') . "</a></li>";
 } else {
     $cache_menu = array('title' => tr('cache_menu'), 'menustring' => tr('cache_menu'), 'siteid' => 'cachelisting', 'navicolor' => '#E8DDE4', 'visible' => false, 'filename' => 'viewcache.php', 'submenu' => array());
 }
 tpl_set_var('log', $log_action);
 tpl_set_var('watch', $watch_action);
コード例 #7
0
                        cache_score = "0";
                }
                else
                        show_score = "";
                        if (cache_topratings == 0)
                        print_topratings = "";
                        else
                {
                print_topratings = "<br /><b>{{recommendations}}: </b>";
                        var gwiazdka = "<img width=\"10\" height=\"10\" src=\"images/rating-star.png\" alt=\"{{recommendation}\" />";
                        var ii;
                        for (ii = 0; ii < cache_topratings; ii++)
                        print_topratings += gwiazdka;
                }
    <?php 
    onTheList($_SESSION['print_list'], $_REQUEST['cacheid']) == -1 ? $yn = 'y' : ($yn = 'n');
    ?>

                if (markers[i].getAttribute("id") == cache_id)
                {
                var infoWindowContent = "";
                        infoWindowContent += "<table border=\"0\" width=\"350\" height=\"120\">";
                        infoWindowContent += "<tr><td colspan=\"2\" width=\"100%\"><table cellspacing=\"0\" width=\"100%\"><tr><td width=\"90%\">";
                        infoWindowContent += "<a href=\"viewcache.php?cacheid=" + cache_id + "\" target=\"_blank\">" + cache_name + "</a>";
                        infoWindowContent += "</td><td width=\"10%\">";
                        infoWindowContent += "<b>" + cache_wp + "</b></td></tr></table>";
                        infoWindowContent += "</td></tr>";
                        infoWindowContent += "<tr><td width=\"70%\" valign=\"top\">";
                        infoWindowContent += "<b>{{created_by}}:</b> " + cache_owner + show_score + print_topratings;
                        infoWindowContent += "</td>";
                        infoWindowContent += "<td valign=\"top\" width=\"30%\"><table cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"100%\">";