Example #1
0
     $activation_date = "'" . date('Y-m-d H:i:s', mktime($activate_hour, 0, 0, $activate_month, $activate_day, $activate_year)) . "'";
 } elseif ($publish == 'notnow') {
     $sel_status = 5;
     $activation_date = 'NULL';
 } else {
     // should never happen
     $activation_date = 'NULL';
 }
 $cache_uuid = create_uuid();
 //add record to caches table
 sql("INSERT INTO `caches` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t`cache_id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`user_id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`name`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`longitude`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`latitude`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`type` ,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`status` ,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`country` ,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`date_hidden` ,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`date_activate` ,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`size` ,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`difficulty` ,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`terrain`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`uuid`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`logpw`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`search_time`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`way_length`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`wp_gc`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`wp_nc`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t`node`\r\n\t\t\t\t\t\t\t\t\t\t\t) VALUES (\r\n\t\t\t\t\t\t\t\t\t\t\t\t'', '&1', '&2', '&3', '&4', '&5', '&6', '&7', '&8', {$activation_date}, \r\n\t\t\t\t\t\t\t\t\t\t\t\t'&9', '&10', '&11', '&12', '&13', '&14', '&15', '&16', '&17', '&18')", $usr['userid'], $name, $longitude, $latitude, $sel_type, $sel_status, $sel_country, date('Y-m-d', $hidden_date), $sel_size, $difficulty, $terrain, $cache_uuid, $log_pw, $search_time, $way_length, $wp_gc, $wp_nc, $oc_nodeid);
 $cache_id = mysql_insert_id($dblink);
 // do not use slave server for the next time ...
 db_slave_exclude();
 // waypoint erstellen
 setCacheWaypoint($cache_id);
 $desc_uuid = create_uuid();
 //add record to cache_desc table
 if ($descMode != 1) {
     sql("INSERT INTO `cache_desc` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`cache_id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`language`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`desc`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`desc_html`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`hint`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`short_desc`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`last_modified`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`uuid`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`desc_htmledit`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`node`\r\n\t\t\t\t\t\t\t\t\t\t\t\t) VALUES ('', '&1', '&2', '&3', '1', '&4', '&5', NOW(), '&6', '&7', '&8')", $cache_id, $sel_lang, $desc, nl2br(htmlspecialchars($hints, ENT_COMPAT, 'UTF-8')), $short_desc, $desc_uuid, $descMode == 3 ? 1 : 0, $oc_nodeid);
 } else {
     sql("INSERT INTO `cache_desc` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`cache_id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`language`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`desc`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`desc_html`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`hint`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`short_desc`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`last_modified`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`uuid`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`desc_htmledit`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`node`\r\n\t\t\t\t\t\t\t\t\t\t\t\t) VALUES ('', '&1', '&2', '&3', '0', '&4', '&5', NOW(), '&6', 0, '&7')", $cache_id, $sel_lang, nl2br(htmlspecialchars($desc, ENT_COMPAT, 'UTF-8')), nl2br(htmlspecialchars($hints, ENT_COMPAT, 'UTF-8')), $short_desc, $desc_uuid, $oc_nodeid);
 }
 // insert cache-attributes
 for ($i = 0; $i < count($cache_attribs); $i++) {
     if ($cache_attribs[$i] + 0 > 0) {
         sql("INSERT INTO `caches_attributes` (`cache_id`, `attrib_id`) VALUES ('&1', '&2')", $cache_id, $cache_attribs[$i] + 0);
     }
 }
 // only if cache is published NOW or activate_date is in the past
 if ($publish == 'now2' || $publish == 'later' && mktime($activate_hour, 0, 0, $activate_month, $activate_day, $activate_year) <= $today) {
Example #2
0
 // 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 = sqlValue("SELECT `name` FROM `nuts_codes` WHERE `code`='" . sql_escape($sel_region) . "'", 0);
 } else {
     $code3 = null;
     $adm3 = null;
 }
 sql("INSERT INTO `cache_location` (cache_id,adm1,adm3,code1,code3) VALUES ('&1','&2','&3','&4','&5')", $cache_id, $adm1, $adm3, $code1, $code3);
 // update cache last modified, it is for work of cache_locations update information
 sql("UPDATE `caches` SET `last_modified`=NOW() WHERE `cache_id`='&1'", $cache_id);
 // waypoint erstellen
 setCacheWaypoint($cache_id, $oc_waypoint);
 $desc_uuid = create_uuid();
 //add record to cache_desc table
 $desc = userInputFilter::purifyHtmlString($desc);
 $query = "INSERT INTO `cache_desc` (\n                                                `cache_id`,\n                                                `language`,\n                                                `desc`,\n                                                `hint`,\n                                                `short_desc`,\n                                                `last_modified`,\n                                                `uuid`,\n                                                `node`\n                                            ) VALUES (:1, :2, :3, :4, :5, NOW(), :6, :7)";
 $db->multiVariableQuery($query, $cache_id, $sel_lang, $desc, nl2br(htmlspecialchars($hints, ENT_COMPAT, 'UTF-8')), $short_desc, $desc_uuid, $oc_nodeid);
 setCacheDefaultDescLang($cache_id);
 // insert cache-attributes
 for ($i = 0; $i < count($cache_attribs); $i++) {
     if ($cache_attribs[$i] + 0 > 0) {
         sql("INSERT INTO `caches_attributes` (`cache_id`, `attrib_id`) VALUES ('&1', '&2')", $cache_id, $cache_attribs[$i] + 0);
     }
 }
 // only if no approval is needed and cache is published NOW or activate_date is in the past
 if (!$needs_approvement && ($publish == 'now' || $publish == 'later' && mktime($activate_hour, 0, 0, $activate_month, $activate_day, $activate_year) <= $today)) {
     //do event handling
Example #3
0
<?php

$rootpath = '../../';
require_once $rootpath . 'lib/settings.inc.php';
require_once $rootpath . 'lib/clicompatbase.inc.php';
/* begin db connect */
$bFail = false;
$dblink = mysql_connect($dbserver, $dbusername, $dbpasswd);
if ($dblink != false) {
    //database connection established ... set the used database
    if (@mysql_select_db($dbname, $dblink) == false) {
        $bFail = true;
        mysql_close($dblink);
        $dblink = false;
    }
} else {
    $bFail = true;
}
if ($bFail == true) {
    echo 'Unable to connect to database';
    exit;
}
/* end db connect */
$rs = sql('SELECT `cache_id` FROM `caches` WHERE ISNULL(`wp_oc`)');
while ($r = mysql_fetch_array($rs)) {
    setCacheWaypoint($r['cache_id']);
}
mysql_free_result($rs);