コード例 #1
0
ファイル: log.php プロジェクト: kojoty/opencaching-pl
function isGeokretInCache($cacheid)
{
    $res = XDb::xSql("SELECT wp_oc, wp_gc, wp_nc, wp_ge, wp_tc\n        FROM caches WHERE cache_id = ? LIMIT 1", $cacheid);
    $cache_record = XDb::xFetchArray($res);
    // get cache waypoint
    $cache_wp = '';
    if ($cache_record['wp_oc'] != '') {
        $cache_wp = $cache_record['wp_oc'];
    } else {
        if ($cache_record['wp_gc'] != '') {
            $cache_wp = $cache_record['wp_gc'];
        } else {
            if ($cache_record['wp_nc'] != '') {
                $cache_wp = $cache_record['wp_nc'];
            } else {
                if ($cache_record['wp_ge'] != '') {
                    $cache_wp = $cache_record['wp_ge'];
                } else {
                    if ($cache_record['wp_tc'] != '') {
                        $cache_wp = $cache_record['wp_tc'];
                    }
                }
            }
        }
    }
    $gkNum = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM gk_item\n        WHERE id IN (\n            SELECT id FROM gk_item_waypoint\n            WHERE wp = :1\n            )\n            AND stateid<>1 AND stateid<>4\n            AND stateid <>5 AND typeid<>2", 0, $cache_wp);
    if ($gkNum == 0) {
        return 0;
    } else {
        return 1;
    }
}
コード例 #2
0
ファイル: caches.inc.php プロジェクト: kojoty/opencaching-pl
function get_cache_size_from_database()
{
    $cache_size = array();
    $resp = XDb::xSql("SELECT * FROM cache_size ORDER BY id ASC");
    while ($row = XDb::xFetchArray($resp)) {
        $cache_size[] = $row;
    }
    return $cache_size;
}
コード例 #3
0
function online_user()
{
    // add check users id who want to by username hidden
    $rs = XDb::xSql("SELECT `user_id` FROM `sys_sessions`\n        WHERE user_id!=1 AND `sys_sessions`.last_login >(NOW()-INTERVAL 10 MINUTE)\n        GROUP BY `user_id`");
    $online_users = array();
    while ($r = XDb::xFetchArray($rs)) {
        $online_users[] = $r['user_id'];
    }
    return $online_users;
}
コード例 #4
0
ファイル: logs.php プロジェクト: kojoty/opencaching-pl
function find_news($start, $end)
{
    global $tpl;
    global $lang;
    global $znalezione;
    $wp = XDb::xEscape($_GET['wp']);
    $query = "select id,type,user_id,date,text,deleted from cache_logs where cache_id = (select cache_id from caches where wp_oc = '" . $wp . "') order by date desc limit " . $start . "," . $end;
    $wynik = XDb::xSql($query);
    $query = "select name,cache_id from caches where cache_id = (select cache_id from caches where wp_oc = '" . $wp . "');";
    $wynik2 = XDb::xSql($query);
    $caches = XDb::xFetchArray($wynik2);
    $tpl->assign("name", $caches['name']);
    // detailed cache access logging
    global $enable_cache_access_logs;
    if (@$enable_cache_access_logs) {
        $dbc = OcDb::instance();
        $cache_id = $caches['cache_id'];
        $user_id = @$_SESSION['user_id'] > 0 ? $_SESSION['user_id'] : null;
        $access_log = @$_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id];
        if ($access_log === null) {
            $_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id] = array();
            $access_log = $_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id];
        }
        if (@$access_log[$cache_id] !== true) {
            $dbc->multiVariableQuery('INSERT INTO CACHE_ACCESS_LOGS
                        (event_date, cache_id, user_id, source, event, ip_addr, user_agent, forwarded_for)
                     VALUES
                        (NOW(), :1, :2, \'M\', \'view_logs\', :3, :4, :5)', $cache_id, $user_id, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_X_FORWARDED_FOR']);
            $access_log[$cache_id] = true;
            $_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id] = $access_log;
        }
    }
    $znalezione = array();
    while ($logs = XDb::xFetchArray($wynik)) {
        if ($logs['deleted'] == 0) {
            $query = "select username from user where user_id = '" . $logs['user_id'] . "';";
            $wynik3 = XDb::xSql($query);
            $user = XDb::xFetchArray($wynik3);
            $logs2['id'] = $logs['id'];
            $logs2['user_id'] = $logs['user_id'];
            $logs2['newtype'] = $logs['type'];
            $logs2['newdate'] = date('j.m.Y', strtotime($logs['date']));
            $logs2['username'] = $user[0];
            $logs2['newtext'] = html2log($logs['text']);
            $znalezione[] = $logs2;
        }
    }
    $tpl->assign("wp_oc", $wp);
    $tpl->assign("logs", $znalezione);
}
コード例 #5
0
ファイル: cachemap2.php プロジェクト: kojoty/opencaching-pl
function getDBFilter($userid)
{
    $filter = "11111111110111110134100000000000";
    // default filter
    $query = XDb::xSql("SELECT * from map_settings_v2 WHERE `user_id`= ? ", $userid);
    while ($row = XDb::xFetchArray($query)) {
        $filter = '';
        foreach ($row as $k => $v) {
            if ($k != 'user_id') {
                $filter .= $v;
            }
        }
    }
    return $filter;
}
コード例 #6
0
ファイル: news.php プロジェクト: kojoty/opencaching-pl
function find_news($start, $end)
{
    global $tpl;
    $query = "SELECT id,date_posted,content FROM `news` order by id desc limit " . $start . "," . $end;
    $wynik = XDb::xSql($query);
    $ile = XDb::xNumRows($wynik);
    $znalezione = array();
    while ($odp2 = XDb::xFetchArray($wynik)) {
        $odp['date_posted'] = $odp2['date_posted'];
        //$odp['content']=strip_tags($odp2['content'],'<b></b><p></p><a></a><br><br/>');
        $odp['content'] = html2desc($odp2['content']);
        $znalezione[] = $odp;
    }
    $tpl->assign('news', $znalezione);
    return $ile;
}
コード例 #7
0
ファイル: mywatches.php プロジェクト: kojoty/opencaching-pl
 function find_news($start, $end)
 {
     global $lang;
     global $ile;
     global $url;
     global $znalezione;
     $query = "select cache_id from cache_watches where user_id=" . $_SESSION['user_id'] . " limit " . $start . "," . $end;
     $wynik = XDb::xSql($query);
     $ile2 = XDb::xNumRows($wynik);
     if ($ile2 > 0) {
         $znalezione = array();
         while ($rek = XDb::xFetchArray($wynik)) {
             $query = "select status,cache_id,name, score, latitude, longitude, wp_oc, user_id, type from caches where cache_id=" . $rek['cache_id'] . " order by name";
             $wynik2 = XDb::xSql($query);
             while ($rekord = XDb::xFetchArray($wynik2)) {
                 if (isset($_SESSION['user_id'])) {
                     $query2 = "select 1 from cache_logs where user_id = '" . $_SESSION['user_id'] . "' and type = '1' and deleted='0' and cache_id ='" . $rekord['cache_id'] . "';";
                     $wynik2 = XDb::xSql($query2);
                     $if_found = XDb::xFetchArray($wynik2);
                     if ($if_found[0] != '1') {
                         $query2 = "select 2 from cache_logs where user_id = '" . $_SESSION['user_id'] . "' and type = '2' and deleted='0' and cache_id ='" . $rekord['cache_id'] . "';";
                         $wynik2 = XDb::xSql($query2);
                         $if_found = XDb::xFetchArray($wynik2);
                     }
                     $if_found = $if_found[0];
                 }
                 $query = "select username from user where user_id = " . $rekord['user_id'] . ";";
                 $wynik2 = XDb::xSql($query);
                 $wiersz = XDb::xFetchArray($wynik2);
                 $query = "select " . $lang . " from cache_type where id = " . $rekord['type'] . ";";
                 $wynik2 = XDb::xSql($query);
                 $wiersz2 = XDb::xFetchArray($wynik2);
                 $rekord['if_found'] = $if_found;
                 $rekord['username'] = $wiersz['username'];
                 $rekord['N'] = cords($rekord['latitude']);
                 $rekord['E'] = cords($rekord['longitude']);
                 $rekord['typetext'] = $wiersz2[0];
                 $znalezione[] = $rekord;
             }
         }
     }
 }
