Пример #1
0
                $cache_id = mysql_insert_id($dblink);
                // do not use slave server for the next time ...
                db_slave_exclude();
                //add record to cache_desc table
                sql("INSERT INTO `cache_desc` (\n\t\t\t\t\t\t\t\t\t\t\t\t`id`,\n\t\t\t\t\t\t\t\t\t\t\t\t`cache_id`,\n\t\t\t\t\t\t\t\t\t\t\t\t`language`,\n\t\t\t\t\t\t\t\t\t\t\t\t`desc`,\n\t\t\t\t\t\t\t\t\t\t\t\t`desc_html`,\n\t\t\t\t\t\t\t\t\t\t\t\t`hint`,\n\t\t\t\t\t\t\t\t\t\t\t\t`short_desc`,\n\t\t\t\t\t\t\t\t\t\t\t\t`last_modified`,\n\t\t\t\t\t\t\t\t\t\t\t\t`desc_htmledit`,\n\t\t\t\t\t\t\t\t\t\t\t\t`node`\n\t\t\t\t\t\t\t\t\t\t\t) VALUES ('', '&1', '&2', '&3', '&4', '&5', '&6', NOW(), '&7', '&8')", $cache_id, $sel_lang, $desc, $descMode != 1 ? 1 : 0, nl2br(htmlspecialchars($hints, ENT_COMPAT, 'UTF-8')), $short_desc, $descMode == 3 ? 1 : 0, $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) {
                    //do event handling
                    include_once $opt['rootpath'] . '/lib/eventhandler.inc.php';
                    event_notify_new_cache($cache_id + 0);
                    event_new_cache($usr['userid'] + 0);
                }
                // redirection
                tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id));
            } else {
                tpl_set_var('general_message', $error_general);
            }
        }
    }
}
if ($no_tpl_build == false) {
    tpl_set_var('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
    tpl_set_var('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
    // make the template and send it out
    tpl_BuildTemplate();
Пример #2
0
<?php

/**
 * This script publishes the cache if its activation_date was set
 */
use Utils\Database\XDb;
use lib\Objects\GeoCache\GeoCache;
$rootpath = '../../';
require_once $rootpath . 'lib/ClassPathDictionary.php';
require_once $rootpath . 'lib/eventhandler.inc.php';
require_once $rootpath . 'lib/consts.inc.php';
require_once $rootpath . 'lib/settings.inc.php';
$rsPublish = XDb::xSql("SELECT `cache_id`, `user_id`\n                FROM `caches`\n                WHERE `status` = 5\n                  AND `date_activate` != 0\n                  AND `date_activate` <= NOW()");
while ($rPublish = XDb::xFetchArray($rsPublish)) {
    $userid = $rPublish['user_id'];
    $cacheid = $rPublish['cache_id'];
    // update cache status to active
    XDb::xSql("UPDATE `caches` SET `status`=1, `date_activate`=NULL, `last_modified`=NOW() WHERE `cache_id`= ? ", $cacheid);
    // send events
    GeoCache::touchCache($cacheid);
    event_new_cache($userid);
    event_notify_new_cache($cacheid);
}
XDb::xFreeResults($rsPublish);