示例#1
0
/**
 * Crea una sessione del torneo
 * @param $TourId: id del torneo
 * @return true se ci riesce e false altrimenti
 */
function CreateTourSession($TourId)
{
    $Select = "SELECT" . " Tournament.*" . ", UNIX_TIMESTAMP(ToWhenFrom) AS ToWhenFromUTS" . ", DATE_FORMAT(ToWhenFrom,'" . get_text('DateFmtDB') . "') AS DtFrom" . ", UNIX_TIMESTAMP(ToWhenTo) AS ToWhenToUTS" . ", DATE_FORMAT(ToWhenTo,'" . get_text('DateFmtDB') . "') AS DtTo" . ", ToTypeName AS TtName" . ", ToElimination AS TtElimination " . "FROM Tournament " . "WHERE ToId=" . StrSafe_DB($TourId) . " ";
    //print $Select;
    $Rs = safe_r_sql($Select);
    if (safe_num_rows($Rs) == 1) {
        $debug = $_SESSION['debug'];
        $debmode = !empty($_SESSION['debug-mode']) ? $_SESSION['debug-mode'] : '';
        $_SESSION = array();
        $_SESSION['debug'] = $debug;
        $_SESSION['debug-mode'] = $debmode;
        $MyRow = safe_fetch($Rs);
        $_SESSION['TourId'] = $MyRow->ToId;
        $_SESSION['TourType'] = $MyRow->ToType;
        $_SESSION['TourPrintLang'] = $MyRow->ToPrintLang;
        $_SESSION['TourLocRule'] = $MyRow->ToLocRule;
        $_SESSION['TourCode'] = $MyRow->ToCode;
        $_SESSION['TourCodeSafe'] = preg_replace('/[^a-z0-9_.-]+/sim', '', $MyRow->ToCode);
        $_SESSION['TourCollation'] = $MyRow->ToCollation;
        $_SESSION['TourName'] = $MyRow->ToName;
        $_SESSION['TourWhere'] = $MyRow->ToWhere;
        $_SESSION['TourRealWhenFrom'] = $MyRow->ToWhenFrom;
        $_SESSION['TourRealWhenTo'] = $MyRow->ToWhenTo;
        $_SESSION['TourWhenFrom'] = $MyRow->DtFrom;
        $_SESSION['TourWhenTo'] = $MyRow->DtTo;
        $_SESSION['ToWhenFromUTS'] = $MyRow->ToWhenFromUTS;
        $_SESSION['ToWhenToUTS'] = $MyRow->ToWhenToUTS;
        $_SESSION['ToPaper'] = $MyRow->ToPrintPaper;
        // parametri per le credenziali di upload verso ianseo.net
        $_SESSION['OnlineId'] = 0;
        $_SESSION['OnlineEventCode'] = 0;
        $_SESSION['OnlineAuth'] = 0;
        //Parametro per il Padding dei paglioni
        $_SESSION['TargetPadding'] = 2;
        // sets the collation for the tournament
        set_collation($MyRow->ToCollation);
        // if a collation is set for a tournament, this will be the default whatever language is chosen
        $_SESSION['COLLATION-LOCK'] = $MyRow->ToCollation != '';
        // Defines if a tournament is ORIS compliant or not
        $_SESSION['ISORIS'] = $MyRow->ToIsORIS;
        $q = "\r\n\t\t\tSELECT IFNULL(MAX(SesTar4Session),0) AS max_session\r\n\t\t\tFROM\r\n\t\t\t\tSession\r\n\t\t\tWHERE\r\n\t\t\t\tSesTournament={$MyRow->ToId}\r\n\t\t";
        $t = safe_r_sql($q);
        if ($u = safe_fetch($t)) {
            if ($u->max_session >= 100) {
                $_SESSION['TargetPadding'] = 3;
            } else {
                $_SESSION['TargetPadding'] = 2;
            }
        }
        $_SESSION['ClickMenu'] = GetParameter('OnClickMenu');
        // parametri per gli spareggi... e i menu
        set_qual_session_flags();
        return $MyRow;
    }
    return false;
}
示例#2
0
// setup connection
//------------------------------------------------------------------------------
$database_connection = @mysql_connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD);
@mysql_select_db(DATABASE_NAME, $database_connection);
if (mysql_error()) {
    $error_content = @file_get_contents('html/site_error.html');
    if (!empty($error_content)) {
        $error_content = str_ireplace(array('{HEADER_TEXT}', '{ERROR_SIGNATURE}', '{ERROR_MESSAGE}'), array('System Fatal Error', 'Database connection', SITE_MODE == 'development' ? 'Reporting details:<br>' . mysql_error() : 'Please check your database connection parameters!'), $error_content);
    } else {
        $error_content = 'System Fatal Error: ' . mysql_error();
    }
    echo $error_content;
    exit;
}
// set collation
set_collation();
// set group_concat max length
set_group_concat_max_length();
/// set sql_mode to empty if you have Mixing of GROUP columns SQL issue
///set_sql_mode();
// autoloading classes
//------------------------------------------------------------------------------
function __autoload($class_name)
{
    if ($class_name == 'PHPMailer') {
        require_once 'modules/phpmailer/class.phpmailer.php';
    } else {
        require_once 'classes/' . $class_name . '.class.php';
    }
}
if (defined('APPHP_CONNECT') && APPHP_CONNECT == 'direct') {