コード例 #8
0
function genStatPieUrl()
{
    $startDate = mktime(0, 0, 0, 1, 1, 2006);
    global $lang;
    if (checkField('cache_type', $lang)) {
        $lang_db = XDb::xEscape($lang);
    } else {
        $lang_db = "en";
    }
    // Get data
    $rsTypes = XDb::xSql("SELECT COUNT(`caches`.`type`) `count`, `cache_type`.`{$lang_db}` AS `type`, `cache_type`.`color`\n        FROM `caches` INNER JOIN `cache_type` ON (`caches`.`type`=`cache_type`.`id`)\n        WHERE `status`=1\n        GROUP BY `caches`.`type`\n        ORDER BY `count` DESC");
    $yData = array();
    $xData = array();
    $colors = array();
    $url = "http://chart.apis.google.com/chart?chs=550x200&chd=t:";
    $sum = 0;
    while ($rTypes = XDb::xFetchArray($rsTypes)) {
        $yData[] = ' (' . $rTypes['count'] . ') ' . $rTypes['type'];
        $xData[] = $rTypes['count'];
        $colors[] = substr($rTypes['color'], 1);
        $sum += $rTypes['count'];
    }
    XDb::xFreeResults($rsTypes);
    foreach ($xData as $count) {
        $url .= normTo100($count, $sum) . ",";
    }
    $url = substr($url, 0, -1);
    $url .= "&cht=p3&chl=";
    foreach ($yData as $label) {
        $url .= urlencode($label) . "|";
    }
    $url = substr($url, 0, -1);
    $url .= "&chco=";
    foreach ($colors as $color) {
        $url .= urlencode($color) . ",";
    }
    return $url = substr($url, 0, -1);
}
コード例 #9
0
ファイル: login.class.php プロジェクト: kojoty/opencaching-pl
 function try_login($user, $password, $remember)
 {
     $this->pClear();
     $query = "select user_id,username from user where username = '******';";
     $wynik = XDb::xSql($query);
     $wiersz = XDb::xFetchArray($wynik);
     $user_id = $wiersz['user_id'];
     if ($user_id) {
         /* User exists. Is the password correct? */
         $pm = new PasswordManager($user_id);
         if (!$pm->verify($password)) {
             $user_id = null;
         }
     }
     if (!empty($user_id)) {
         $_SESSION['username'] = $wiersz['username'];
         $_SESSION['user_id'] = $user_id;
         $query = "SELECT now() as now, uuid() as uuid";
         $wynik = XDb::xSql($query);
         $rekord = XDb::xFetchArray($wynik);
         $dzis = $rekord['now'];
         $uuid = $rekord['uuid'];
         $query = "update user set last_login_mobile = '" . $dzis . "' where user_id='" . $user_id . "';";
         XDb::xSql($query);
         $this->userid = $user_id;
         $this->username = $user;
         $this->lastlogin = $dzis;
         $this->sessionid = $uuid;
         $this->verified = true;
         if ($remember == 1) {
             $this->pStoreCookie();
         }
         $query = "update user set uuid_mobile ='" . $uuid . "', last_login_mobile='" . $dzis . "' where user_id='" . $user_id . "';";
         XDb::xSql($query);
     }
     return;
 }
コード例 #10
0
/**
 * Reads user map settings from the DB
 * @param int $user_id - user identifier
 */
