function landkreisFromLocid($locid)
{
    if (!is_numeric($locid)) {
        return '';
    }
    return XDb::xMultiVariableQueryValue("SELECT `rb`.`text_val` `regierungsbezirk`\n        FROM `geodb_textdata` `ct`, `geodb_textdata` `rb`, `geodb_hierarchies` `hr`\n        WHERE `ct`.`loc_id`=`hr`.`loc_id`\n            AND `hr`.`id_lvl5`=`rb`.`loc_id`\n            AND `ct`.`text_type`=500100000\n            AND `rb`.`text_type`=500100000\n            AND `ct`.`loc_id`= :1\n            AND `hr`.`id_lvl5`!=0", 0, $locid);
}
Beispiel #2
0
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;
    }
}
Beispiel #3
0
        $code2 = $sCode;
        $adm2 = XDb::xMultiVariableQueryValue("SELECT `name` FROM `nuts_codes` WHERE `code`= :1", 0, $sCode);
        $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";
        }
        $eLang = XDb::xEscape($lang_db);
        // try to get localised name first
        $adm1 = XDb::xMultiVariableQueryValue("SELECT `countries`.`{$eLang}` FROM `countries`\n            WHERE `countries`.`short`= :1 ", 0, $sCode);
        if ($adm1 == null) {
            $adm1 = XDb::xMultiVariableQueryValue("SELECT `name` FROM `nuts_codes` WHERE `code`= :1 ", 0, $sCode);
        }
    }
    tpl_set_var('country', $adm1);
    tpl_set_var('region', $adm3);
} else {
    tpl_set_var('country', "");
    tpl_set_var('region', "");
}
//From Google
$url = '//maps.googleapis.com/maps/api/geocode/json?latlng=' . $lat . ',' . $lon . '&sensor=false&language=' . $lang;
$data = @file_get_contents($url);
$jsondata = json_decode($data, true);
//print_r($jsondata);
if (isset($jsondata['status']) && strtoupper($jsondata['status']) == 'OK') {
    $woj = $jsondata['results']['0']['address_components']['5']['long_name'];
Beispiel #4
0
 tpl_set_var('cache_stat', $rs_stat);
 $ran = XDb::xMultiVariableQueryValue("SELECT count(cache_id) FROM caches WHERE `caches`.`status` = '1' AND `caches`.`user_id`= :1 ", 0, $user_id);
 tpl_set_var('activeN', $ran);
 $run = XDb::xMultiVariableQueryValue("SELECT count(cache_id) FROM caches WHERE `caches`.`status` = '2' AND `caches`.`user_id`= :1", 0, $user_id);
 tpl_set_var('unavailableN', $run);
 $rarn = XDb::xMultiVariableQueryValue("SELECT count(cache_id) FROM caches WHERE `caches`.`status` = '3' AND `caches`.`user_id`= :1 ", 0, $user_id);
 tpl_set_var('archivedN', $rarn);
 $rnpn = XDb::xMultiVariableQueryValue("SELECT count(cache_id) FROM caches WHERE `caches`.`status` = '5' AND `caches`.`user_id`= :1 ", 0, $user_id);
 tpl_set_var('notpublishedN', $rnpn);
 $rapn = XDb::xMultiVariableQueryValue("SELECT count(cache_id) FROM caches WHERE `caches`.`status` = '4' AND `caches`.`user_id`= :1", 0, $user_id);
 tpl_set_var('approvalN', $rapn);
 $rbln = XDb::xMultiVariableQueryValue("SELECT count(cache_id) FROM caches WHERE `caches`.`status` = '6' AND `caches`.`user_id`=:1", 0, $user_id);
 tpl_set_var('blockedN', $rbln);
 $LOGS_PER_PAGE = 50;
 $PAGES_LISTED = 10;
 $total_logs = XDb::xMultiVariableQueryValue("SELECT count(cache_id) FROM caches WHERE `caches`.`status` = :1 AND `caches`.`user_id`= :2 ", 0, $stat_cache, $user_id);
 $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']);
 }
 // obsluga sortowania kolumn
 if (!isset($_GET['col']) || intval($_GET['col']) < 1 || intval($_GET['col']) > 7) {
     $sort_col = 1;
 } else {
     $sort_col = intval($_GET['col']);
 }
 if (!isset($_GET['sort']) || intval($_GET['sort']) < 0 || intval($_GET['sort']) > 1) {
     $sort_sort = 2;
Beispiel #5
0
     // send email to RR
     $emailheaders = "Content-Type: text/plain; charset=utf-8\r\n";
     $emailheaders .= "From: " . $site_name . " <" . $cache_reporter['email'] . ">\r\n";
     $emailheaders .= "Reply-To: " . $site_name . " <" . $cache_reporter['email'] . ">";
     mb_send_mail($octeam_email, tr('reportcache07') . " (" . $cache['wp_oc'] . ")", $email_content, $emailheaders);
     // echo($octeam_email. tr('reportcache07'). $email_content. $emailheaders);
 } else {
     $tplname = 'reportcache_sent_owner';
 }
 //get email address of cache owner
 if ($_POST['adresat'] == "rr") {
     $email_content = file_get_contents($stylepath . '/email/newreport_cacheowner.email');
 } else {
     $email_content = file_get_contents($stylepath . '/email/newreport_cacheowneronly.email');
 }
 $cache_owner = XDb::xMultiVariableQueryValue("SELECT `email` FROM `user` WHERE `user_id`=:1", '', $cache['user_id']);
 $email_content = mb_ereg_replace('{server}', $absolute_server_URI, $email_content);
 $email_content = mb_ereg_replace('{reportcache10}', tr('reportcache10'), $email_content);
 $email_content = mb_ereg_replace('{reportcache11}', tr('reportcache11'), $email_content);
 $email_content = mb_ereg_replace('{reportcache12}', tr('reportcache12'), $email_content);
 $email_content = mb_ereg_replace('{reportcache15}', tr('reportcache15'), $email_content);
 $email_content = mb_ereg_replace('{reportcache17}', tr('reportcache17'), $email_content);
 $email_content = mb_ereg_replace('{reportcache18}', tr('reportcache18'), $email_content);
 $email_content = mb_ereg_replace('{reportcache19}', tr('reportcache19'), $email_content);
 $email_content = mb_ereg_replace('{octeamEmailsSignature}', $octeamEmailsSignature, $email_content);
 $email_content = mb_ereg_replace('{date}', date($datetimeFormat), $email_content);
 $email_content = mb_ereg_replace('{submitter}', $usr['username'], $email_content);
 $email_content = mb_ereg_replace('{cachename}', $cache['name'], $email_content);
 $email_content = mb_ereg_replace('{cache_wp}', $cache['wp_oc'], $email_content);
 $email_content = mb_ereg_replace('{cacheid}', $cacheid, $email_content);
 $email_content = mb_ereg_replace('{reason}', reason($_POST['reason']), $email_content);
