Esempio n. 1
0
/**
 *
 * Questa funzione aggiune un'opzione nel torneo => diventa variabile di sessione
 */
function Set_Tournament_Option($key, $value, $unset = false)
{
    if (empty($_SESSION['TourId']) || $_SESSION['TourId'] <= 0) {
        return;
    }
    $ConstToStore = array();
    $q = safe_r_sql("select ToOptions from Tournament where ToId={$_SESSION['TourId']}");
    $r = safe_fetch($q);
    if (!empty($r->ToOptions)) {
        $ConstToStore = unserialize($r->ToOptions);
    }
    if ($unset) {
        unset($ConstToStore[$key]);
    } else {
        $ConstToStore[$key] = $value;
    }
    safe_w_sql("update Tournament set ToOptions=" . StrSafe_DB(serialize($ConstToStore)) . " where ToId={$_SESSION['TourId']}");
    define_session_flags($ConstToStore);
}
Esempio n. 2
0
require_once 'Common/distro.inc.php';
// ALWAYS SET THE TIMEZONE TO UTC!!!!
date_default_timezone_set('UTC');
$CFG->LANGUAGE_PATH = $CFG->DOCUMENT_PATH . 'Common/Languages/';
require_once $CFG->DOCUMENT_PATH . 'Common/Fun_DB.inc.php';
require_once $CFG->DOCUMENT_PATH . 'Common/Globals.inc.php';
@(include_once $CFG->DOCUMENT_PATH . 'Common/config.inc.php');
@(include_once 'Common/DebugOverrides.php');
// Check if the DB is up to date
if (in_array($CFG->DOCUMENT_PATH . 'Common' . DIRECTORY_SEPARATOR . 'config.inc.php', get_included_files())) {
    $version = GetParameter('DBUpdate');
    if ($version < $newversion) {
        require_once 'Common/UpdateDb.inc.php';
    }
}
define_session_flags();
// restores some of the Session flags
if (!INSTALL and !file_exists($CFG->DOCUMENT_PATH . 'Common/config.inc.php') || empty($CFG->R_HOST) || empty($CFG->W_HOST) || empty($CFG->R_USER) || empty($CFG->W_USER) || empty($CFG->R_PASS) || empty($CFG->W_PASS) || empty($CFG->DB_NAME)) {
    $CFG->ROOT_DIR = substr($_SERVER['SCRIPT_NAME'], 0, strlen(dirname(__FILE__)) + strlen($_SERVER['SCRIPT_NAME']) - strlen(realpath($_SERVER['SCRIPT_FILENAME']))) . '/';
    cd_redirect($CFG->ROOT_DIR . 'Install/');
}
/*
Controllo del debug va in sessione
*/
if (!isset($_SESSION['debug'])) {
    if (file_exists($CFG->DOCUMENT_PATH . 'Common/config.inc.php')) {
        $_SESSION['debug'] = getparameter('DEBUG');
        // modificare a true per partire con il debug !!
    } else {
        $_SESSION['debug'] = false;
    }