function getDBFilter($user_id)
{
    global $MIN_SCORE, $MAX_SCORE, $powerTrailModuleSwitchOn;
    // defined in settings.inc/php
    $filter = array("h_u" => 1, "h_t" => 1, "h_m" => 1, "h_v" => 1, "h_w" => 1, "h_e" => 1, "h_q" => 1, "h_o" => 1, "h_owncache" => 1, "h_ignored" => 0, "h_own" => 1, "h_found" => 1, "h_noattempt" => 1, "h_nogeokret" => 1, "h_avail" => 0, "h_temp_unavail" => 1, "map_type" => 1, "h_arch" => 0, "be_ftf" => 0, "powertrail_only" => 0, "min_score" => $MIN_SCORE, "max_score" => $MAX_SCORE, "h_noscore" => 1);
    // default filter
    $query = XDb::xSql("SELECT * FROM map_settings WHERE `user_id`= ? LIMIT 1", $user_id);
    while ($row = XDb::xFetchArray($query)) {
        $filter["h_u"] = $row['unknown'];
        $filter["h_t"] = $row['traditional'];
        $filter["h_m"] = $row['multicache'];
        $filter["h_v"] = $row['virtual'];
        $filter["h_w"] = $row['webcam'];
        $filter["h_e"] = $row['event'];
        $filter["h_q"] = $row['quiz'];
        $filter["h_o"] = $row['mobile'];
        $filter["h_owncache"] = $row['owncache'];
        $filter["h_ignored"] = $row['ignored'];
        $filter["h_own"] = $row['own'];
        $filter["h_found"] = $row['found'];
        $filter["h_noattempt"] = $row['notyetfound'];
        $filter["h_nogeokret"] = $row['geokret'];
        $filter["h_avail"] = $row['active'];
        $filter["h_temp_unavail"] = $row['notactive'];
        $filter["map_type"] = $row['maptype'];
        $filter["h_arch"] = $row['archived'];
        $filter["be_ftf"] = $row['be_ftf'];
        if ($powerTrailModuleSwitchOn) {
            $filter["powertrail_only"] = $row['powertrail_only'];
        }
        $filter["min_score"] = $row['min_score'];
        $filter["max_score"] = $row['max_score'];
        $filter["h_noscore"] = $row['noscore'];
    }
    return $filter;
}
コード例 #11
0
function event_notify_new_cache($cache_id)
{
    global $rootpath;
    //prepare the templates and include all neccessary
    require_once $rootpath . 'lib/search.inc.php';
    $rs = XDb::xSql('SELECT `caches`.`latitude`, `caches`.`longitude`
        FROM `caches`
        WHERE `caches`.`cache_id`= ? ', $cache_id);
    $r = XDb::xFetchArray($rs);
    $latFrom = $r['latitude'];
    $lonFrom = $r['longitude'];
    XDb::xFreeResults($rs);
    $distanceMultiplier = 1;
    // TODO: Seeking pre-select `user`. `latitude` like with max_lon / min_lon / max_lat / min_lat
    XDb::xSql('INSERT INTO `notify_waiting` (`id`, `cache_id`, `user_id`, `type`)
        SELECT NULL, ' . XDb::xEscape($cache_id) . ', `user`.`user_id`, ' . NOTIFY_NEW_CACHES . '
        FROM `user`
        WHERE NOT ISNULL(`user`.`latitude`)
          AND NOT ISNULL(`user`.`longitude`)
          AND `user`.`notify_radius` > 0
          AND (acos(cos((90- ? ) * 3.14159 / 180) * cos((90-`user`.`latitude`) * 3.14159 / 180) +
              sin((90-?) * 3.14159 / 180) * sin((90-`user`.`latitude`) * 3.14159 / 180) * cos(( ? -`user`.`longitude`) *
              3.14159 / 180)) * 6370 * ?) <= `user`.`notify_radius`', $latFrom, $latFrom, $lonFrom, $distanceMultiplier);
}
コード例 #12
0
ファイル: mailto.php プロジェクト: kojoty/opencaching-pl
 if (!$userid) {
     $message = $message_user_not_found;
 }
 $send_emailaddress = isset($_REQUEST['send_emailaddress']) ? $_REQUEST['send_emailaddress'] : 0;
 // get sender data
 $resp = XDb::xSql("SELECT `username`, `email` FROM `user` WHERE `user_id`= ? LIMIT 1", $usr['userid']);
 if ($row = XDb::xFetchArray($resp)) {
     $from_username = $row['username'];
     $from_email = $row['email'];
 } else {
     $message = $message_title_internal;
 }
 // get reciver data
 if (!$message) {
     $resp = XDb::xSql("SELECT `username`, `email` FROM `user` WHERE `user_id`= ? ", $userid);
     if ($row = XDb::xFetchArray($resp)) {
         $to_username = $row['username'];
         $to_email = $row['email'];
     } else {
         $message = $message_title_internal;
     }
 }
 // got messsage via url to display?
 $message = isset($_REQUEST['message']) ? $_REQUEST['message'] : '';
 $subject = "";
 $text = "";
 if (!$message) {
     if (isset($_POST['submit'])) {
         // store
         $subject = isset($_REQUEST['subject']) ? stripslashes($_REQUEST['subject']) : '';
         $text = isset($_REQUEST['text']) ? stripslashes($_REQUEST['text']) : '';
コード例 #13
0
 }
 if (isset($_POST['delete'])) {
     $route_id = $_POST['routeid'];
     $remove = 1;
 }
 if (isset($_POST['routeid'])) {
     $route_id = $_POST['routeid'];
 }
 $tplname = 'myroutes_edit';
 $user_id = $usr['userid'];
 if (isset($_POST['back'])) {
     tpl_redirect('myroutes.php');
     exit;
 }
 $route_rs = XDb::xSql("SELECT `user_id`,`name`, `description`, `radius`\n            FROM `routes`\n            WHERE `route_id`= ? AND `user_id`= ?", $route_id, $user_id);
 $record = XDb::xFetchArray($route_rs);
 tpl_set_var('routes_name', $record['name']);
 $rname = isset($_POST['name']) ? $_POST['name'] : '';
 $rdesc = isset($_POST['desc']) ? $_POST['desc'] : '';
 $rradius = isset($_POST['radius']) ? $_POST['radius'] : '';
 tpl_set_var('cachemap_header', '<script src="//maps.googleapis.com/maps/api/js?libraries=geometry&amp;sensor=false&amp;language=' . $lang . '" type="text/javascript"></script>');
 if ($record['user_id'] == $usr['userid']) {
     if ($remove == 1) {
         //remove
         XDb::xSql("DELETE FROM `routes` WHERE `route_id`= ? AND `user_id`= ? ", $route_id, $user_id);
         XDb::xSql("DELETE FROM `route_points` WHERE `route_id`= ? ", $route_id);
         tpl_redirect('myroutes.php');
         exit;
     }
 }
 // start submit
コード例 #14
0
ファイル: news.php プロジェクト: kojoty/opencaching-pl
<?php

use Utils\Database\XDb;
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
    //get the news
    $tplname = 'news';
    $newscontent = '';
    require $stylepath . '/news.inc.php';
    $rsNewsTopics = XDb::xSql('SELECT `name`, `id` FROM `news_topics` ORDER BY `id` ASC');
    while ($rNewsTopics = XDb::xFetchArray($rsNewsTopics)) {
        $rsNews = XDb::xSql("SELECT `date_posted`, `content` FROM `news`\n            WHERE `topic`= ? AND `display`=1\n            ORDER BY `date_posted` DESC LIMIT 0, 20", $rNewsTopics['id']);
        while ($rNews = XDb::xFetchArray($rsNews)) {
            $thisnewscontent = $tpl_newstopic_without_topic;
            $thisnewscontent = mb_ereg_replace('{date}', date('d-m-Y', strtotime($rNews['date_posted'])), $thisnewscontent);
            $thisnewscontent = mb_ereg_replace('{message}', $rNews['content'], $thisnewscontent);
            $newscontent .= $thisnewscontent . "\n";
        }
        XDb::xFreeResults($rsNews);
    }
    XDb::xFreeResults($rsNewsTopics);
    //$newscontent .= "</table>";
    tpl_set_var('list_of_news', $newscontent);
}
//make the template and send it out
tpl_BuildTemplate();
コード例 #15
0
ファイル: myroutes.php プロジェクト: kojoty/opencaching-pl
        $route_rs = XDb::xSql("SELECT `route_id` ,`description` `desc`, `name`,`radius`,`length`\n            FROM `routes`  WHERE `user_id`= ?\n            ORDER BY `route_id` DESC", $user_id);
        if ($routes_record = XDb::xFetchArray($route_rs)) {
            $routes .= '<div class="headitems">';
            $routes .= '<div style="width:80px;" class="myr">' . tr('route_name') . '</div><div class="ver">&nbsp;</div><div style="width:295px;" class="myr">&nbsp;' . tr('route_desc') . '</div><div class="ver">&nbsp;</div><div style="width:60px;" class="myr">&nbsp;' . tr('radius') . '</div><div class="ver">&nbsp;</div><div style="width:60px;" class="myr">&nbsp;' . tr('length') . '</div><div class="ver">&nbsp;</div><div style="width:70px;" class="myr">&nbsp;' . tr('caches') . '</div><div class="ver">&nbsp;</div><div style="width:50px;" class="myr">' . tr('edit') . '</div><div class="ver">&nbsp;</div><div style="width:20px;" class="myr">&nbsp;' . tr('delete') . '</div></div>';
            do {
                $desc = $routes_record['desc'];
                if ($desc != '') {
                    require_once $rootpath . 'lib/class.inputfilter.php';
                    $myFilter = new InputFilter($allowedtags, $allowedattr, 0, 0, 1);
                    $desc = $myFilter->process($desc);
                }
                $routes .= '<div class="listitems">';
                //                          $routes .= '<div style="margin-left:5px;width:75px;" class="myr">'.$routes_record['name']. '</div><div class="ver35">&nbsp;</div><div style="width:295px;" class="myr">'.nl2br($desc).'</div><div class="ver35">&nbsp;</div><div style="width:60px;text-align:center;" class="myr">'.$routes_record['radius']. ' km</div><div class="ver35">&nbsp;</div><div style="width:60px;text-align:center;" class="myr">'.round($routes_record['length'],0). ' km</div><div class="ver35">&nbsp;</div><div style="width:70px;float:left;text-align:center;"><a class="links" href="myroutes_search.php?routeid='.$routes_record['route_id'].'"><img src="tpl/stdstyle/images/action/16x16-search.png" alt="" title="Search caches along route" /></a></div><div class="ver35">&nbsp;</div><div style="width:50px;float:left;text-align:center;"><a class="links" href="myroutes_edit.php?routeid='.$routes_record['route_id'].'"><img src="images/actions/edit-16.png" alt="" title="Edit route" /></a></div><div class="ver35">&nbsp;</div><div style="width:20px;float:left;text-align:center;"><a class="links" href="myroutes_edit.php?routeid='.$routes_record['route_id'].'&delete" onclick="return confirm(\'Czy chcesz usunąć tę trase?\');"><img src="tpl/stdstyle/images/log/16x16-trash.png" alt="" title="Usuń" /></a></div></div>';
                $routes .= '<table border="0" class="myr"><tr><td style="margin-left:3px;width:75px;" class="myr">' . $routes_record['name'] . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
                            <td style="width:297px;" class="myr">' . nl2br($desc) . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
                            <td style="width:65px;" class="myr">' . $routes_record['radius'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
                            <td style="width:62px;" class="myr">' . $routes_record['length'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
                            <td style="width:73px;" class="myr"><a class="links" href="myroutes_search.php?routeid=' . $routes_record['route_id'] . '"><img src="tpl/stdstyle/images/action/16x16-search.png" alt="" title=' . tr("search_caches_along_route") . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
                            <td style="width:53px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '"><img src="images/actions/edit-16.png" alt="" title=' . tr('edit_route') . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
                            <td style="width:23px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '&delete" onclick="return confirm(\'' . tr("confirm_remove_route") . '\');"><img style="vertical-align: middle;" src="tpl/stdstyle/images/log/16x16-trash.png" alt="" title=' . tr('delete') . ' /></a></td></tr></table></div>';
            } while ($routes_record = XDb::xFetchArray($route_rs));
            $routes .= '';
            tpl_set_var('content', $routes);
        } else {
            tpl_set_var('content', "<div class=\"listitems\"><br/><center><span style=\"font-size:140%;font-weight:bold \">&nbsp;&nbsp;" . tr('no_routes') . "</span><br/><br/></center></div>");
        }
        XDb::xFreeResults($route_rs);
    }
}
//make the template and send it out
tpl_BuildTemplate();
コード例 #16
0
ファイル: t7.php プロジェクト: kojoty/opencaching-pl
        ) 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">
            &nbsp;&nbsp;<b>' . tr('Stats_t7_06') . '</b>&nbsp;&nbsp;
        </td>
    </tr><tr><td height="2"></td></tr>';
    while ($line = XDb::xFetchArray($rsfCR)) {
        echo '<tr class="bgcolor2">
                <td align="right">
                    &nbsp;&nbsp;<b>' . $line["count"] . '</b>&nbsp;&nbsp;
                </td>
                <td align="right">
                    &nbsp;&nbsp;<b><a class=links href=articles.php?page=s10&region=' . $line['code_region'] . '>' . $line['region'] . '</a></b>&nbsp;&nbsp;
                </td>';
    }
    echo '</table>' . "\n";
    XDb::xFreeResults($rsfCR);
    $result = ob_get_clean();
    apc_store($cache_key, $result, 86400);
}
print $result;
コード例 #17
0
ファイル: COGstat.php プロジェクト: kojoty/opencaching-pl
 $rscaches = XDb::xSql("SELECT count(*) count, username FROM approval_status, user\n        WHERE user.user_id=approval_status.user_id AND date_approval > ?\n        GROUP BY approval_status.user_id\n        ORDER BY username", $start_time);
 $rscachesM = XDb::xSql("SELECT count(*) count, MONTH(`date_approval`) `month` FROM approval_status\n        WHERE date_approval > ?\n        GROUP BY MONTH(`date_approval`) , YEAR(`date_approval`)\n        ORDER BY YEAR(`date_approval`) ASC, MONTH(`date_approval`) ASC", $start_time);
 $xtitle = "";
 while ($ry = XDb::xFetchArray($rsreports)) {
     $y[] = $ry['count'];
     $x[] = $ry['username'];
 }
 while ($ry2 = XDb::xFetchArray($rscaches)) {
     $y2[] = $ry2['count'];
     $x2[] = $ry2['username'];
 }
 while ($ry3 = XDb::xFetchArray($rsreportsM)) {
     $y3[] = $ry3['count'];
     $x3[] = $ry3['month'];
 }
 while ($ry4 = XDb::xFetchArray($rscachesM)) {
     $y4[] = $ry4['count'];
     $x4[] = $ry4['month'];
 }
 XDb::xFreeResults($rsreportsM);
 XDb::xFreeResults($rsreports);
 XDb::xFreeResults($rscaches);
 XDb::xFreeResults($rscachesM);
 // Create the graph. These two calls are always required
 $graph = new Graph(740, 200, 'auto');
 $graph->SetScale('textint', 0, max($y) + max($y) * 0.2, 0, 0);
 // Add a drop shadow
 $graph->SetShadow();
 // Adjust the margin a bit to make more room for titles
 $graph->SetMargin(50, 30, 30, 40);
 // Create a bar pot