if (!isset($_SESSION['user_id'])) {
    print 'no hacking please!';
    exit;
}
$ptAPI = new powerTrailBase();
if (isset($_REQUEST['rcalcAll'])) {
    recalculateOnce();
    print '<br><br><b>cachePoints were updated</b>';
    exit;
}
isset($_REQUEST['projectId']) ? $projectId = $_REQUEST['projectId'] : exit;
isset($_REQUEST['cacheId']) ? $cacheId = (int) $_REQUEST['cacheId'] : exit;
isset($_REQUEST['rmOtherUserCacheFromPt']) ? $rmOtherUserCacheFromPt = true : ($rmOtherUserCacheFromPt = false);
$db = OcDb::instance();
// check if cache is already cannected with any power trail
$resultPowerTrailId['PowerTrailId'] = XDb::xMultiVariableQueryValue('SELECT `PowerTrailId` FROM `powerTrail_caches` WHERE `cacheId` = :1', false, $cacheId);
if (isset($_REQUEST['removeByCOG']) && $_SESSION['ptRmByCog'] === 1) {
    removeCacheFromPowerTrail($cacheId, $resultPowerTrailId, $db, $ptAPI);
    recalculate($resultPowerTrailId['PowerTrailId']);
    print 'removedByCOG';
    exit;
}
if (isset($resultPowerTrailId['PowerTrailId']) && $resultPowerTrailId['PowerTrailId'] != 0) {
    $geocacheIsAttaschedToPt = true;
} else {
    $geocacheIsAttaschedToPt = false;
}
if ($rmOtherUserCacheFromPt === true) {
    if ($geocacheIsAttaschedToPt === true) {
        removeCacheFromPowerTrail($cacheId, $resultPowerTrailId, $db, $ptAPI);
        recalculate($resultPowerTrailId['PowerTrailId']);
Beispiel #7
0
 }
 $tplname = 'ustat';
 if ($user_id != $usr['userid']) {
     // do not highlight My stats menu item if browsing other users stats
     $mnu_siteid = 'start';
 }
 $stat_menu = array('title' => 'Statictics', 'menustring' => 'Statistics', 'siteid' => 'statlisting', 'visible' => false, 'filename' => 'ustatsg2.php?userid=' . $user_id, 'submenu' => array(array('title' => tr('generla_stat'), 'menustring' => tr('general_stat'), 'visible' => true, 'filename' => 'viewprofile.php?userid=' . $user_id, 'newwindow' => false, 'siteid' => 'general_stat', 'icon' => 'images/actions/stat'), array('title' => tr('graph_created'), 'menustring' => tr('graph_created'), 'visible' => true, 'filename' => 'ustatsg1.php?userid=' . $user_id, 'newwindow' => false, 'siteid' => 'createstat', 'icon' => 'images/actions/stat')));
 $content = "";
 $rsGeneralStat = XDb::xSql("SELECT  hidden_count, founds_count, log_notes_count, notfounds_count, username\n            FROM `user` WHERE user_id= ? LIMIT 1", $user_id);
 $user_record = XDb::xFetchArray($rsGeneralStat);
 tpl_set_var('username', $user_record['username']);
 if ($user_record['founds_count'] == 0) {
     $content .= '<p>&nbsp;</p><p>&nbsp;</p><div class="content2-container bg-blue02"><p class="content-title-noshade-size1">&nbsp;<img src="tpl/stdstyle/images/blue/logs.png" class="icon32" alt="Caches Find" title="Caches Find" />&nbsp;&nbsp;&nbsp;' . tr("graph_find") . '</p></div><br /><br /><p> <b>' . tr("there_is_no_caches_found") . '</b></p>';
 } else {
     // calculate diif days between date of register on OC  to current date
     $ddays = XDb::xMultiVariableQueryValue("SELECT TO_DAYS( NOW() ) - TO_DAYS(`date_created`) `diff` FROM `user` WHERE user_id= :1 LIMIT 1 ", 0, $user_id);
     $rsGeneralStat = XDb::xSql("SELECT YEAR(`date_created`) usertime,hidden_count, founds_count, log_notes_count, username\n                FROM `user` WHERE user_id= ? LIMIT 1", $user_id);
     if ($rsGeneralStat !== false) {
         $user_record = XDb::xFetchArray($rsGeneralStat);
         XDb::xFreeResults($rsGeneralStat);
         tpl_set_var('username', $user_record['username']);
     }
     $content .= '<p>&nbsp;</p><p>&nbsp;</p><div class="content2-container bg-blue02"><p class="content-title-noshade-size1">&nbsp;<img src="tpl/stdstyle/images/blue/logs.png" class="icon32" alt="Caches Find" title="Caches Find" />&nbsp;&nbsp;&nbsp;' . tr("graph_find") . '</p></div><br />';
     $content .= '<p><img src="graphs/PieGraphustat.php?userid=' . $user_id . '&amp;t=cf"  border="0" alt="" width="500" height="300" /></p>';
     $year = date("Y");
     $content .= '<p><img src="graphs/BarGraphustat.php?userid=' . $user_id . '&amp;t=cfm' . $year . '"  border="0" alt="" width="500" height="200" /></p>';
     if ($user_record['usertime'] != $year) {
         $yearr = $year - 1;
         $content .= '<p><img src="graphs/BarGraphustat.php?userid=' . $user_id . '&amp;t=cfm' . $yearr . '"  border="0" alt="" width="500" height="200" /></p>';
     }
     $content .= '<p><img src="graphs/BarGraphustat.php?userid=' . $user_id . '&amp;t=cfy"  border="0" alt="" width="500" height="200" /></p>';
Beispiel #8
0
<?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'] : 'mywatches.php';
    if ($usr !== false) {
        //add to caches
        $geocacheExist = XDb::xMultiVariableQueryValue('SELECT user_id FROM caches WHERE cache_id= :1', -1, $cache_id);
        if ($geocacheExist > -1) {
            // (check if user is not curently watching specified cache)
            $isWatched = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM `cache_watches` WHERE `cache_id` = :1 AND `user_id` = :2", 1, $cache_id, $usr['userid']);
            // if so proceed to add to database
            if ($isWatched < 1) {
                // increase this cache watchers count
                XDb::xSql('UPDATE caches SET watcher=watcher+1  WHERE cache_id= ? ', $cache_id);
                //add watch
                XDb::xSql('INSERT INTO `cache_watches` (`cache_id`, `user_id`, `last_executed`) VALUES (?, ?, NOW())', $cache_id, $usr['userid']);
                //add to user
                XDb::xSql('UPDATE user SET cache_watches=cache_watches+1 WHERE user_id= ? ', $usr['userid']);
            }
            tpl_redirect($target);
        }
    }
}
tpl_BuildTemplate();
Beispiel #9
0
?>

<table class="table" width="760" style="line-height: 1.6em; font-size: 10px;">
    <tr><td>
            <?php 
global $lang, $rootpath;
if (!isset($rootpath)) {
    $rootpath = './';
}
//include template handling
require_once $rootpath . 'lib/common.inc.php';
if (isset($_REQUEST['region'])) {
    $region = $_REQUEST['region'];
}
echo '<table width="97%"><tr><td align="center"><center><b> ' . tr('ranking_by_number_of_created_caches') . ' </b><br />tylko aktywne skrzynki<br />';
$woj = XDb::xMultiVariableQueryValue("SELECT nuts_codes.name FROM nuts_codes WHERE code= :1 ", 0, $region);
echo '<br /><b><font color="blue">' . $woj . '</font></b></center></td></tr></table>';
echo '<table border="1" bgcolor="white" width="97%">' . "\n";
$wyniki = XDb::xSql("SELECT count(*) count, user.username nick,caches.user_id userid\n                FROM caches\n                    JOIN user USING(user_id)\n                    JOIN cache_location USING (cache_id)\n                WHERE caches.status=1 AND caches.type<>6\n                    AND cache_location.code3= ?\n                GROUP BY caches.user_id\n                ORDER by count DESC, user.username ASC", $region);
$licznik = 0;
$wartosc = 0;
echo '<tr class="bgcolor2"><td align="right">&nbsp;&nbsp;<b>' . tr('ranking') . '</b>&nbsp;&nbsp;</td><td align="center">&nbsp;&nbsp;<b>' . tr('number_of_caches') . '</b>&nbsp;&nbsp;</td><td align="center">&nbsp;&nbsp;<b>' . tr('username') . '</b>&nbsp;&nbsp;</td></tr>';
echo '<tr><td height="2"></td></tr>';
while ($wynik = XDb::xFetchArray($wyniki)) {
    if ($wartosc == 0) {
        $wartosc = $wynik['count'];
        $licznik = 1;
        echo "<tr class='bgcolor2'><td align='right'>&nbsp;&nbsp;<b>{$licznik}</b>&nbsp;&nbsp;</td><td align='right'>&nbsp;&nbsp;<b>" . $wynik['count'] . "</b>&nbsp;&nbsp;</td><td><a href='viewprofile.php?userid=" . $wynik['userid'] . "'>" . htmlspecialchars($wynik['nick']) . "</a>";
    } else {
        if ($wartosc == $wynik['count']) {
            echo ', <a href="viewprofile.php?userid=' . $wynik['userid'] . '">' . htmlspecialchars($wynik['nick']) . '</a>';
<?php

use Utils\Database\XDb;
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
if ($usr['admin']) {
    $_SESSION['submitted'] = false;
    $cachename = XDb::xMultiVariableQueryValue("SELECT name FROM caches WHERE cache_id= :1 ", 0, $_REQUEST['cacheid']);
    tpl_set_var('cachename', $cachename);
    tpl_set_var('cacheid', $_REQUEST['cacheid']);
    $tplname = 'add_rr_comment';
    tpl_BuildTemplate();
}
Beispiel #11
0
         //wp-type
         $type_not_ok = false;
         if ($sel_type == -1) {
             tpl_set_var('type_message', $typewp_not_ok_message);
             $error = true;
             $type_not_ok = true;
         }
         //no errors?
         if (!($descwp_not_ok || $lon_not_ok || $lat_not_ok || $type_not_ok)) {
             //add record
             XDb::xSql("INSERT INTO `waypoints` (\n                                    `wp_id`, `cache_id`,`longitude`,`latitude`,`type` ,\n                                    `status` ,`stage` ,`desc` ,`opensprawdzacz`)\n                                   VALUES ('', ?, ?, ?, ?, ?, ?, ?, ?)", $cache_id, $longitude, $latitude, $sel_type, $wp_status, $wp_stage, $wp_desc, $opensprawdzacz_taknie);
             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 && $sel_type == 3) {
                 $proba = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM `opensprawdzacz` WHERE `cache_id` = :1 ", 0, $cache_id);
                 if ($proba == 0) {
                     XDb::xSql("INSERT INTO `opensprawdzacz`(`id`,  `cache_id`,  `proby`, `sukcesy`)\n                                                     VALUES ('', '{$cache_id}',   0,       0)");
                 }
             }
             // ==== opensprawdzacz end ===========================================
             tpl_redirect('editcache.php?cacheid=' . urlencode($cache_id));
         } else {
             tpl_set_var('general_message', $error_general);
         }
         // end submit
     }
     XDb::xFreeResults($cache_rs);
     XDb::xFreeResults($wp_rs);
 } else {
     $no_tpl_build = true;
Beispiel #12
0
 /**
  * This function is moved from clicompatbase
  * @param unknown $cacheid
  */
 public static function setCacheDefaultDescLang($cacheid)
 {
     $r['desc_languages'] = XDb::xMultiVariableQueryValue("SELECT `desc_languages` FROM `caches`\n            WHERE `cache_id`= :1 LIMIT 1", null, $cacheid);
     if (mb_strpos($r['desc_languages'], 'PL') !== false) {
         $desclang = 'PL';
     } else {
         if (mb_strpos($r['desc_languages'], 'EN') !== false) {
             $desclang = 'EN';
         } else {
             if ($r['desc_languages'] == '') {
                 $desclang = '';
             } else {
                 $desclang = mb_substr($r['desc_languages'], 0, 2);
             }
         }
     }
     XDb::xSql("UPDATE `caches` SET\n                `default_desclang`= ?, `last_modified`=NOW()\n            WHERE cache_id= ? LIMIT 1", $desclang, $cacheid);
 }
Beispiel #13
0
         $allok = false;
     }
 }
 if ($allok == true) {
     //ok, wir haben eine gĂźltige uuid und sind der owner ...
     $fna = mb_split('\\.', $url);
     $extension = mb_strtolower($fna[count($fna) - 1]);
     // datei und in DB lĂśschen
     @unlink($picdir . '/' . $uuid . '.' . $extension);
     XDb::xSql("DELETE FROM `pictures` WHERE `uuid`= ? LIMIT 1", $uuid);
     XDb::xSql("INSERT INTO `removed_objects` (`localID`, `uuid`, `type`, `removed_date`, `node`)\n                VALUES (?, ?, 6, NOW(), ?)", $localid, $uuid, $oc_nodeid);
     switch ($type) {
         // log
         case 1:
             XDb::xSql("UPDATE `cache_logs` SET `picturescount`=`picturescount`-1, `last_modified`=NOW()\n                    WHERE `id`= ? LIMIT 1", $objectid);
             $r['cache_id'] = XDb::xMultiVariableQueryValue("SELECT `cache_id` FROM `cache_logs`\n                                        WHERE `deleted`=0 AND `id`= :1 LIMIT 1", 0, $objectid);
             tpl_redirect('viewlogs.php?cacheid=' . urlencode($r['cache_id']));
             break;
             // cache
         // cache
         case 2:
             XDb::xSql("UPDATE `caches` SET `picturescount`=`picturescount`-1, `last_modified`=NOW()\n                        WHERE `cache_id`= ? LIMIT 1", $objectid);
             tpl_redirect('editcache.php?cacheid=' . urlencode($objectid));
             break;
     }
     tpl_redirect('index.php');
     exit;
 } else {
     $tplname = 'message';
     tpl_set_var('messagetitle', $message_title_internal);
     tpl_set_var('message_start', '');
Beispiel #14
0
require_once './lib/common.inc.php';
$message = false;
//Preprocessing
if ($error == false) {
    //user logged in?
    if ($usr == false) {
        $target = urlencode(tpl_get_current_page());
        tpl_redirect('login.php?target=' . $target);
    } else {
        $tplname = 'editpic';
        require_once $stylepath . '/editpic.inc.php';
        $uuid = isset($_REQUEST['uuid']) ? $_REQUEST['uuid'] : 0;
        if (!$uuid) {
            $message = $message_picture_not_found;
        }
        $owner = XDb::xMultiVariableQueryValue("SELECT `user_id` FROM `pictures` WHERE `uuid`= :1 LIMIT 1", 0, $uuid);
        if ($usr['admin'] || $owner == $usr['userid']) {
            if (!$message) {
                $rs = XDb::xSql("SELECT `pictures`.`spoiler`, `pictures`.`display`, `pictures`.`title`, `pictures`.`object_id`,\n                            `pictures`.`object_type`, `caches`.`name`, `caches`.`cache_id`\n                    FROM `pictures`, `caches`\n                    WHERE `caches`.`cache_id`=`pictures`.`object_id` AND `pictures`.`uuid`= ? AND `pictures`.`user_id`= ? LIMIT 1", $uuid, $owner);
                if (!($row = XDb::xFetchArray($rs))) {
                    $message = $message_picture_not_found;
                }
            }
        }
        if (!$message) {
            if (isset($_POST['submit'])) {
                if ($_FILES['file']['name'] != '') {
                    // check if the file has been uploaded successfully
                    if ($_FILES['file']['error'] != 0) {
                        // oops ... no idea what I should do now
                        $tplname = 'message';
Beispiel #15
0
 if ($allok == true) {
     //check if object exists and we are the owner (allowed to upload a pic)
     switch ($type) {
         // log
         case 1:
             $rs = XDb::xSql("SELECT `user_id`, `cache_id` FROM `cache_logs` WHERE `deleted`=0 AND `id`= ?", $objectid);
             if (!($r = XDb::xFetchArray($rs))) {
                 $allok = false;
             } else {
                 if ($r['user_id'] != $usr['userid'] && $usr['admin'] == false) {
                     $allok = false;
                 }
                 $cacheid = $r['cache_id'];
                 tpl_set_var('cacheid', $cacheid);
                 tpl_set_var('pictypedesc', $pictypedesc_log);
                 $rCache['name'] = XDb::xMultiVariableQueryValue("SELECT `name` FROM `caches` WHERE `cache_id`= :1 LIMIT 1", '', $cacheid);
                 tpl_set_var('cachename', htmlspecialchars($rCache['name'], ENT_COMPAT, 'UTF-8'));
                 tpl_set_var('begin_cacheonly', '<!--');
                 tpl_set_var('end_cacheonly', '-->');
             }
             XDb::xFreeResults($rs);
             break;
             // cache
         // cache
         case 2:
             $rs = XDb::xSql("SELECT `user_id`, `cache_id`, `name` FROM `caches` WHERE `cache_id`= ? LIMIT 1", $objectid);
             if (!($r = XDb::xFetchArray($rs))) {
                 $allok = false;
             } else {
                 tpl_set_var('cachename', htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8'));
                 tpl_set_var('cacheid', $r['cache_id']);
Beispiel #16
0
<?php

use Utils\Database\XDb;
use Utils\Database\OcDb;
require './lib/common.inc.php';
require $stylepath . '/usertops.inc.php';
if ($error == false) {
    $userid = isset($_REQUEST['userid']) ? $_REQUEST['userid'] + 0 : 0;
    $tplname = 'usertops';
    $username = XDb::xMultiVariableQueryValue("SELECT `username` FROM `user` WHERE `user_id`= :1 LIMIT 1", null, $userid);
    if (!is_null($username)) {
        // user found
        tpl_set_var('userid', $userid);
        tpl_set_var('username', $username);
    } else {
        // user not found
        tpl_set_var('userid', 0);
        tpl_set_var('username', '-Not Found-');
        $userid = 0;
        $username = "******";
        $notop5 = $user_notfound;
    }
    $i = 0;
    $content = '';
    $dbc = OcDb::instance();
    $s = $dbc->multiVariableQuery("SELECT `cache_rating`.`cache_id` AS `cache_id`, `caches`.`name` AS `cachename`,\n                `user`.`username` AS `ownername`, `user`.`user_id` AS `owner_id`\n        FROM `cache_rating`, `caches`, `user`\n        WHERE `cache_rating`.`cache_id` = `caches`.`cache_id`\n            AND `caches`.`user_id`=`user`.`user_id`\n            AND `cache_rating`.`user_id`= :1 ORDER BY `caches`.`name` ASC", $userid);
    if ($dbc->rowCount($s) != 0) {
        while ($r = $dbc->dbResultFetch($s)) {
            $thisline = $viewtop5_line;
            $thisline = mb_ereg_replace('{cachename}', htmlspecialchars($r['cachename'], ENT_COMPAT, 'UTF-8'), $thisline);
            $thisline = mb_ereg_replace('{cacheid}', htmlspecialchars($r['cache_id'], ENT_COMPAT, 'UTF-8'), $thisline);
Beispiel #17
0
function notifyOwner($cacheid, $msgType)
{
    // msgType - 0 = cache accepted, 1 = cache declined (=archived)
    global $stylepath, $usr, $octeam_email, $site_name, $absolute_server_URI, $octeamEmailsSignature;
    $user_id = getCacheOwnerId($cacheid);
    $cachename = getCachename($cacheid);
    if ($msgType == 0) {
        $email_content = file_get_contents($stylepath . '/email/activated_cache.email');
    } else {
        $email_content = file_get_contents($stylepath . '/email/archived_cache.email');
    }
    $email_headers = "Content-Type: text/plain; charset=utf-8\r\n";
    $email_headers .= "From: {$site_name} <{$octeam_email}>\r\n";
    $email_headers .= "Reply-To: {$octeam_email}\r\n";
    $email_content = mb_ereg_replace('{server}', $absolute_server_URI, $email_content);
    $email_content = mb_ereg_replace('{cachename}', $cachename, $email_content);
    $email_content = mb_ereg_replace('{cacheid}', $cacheid, $email_content);
    $email_content = mb_ereg_replace('{octeamEmailsSignature}', $octeamEmailsSignature, $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_01}', tr('cacheArchived_01'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_02}', tr('cacheArchived_02'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_03}', tr('cacheArchived_03'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_04}', tr('cacheArchived_04'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_05}', tr('cacheArchived_05'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_01}', tr('Cacheactivated_01'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_02}', tr('Cacheactivated_02'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_03}', tr('Cacheactivated_03'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_04}', tr('Cacheactivated_04'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_05}', tr('Cacheactivated_05'), $email_content);
    $owner_email = XDb::xMultiVariableQueryValue("SELECT `email` FROM `user` WHERE `user_id`= :1 LIMIT 1", '', $user_id);
    if ($msgType == 0) {
        //send email to owner
        mb_send_mail($owner_email['email'], tr('viewPending_01') . ": " . $cachename, $email_content, $email_headers);
        //send email to approver
        mb_send_mail($usr['email'], tr('viewPending_01') . ": " . $cachename, tr('viewPending_02') . ":\n" . $email_content, $email_headers);
        // generate automatic log about status cache
        $log_text = tr("viewPending_03");
        $log_uuid = create_uuid();
        XDb::xSql("INSERT INTO `cache_logs`\n                (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`,`encrypt`)\n            VALUES ('', ?, ?, '12', NOW(), ?, '0', '0', NOW(), NOW(), ?, '2', '0')", $cacheid, $usr['userid'], $log_text, $log_uuid);
    } else {
        //send email to owner
        mb_send_mail($owner_email['email'], tr('viewPending_04') . ": " . $cachename, $email_content, $email_headers);
        //send email to approver
        mb_send_mail($usr['email'], tr('viewPending_04') . ": " . $cachename, tr('viewPending_05') . ":\n" . $email_content, $email_headers);
        // generate automatic log about status cache
        $log_text = tr("viewPending_06");
        $log_uuid = create_uuid();
        XDb::xSql("INSERT INTO `cache_logs`\n                (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`,`encrypt`)\n            VALUES ('', ?, ?, ?, NOW(), ?, ?, ?, NOW(), NOW(), ?, ?, ?)", $cacheid, $usr['userid'], 12, $log_text, 0, 0, $log_uuid, 2, 0);
    }
}
Beispiel #18
0
function user_id2uuid($id)
{
    XDb::xMultiVariableQueryValue('SELECT uuid FROM user WHERE user_id= :1 LIMIT 1', $id);
}
Beispiel #19
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 = '';
for ($i = 0; $i < $res2['num'] / $PER_PAGE; $i++) {
    $pages .= "<a href=\"javascript:load_data(" . $i . ");\">" . ($i + 1) . "</a> ";
}
$pages = htmlspecialchars($pages);
echo "<data count=\"" . $res2['num'] . "\" pager=\"" . $pages . "\" />\n";
echo "</markers>";
Beispiel #20
0
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>";
    }
}
echo '</td></tr></table>' . "\n";
Beispiel #21
0
use Utils\Database\XDb;
// Unicode Reminder ??
setlocale(LC_TIME, 'pl_PL.UTF-8');
//setlocale(LC_TIME, 'pl_PL.ISO-8859-2');
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
global $dynbasepath;
// Parameter
$jpeg_qualitaet = 80;
$fontfile = "./lib/fonts/arial.ttf";
# get userid and style from URL
$userid = isset($_REQUEST['userid']) ? $_REQUEST['userid'] : 0;
// nie licz spotkan, skrzynek jeszcze nieaktywnych, zarchiwizowanych i wstrzymanych
$hidden = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM caches\n    WHERE user_id= :1 AND status <> 2 AND status <> 3 AND status <> 4\n        AND status <> 5 AND status <> 6 AND type <> 6", 0, $userid);
$found = XDb::xMultiVariableQueryValue("SELECT COUNT(*) founds_count FROM cache_logs\n    WHERE user_id= :1 AND type=1 AND deleted=0", 0, $userid);
# get detailed info from DB
$rs = XDb::xSql("SELECT `username`, `statpic_logo`, `statpic_text` FROM `user`\n    WHERE `user_id`= ? LIMIT 1", $userid);
if ($record = XDb::xFetchArray($rs)) {
    $username = $record['username'];
    $logo = isset($record['statpic_logo']) ? $record['statpic_logo'] : 0;
    $logotext = isset($record['statpic_text']) ? $record['statpic_text'] : 'Opencaching';
} else {
    $userid = 0;
    $username = "******";
    $logo = 0;
    $logotext = 'Opencaching';
}
XDb::xFreeResults($rs);
$userid = $userid + 0;
if (!file_exists($dynbasepath . 'images/statpics/statpic' . $userid . '.jpg')) {
Beispiel #22
0
                 //crypt the log ROT13, but keep HTML-Tags and Entities
                 $data_text = str_rot13_html($data_text);
             } else {
                 $logtext .= "<br/>";
             }
             $logtext .= $data_text;
             $tmp_log = mb_ereg_replace('{logtext}', $logtext, $tmp_log);
             $content .= "\n" . $tmp_log;
         }
         XDb::xFreeResults($rs_logs);
         $content .= '</ul></div><br />';
     }
 }
 //  ----------------- begin  owner section  ----------------------------------
 if ($user_id == $usr['userid'] || $usr['admin']) {
     $rscheck = XDb::xMultiVariableQueryValue("SELECT count(*) FROM caches\n                WHERE (status = 4 OR status = 5 OR status = 6) AND `user_id`= :1", 0, $user_id);
     if ($rscheck != 0) {
         $content .= '<br /><div class="content-title-noshade box-blue">';
     }
     //get not published caches DATE_FORMAT(`caches`.`date_activate`,'%d-%m-%Y'),
     $geocachesNotPublished = $user->getGeocachesNotPublished();
     if ($geocachesNotPublished->count() > 0) {
         $content .= '<p><span class="content-title-noshade txt-blue08">' . tr('not_yet_published') . ':</span></p><br /><div><ul style="margin: -0.9em 0px 0.9em 0px; padding: 0px 0px 0px 10px; list-style-type: none; line-height: 1.2em; font-size: 115%;">';
         foreach ($geocachesNotPublished as $geocache) {
             $content .= "\n" . buildGeocacheHtml($geocache, $cache_notpublished_line);
         }
         $content .= '</ul></div>';
     }
     $waitAproveGeocaches = $user->getGeocachesWaitAproove();
     if ($waitAproveGeocaches->count() > 0) {
         $content .= '<br /><p><span class="content-title-noshade txt-blue08">' . tr('caches_waiting_approve') . ':</span></p><br /><div><ul style="margin: -0.9em 0px 0.9em 0px; padding: 0px 0px 0px 10px; list-style-type: none; line-height: 1.2em; font-size: 115%;">';
Beispiel #23
0
     require_once $rootpath . 'okapi/facade.php';
     \okapi\Facade::schedule_user_entries_check($log_record['cache_id'], $log_record['user_id']);
     \okapi\Facade::disable_error_handling();
     //Update last found
     $lastFoundDate = XDb::xMultiVariableQueryValue("SELECT MAX(`date`) AS `date` FROM `cache_logs`\n                         WHERE `type` = 1 AND `cache_id`= :1 AND deleted = 0", 'NULL', $log_record['cache_id']);
     XDb::xSql("UPDATE `caches` SET `last_found`=?, `founds`=?, `notfounds`=?, `notes`=? WHERE `cache_id`=?", $lastFoundDate, $cache_record['founds'], $cache_record['notfounds'], $cache_record['notes'], $log_record['cache_id']);
     unset($cache_record);
     //display cache page
     tpl_redirect('viewcache.php?cacheid=' . urlencode($log_record['cache_id']));
     exit;
 }
 // check if user has already found this cache and is not editing the found log (i.e. is able to change another comment's type to 'found')
 $already_found_in_other_comment = 0;
 $founds2 = XDb::xMultiVariableQueryValue("SELECT count(*) as founds FROM `cache_logs`\n                    WHERE user_id= :1 AND cache_id= :2 AND type='1' AND deleted=0", 0, $usr['userid'], $log_record['cache_id']);
 if ($founds2 > 0) {
     $founds3 = XDb::xMultiVariableQueryValue("SELECT count(*) as founds FROM `cache_logs`\n                        WHERE id= :1 AND type=1 AND deleted=0", 0, $log_id);
     if ($founds3 == 0) {
         $already_found_in_other_comment = 1;
     }
 }
 //build logtypeoptions
 $logtypeoptions = '';
 foreach ($log_types as $type) {
     // skip if permission=O ???? and not owner
     if ($type['permission'] == 'B' && $log_record['user_id'] != $cache_user_id && $usr['admin'] == false) {
         continue;
     }
     if ($log_record['logtype'] != $type['id'] && $log_record['cachestatus'] != 1) {
         continue;
     }
     if ($log_record['logtype'] != $type['id'] && $log_record['cachestatus'] == 1 && $log_record['user_id'] == $cache_user_id) {
Beispiel #24
0
function doesUserExist($username)
{
    return XDb::xMultiVariableQueryValue("SELECT user_id FROM user WHERE username= :1 ", 0, $username);
}
Beispiel #25
0
     $to[] = '- ';
     $from[] = ']]>';
     $to[] = ']] >';
     $from[] = '';
     $to[] = '';
     for ($i = 0; $i < count($from); $i++) {
         $str = str_replace($from[$i], $to[$i], $str);
     }
     return str_replace('[\\x00-\\x09|\\x0A-\\x0E-\\x1F]', '', $str);
     //filterevilchars
 }
 $username = XDb::xMultiVariableQueryValue("SELECT username FROM user WHERE user_id= :1 LIMIT 1", '', $user_id);
 tpl_set_var('username', $username);
 $LOGS_PER_PAGE = 50;
 $PAGES_LISTED = 10;
 $total_logs = XDb::xMultiVariableQueryValue("SELECT count(id) FROM cache_logs, caches WHERE `cache_logs`.`cache_id`=`caches`.`cache_id`\n                AND `cache_logs`.`deleted`=0\n                AND `caches`.`status` != 4\n                AND `caches`.`status` != 5\n                AND `caches`.`status` != 6\n                AND `cache_logs`.`user_id`= :1 ", 0, $user_id);
 $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 / $LOGS_PER_PAGE + 1 >= $PAGES_LISTED) {
     $pages .= '<a href="my_logs.php?userid=' . $user_id . '&amp;start=' . max(0, ($startat - $PAGES_LISTED - 1) * $LOGS_PER_PAGE) . '">{first_img}</a> ';
 } else {
     $pages .= "{first_img_inactive}";
 }
 for ($i = max(1, $startat); $i < min($startat + $PAGES_LISTED, $total_pages + 1); $i++) {
     $page_number = ($i - 1) * $LOGS_PER_PAGE;
Beispiel #26
0
 }
 $cache_uuid = create_uuid();
 //add record to caches table
 XDb::xSql("INSERT INTO `caches` SET\n                        `cache_id` = '', `user_id` = ?, `name` = ?, `longitude` = ?, `latitude` = ?, `last_modified` = NOW(),\n                        `date_created` = NOW(), `type` = ?, `status` = ?, `country` = ?, `date_hidden` = ?, `date_activate` = ?,\n                        `founds` = 0, `notfounds` = 0, `watcher` = 0, `notes` = 0, `last_found` = NULL, `size` = ?, `difficulty` = ?,\n                        `terrain` = ?, `uuid` = ?, `logpw` = ?, `search_time` = ?, `way_length` = ?, `wp_gc` = ?,\n                        `wp_nc` = ?, `wp_ge` = ?, `wp_tc` = ?, `node` = ? ", $usr['userid'], $name, $longitude, $latitude, $sel_type, $sel_status, $sel_country, date('Y-m-d', $hidden_date), $activation_date, $sel_size, $difficulty, $terrain, $cache_uuid, $log_pw, $search_time, $way_length, $wp_gc, $wp_nc, $wp_ge, $wp_tc, $oc_nodeid);
 $cache_id = XDb::xLastInsertId();
 // insert cache_location
 $code1 = $sel_country;
 $eLang = XDb::xEscape($lang);
 $adm1 = XDb::xMultiVariableQueryValue("SELECT `countries`.{$eLang} FROM `countries`\n                                    WHERE `countries`.`short`= :1 ", 0, $code1);
 // check if selected country has no districts, then use $default_region
 if ($sel_region == -1) {
     $sel_region = $default_region;
 }
 if ($sel_region != "0") {
     $code3 = $sel_region;
     $adm3 = XDb::xMultiVariableQueryValue("SELECT `name` FROM `nuts_codes`\n                        WHERE `code`= :1 ", 0, $sel_region);
 } else {
     $code3 = null;
     $adm3 = null;
 }
 XDb::xSql("INSERT INTO `cache_location` (cache_id,adm1,adm3,code1,code3)\n                    VALUES ( ?, ?, ?, ?, ?)", $cache_id, $adm1, $adm3, $code1, $code3);
 // update cache last modified, it is for work of cache_locations update information
 XDb::xSql("UPDATE `caches` SET `last_modified`=NOW() WHERE `cache_id`= ? ", $cache_id);
 // waypoint erstellen
 setCacheWaypoint($cache_id, $oc_waypoint);
 $desc_uuid = create_uuid();
 //add record to cache_desc table
 $desc = userInputFilter::purifyHtmlString($desc);
 $db->multiVariableQuery("INSERT INTO `cache_desc` (\n                        `cache_id`, `language`, `desc`, `hint`,\n                        `short_desc`, `last_modified`, `uuid`, `node` )\n                    VALUES (:1, :2, :3, :4, :5, NOW(), :6, :7)", $cache_id, $sel_lang, $desc, nl2br(htmlspecialchars($hints, ENT_COMPAT, 'UTF-8')), $short_desc, $desc_uuid, $oc_nodeid);
 GeoCache::setCacheDefaultDescLang($cache_id);
 // insert cache-attributes
Beispiel #27
0
function getUsername($userid)
{
    return XDb::xMultiVariableQueryValue("SELECT username FROM user WHERE user_id= :1 ", null, $userid);
}
         $access_log[$cache_id] = true;
         $_SESSION['CACHE_ACCESS_LOG_GPX_' . $user_id] = $access_log;
     }
 }
 $thisline = $gpxLine;
 $lat = sprintf('%01.5f', $r['latitude']);
 $thisline = str_replace('{lat}', $lat, $thisline);
 $lon = sprintf('%01.5f', $r['longitude']);
 $thisline = str_replace('{lon}', $lon, $thisline);
 $time = date($gpxTimeFormat, strtotime($r['date_hidden']));
 $thisline = str_replace('{{time}}', $time, $thisline);
 $thisline = str_replace('{{waypoint}}', $r['waypoint'], $thisline);
 $thisline = str_replace('{cacheid}', $r['cacheid'], $thisline);
 $thisline = str_replace('{cachename}', cleanup_text($r['name']), $thisline);
 $thisline = str_replace('{country}', tr($r['country']), $thisline);
 $region = XDb::xMultiVariableQueryValue("SELECT `adm3` FROM `cache_location` WHERE `cache_id`= :1 LIMIT 1", 0, $r['cacheid']);
 $thisline = str_replace('{region}', $region, $thisline);
 // modified coords
 if ($r['cache_mod_cords_id'] > 0) {
     // check if we have user coords
     $thisline = str_replace('{mod_suffix}', '(F)', $thisline);
 } else {
     $thisline = str_replace('{mod_suffix}', '', $thisline);
 }
 if ($r['hint'] == '') {
     $thisline = str_replace('{hints}', '', $thisline);
 } else {
     $thisline = str_replace('{hints}', cleanup_text($r['hint']), $thisline);
 }
 $logpw = $r['logpw'] == "" ? "" : "" . tr('search_gpxgc_01') . " <br />";
 $thisline = str_replace('{shortdesc}', cleanup_text($r['short_desc']), $thisline);
Beispiel #29
0
            myText.value = myText.value.substr(0, start) + parSmiley + selText + myText.value.substr(end);
            /* Cursorposition hinter Smiley setzen */
            myText.selectionStart = start + parSmiley.length;
            myText.selectionEnd = start + parSmiley.length;
        }
        /* fuer die anderen Browser */
        else
        {
            alert(navigator.appName + ': Setting smilies is not supported');
        }
    }

    function _chkFound() {

<?php 
$founds = XDb::xMultiVariableQueryValue("SELECT count(cache_id)\n    FROM cache_logs\n    WHERE `deleted`=0\n        AND cache_id = :1\n        AND user_id = :2\n        AND type='1'", 0, $_REQUEST['cacheid'], $usr['userid']);
?>


        if (document.logform.logtype.value == "1" || (<?php 
echo $founds;
?>
 > 0 && document.logform.logtype.value == "3") || document.logform.logtype.value == "7") {
            document.logform.r.disabled = false;
            //document.logform.rating.disabled = false;
        }
        else
        {
            document.logform.r.disabled = false;
            //document.logform.rating.disabled = true;
        }
Beispiel #30
0
function user_id2uuid($id)
{
    return XDb::xMultiVariableQueryValue("SELECT `uuid` FROM `user` WHERE `user_id`= :1 LIMIT 1", '', $id);
}