コード例 #18
0
ファイル: near.php プロジェクト: kojoty/opencaching-pl
            }
            $rekord['user_id'] = $wiersz['user_id'];
            $rekord['name'] = $wiersz['name'];
            $rekord['status'] = $wiersz['status'];
            $rekord['score'] = score2ratingnum($wiersz['score']);
            $rekord['latitude'] = $wiersz['latitude'];
            $rekord['longitude'] = $wiersz['longitude'];
            $rekord['wp_oc'] = $wartosc;
            $rekord['N'] = cords($rekord['latitude']);
            $rekord['E'] = cords($rekord['longitude']);
            $rekord['distance'] = $dist;
            $rekord['kier'] = $kier;
            $rekord['if_found'] = $if_found;
            $query = "select username from user where user_id = '" . $rekord['user_id'] . "';";
            $wynik = XDb::xSql($query);
            $wiersz = XDb::xFetchArray($wynik);
            $rekord['username'] = $wiersz['username'];
            $znalezione[] = $rekord;
            $lista[] = $rekord['wp_oc'];
            $i++;
        }
        $url = $_SERVER['REQUEST_URI'];
        $tpl->assign('lista', $lista);
        stronicowanie($_GET['page'], 'viewcache', $znalezione, $i, $url);
        exit;
    } else {
        $tpl->assign('error', 1);
    }
} elseif (isset($_POST['city']) && isset($_POST['radius'])) {
    if (!empty($_POST['city']) && !empty($_POST['radius']) && preg_match("/^\\d+\$/", $_POST['radius']) && $_POST['radius'] >= 1 && $_POST['radius'] <= 25) {
        $city = makeUrl($_POST['city']);
コード例 #19
0
ファイル: t5.php プロジェクト: kojoty/opencaching-pl
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');
echo '<table width="97%"><tr><td align="center"><center><b>' . tr('Stats_t5_01') . '</b><br /><br />' . tr('Stats_t5_02') . ': (z% - <b><font color="green">X</font>/<font color="blue">Y</font></b>) X- ' . tr('Stats_t5_03') . ', Y - ' . tr('Stats_t5_04') . ', <br /> z - ' . tr('Stats_t5_05') . ' % ' . tr('Stats_t5_06') . ' (X/Y)*100<br /><br /></center></td></tr> </table>';
echo '<table border="1" bgcolor="white" width="97%" style="font-size:11px; line-height:1.6em;">' . "\n";
$linie = XDb::xSql("SELECT count(*) count, user.username username, user.user_id user_id\n    FROM caches, cache_rating, user\n    WHERE `cache_rating`.`cache_id`=caches.cache_id\n        AND caches.user_id=user.user_id\n        AND caches.type <> 6\n    GROUP BY `user`.`user_id`\n    ORDER BY `count` DESC, `user`.`username` ASC");
echo '<tr><td class="bgcolor2" align="right"><b>' . tr('Stats_t5_07') . '</b>&nbsp;&nbsp;</td><td class="bgcolor2" align="center"><img src="images/rating-star.png" border="0" alt="Recommendations" />&nbsp;<b>' . tr('Stats_t5_08') . '</b>&nbsp;&nbsp;</td><td class="bgcolor2" align="center"><b>' . tr('Stats_t5_09') . '</b>&nbsp;&nbsp;</td></tr><tr><td>';
$l2 = "";
$licznik = 0;
while ($linia = XDb::xFetchArray($linie)) {
    $l1 = $linia['count'];
    $x = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM caches\n        WHERE `caches`.`topratings` >= 1\n            AND caches.type <> 6\n            AND caches.user_id= :1 ", 0, $linia['user_id']);
    $y = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM caches\n        WHERE user_id= :1\n            AND status <> 4 AND status <> 5\n            AND status <> 6 AND type <> 6", 0, $linia['user_id']);
    if ($y != 0) {
        $xy = sprintf("%.u", $x / $y * 100);
    } else {
        $xy = 0;
    }
    if ($l2 != $l1) {
        $licznik++;
        echo "</td></tr><tr><td class=\"bgcolor2\" align=\"right\">&nbsp;&nbsp;<b>{$licznik}</b>&nbsp;&nbsp;</td><td class=\"bgcolor2\" align=\"right\">&nbsp;&nbsp;<b>{$l1}</b>&nbsp;&nbsp;</td>";
        echo "<td class=\"bgcolor2\"><a class=\"links\" href=\"viewprofile.php?userid=" . $linia['user_id'] . "\">" . htmlspecialchars($linia['username']) . " (<font color=\"firebrick\">{$xy}% - </font><font color=\"green\">{$x}</font>/<font color=\"blue\">{$y}</font>)</a>";
        $l2 = $l1;
    } else {
        echo ", <a class=\"links\" href=\"viewprofile.php?userid=" . $linia['user_id'] . "\">" . htmlspecialchars($linia['username']) . " (<font color=\"firebrick\">{$xy}% - </font><font color=\"green\">{$x}</font>/<font color=\"blue\">{$y}</font>)</a>";
コード例 #20
0
ファイル: s11a.tpl.php プロジェクト: kojoty/opencaching-pl
if (!isset($rootpath)) {
    $rootpath = './';
}
//include template handling
require_once $rootpath . 'lib/common.inc.php';
setlocale(LC_TIME, 'pl_PL.UTF-8');
echo '<center><table width="97%" border="0"><tr><td align="center"><center><b>{{Stats_s3a_01}}<br/><b>';
echo '<br /><br />({{Stats_s3a_02}})</center></td></tr></table><br><table border="1" bgcolor="white" width="30%">' . "\n";
echo '
<tr class="bgcolor2">
    <td align="right">
        <b>{{Stats_s3a_03}}:</b>&nbsp;&nbsp;
    </td>
</tr><tr><td height="2"></td></tr>';
$rs = XDb::xSql("SELECT `code`, `name` FROM `nuts_codes`\n                WHERE (" . $config['provinceNutsCondition'] . ") ORDER BY `name` ASC");
while ($record = XDb::xFetchArray($rs)) {
    echo '<tr class="bgcolor2">
            <td align="right">
                <b><a class=links href=articles.php?page=s11&region=' . $record[code] . '>' . $record[name] . '</a></b>&nbsp;&nbsp;
            </td>';
}
echo '</table>' . "\n";
XDb::xFreeResults($rs);
?>
        </td></tr>
</table>

<script type="text/javascript">
    TimeTrack("END", "S11a");
</script>
コード例 #21
0
ファイル: addignore.php プロジェクト: kojoty/opencaching-pl
<?php

use Utils\Database\XDb;
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
    $cache_id = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : '';
    $target = isset($_REQUEST['target']) ? $_REQUEST['target'] : 'myignores.php';
    if ($usr !== false) {
        //add to caches
        $rs = XDb::xQuery('SELECT ignorer_count FROM caches WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
        if ($record = Xdb::xFetchArray($rs)) {
            XDb::xSql('UPDATE caches SET ignorer_count=\'' . ($record['ignorer_count'] + 1) . '\'
                       WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
            //add watch
            XDb::xSql('INSERT INTO `cache_ignore` (`cache_id`, `user_id`)
                       VALUES (\'' . XDb::xEscape($cache_id) . '\', \'' . XDb::xEscape($usr['userid']) . '\')');
            //add to user
            $rs = XDb::xSql('SELECT cache_ignores FROM user WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
            $record = XDb::xFetchArray($rs);
            XDb::xSql('UPDATE user SET cache_ignores=\'' . ($record['cache_ignores'] + 1) . '\' WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
            tpl_redirect($target);
        }
    }
}
tpl_BuildTemplate();
コード例 #22
0
         $rsCachesFindMonth1 = XDb::xSql("SELECT COUNT(*) `count`, YEAR(`date`) `year`, MONTH(`date`) `month` FROM `cache_logs`\n                WHERE type=1 AND cache_logs.deleted='0' AND cache_id=? AND YEAR(`date`)=? AND MONTH(`date`)=?\n                GROUP BY MONTH(`date`) , YEAR(`date`)\n                ORDER BY YEAR(`date`) ASC, MONTH(`date`) ASC", $cache_id, $year, $month);
         if ($rsCachesFindMonth1 !== false) {
             $rfm = XDb::xFetchArray($rsCachesFindMonth1);
             $y1[] = $rfm['count'];
             $x1[] = $rfm['month'];
         } else {
             $y1[] = $i;
             $x1[] = 0;
         }
     }
     XDb::xFreeResults($rsCachesFindMonth1);
     for ($i = 1; $i < 13; $i++) {
         $month = $i;
         $rsCachesFindMonth2 = XDb::xSql("SELECT COUNT(*) `count`, YEAR(`date`) `year`, MONTH(`date`) `month` FROM `cache_logs`\n                WHERE type=2 AND cache_logs.deleted='0' AND cache_id=? AND YEAR(`date`)=? AND MONTH(`date`)=?\n                GROUP BY MONTH(`date`) , YEAR(`date`)\n                ORDER BY YEAR(`date`) ASC, MONTH(`date`) ASC", $cache_id, $year, $month);
         if ($rsCachesFindMonth2 !== false) {
             $rfm = XDb::xFetchArray($rsCachesFindMonth2);
             $y2[] = $rfm['count'];
             $x2[] = $rfm['month'];
         } else {
             $y2[] = $i;
             $x2[] = 0;
         }
     }
     XDb::xFreeResults($rsCachesFindMonth2);
 }
 setlocale(LC_ALL, 'pl_PL.utf8');
 $dateLocale = new DateLocale();
 // Create the graph. These two calls are always required
 $graph = new Graph(400, 200);
 $graph->SetScale("textlin");
 $graph->SetShadow();
コード例 #23
0
ファイル: coordinates.php プロジェクト: kojoty/opencaching-pl
  tpl_set_var('gk_hoch', (int) $gk[1]);

  $qthlocator = help_latlongToQTH($lat_float, $lon_float);

  tpl_set_var('qthlocator', $qthlocator); */
$utm = ll2utm($lat_float, $lon_float);
tpl_set_var('utm2_zone', $utm[0]);
tpl_set_var('utm2_letter', $utm[1]);
tpl_set_var('utm2_NS', $utm[2]);
tpl_set_var('utm2_north', (int) $utm[3]);
tpl_set_var('utm2_EW', $utm[4]);
tpl_set_var('utm2_east', (int) $utm[5]);
tpl_set_var('nocacheid_start', '<!--');
tpl_set_var('nocacheid_end', '-->');
tpl_set_var('owner', '');
tpl_set_var('cachename', '');
tpl_set_var('wp', '');
// wp gesetzt?
$wp = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : '';
if ($wp != '') {
    $rs = XDb::xSql("SELECT `caches`.`name`, `user`.`username`\n         FROM `caches` INNER JOIN `user` ON (`user`.`user_id`=`caches`.`user_id`)\n         WHERE `caches`.`wp_oc`= ? ", $wp);
    if ($r = XDb::xFetchArray($rs)) {
        tpl_set_var('nocacheid_start', '');
        tpl_set_var('nocacheid_end', '');
        tpl_set_var('owner', htmlspecialchars($r['username'], ENT_COMPAT, 'UTF-8'));
        tpl_set_var('cachename', htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8'));
        tpl_set_var('wp', htmlspecialchars($wp, ENT_COMPAT, 'UTF-8'));
    }
}
//make the template and send it out
tpl_BuildTemplate();
コード例 #24
0
 function find_news($start, $end)
 {
     global $lang;
     global $ile;
     global $url;
     global $tpl;
     global $znalezione;
     if (isset($_GET['nazwa'])) {
         $nazwa = XDb::xEscape($_GET['nazwa']);
         $query = "select votes,cache_id,name, status, score, latitude, longitude, wp_oc, user_id, type from caches where name like '%" . $nazwa . "%' and caches.status in ('1','2','3') order by name limit " . $start . "," . $end;
         $czykilka = 1;
         $url = "./find.php?nazwa=" . $nazwa;
     }
     if (isset($_GET['wp'])) {
         $wp = XDb::xEscape($_GET['wp']);
         $query = "select votes,cache_id,name, status, score, latitude, longitude, wp_oc, user_id, type from caches where wp_oc = '" . $wp . "' and caches.status in ('1','2','3') order by name limit " . $start . "," . $end;
         $czykilka = 0;
         $url = "./find.php?wp=" . $wp;
     }
     if (isset($_GET['owner'])) {
         $owner = XDb::xEscape($_GET['owner']);
         $query = "select votes,cache_id,name, status, score, latitude, longitude, wp_oc, user_id, type from caches where user_id = (select user_id from user where username ='******') and caches.status in ('1','2','3') order by name limit " . $start . "," . $end;
         $czykilka = 1;
         $url = "./find.php?owner=" . $owner;
     }
     if (isset($_GET['finder'])) {
         $finder = XDb::xEscape($_GET['finder']);
         $query = "select caches.votes,caches.cache_id,name, status, score, latitude, longitude, wp_oc, caches.user_id, caches.type from caches inner join cache_logs on caches.cache_id=cache_logs.cache_id where cache_logs.user_id = (select user.user_id from user where username ='******') and cache_logs.type = '1' and cache_logs.deleted=0 and caches.status in ('1','2','3') order by cache_logs.id desc limit " . $start . "," . $end;
         $czykilka = 1;
         $url = "./find.php?finder=" . $finder;
     }
     $wynik = XDb::xSql($query);
     $ilewyn = XDb::xNumRows($wynik);
     if ($czykilka == 0) {
         if ($ilewyn > 0) {
             global $address;
             $wiersz = XDb::xFetchArray($wynik);
             $adres = "./" . $address . ".php?wp=" . $wiersz['wp_oc'];
             header('Location: ' . $adres);
             exit;
         } else {
             $tpl->assign("error", "1");
         }
     }
     if ($czykilka == 1) {
         $znalezione = array();
         while ($rekord = XDb::xFetchArray($wynik)) {
             if (isset($_SESSION['user_id'])) {
                 $query2 = "select 1 from cache_logs where user_id = '" . $_SESSION['user_id'] . "' and type = '1' and deleted='0' and cache_id ='" . $rekord['cache_id'] . "';";
                 $wynik2 = XDb::xSql($query2);
                 $if_found = XDb::xFetchArray($wynik2);
                 if ($if_found[0] != '1') {
                     $query2 = "select 2 from cache_logs where user_id = '" . $_SESSION['user_id'] . "' and type = '2' and deleted='0' and cache_id ='" . $rekord['cache_id'] . "';";
                     $wynik2 = XDb::xSql($query2);
                     $if_found = XDb::xFetchArray($wynik2);
                 }
                 $if_found = $if_found[0];
             }
             $query = "select username from user where user_id = " . $rekord['user_id'] . ";";
             $wynik2 = XDb::xSql($query);
             $wiersz = XDb::xFetchArray($wynik2);
             $query = "select " . $lang . " from cache_type where id = " . $rekord['type'] . ";";
             $wynik2 = XDb::xSql($query);
             $wiersz2 = XDb::xFetchArray($wynik2);
             if ($rekord['votes'] > 3) {
                 $rekord['score'] = score2ratingnum($rekord['score']);
             } else {
                 $rekord['score'] = 5;
             }
             $rekord['username'] = $wiersz['username'];
             $rekord['if_found'] = $if_found;
             $rekord['N'] = cords($rekord['latitude']);
             $rekord['E'] = cords($rekord['longitude']);
             $rekord['typetext'] = $wiersz2[0];
             $znalezione[] = $rekord;
         }
     }
 }
コード例 #25
0
function viewcache_getfullsizedpicturestable($cacheid, $viewtext = true, $spoiler_only = false, $picturescount)
{
    global $thumb_max_width;
    global $thumb_max_height;
    $nCol = 0;
    if ($spoiler_only) {
        $spoiler_only = 'spoiler=1 AND';
    } else {
        $spoiler_only = "";
    }
    $rs = XDb::xSql('SELECT uuid, title, url, spoiler
        FROM pictures
        WHERE ' . $spoiler_only . ' object_id = ?
            AND object_type=2 AND display=1
        ORDER BY date_created', $cacheid);
    while ($r = XDb::xFetchArray($rs)) {
        $retval .= '<div style="display: block; float: left; margin: 3px;">';
        if ($viewtext) {
            $retval .= '<div style=""><p>' . $r['title'] . '</p></div>';
        }
        $retval .= '<img style="max-width: 600px;" src="' . $r['url'] . '" alt="' . $r['title'] . '" title="' . $r['title'] . '" />';
        $retval .= '</div>';
    }
    XDb::xFreeResults($rs);
    return $retval;
}
コード例 #26
0
ファイル: ustatsg2.php プロジェクト: kojoty/opencaching-pl
            $content .= '<p><img src="graphs/BarGraphustat.php?userid=' . $user_id . '&amp;t=cfy"  border="0" alt="" width="500" height="200" /></p>';
        }
        // Parameter
        $jpeg_qualitaet = 80;
        $fontfile = "./lib/fonts/arial.ttf";
        $tplpath = 'images/PLmapa.gif';
        $im = ImageCreateFromGIF($tplpath);
        $clrWhite = ImageColorAllocate($im, 255, 255, 255);
        $clrBorder = ImageColorAllocate($im, 70, 70, 70);
        $clrBlack = ImageColorAllocate($im, 0, 0, 0);
        $clrRed = ImageColorAllocate($im, 255, 0, 0);
        $clrBlue = ImageColorAllocate($im, 0, 0, 255);
        $fontsize = 18;
        $wojewodztwa = array('PL11' => array(110, 138), 'PL12' => array(155, 108), 'PL21' => array(135, 208), 'PL22' => array(103, 188), 'PL31' => array(200, 150), 'PL32' => array(180, 200), 'PL33' => array(146, 170), 'PL34' => array(195, 75), 'PL41' => array(65, 115), 'PL42' => array(26, 55), 'PL43' => array(19, 100), 'PL51' => array(35, 149), 'PL52' => array(78, 169), 'PL61' => array(90, 85), 'PL62' => array(145, 50), 'PL63' => array(85, 43));
        $wyniki = XDb::xSql("SELECT cache_location.code3 wojewodztwo, COUNT(*) ilosc FROM cache_logs, cache_location\n            WHERE cache_logs.user_id= ? AND cache_logs.type='1'\n                AND cache_logs.deleted='0'\n                AND cache_location.code3 IN ('PL11','PL12','PL21','PL22','PL31','PL32','PL33','PL34','PL41','PL42','PL43','PL51','PL52','PL61','PL62','PL63')\n                AND cache_logs.cache_id=cache_location.cache_id\n            GROUP BY cache_location.code3", $user_id);
        while ($wynik = XDb::xFetchArray($wyniki)) {
            $text = $wynik['ilosc'];
            if ($text != "0") {
                ImageTTFText($im, 14, 0, $wojewodztwa[$wynik['wojewodztwo']][0], $wojewodztwa[$wynik['wojewodztwo']][1], $clrBlack, $fontfile, $text);
            }
        }
        // write output
        Imagejpeg($im, $dynbasepath . 'images/statpics/mapstat' . $user_id . '.jpg', $jpeg_qualitaet);
        ImageDestroy($im);
        // generate number for refresh image
        $rand = rand();
        $content .= '<p style="margin-left: 125px;"><img src=/images/statpics/mapstat' . $user_id . '.jpg?rand=' . $rand . ' border="0" alt="" width="250" height="235" /></p>';
        tpl_set_var('content', $content);
    }
}
tpl_BuildTemplate();
コード例 #27
0
ファイル: viewreports.php プロジェクト: kojoty/opencaching-pl
// tylko dla członków Rady
if ($error == false && $usr['admin']) {
    if (isset($_GET['archiwum']) && $_GET['archiwum'] == 1) {
        tpl_set_var('arch_curr', tr("cache_reports_34"));
        tpl_set_var('archiwum', 0);
        $show_archive = " reports.status = 2 AND ";
        $sorting_order = "DESC";
    } else {
        tpl_set_var('arch_curr', tr("cache_reports_35"));
        tpl_set_var('archiwum', 1);
        $show_archive = " reports.status <> 2 AND ";
        $sorting_order = "DESC";
    }
    $query = XDb::xSql("SELECT cache_status.id AS cs_id, caches.last_modified AS lastmodified,\n                caches.user_id AS cache_ownerid,cache_status.{$lang} AS cache_status, reports.id as report_id,\n                reports.user_id as user_id, reports.changed_by as changed_by, reports.changed_date as changed_date,\n                reports.cache_id as cache_id, reports.type as type, reports.text as text,\n                reports.submit_date as submit_date, reports.responsible_id as responsible_id,\n                reports.status as status, user.username as username, user.user_id as user_id,\n                caches.name as cachename,IFNULL(`cache_location`.`adm3`, '') AS `adm3`, caches.status AS c_status\n        FROM cache_status, reports, user, (\n            `caches` LEFT JOIN `cache_location` ON `caches`.`cache_id` = `cache_location`.`cache_id`\n            )\n        WHERE cache_status.id = caches.status\n            AND " . XDb::xEscape($show_archive) . " user.user_id = reports.user_id\n            AND caches.cache_id = reports.cache_id\n        ORDER BY submit_date " . XDb::xEscape($sorting_order));
    $row_num = 0;
    while ($report = XDb::xFetchArray($query)) {
        if ($row_num % 2) {
            $bgcolor = "bgcolor1";
        } else {
            $bgcolor = "bgcolor2";
        }
        $content .= "<tr>\n";
        $userLastLogin = XDb::xMultiVariableQueryValue("SELECT last_login FROM user WHERE user_id=:1 ", 0, $report['cache_ownerid']);
        if ($userLastLogin == "0000-00-00 00:00:00") {
            $userlogin = "******";
        } else {
            $userlogin = strftime("%Y-%m-%d", strtotime($userLastLogin));
        }
        if ($usr['userid'] == $report['responsible_id']) {
            $addborder = "style='border-width:2px;'";
        } else {
コード例 #28
0
ファイル: viewprofile.php プロジェクト: kojoty/opencaching-pl
     while ($rms = XDb::xFetchArray($rsms)) {
         $content .= '<tr> <td>' . ($rms['row'] - 1) . '</td><td>' . $rms['data'] . '</td><td><a class="links" href="viewcache.php?cacheid=' . $rms['cache_id'] . '">' . $rms['wp_oc'] . '</a></td></tr>';
     }
     $content .= '</table>';
     XDb::xFreeResults($rsms);
 }
 //$total_created_and_owned_caches > 0
 XDb::xFreeResults($rscc2);
 $rs_logs = XDb::xSql("SELECT cache_logs.id, cache_logs.cache_id AS cache_id, cache_logs.type AS log_type,\n                        cache_logs.text AS log_text, DATE_FORMAT(cache_logs.date,'%d-%m-%Y') AS log_date,\n                        caches.name AS cache_name, caches.wp_oc AS wp_name, cache_logs.encrypt AS encrypt,\n                        caches.user_id AS cache_owner, cache_logs.user_id AS luser_id, user.username AS user_name,\n                        user.user_id AS user_id, caches.type AS cache_type, cache_type.icon_small AS cache_icon_small,\n                        log_types.icon_small AS icon_small, IF(ISNULL(`cache_rating`.`cache_id`), 0, 1) AS `recommended`,\n                        COUNT(gk_item.id) AS geokret_in\n                FROM ((cache_logs\n                    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                    INNER JOIN cache_type ON (caches.type = cache_type.id)\n                    LEFT JOIN `cache_rating` ON `cache_logs`.`cache_id`=`cache_rating`.`cache_id`\n                        AND `cache_logs`.`user_id`=`cache_rating`.`user_id`\n                    LEFT JOIN gk_item_waypoint ON gk_item_waypoint.wp = caches.wp_oc\n                    LEFT JOIN gk_item ON gk_item.id = gk_item_waypoint.id\n                        AND gk_item.stateid<>1 AND gk_item.stateid<>4 AND gk_item.typeid<>2 AND gk_item.stateid !=5\n                    WHERE (caches.status=1 OR caches.status=2 OR caches.status=3) AND cache_logs.deleted=0 AND `caches`.`user_id`= ?\n                        AND `cache_logs`.`cache_id`=`caches`.`cache_id`\n                        AND `user`.`user_id`=`cache_logs`.`user_id`\n                    GROUP BY cache_logs.id\n                    ORDER BY `cache_logs`.`date_created` DESC\n                    LIMIT 5", $user_id);
 if (XDb::xNumRows($rs_logs) != 0) {
     $content .= '<p>&nbsp;</p><p><span class="content-title-noshade txt-blue08">' . tr('latest_logs_in_caches') . ':</span>&nbsp;&nbsp;<img src="tpl/stdstyle/images/blue/arrow.png" alt="" /> [<a class="links" href="mycaches_logs.php?userid=' . $user_id . '">' . tr('show_all') . '</a>] ';
     if ($user_id == $usr['userid'] || $usr['admin']) {
         $content .= '&nbsp;&nbsp;<a class="links" href="rss/mycaches_logs.xml?userid=' . $user_id . '"><img src=images/rss.gif alt="" /></a>';
     }
     $content .= '</p><br /><div><ul style="margin: -0.9em 0px 0.9em 0px; padding: 0px 0px 0px 10px; list-style-type: none; line-height: 1.6em; font-size: 12px;">';
     while ($record_logs = XDb::xFetchArray($rs_logs)) {
         $tmp_log = $cache_line_my_caches;
         if ($record_logs['geokret_in'] != '0') {
             $tmp_log = mb_ereg_replace('{gkimage}', '<img src="images/gk.png" border="0" alt="" title="GeoKret" />', $tmp_log);
         } else {
             $tmp_log = mb_ereg_replace('{gkimage}', '<img src="images/rating-star-empty.png" border="0" alt=""/>', $tmp_log);
         }
         if ($record_logs['recommended'] == 1 && $record_logs['log_type'] == 1) {
             $tmp_log = mb_ereg_replace('{rateimage}', '<img src="images/rating-star.png" border="0" alt=""/>', $tmp_log);
         } else {
             $tmp_log = mb_ereg_replace('{rateimage}', '<img src="images/rating-star-empty.png" border="0" alt=""/>', $tmp_log);
         }
         $tmp_log = mb_ereg_replace('{logimage}', icon_log_type($record_logs['icon_small'], "..."), $tmp_log);
         $tmp_log = mb_ereg_replace('{cacheimage}', $record_logs['cache_icon_small'], $tmp_log);
         $tmp_log = mb_ereg_replace('{date}', $record_logs['log_date'], $tmp_log);
         $tmp_log = mb_ereg_replace('{cachename}', htmlspecialchars($record_logs['cache_name'], ENT_COMPAT, 'UTF-8'), $tmp_log);
コード例 #29
0
                    $thisline = mb_ereg_replace('{log_picture_onclick}', "alert('" . $spoiler_disable_msg . "'); return false;", $thisline);
                    $thisline = mb_ereg_replace('{link}', 'index.php', $thisline);
                    $thisline = mb_ereg_replace('{longdesc}', 'index.php', $thisline);
                } else {
                    $thisline = mb_ereg_replace('{log_picture_onclick}', "enlarge(this)", $thisline);
                    $thisline = mb_ereg_replace('{link}', $pic_record['url'], $thisline);
                    $thisline = mb_ereg_replace('{longdesc}', str_replace("uploads", "uploads", $pic_record['url']), $thisline);
                }
                $thisline = mb_ereg_replace('{imgsrc}', 'thumbs.php?uuid=' . urlencode($pic_record['uuid']), $thisline);
                if ($pic_record['title'] == "") {
                    $title = "link";
                } else {
                    $title = htmlspecialchars($pic_record['title'], ENT_COMPAT, 'UTF-8');
                }
                $thisline = mb_ereg_replace('{title}', "<a class=links href=viewlogs.php?logid=" . $pic_record['object_id'] . ">" . $title . "</a>", $thisline);
                $logpicturelines .= $thisline;
            } while ($pic_record = XDb::xFetchArray($rspictures));
        }
        XDb::xFreeResults($rspictures);
        $tmplog = $logpicturelines;
        $logs = "{$tmplog}\n";
        tpl_set_var('logpictures', $logs);
    } else {
        //display search page
        // redirection
        tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id));
        exit;
    }
}
//make the template and send it out
tpl_BuildTemplate();
コード例 #30
-1
function getPictures($cacheid, $picturescount)
{
    global $thumb_max_width;
    global $thumb_max_height;
    $rs = XDb::xSql('SELECT uuid, title, url, spoiler FROM pictures
            WHERE object_id= ? AND object_type=2 AND display=1
            ORDER BY date_created', $cacheid);
    if (!isset($retval)) {
        $retval = '';
    }
    while ($r = XDb::xFetchArray($rs)) {
        $retval .= '&lt;img src="' . $r['url'] . '"&gt;&lt;br&gt;' . cleanup_text($r['title']) . '&lt;br&gt;';
    }
    XDb::xFreeResults($rs);
    return $retval;
}