Ejemplo n.º 1
0
 /**
  * safeFilter()
  * Protegge con gli apici gli elementi di $this->opts['events']
  *
  * @return mixed: false se non c'è filtro oppure la stringa da inserire nella where delle query
  */
 protected function safeFilter()
 {
     $ret = array();
     if (!empty($this->opts['events'])) {
         if (!is_array($this->opts['events'])) {
             $this->opts['events'] = array($this->opts['events']);
         }
         $f = array();
         foreach ($this->opts['events'] as $e) {
             @(list($event, $phase) = explode('@', $e));
             if ($event and !is_null($phase)) {
                 $f[] = '(EvCode=' . StrSafe_DB($event) . ' AND GrPhase=' . $phase . ')';
             } elseif ($event) {
                 $f[] = '(EvCode=' . StrSafe_DB($event) . ')';
             } elseif (!is_null($phase)) {
                 $f[] = '(GrPhase=' . $phase . ')';
             }
         }
         if ($f) {
             $ret[] = '(' . implode(' OR ', $f) . ')';
         }
     }
     if (!empty($this->opts['schedule'])) {
         $ret[] = "CONCAT(FSScheduledDate,' ',FSScheduledTime)=" . StrSafe_DB($this->opts['schedule']) . "";
     }
     if ($ret) {
         return ' AND ' . implode(' AND ', $ret);
     }
     return '';
 }
Ejemplo n.º 2
0
 function __construct($TemplateID = 0)
 {
     parent::__construct('BackNumber');
     $Select = "SELECT BackNumber.*, LENGTH(BnBackground) as ImgSize  " . "FROM BackNumber  " . "WHERE BnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND BnFinal in (0," . $TemplateID . ") order by BnFinal desc limit 1";
     //print $Select;exit;
     $Rs = safe_r_sql($Select);
     if (safe_num_rows($Rs) == 1) {
         $this->RowBn = safe_fetch($Rs);
     } else {
         // fall back if no Backnumber creates from template!
         include_once 'Tournament/BackNumberEmpty.php';
         $this->RowBn = emptyBackNumber();
     }
     $this->Rotation = $this->RowBn->BnOffsetX != 0 || $this->RowBn->BnOffsetY != 0;
     $this->RotX = $this->RowBn->BnWidth / 2;
     $this->RotY = $this->RowBn->BnOffsetY / 2;
     // TargetNo Specs
     $this->TargetNoFont = ($this->RowBn->BnTargetNo & 4) == 4 ? $this->FontFix : (($this->RowBn->BnTargetNo & 2) == 2 ? 'dejavuserif' : $this->FontStd);
     $this->TargetNoStyle = ($this->RowBn->BnTargetNo & 8 ? 'B' : '') . ($this->RowBn->BnTargetNo & 16 ? 'I' : '');
     $this->TargetNoColor = array(base_convert(substr($this->RowBn->BnTnoColor, 0, 2), 16, 10), base_convert(substr($this->RowBn->BnTnoColor, 2, 2), 16, 10), base_convert(substr($this->RowBn->BnTnoColor, 4, 2), 16, 10));
     $this->TargetNoAlign = ($this->RowBn->BnTargetNo & 96) == 64 ? 'L' : (($this->RowBn->BnTargetNo & 96) == 32 ? 'R' : 'C');
     // Athlete Specs
     $this->AthleteFont = ($this->RowBn->BnAthlete & 4) == 4 ? $this->FontFix : (($this->RowBn->BnAthlete & 2) == 2 ? 'dejavuserif' : $this->FontStd);
     $this->AthleteStyle = ($this->RowBn->BnAthlete & 8 ? 'B' : '') . ($this->RowBn->BnAthlete & 16 ? 'I' : '');
     $this->AthleteColor = array(base_convert(substr($this->RowBn->BnAthColor, 0, 2), 16, 10), base_convert(substr($this->RowBn->BnAthColor, 2, 2), 16, 10), base_convert(substr($this->RowBn->BnAthColor, 4, 2), 16, 10));
     $this->AthleteAlign = ($this->RowBn->BnAthlete & 96) == 64 ? 'L' : (($this->RowBn->BnAthlete & 96) == 32 ? 'R' : 'C');
     if ($this->RowBn->BnCapitalFirstName) {
         $this->FirstNameAllCaps = true;
     }
     // Country Specs
     $this->CountryFont = ($this->RowBn->BnCountry & 4) == 4 ? $this->FontFix : (($this->RowBn->BnCountry & 2) == 2 ? 'dejavuserif' : $this->FontStd);
     $this->CountryStyle = ($this->RowBn->BnCountry & 8 ? 'B' : '') . ($this->RowBn->BnCountry & 16 ? 'I' : '');
     $this->CountryColor = array(base_convert(substr($this->RowBn->BnCoColor, 0, 2), 16, 10), base_convert(substr($this->RowBn->BnCoColor, 2, 2), 16, 10), base_convert(substr($this->RowBn->BnCoColor, 4, 2), 16, 10));
     $this->CountryAlign = ($this->RowBn->BnCountry & 96) == 64 ? 'L' : (($this->RowBn->BnCountry & 96) == 32 ? 'R' : 'C');
     // background temp creation
     if ($this->RowBn->ImgSize) {
         $this->BackGroundFile = tempnam('/tmp', 'bgf');
         $img = imagecreatefromstring($this->RowBn->BnBackground);
         if (!imagepng($img, $this->BackGroundFile)) {
             die('could not create image');
         }
     }
     $Orientation = $this->RowBn->BnWidth > $this->RowBn->BnHeight ? 'L' : 'P';
     $this->setPageOrientation($Orientation);
     $this->setPageFormat(array($this->RowBn->BnWidth, $this->RowBn->BnHeight), $Orientation);
     $this->SetFont($this->FontStd, '', 10);
     $this->AliasNbPages();
     $this->setPrintHeader(false);
     $this->setPrintFooter(false);
     $this->SetMargins(10, 10, 10);
     $this->SetAutoPageBreak(false, 10);
     $this->SetAuthor('http://www.ianseo.net');
     $this->SetCreator('Software Design by Ianseo');
     $this->SetTitle('IANSEO - Integrated Result System (release ' . ProgramVersion . ')');
     $this->SetSubject('BackNo');
 }
/**
 * Processa il file di setup $File2Proc
 *
 * @param String $File2Proc: file da processare (solo il basename!)
 * @param Int $Id: id del torneo
 *
 * @return void
 */
function ProcessSetupFile($Id, $File2Proc = 'Setup.set')
{
    $ff = $File2Proc;
    $fh = @file($ff);
    if ($fh) {
        foreach ($fh as $Buffer) {
            if (trim($Buffer) and substr($Buffer, 0, 1) != '#') {
                $Query = str_replace('##TourId##', StrSafe_DB($Id), $Buffer);
                $Rs = safe_w_sql($Query);
            }
        }
    }
}
Ejemplo n.º 4
0
function MakePhaseFilter($Phase)
{
    $Ret = '';
    if (trim($Phase) != '') {
        $Arr_Ph = explode('|', $Phase);
        if (is_array($Arr_Ph)) {
            foreach ($Arr_Ph as $Key => $Value) {
                $Arr_Ph[$Key] = StrSafe_DB($Value);
            }
            $Ret = "IN (" . implode(',', $Arr_Ph) . ") ";
        }
    }
    return $Ret;
}
Ejemplo n.º 5
0
function WriteTeam($CurTeam, $CurSubTeam, $CurComponent, $EventCode, $Scores, $Golds, $XNines)
{
    // Insert in Teams
    $InsertQuery = "REPLACE INTO Teams (TeCoId,TeSubTeam,TeEvent,TeTournament,TeFinEvent,TeScore,TeGold,TeXNine,TeFinal) " . "VALUES(" . StrSafe_DB($CurTeam) . "," . StrSafe_DB($CurSubTeam) . "," . StrSafe_DB($EventCode) . "," . StrSafe_DB($_SESSION['TourId']) . "," . "'0'," . StrSafe_DB(array_sum($Scores)) . "," . StrSafe_DB(array_sum($Golds)) . "," . StrSafe_DB(array_sum($XNines)) . "," . "'0'" . ") ";
    $RsT = safe_w_sql($InsertQuery);
    if (empty($CurComponent)) {
        return;
    }
    $InsertQuery = "REPLACE INTO TeamComponent (TcCoId,TcSubTeam, TcTournament,TcEvent,TcFinEvent,TcId,TcOrder) VALUES ";
    for ($i = 0; $i < count($CurComponent); $i++) {
        $InsertQuery .= "(" . StrSafe_DB($CurTeam) . "," . StrSafe_DB($CurSubTeam) . "," . StrSafe_DB($_SESSION['TourId']) . "," . StrSafe_DB($EventCode) . "," . "'0'," . StrSafe_DB($CurComponent[$i]) . "," . StrSafe_DB($i + 1) . '), ';
    }
    $InsertQuery = substr($InsertQuery, 0, -2);
    $RsT = safe_w_sql($InsertQuery);
}
Ejemplo n.º 6
0
 /**
  * safeFilterR()
  * Protegge con gli apici gli elementi di $this->opts['eventsR']
  *
  * @return mixed: false se non c'è filtro oppure la stringa da inserire nella where delle query
  */
 protected function safeFilterR()
 {
     $filter = false;
     if (array_key_exists('eventsR', $this->opts)) {
         if (is_array($this->opts['eventsR']) && count($this->opts['eventsR']) > 0) {
             $filter = array();
             foreach ($this->opts['eventsR'] as $e) {
                 $filter[] = StrSafe_DB($e);
             }
             $filter = "AND EvCode IN(" . implode(',', $filter) . ")";
         } elseif (gettype($this->opts['eventsR']) == 'string' && trim($this->opts['eventsR']) != '') {
             $filter = "AND EvCode LIKE '" . $this->opts['eventsR'] . "' ";
         } else {
             $filter = false;
         }
     } else {
         $filter = false;
     }
     return $filter;
 }
Ejemplo n.º 7
0
/**
 * GetSessions().
 * Ritorna l'elenco di tutte le sessioni.
 * La chiave sarà SesOrder_SesType e la descrizione cambierà a seconda del valore di $extend
 *
 * @param char $type: tipo di sessione; null => tutte, Q qualifica E eliminatorie F final
 * @param bool $extend: true per la descrizione estesa: 'Nome (Tipo Ordine)' false per quella breve: Nome (Ordine)
 * @param string[] $ids: vettore di id. se specificato verranno ritornati quelli
 * @param int $tour: null considera il torneo aperto se no quello passato.
 *
 * @return mixed: array con l'elenco delle sessioni con la descrizione impostata in base a $extend e l'id SesOrder_SesType
 */
function GetSessions($type = null, $extend = false, $ids = null, $tour = null)
{
    $tour = !is_null($tour) ? $tour : $_SESSION['TourId'];
    $sessionsTypes = GetSessionsTypes();
    $filter = "SesTournament=" . StrSafe_DB($tour) . " ";
    if (is_null($ids)) {
        if (!is_null($type) && array_key_exists($type, $sessionsTypes)) {
            $filter .= "AND SesType='" . $type . "' ";
        }
    } else {
        if (!is_array($ids)) {
            $ids = array($ids);
        }
        $in = array();
        for ($i = 0; $i < count($ids); ++$i) {
            $in[] = StrSafe_DB($ids[$i]);
        }
        $filter .= "AND CONCAT(SesOrder,'_',SesType) IN (" . implode(',', $in) . ") ";
    }
    $ret = array();
    $q = "SELECT * FROM Session WHERE {$filter} ORDER BY locate(SesType, 'QEF'), SesOrder ";
    $r = safe_r_sql($q);
    // 	debug_svela($q);
    if ($r && safe_num_rows($r) > 0) {
        while ($row = safe_fetch($r)) {
            $tmp = $row;
            $tmp->Id = $row->SesOrder . '_' . $row->SesType;
            if ($row->SesName != '') {
                $tmp->Descr = $row->SesOrder . ': ' . $row->SesName;
                if ($extend) {
                    $tmp->Descr = $row->SesName . ' (' . $sessionsTypes[$row->SesType] . ' ' . $row->SesOrder . ')';
                }
            } else {
                $tmp->Descr = $tmp->SesOrder;
            }
            $ret[] = $tmp;
        }
    }
    return $ret;
}
Ejemplo n.º 8
0
function tour_delete($TourId)
{
    $TableArray = array("AccColors" => "AcTournament", "AccEntries" => "AETournament", "AccPrice" => "APTournament", "ACL" => "AclTournament", 'AclDetails' => 'AclDtTournament', "AvailableTarget" => "AtTournament", "Awards" => "AwTournament", "Awarded" => "AwTournament", "BackNumber" => "BnTournament", "BoinxSchedule" => "BsTournament", "CasScore" => "CaSTournament", "CasTeam" => "CaTournament", "CasTeamFinal" => "CTFTournament", "CasTeamTarget" => "CTTTournament", "Classes" => "ClTournament", "Countries" => "CoTournament", "DistanceInformation" => "DiTournament", "Divisions" => "DivTournament", "Eliminations" => "ElTournament", "Emails" => "EmTournament", "Entries" => "EnTournament", "EventClass" => "EcTournament", "Events" => "EvTournament", "Individuals" => "IndTournament", "F2FGrid" => "F2FTournament", "F2FEntries" => "F2FTournament", "F2FFinal" => "F2FTournament", "FinalReportA" => "FraTournament", "Finals" => "FinTournament", "FinSchedule" => "FSTournament", "FinTraining" => 'FtTournament', "FinTrainingEvent" => 'FteTournament', "Flags" => 'FlTournament', "GuessWho" => 'GwTournament', "GuessWhoData" => 'GwdTournament', "HhtData" => "HdTournament", "HhtEvents" => "HeTournament", "HhtSetup" => "HsTournament", "IdCardElements" => "IceTournament", "IdCards" => "IcTournament", "Images" => "ImTournament", 'ModulesParameters' => 'MpTournament', 'PrintOutsRules' => 'PorTournament', 'RecTournament' => 'RtTournament', "Reviews" => "RevTournament", "Scheduler" => "SchTournament", "Session" => "SesTournament", "SubClass" => "ScTournament", "TargetFaces" => "TfTournament", "TargetGroups" => "TgTournament", "TeamComponent" => "TcTournament", "TeamFinals" => "TfTournament", "TeamFinComponent" => "TfcTournament", "Teams" => "TeTournament", "Tournament" => "ToId", "TournamentDistances" => "TdTournament", "TournamentInvolved" => "TiTournament", "TourRecords" => "TrTournament", "TVContents" => "TVCTournament", "TVOut" => "TvTournament", "TVParams" => "TVPTournament", "TVRules" => "TVRTournament", "TVSequence" => "TVSTournament", "VegasAwards" => "VaTournament");
    foreach ($TableArray as $Key => $Value) {
        $Sql = "DELETE FROM " . $Key . " WHERE " . $Value . " = " . StrSafe_DB($TourId);
        safe_w_sql($Sql);
    }
    $Sql = "DELETE FROM Qualifications WHERE QuId NOT IN (SELECT EnId From Entries) ";
    safe_w_sql($Sql);
    $Sql = "DELETE FROM ElabQualifications WHERE EqId NOT IN (SELECT EnId From Entries) ";
    safe_w_sql($Sql);
    $Sql = "DELETE FROM Eliminations WHERE ElId NOT IN (SELECT EnId From Entries) ";
    safe_w_sql($Sql);
    $Sql = "DELETE FROM Individuals WHERE IndId NOT IN (SELECT EnId From Entries) ";
    safe_w_sql($Sql);
    $Sql = "DELETE FROM Photos WHERE PhEnId NOT IN (SELECT EnId From Entries) ";
    safe_w_sql($Sql);
    $Sql = "DELETE FROM Vegas WHERE VeId NOT IN (SELECT EnId From Entries) ";
    safe_w_sql($Sql);
    $Sql = "DELETE FROM ExtraData WHERE EdId NOT IN (SELECT EnId From Entries) ";
    safe_w_sql($Sql);
}
Ejemplo n.º 9
0
/**
 * Cerca quale evento è live in questo momento
 * Se trova più eventi contemporanei ritorna i dati di quello con modifiche più recenti.
 *
 * @param Int $Team: vale 0 se l'evento è individuale e 1 se è a squadre.
 *
 * @return Array: Un vettore formato dall'Evento e dal MatchNo oppure false in caso di errore.
 * 					Se non ci sono eventi live viene ritornato array(NULL,NULL)
 */
function FindLive($Team = -1)
{
    if ($Team == 0) {
        $Select = "SELECT" . "  '0' Team" . " , FinDateTime DateTime" . " , FinEvent AS Event" . " , FinMatchNo AS MatchNo" . " FROM" . "  Finals " . " WHERE" . "  FinTournament=" . StrSafe_DB($_SESSION['TourId']) . "  AND FinLive='1' " . "ORDER BY" . " Team," . " DateTime DESC," . " Event ASC," . " MatchNo ASC ";
    } elseif ($Team == 1) {
        $Select = "SELECT" . "  '1' Team " . " , TfDateTime DateTime" . " , TfEvent AS Event " . " , TfMatchNo AS MatchNo " . " FROM" . "  TeamFinals " . " WHERE" . "  TfTournament=" . StrSafe_DB($_SESSION['TourId']) . "  AND TfLive='1' " . "ORDER BY" . " Team," . " DateTime DESC," . " Event ASC," . " MatchNo ASC";
    } elseif ($Team == -1) {
        $Select = "(SELECT" . "  '0' Team" . " , FinDateTime DateTime" . " , FinEvent AS Event" . " , FinMatchNo AS MatchNo" . " FROM" . "  Finals " . " WHERE" . "  FinTournament=" . StrSafe_DB($_SESSION['TourId']) . "  AND FinLive='1') " . "UNION " . "(SELECT" . "  '1' Team " . " , TfDateTime DateTime " . " , TfEvent AS Event " . " , TfMatchNo AS MatchNo " . " FROM" . "  TeamFinals " . " WHERE" . "  TfTournament=" . StrSafe_DB($_SESSION['TourId']) . "  AND TfLive='1') " . "ORDER BY" . " Team," . " DateTime DESC," . " Event ASC," . " MatchNo ASC ";
    } else {
        return '';
    }
    $Rs = safe_r_sql($Select);
    // at least 2 rows because "live" is set on both opponents!
    if (safe_num_rows($Rs) < 2) {
        return '';
    }
    $MyRow1 = safe_fetch($Rs);
    $MyRow2 = safe_fetch($Rs);
    // check if these are really 2 opponents in the same match!!
    if ($MyRow1->Event == $MyRow2->Event and $MyRow1->Team == $MyRow2->Team and ($MyRow1->MatchNo == $MyRow2->MatchNo - 1 or $MyRow1->MatchNo == $MyRow2->MatchNo + 1)) {
        return array($MyRow1->Event, min($MyRow1->MatchNo, $MyRow2->MatchNo), $MyRow1->Team);
    }
    return '';
}
Ejemplo n.º 10
0
function SetAccreditation($Id, $SetRap = 0, $return = 'RicaricaOpener', $TourId = 0, $AccOp = 0)
{
    $RicaricaOpener = false;
    if (!$TourId) {
        $TourId = $_SESSION['TourId'];
    }
    if (!$AccOp) {
        $AccOp = $_SESSION['AccOp'];
    }
    /*
     * Devo prevenire l'insert se l'id è in stato 7.
     * Per farlo cerco lo stato del tizio.
     * Se è 7 vuol dire che uno ha cliccato sul bottone dopo aver aperto il popup e io non scrivo in db
     */
    $Select = "SELECT EnId FROM Entries\n\t\tWHERE EnId=" . StrSafe_DB($Id) . " AND EnTournament={$TourId} AND EnStatus='7' ";
    $Rs = safe_r_sql($Select);
    //TODO Patchare la query per supportare bene IpV6
    if (safe_num_rows($Rs) == 0) {
        $Insert = "INSERT INTO AccEntries\n\t\t\t(AEId,AEOperation,AETournament,AEWhen,AEFromIp,AERapp)\n\t\t\tVALUES(\n\t\t\t\t{$Id}," . StrSafe_DB($AccOp) . "," . StrSafe_DB($TourId) . "," . StrSafe_DB(date('Y-m-d H:i')) . "," . "INET_ATON('" . ($_SERVER['REMOTE_ADDR'] != '::1' ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1') . "'), " . StrSafe_DB($SetRap) . "" . ") ON DUPLICATE KEY UPDATE " . "AEWhen=" . StrSafe_DB(date('Y-m-d H:i')) . "," . "AEFromIp=INET_ATON('" . ($_SERVER['REMOTE_ADDR'] != '::1' ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1') . "') ";
        $RsIns = safe_w_sql($Insert);
        $RicaricaOpener = $return == 'RicaricaOpener' ? true : (safe_w_affected_rows() ? 'AccreditationOK' : 'AccreditationTwice');
    }
    return $RicaricaOpener;
}
Ejemplo n.º 11
0
if (!IsBlocked(BIT_BLOCK_PARTICIPANT)) {
    $recalc = false;
    $indFEvent = $teamFEvent = $country = $div = $cl = $zero = null;
    // se cambio status ricalcolo gli spareggi
    $query = "SELECT EnClass FROM Entries WHERE EnId=" . StrSafe_DB($id) . " AND EnStatus<>" . StrSafe_DB($status) . " ";
    //print $query;exit;
    $rs = safe_r_sql($query);
    if ($rs && safe_num_rows($rs) == 1) {
        $recalc = true;
        $x = Params4Recalc($id);
        if ($x !== false) {
            list($indFEvent, $teamFEvent, $country, $div, $cl, $zero) = $x;
        }
    }
    //Adesso aggiorno lo status
    $query = "UPDATE " . "Entries " . "SET " . "EnStatus=" . StrSafe_DB($status) . " " . "WHERE " . "EnId=" . StrSafe_DB($id) . " ";
    $rs = safe_w_sql($query);
    if (!$rs) {
        $error = 1;
    }
    if ($recalc) {
        // ricalcolo il vecchio e il nuovo
        if (!is_null($indFEvent)) {
            RecalculateShootoffAndTeams($indFEvent, $teamFEvent, $country, $div, $cl, $zero);
        }
        // rank di classe x tutte le distanze
        $q = "SELECT ToNumDist FROM Tournament WHERE ToId={$_SESSION['TourId']}";
        $r = safe_r_sql($q);
        $tmpRow = safe_fetch($r);
        for ($i = 0; $i < $tmpRow->ToNumDist; ++$i) {
            if (!is_null($indFEvent)) {
Ejemplo n.º 12
0
    exit;
}
$Errore = 0;
if (!IsBlocked(BIT_BLOCK_TOURDATA) && !defined('dontEditClassDiv')) {
    $Age = $_REQUEST['Age'];
    $ClId = $_REQUEST['ClId'];
    if (!is_numeric($Age)) {
        $Errore = 1;
    } else {
        $ClDivAllowed = empty($_REQUEST['AlDivs']) ? '' : $_REQUEST['AlDivs'];
        if (!CheckClassAge($ClId, $Age, $_REQUEST['FromTo'], $ClDivAllowed)) {
            $Errore = 1;
        }
    }
    if (!$Errore) {
        $Update = "UPDATE Classes SET " . "ClAge" . $_REQUEST['FromTo'] . "=" . StrSafe_DB($Age) . " " . ", ClDivisionsAllowed=" . StrSafe_DB($ClDivAllowed) . " " . "WHERE ClId=" . StrSafe_DB($ClId) . " AND ClTournament=" . StrSafe_DB($_SESSION['TourId']) . "";
        $Rs = safe_w_sql($Update);
        $err = safe_w_error();
        if ($err->errno != 0) {
            $Errore = 1;
        }
    }
} else {
    $Errore = 1;
}
if (!debug) {
    header('Content-Type: text/xml');
}
print '<response>' . "\n";
print '<error>' . $Errore . '</error>' . "\n";
print '<clid>' . $_REQUEST['ClId'] . '</clid>' . "\n";
Ejemplo n.º 13
0
<?php

define('debug', false);
// settare a true per l'output di debug
require_once dirname(dirname(__FILE__)) . '/config.php';
if (!CheckTourSession()) {
    print get_text('CrackError');
    exit;
}
$Errore = 0;
$XmlOut = "";
$MyQuery = "";
if (isset($_REQUEST["Session"]) && isset($_REQUEST["Hour"]) && preg_match("/^[1-9]{1}\$/i", $_REQUEST["Session"]) && preg_match("/^[0-9]{2}:[0-9]{2}\$/i", $_REQUEST["Hour"])) {
    $MyQuery = "SELECT QuTargetNo, (QuTimeStamp > " . StrSafe_DB(date("Y-m-d") . " " . $_REQUEST["Hour"] . ":00") . ") as isUpdated" . " FROM Qualifications" . " INNER JOIN Entries ON QuId=EnId" . " WHERE EnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND QuSession=" . StrSafe_DB($_REQUEST["Session"]) . " AND EnStatus <=1 " . " ORDER BY QuTargetNo";
    //echo $MyQuery; exit();
    $Rs = safe_r_sql($MyQuery);
    if (safe_num_rows($Rs) > 0) {
        $OldTarget = '';
        $cntOk = 0;
        $cntKo = 0;
        while ($MyRow = safe_fetch($Rs)) {
            if ($OldTarget != substr($MyRow->QuTargetNo, 0, -1) && $OldTarget != '') {
                $XmlOut .= "<target>\n";
                $XmlOut .= "<no>" . substr($OldTarget, 1) . "</no>\n";
                $XmlOut .= "<status>" . ($cntKo == 0 ? '0' : ($cntOk == 0 ? '2' : '1')) . "</status>\n";
                $XmlOut .= "</target>\n";
                $cntOk = 0;
                $cntKo = 0;
            }
            if ($MyRow->isUpdated == 1) {
                $cntOk++;
Ejemplo n.º 14
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
CheckTourSession(true);
print_r($_COOKIE);
$JS_SCRIPT = array('<script type="text/javascript" src="Fun_AJAX_GetImage.js"></script>', '<script type="text/javascript" src="../Fun_JS.js"></script>');
$txtHeader = "";
$athId = empty($_REQUEST['AthId']) || $_REQUEST['AthId'] == 0 ? null : $_REQUEST['AthId'];
$sql = "SELECT EnCode, EnFirstName, EnName FROM Entries WHERE EnId=" . StrSafe_DB($athId) . " AND EnTournament=" . StrSafe_DB($_SESSION['TourId']);
$Rs = safe_r_sql($sql);
if (safe_num_rows($Rs) == 1) {
    $MyRow = safe_fetch($Rs);
    $txtHeader = $MyRow->EnCode . " - " . $MyRow->EnFirstName . " " . $MyRow->EnName;
}
$x = 168;
$y = 78;
$w = 300;
$camurl = empty($_REQUEST['CamUrl']) ? "" : urldecode($_REQUEST['CamUrl']);
if (!$camurl) {
    $camurl = $_COOKIE['CamUrl'];
}
$boundary = "\n--";
$f = @fopen($camurl, "r");
if ($camurl and $f) {
    $r = "";
    $im = null;
    if (preg_match('/\\.jpg$/i', $camurl) != 0) {
        while (!feof($f)) {
            $r .= fread($f, 4096);
        }
        $im = imagecreatefromstring($r);
Ejemplo n.º 15
0
        foreach ($v['events'] as $ph => $ev) {
            $val[] = $ph . ' (' . implode('+', $ev) . ')';
        }
        //					$ComboSes.='<option value="'.$k.'"'.$v['selected'].'>'.$v['date']  . ' '. implode('; ',$val).'</option>';
        echo '<tr id="row_' . $k . '">';
        echo '<td class="Center">';
        if ($k && array_key_exists($k, $EventArray) && $EventArray[$k] != $_REQUEST['Id']) {
            echo "&nbsp;";
        } else {
            echo '<input type="checkbox" name="eventList" value="' . $k . '" id="chk_' . $k . '" ' . (array_key_exists($k, $EventArray) ? 'checked' : '') . ' onClick="saveHhtEvent(\'' . $k . '\')">';
        }
        echo '</td>';
        echo '<td colspan="2">' . $v['date'] . ' ' . implode('; ', $val) . '</td>';
        echo '</tr>' . "\n";
    }
}
sort($listCodes);
$delete = "DELETE FROM HhtEvents " . "WHERE HeEventCode NOT IN (" . implode(',', $listCodes) . ") AND HeTournament=" . StrSafe_DB($_SESSION['TourId']) . " ";
$rs = safe_w_sql($delete);
?>
		</table>
		</form>
		<br>
		<a class="Link" href="Configuration.php"><?php 
echo get_text('Back');
?>
</a>
	</div>
</div>
<?php 
include 'Common/Templates/tail.php';
Ejemplo n.º 16
0
/*
													- SelectCountryCode.php -
	Compila il nome della nazione partendo dal codice della stessa
*/
define('debug', false);
require_once dirname(dirname(__FILE__)) . '/config.php';
if (!isset($_REQUEST['which']) && !isset($_REQUEST['Code']) || !CheckTourSession()) {
    print get_text('CrackError');
    exit;
}
$Errore = 0;
$Id = 0;
$Name = '';
if (strlen($_REQUEST['Code']) > 0) {
    // cerco il codice nazione nel db
    $Select = "SELECT CoId,CoName " . "FROM Countries " . "WHERE CoCode=" . StrSafe_DB($_REQUEST['Code']) . " AND CoTournament=" . StrSafe_DB($_SESSION['TourId']) . " ";
    $Rs = safe_r_sql($Select);
    if ($Rs) {
        if (safe_num_rows($Rs) == 1) {
            $MyRow = safe_fetch($Rs);
            $Id = $MyRow->CoId;
            $Name = $MyRow->CoName;
        }
    } else {
        $Errore = 1;
    }
}
if (!debug) {
    header('Content-Type: text/xml');
}
print '<response>' . "\n";
Ejemplo n.º 17
0
$RsSel = safe_r_sql($Select);
if (safe_num_rows($RsSel) > 0) {
    while ($Row = safe_fetch($RsSel)) {
        //print '<input type="checkbox" name="New_EcDivision[]" id="New_EcDivision_' . $MyRow->DivId .'" value="1">' . $MyRow->DivId . '<br>';
        $ComboDiv .= '<option value="' . $Row->DivId . '">' . $Row->DivId . '</option>' . "\n";
    }
}
$ComboDiv .= '</select>' . "\n";
print $ComboDiv;
print '<br><br><a class="Link" href="javascript:SelectAllOpt(\'New_EcDivision\');">' . get_text('SelectAll') . '</a>';
?>
</td>
<td width="25%" class="Center" valign="top">
<?php 
$ComboCl = '<select name="New_EcClass" id="New_EcClass" multiple="multiple">' . "\n";
$Select = "SELECT * " . "FROM Classes " . "WHERE ClTournament = " . StrSafe_DB($_SESSION['TourId']) . " AND ClAthlete=1 " . "ORDER BY ClViewOrder ASC ";
$RsSel = safe_r_sql($Select);
if (safe_num_rows($RsSel) > 0) {
    while ($Row = safe_fetch($RsSel)) {
        //print '<input type="checkbox" name="New_EcClass[]" id="New_EcClass_' . $MyRow->ClId .'" value="1">' . $MyRow->ClId . '<br>';
        $ComboCl .= '<option value="' . $Row->ClId . '">' . $Row->ClId . '</option>' . "\n";
    }
}
$ComboCl .= '</select>' . "\n";
print $ComboCl;
print '<br><br><a class="Link" href="javascript:SelectAllOpt(\'New_EcClass\');">' . get_text('SelectAll') . '</a>';
?>
</td>
<td width="25%" class="Center" valign="top">
<input type="button" name="Command" id="Command" value="<?php 
print get_text('CmdSave');
Ejemplo n.º 18
0
echo '<img src="../../Common/Images/pdf.gif" alt="' . get_text('IndFinal') . '" border="0"><br>';
echo get_text('IndFinal');
echo '</a></td>';
echo '<td class="Center" width="40%" rowspan="2">';
$t = safe_r_sql("SELECT * FROM BackNumber WHERE BnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND BnFinal in (0,1) order by BnFinal desc");
if (safe_num_rows($t)) {
    echo '<img src="../../Tournament/ImgBackNumber.php?IdTpl=1"><br/><br/>';
}
echo '<input type="button" value="' . get_text('BackNoEdit', 'BackNumbers') . '" onClick="document.location=\'' . $CFG->ROOT_DIR . 'Tournament/BackNumber.php?BackNo=1\'">' . '<br /><input type="button" value="' . get_text('BackNoExportLayout', 'BackNumbers') . '" onClick="document.location=\'' . $CFG->ROOT_DIR . 'Tournament/BackNumbersExport.php?BackNo=1\'">' . '<form id="PrnParameters" action="" method="post" enctype="multipart/form-data"><br /><input type="file" name="ImportBackNumbers" />&nbsp;&nbsp;&nbsp;' . '<input name="Submit" type="submit" value="' . get_text('BackNoImportLayout', 'BackNumbers') . '"></form></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="Center" width="60%"><div align="center"><br>';
echo '<table class="Tabella" style="width:80%">';
echo '<tr>';
//Eventi
$MySql = "SELECT EvCode, EvEventName FROM Events WHERE EvTeamEvent='0' AND EvTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND EvFinalFirstPhase!=0 ORDER BY EvProgr";
$Rs = safe_r_sql($MySql);
if (safe_num_rows($Rs) > 0) {
    $TmpCnt = 0;
    while ($MyRow = safe_fetch($Rs)) {
        if ($TmpCnt++ % 2 == 0 && $TmpCnt != 1) {
            echo '</tr><tr>';
        }
        echo '<td class="Center" width="50%"><a href="PDFBackNumber.php?Event=' . $MyRow->EvCode . '" class="Link" target="PrintOut">';
        echo '<img src="../../Common/Images/pdf_small.gif" alt="' . $MyRow->EvCode . '" border="0"><br>';
        echo $MyRow->EvCode . ' - ' . get_text($MyRow->EvEventName, '', '', true);
        echo '</a></td>';
    }
    if ($TmpCnt % 2 != 0) {
        echo '<td>&nbsp;</td>';
    }
Ejemplo n.º 19
0
$FinEventTeam = 0;
$Select = "SELECT COUNT(EvCode) AS Quanti,EvTeamEvent FROM Events " . "WHERE EvTournament=" . StrSafe_DB($_SESSION['TourId']) . "   AND EvShootOff=1 " . "GROUP BY EvTeamEvent ";
$Rs = safe_r_sql($Select);
if ($Rs) {
    while ($RowEv = safe_fetch($Rs)) {
        if ($RowEv->EvTeamEvent == '0') {
            $FinEventInd = $RowEv->Quanti;
        } elseif ($RowEv->EvTeamEvent == '1') {
            $FinEventTeam = $RowEv->Quanti;
        }
    }
}
// Cerco gli eventi delle eliminatorie
$ElimEvent = array(1 => 0, 2 => 0);
for ($i = 1; $i <= 2; ++$i) {
    $Select = "SELECT EvCode FROM Events " . "WHERE EvTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND EvElim" . $i . ">0 AND EvE" . $i . "ShootOff=1 ";
    $Rs = safe_r_sql($Select);
    if ($Rs && safe_num_rows($Rs) > 0) {
        $ElimEvent[$i] = safe_num_rows($Rs);
    }
}
list($asc, ) = ExportASC();
/*
 * preparo il vettore con i file che non sono pdf
 * Mentre lo faccio inizializzo il vettore per ciclare tra i pdf
 */
$pdfFiles = array($ToCode . '_report.pdf' => dirname(__FILE__) . '/FinalReport/PDFReport.php', $ToCode . '.pdf' => dirname(dirname(__FILE__)) . '/Qualification/PrnIndividual.php', $ToCode . '_team.pdf' => dirname(dirname(__FILE__)) . '/Qualification/PrnTeam.php');
$Tour = array();
$Tour[$ToCode . '.ianseo'] = gzcompress(serialize(export_tournament($_SESSION['TourId'], false)));
$Tour[$ToCode . '.asc'] = $asc;
$Tour[$ToCode . '.lst'] = ExportLSTInd();
Ejemplo n.º 20
0
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Tournament/Fun_Tournament.local.inc.php';
if (!CheckTourSession() || !isset($_REQUEST['New_ClId']) || !isset($_REQUEST['New_ClSex']) || !isset($_REQUEST['New_ClDescription']) || !isset($_REQUEST['New_ClAthlete']) || !isset($_REQUEST['New_ClViewOrder']) || !isset($_REQUEST['New_ClAgeFrom']) || !isset($_REQUEST['New_ClAgeTo']) || !isset($_REQUEST['New_ClValidClass']) || !isset($_REQUEST['New_ClValidDivision'])) {
    print get_text('CrackError');
    exit;
}
$Errore = intval(IsBlocked(BIT_BLOCK_TOURDATA) && !defined('dontEditClassDiv'));
$MsgErrore = '';
if (!$Errore) {
    if (!is_numeric($_REQUEST['New_ClAgeFrom']) || !is_numeric($_REQUEST['New_ClAgeTo']) || $_REQUEST['New_ClAgeFrom'] <= 0 || $_REQUEST['New_ClAgeTo'] <= 0 || $_REQUEST['New_ClAgeFrom'] > $_REQUEST['New_ClAgeTo']) {
        $Errore = 1;
    }
}
if (!$Errore) {
    // Aggiungo la nuova riga
    $Insert = "INSERT IGNORE INTO Classes (ClId,ClTournament,ClDescription,ClAthlete,ClViewOrder,ClAgeFrom,ClAgeTo,ClValidClass,ClDivisionsAllowed,ClSex) " . "VALUES(" . StrSafe_DB($_REQUEST['New_ClId']) . "," . StrSafe_DB($_SESSION['TourId']) . "," . StrSafe_DB($_REQUEST['New_ClDescription']) . "," . StrSafe_DB(intval($_REQUEST['New_ClAthlete'])) . "," . StrSafe_DB($_REQUEST['New_ClViewOrder']) . ", " . StrSafe_DB($_REQUEST['New_ClAgeFrom']) . ", " . StrSafe_DB($_REQUEST['New_ClAgeTo']) . ", " . StrSafe_DB(CreateValidClass($_REQUEST['New_ClId'], $_REQUEST['New_ClValidClass'])) . ", " . StrSafe_DB($_REQUEST['New_ClValidDivision']) . ", " . StrSafe_DB($_REQUEST['New_ClSex']) . " " . ") ";
    $RsIns = safe_w_sql($Insert);
    //duplicate entries is OK
    if (!safe_w_affected_rows()) {
        $Errore = 2;
        $MsgErrore = get_text('DuplicateEntry', 'Tournament');
    }
}
header('Content-Type: text/xml');
print '<response>' . "\n";
print '<error>' . $Errore . '</error>' . "\n";
print '<errormsg><![CDATA[' . $MsgErrore . ']]></errormsg>' . "\n";
print '<new_clid><![CDATA[' . $_REQUEST['New_ClId'] . ']]></new_clid>' . "\n";
print '<new_cldescr><![CDATA[' . ManageHTML($_REQUEST['New_ClDescription']) . ']]></new_cldescr>' . "\n";
print '<new_clathleteyes><![CDATA[' . ManageHTML(get_text('Yes')) . ']]></new_clathleteyes>' . "\n";
print '<new_clathleteno><![CDATA[' . ManageHTML(get_text('No')) . ']]></new_clathleteno>' . "\n";
Ejemplo n.º 21
0
         		$Rs=safe_w_sql($Update);
         		set_qual_session_flags();*/
         $q = "\r\n\t\t\t\t\t\tSELECT EvCode\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\tEvents\r\n\t\t\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\t\t\tEventClass\r\n\t\t\t\t\t\t\tON EvCode=EcCode AND EvTeamEvent='0' AND EcTournament={$_SESSION['TourId']}\r\n\t\t\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\t\t\tEntries\r\n\t\t\t\t\t\t\tON EcDivision=EnDivision AND EcClass=EnClass  AND EnId={$Atleta}\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t EvTeamEvent='0' AND EvTournament={$_SESSION['TourId']}\r\n\t\t\t\t\t";
         $Rs = safe_w_sql($q);
         if ($Rs && safe_num_rows($Rs) > 0) {
             while ($row = safe_fetch($Rs)) {
                 //print $Fase.'<br>';
                 ResetShootoff($row->EvCode, 0, $Fase == 0 ? 1 : 2);
             }
         }
         if (debug) {
             print $Update . '<br>';
         }
     }
     // estraggo i totali
     $Select = "SELECT ElId, ElElimPhase, " . $Cosa . " " . "FROM Eliminations WHERE ElId=" . StrSafe_DB($Atleta) . " AND ElElimPhase=" . StrSafe_DB($Fase);
     $Rs = safe_r_sql($Select);
     //print $Select;
     $Errore = 0;
     // no error
     $MyRow = NULL;
     if (safe_num_rows($Rs) == 1) {
         $MyRow = safe_fetch($Rs);
         // se il valore del campo passato � uguale a quello in db ok, altrimenti errore
         if ($Value != $MyRow->{$Cosa}) {
             $Errore = 1;
         }
     } else {
         $Errore = 1;
     }
 }
Ejemplo n.º 22
0
 if ($_REQUEST['command'] == 'SAVE') {
     // maneggio i simboli degli ori e delle x
     $golds = explode(',', $_REQUEST['d_ToGoldsChars']);
     $_REQUEST['d_ToGoldsChars'] = '';
     foreach ($golds as $g) {
         $_REQUEST['d_ToGoldsChars'] .= GetLetterFromPrint(trim($g));
     }
     $xnine = explode(',', $_REQUEST['d_ToXNineChars']);
     $_REQUEST['d_ToXNineChars'] = '';
     foreach ($xnine as $x) {
         $_REQUEST['d_ToXNineChars'] .= GetLetterFromPrint(trim($x));
     }
     $up = array();
     foreach ($_REQUEST as $k => $v) {
         if (substr($k, 0, 2) == 'd_') {
             $v = StrSafe_DB($v);
             list(, $field) = explode('_', $k);
             $up[] = "{$field}={$v} ";
         }
     }
     $up = implode(',', $up);
     $q = "\r\n\t\t\t\tUPDATE\r\n\t\t\t\t\tTournament\r\n\t\t\t\tSET\r\n\t\t\t\t\t{$up}\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tToId={$_SESSION['TourId']}\r\n\t\t\t";
     //print $q;Exit;
     $r = safe_r_sql($q);
     // Get the "extra" options
     Set_Tournament_Option('OlympicFont', $font = preg_replace('/[^a-z0-9_ -]+/sim', '', $_REQUEST['OlympicFont']));
     Set_Tournament_Option('OlympicFont-use', !empty($_REQUEST['OlympicFont-use']) and $font);
     // Set the records in which this tournament is going to work
     // Start deleting the records type attributions!
     //			debug_svela($_REQUEST);
     safe_w_sql("delete from TourRecords where TrTournament={$_SESSION['TourId']}");
Ejemplo n.º 23
0
<?php

require_once 'Common/Fun_Sessions.inc.php';
require_once 'Common/Fun_FormatText.inc.php';
$Select = "SELECT EnCode as Bib, EnName AS Name, SesName, " . " PhPhoto, EnId, " . " upper(EnFirstName) AS FirstName, SUBSTRING(AtTargetNo,1,1) AS Session," . " SUBSTRING(AtTargetNo,2) AS TargetNo," . " CoCode AS NationCode, CoName AS Nation, EnClass AS ClassCode," . " EnDivision AS DivCode, EnAgeClass as AgeClass," . " EnSubClass as SubClass, EnStatus as Status " . "FROM AvailableTarget at " . "LEFT JOIN (SELECT EnTournament, QuTargetNo, EnId, EnCode, EnName, EnFirstName, CoCode, CoName, " . "EnClass, EnDivision, EnAgeClass, EnSubClass, EnStatus, EnIndClEvent, EnTeamClEvent, EnIndFEvent, EnTeamFEvent " . "FROM Qualifications AS q  " . "INNER JOIN Entries AS e ON q.QuId=e.EnId AND e.EnTournament= " . StrSafe_DB($TourId) . " AND EnAthlete=1 " . "INNER JOIN Countries AS c ON e.EnCountry=c.CoId AND e.EnTournament=c.CoTournament" . ") as Sq ON at.AtTargetNo=Sq.QuTargetNo " . "LEFT JOIN Session on SUBSTRING(AtTargetNo,1,1) = SesOrder and EnTournament=SesTournament and SesType='Q' " . "LEFT JOIN Photos on EnId=PhEnId " . "WHERE" . " AtTournament = " . StrSafe_DB($TourId) . " AND EnCode IS NOT NULL " . ($TVsettings->TVPSession ? " AND SUBSTRING(AtTargetNo,1,1)= " . StrSafe_DB($TVsettings->TVPSession) . " " : "") . "ORDER BY AtTargetNo, CoCode, Name, CoName, FirstName ";
$Rs = safe_r_sql($Select);
//print $Select;exit;
$oldTarget = 'x';
$tab = array();
$oldSession = 0;
$Ath4Target = 0;
//$fotow=min(200,intval($_SESSION['WINHEIGHT']/6)*4/3); // redefined later
include_once 'Common/CheckPictures.php';
CheckPictures($TourCode);
while ($MyRow = safe_fetch($Rs)) {
    if ($tab and ($oldTarget != intval($MyRow->TargetNo) or !isset($ret[$MyRow->Session]))) {
        // cambio di paglione o di turno, scarico le righe
        $tmpRow = '';
        foreach ($tab as $row => $cols) {
            $tmpRow .= '<tr valign="' . ($row == 0 ? 'middle' : 'top') . '"' . ($row < 2 ? ' align="center"' : '') . '>';
            foreach ($cols as $col) {
                if ($col) {
                    $tmpRow .= '<td align="center">' . $col . '</td>';
                } else {
                    $tmpRow .= '<td>&nbsp;</td>';
                }
            }
            $tmpRow .= '</tr>';
        }
        $tmpRow .= '<tr style="height:2px;"><th colspan="' . $NumCol . '"></th></tr>';
        $ret[$oldSession]['basso'] .= $tmpRow;
Ejemplo n.º 24
0
CheckTourSession(true);
require_once 'Common/Fun_Number.inc.php';
require_once 'Common/Fun_FormatText.inc.php';
$team = isset($_REQUEST['team']) ? $_REQUEST['team'] : null;
$subTeam = isset($_REQUEST['subTeam']) ? $_REQUEST['subTeam'] : null;
$ev = isset($_REQUEST['ev']) ? $_REQUEST['ev'] : null;
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
if (is_null($team) || is_null($subTeam) || is_null($ev) || is_null($id)) {
    exit;
}
$query = "SELECT " . "CoCode,CoName " . "FROM " . "Countries " . "WHERE " . "CoTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND " . "CoId=" . StrSafe_DB($team) . " ";
$rs = safe_r_sql($query);
$MyRow = safe_fetch($rs);
$title = $MyRow->CoCode . ' - ' . stripslashes($MyRow->CoName);
$athletes = array();
$query = "SELECT " . "EnId AS `id`,EnDivision AS `div`,EnClass AS `class`,EnAgeClass AS `ageClass`,EnCode AS `code`,CONCAT(EnFirstName,' ',EnName) AS `name` " . "FROM " . "Entries " . "INNER JOIN " . "EventClass " . "ON EcCode=" . StrSafe_DB($ev) . " AND EcTeamEvent!=0 AND EcTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND EcClass=EnClass AND EcDivision=EnDivision " . "WHERE " . "EnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND IF(EnCountry2=0,EnCountry,EnCountry2)=" . StrSafe_DB($team) . " AND EnAthlete=1 AND EnStatus<=1 " . "AND EnId NOT IN(" . "SELECT " . "TfcId " . "FROM " . "TeamFinComponent " . "WHERE " . "TfcTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND TfcEvent=" . StrSafe_DB($ev) . " " . ")";
//print $query;exit;
$rs = safe_r_sql($query);
if (safe_num_rows($rs) > 0) {
    while ($MyRow = safe_fetch($rs)) {
        $athletes[] = $MyRow;
    }
}
/*print '<pre>';
	print_r($athletes);
	print '</pre>';exit;*/
$JS_SCRIPT = array('<script type="text/javascript">', '	function updateOpener(team,subTeam,ev,oldId,newId)', '	{', '		window.opener.location', '			= \'ChangeComponents2.php\'', '			+ \'?ev=\' + ev', '			+ \'&command=Set\'', '			+ \'&team=\' + team', '			+ \'&subTeam=\' + subTeam', '			+ \'&oldId=\' + oldId', '			+ \'&newId=\' + newId;', '		window.close();', '	}', '</script>');
include 'Common/Templates/head-popup.php';
?>
<table class="Tabella">
	<tr><th class="Title" colspan="4"><?php 
Ejemplo n.º 25
0
if (isset($_REQUEST["ScoreDraw"]) && $_REQUEST["ScoreDraw"] == "CompleteTotals") {
    $pdf->PrintTotalColumns();
}
if (!empty($_REQUEST["ScoreBarcode"])) {
    $pdf->PrintBarcode = true;
}
if (isset($_REQUEST["ScoreDraw"]) && $_REQUEST['ScoreDraw'] == "Draw") {
    $pdf->AddPage();
    for ($i = 1; $i <= $NumDistances; $i++) {
        if ($i == 5) {
            $pdf->AddPage();
        }
        $pdf->DrawScore($MisArray[$i][0], $MisArray[$i][1], $defScoreW, $defScoreH, $NumEnd, 3, array("tNo" => ''));
    }
} else {
    $MyQuery = 'SELECT SUBSTRING(at.AtTargetNo,2) as tNo, EnCode, EnDivision, EnClass, CoCode, CoName, Ath, Noc, Cat, Td1, Td2, Td3, Td4, Td5, Td6, Td7, Td8, ' . 'QuD1Arrowstring, QuD2Arrowstring, QuD3Arrowstring, QuD4Arrowstring, QuD5Arrowstring, QuD6Arrowstring, QuD7Arrowstring, QuD8Arrowstring, ' . 'QuD1Score, QuD2Score, QuD3Score, QuD4Score, QuD5Score, QuD6Score, QuD7Score, QuD8Score, ' . ' QuD1Gold, QuD1XNine, QuD2Gold, QuD2XNine, QuD3Gold, QuD3XNine, QuD4Gold, QuD4XNine, ' . ' QuD5Gold, QuD5XNine, QuD6Gold, QuD6XNine, QuD7Gold, QuD7XNine, QuD8Gold, QuD8XNine, ' . 'printD1gx, printD2gx, printD3gx, printD4gx, printD5gx, printD6gx, printD7gx, printD8gx ' . ' FROM AvailableTarget as at ' . ' ' . ($FillWithArrows ? 'INNER' : 'LEFT') . ' JOIN (' . ' SELECT EnCode, EnDivision, EnClass, CoCode, CoName, QuTargetNo, CONCAT(EnFirstName,\' \', EnName) AS Ath, CONCAT(CoCode, \' - \', CoName) as Noc, CONCAT(EnDivision, \' \', EnClass) AS Cat, ' . ' Td1, Td2, Td3, Td4, Td5, Td6, Td7, Td8,' . ' QuD1Arrowstring, QuD2Arrowstring, QuD3Arrowstring, QuD4Arrowstring, QuD5Arrowstring, QuD6Arrowstring, QuD7Arrowstring, QuD8Arrowstring, ' . ' QuD1Score, QuD2Score, QuD3Score, QuD4Score, QuD5Score, QuD6Score, QuD7Score, QuD8Score, ' . ' QuD1Gold, QuD1XNine, QuD2Gold, QuD2XNine, QuD3Gold, QuD3XNine, QuD4Gold, QuD4XNine, ' . ' QuD5Gold, QuD5XNine, QuD6Gold, QuD6XNine, QuD7Gold, QuD7XNine, QuD8Gold, QuD8XNine, ' . ' QuD1Gold+QuD1XNine as printD1gx, QuD2Gold+QuD2XNine as printD2gx, QuD3Gold+QuD3XNine as printD3gx, QuD4Gold+QuD4XNine as printD4gx, ' . ' QuD5Gold+QuD5XNine as printD5gx, QuD6Gold+QuD6XNine as printD6gx, QuD7Gold+QuD7XNine as printD7gx ,QuD8Gold+QuD8XNine as printD8gx ' . ' FROM Entries ' . ' INNER JOIN Qualifications ON EnId = QuId ' . ' INNER JOIN Countries ON EnCountry=CoId AND EnTournament=CoTournament ' . ' INNER JOIN Tournament ON EnTournament=ToId ' . ' INNER JOIN TournamentDistances ON ToType=TdType and TdTournament=ToId AND CONCAT(TRIM(EnDivision),TRIM(EnClass)) LIKE TdClasses ' . ' WHERE EnTournament = ' . StrSafe_DB($_SESSION['TourId']) . " AND QuTargetNo>='" . $_REQUEST['x_Session'] . str_pad($_REQUEST['x_From'], TargetNoPadding, "0", STR_PAD_LEFT) . "A' AND QuTargetNo<='" . $_REQUEST['x_Session'] . str_pad($_REQUEST['x_To'], TargetNoPadding, "0", STR_PAD_LEFT) . "Z' " . ') as Sqy ON at.AtTargetNo = Sqy.QuTargetNo ' . " WHERE at.AtTournament =  " . StrSafe_DB($_SESSION['TourId']) . ' ' . " AND at.AtTargetNo>='" . $_REQUEST['x_Session'] . str_pad($_REQUEST['x_From'], TargetNoPadding, "0", STR_PAD_LEFT) . "A' AND at.AtTargetNo<='" . $_REQUEST['x_Session'] . str_pad($_REQUEST['x_To'], TargetNoPadding, "0", STR_PAD_LEFT) . "Z' " . ' ORDER BY at.AtTargetNo ASC, Ath, Noc ';
    //print $MyQuery;Exit;
    $Rs = safe_r_sql($MyQuery);
    if (safe_num_rows($Rs) > 0) {
        $TmpTarget = '-----';
        $Tmp = array();
        $DistArray = array();
        while ($MyRow = safe_fetch($Rs)) {
            $pdf->AddPage($NumDistances < 4 ? "L" : "P");
            $Value = array("tNo" => $MyRow->tNo, "EnCode" => $MyRow->EnCode, "Div" => $MyRow->EnDivision, "Cls" => $MyRow->EnClass, "Cat" => $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->Cat : '', "Dist" => '', "D1" => $MyRow->Td1, "D2" => $MyRow->Td2, "D3" => $MyRow->Td3, "D4" => $MyRow->Td4, "D5" => $MyRow->Td5, "D6" => $MyRow->Td6, "D7" => $MyRow->Td7, "D8" => $MyRow->Td8, "gxD1" => $MyRow->printD1gx, "gxD2" => $MyRow->printD2gx, "gxD3" => $MyRow->printD3gx, "gxD4" => $MyRow->printD4gx, "gxD5" => $MyRow->printD5gx, "gxD6" => $MyRow->printD6gx, "gxD7" => $MyRow->printD7gx, "gxD8" => $MyRow->printD8gx, "Arr1" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Arrowstring : '', "Arr2" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD2Arrowstring : '', "Arr3" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD3Arrowstring : '', "Arr4" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD4Arrowstring : '', "Arr5" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD5Arrowstring : '', "Arr6" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD6Arrowstring : '', "Arr7" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD7Arrowstring : '', "Arr8" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD8Arrowstring : '', "Tot1" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? 0 : '', "Tot2" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Score : '', "Tot3" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Score + $MyRow->QuD2Score : '', "Tot4" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Score + $MyRow->QuD2Score + $MyRow->QuD3Score : '', "Tot5" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Score + $MyRow->QuD2Score + $MyRow->QuD3Score + $MyRow->QuD4Score : '', "Tot6" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Score + $MyRow->QuD2Score + $MyRow->QuD3Score + $MyRow->QuD4Score + $MyRow->QuD5Score : '', "Tot7" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Score + $MyRow->QuD2Score + $MyRow->QuD3Score + $MyRow->QuD4Score + $MyRow->QuD5Score + $MyRow->QuD6Score : '', "Tot8" => $FillWithArrows && $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->QuD1Score + $MyRow->QuD2Score + $MyRow->QuD3Score + $MyRow->QuD4Score + $MyRow->QuD5Score + $MyRow->QuD6Score + $MyRow->QuD7Score : '', "QuD1" => $MyRow->QuD1Score, "QuD2" => $MyRow->QuD2Score, "QuD3" => $MyRow->QuD3Score, "QuD4" => $MyRow->QuD4Score, "QuD5" => $MyRow->QuD5Score, "QuD6" => $MyRow->QuD6Score, "QuD7" => $MyRow->QuD7Score, "QuD8" => $MyRow->QuD8Score, "QuGD1" => $MyRow->QuD1Gold, "QuGD2" => $MyRow->QuD2Gold, "QuGD3" => $MyRow->QuD3Gold, "QuGD4" => $MyRow->QuD4Gold, "QuGD5" => $MyRow->QuD5Gold, "QuGD6" => $MyRow->QuD6Gold, "QuGD7" => $MyRow->QuD7Gold, "QuGD8" => $MyRow->QuD8Gold, "QuXD1" => $MyRow->QuD1XNine, "QuXD2" => $MyRow->QuD2XNine, "QuXD3" => $MyRow->QuD3XNine, "QuXD4" => $MyRow->QuD4XNine, "QuXD5" => $MyRow->QuD5XNine, "QuXD6" => $MyRow->QuD6XNine, "QuXD7" => $MyRow->QuD7XNine, "QuXD8" => $MyRow->QuD8XNine, "Ath" => $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->Ath : '', "Noc" => $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->Noc : '', "CoCode" => $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->CoCode : '', "CoName" => $_REQUEST['ScoreDraw'] != "TargetNo" ? $MyRow->CoName : '');
            if ($NumDistances == 2) {
                $defScoreX = $pdf->getSideMargin() * 3;
                $defScoreH = $pdf->GetPageHeight() - $pdf->getTopMargin() * 2;
                $defScoreW = ($pdf->GetPageWidth() - $defScoreX * 3) / 2;
            } elseif ($NumDistances == 3) {
                $defScoreX = $pdf->getSideMargin();
Ejemplo n.º 26
0
    }
}
print '</select>' . "\n";
?>
&nbsp;<input type="submit" value="<?php 
print get_text('CmdOk');
?>
" onclick="document.Frm.Command.value='OK'"><div id="idOutput"></div>
</td>
</tr>
<tr class="Spacer"><td colspan="2"></td></tr>
</table>

<?php 
if (isset($_REQUEST['Command']) && ($_REQUEST['Command'] == 'OK' || $_REQUEST['Command'] == 'SAVE')) {
    $Select = "SELECT EvFinalFirstPhase AS StartPhase, EvFinalAthTarget AS BitMask " . "FROM Events " . "WHERE EvTournament = " . StrSafe_DB($_SESSION['TourId']) . " AND EvTeamEvent='1' " . "AND EvCode=" . StrSafe_DB($_REQUEST['d_Event']) . " ";
    $Rs = safe_r_sql($Select);
    if (safe_num_rows($Rs) == 1) {
        $MyRow = safe_fetch($Rs);
        print '<input type="hidden" name="d_Event2Set" value="' . $_REQUEST['d_Event'] . '">';
        print '<table class="Tabella">' . "\n";
        print '<tr><th width="50%">' . get_text('Phase') . '</th><th width="50%">' . get_text('Ath4Target', 'Tournament') . '</th></tr>' . "\n";
        for ($CurPhase = $MyRow->StartPhase; $CurPhase >= 0; $CurPhase > 1 ? $CurPhase /= 2 : --$CurPhase) {
            print '<tr>';
            print '<td class="Center">' . get_text($CurPhase . '_Phase') . '</td>';
            print '<td class="Center">';
            // Estraggo il bit corrispondete alla fase
            $Bit = $CurPhase > 0 ? $CurPhase * 2 : 1;
            $Value = ($Bit & $MyRow->BitMask) == $Bit ? 1 : 0;
            $e = log($Bit, 2);
            // esponente di 2 per ottenere la fase
Ejemplo n.º 27
0
        } else {
            $TmpWhere .= "CoCode LIKE " . StrSafe_DB(strtoupper(trim($Value)) . "%") . " OR CONCAT(EnFirstName, ' ', EnName) LIKE " . StrSafe_DB(strtoupper(trim($Value)) . "%") . " OR ";
        }
    }
    $TmpWhere = substr($TmpWhere, 0, -3);
}
$MyQuery = "SELECT EnCode as Bib, EnPays,EnName AS Name, upper(EnFirstName) AS FirstName, QuSession AS Session, SUBSTRING(QuTargetNo,2) AS TargetNo, CoCode AS NationCode, CoName AS Nation, EnClass AS ClassCode, EnDivision AS DivCode, EnAgeClass as AgeClass, EnSubClass as SubClass, EnStatus as Status, EnIndClEvent AS `IC`, EnTeamClEvent AS `TC`, EnIndFEvent AS `IF`, EnTeamFEvent as `TF`, EnTeamMixEvent as `TM`, APPrice ";
$MyQuery .= "FROM Entries AS e ";
$MyQuery .= "INNER JOIN Countries AS c ON e.EnCountry=c.CoId AND e.EnTournament=c.CoTournament ";
$MyQuery .= "INNER JOIN Qualifications AS q ON e.EnId=q.QuId ";
$MyQuery .= "INNER JOIN AccEntries AS ae ON e.EnId=ae.AEId AND e.EnTournament=ae.AETournament ";
$MyQuery .= "AND ae.AEOperation=(SELECT AOTId FROM AccOperationType WHERE AOTDescr=" . StrSafe_DB($OpDetails) . ") ";
$MyQuery .= "INNER JOIN AccPrice AS ap ON CONCAT(EnDivision,EnClass) LIKE ap.APDivClass AND e.EnTournament=ap.APTournament ";
$MyQuery .= "WHERE EnAthlete=1 AND EnTournament = " . StrSafe_DB($_SESSION['TourId']) . " ";
if (isset($_REQUEST["Session"]) && is_numeric($_REQUEST["Session"])) {
    $MyQuery .= "AND QuSession = " . StrSafe_DB($_REQUEST["Session"]) . " ";
}
if ($TmpWhere != "") {
    $MyQuery .= "AND (" . $TmpWhere . ")";
}
$MyQuery .= "ORDER BY CoCode, Name, CoName, FirstName, TargetNo ";
//echo $MyQuery;exit;
$Rs = safe_r_sql($MyQuery);
if ($Rs) {
    $ShowStatusLegend = false;
    $OldTeam = '#@#@#';
    $isFirstTime = true;
    $TotalPrice = 0;
    while ($MyRow = safe_fetch($Rs)) {
        if ($OldTeam != $MyRow->NationCode) {
            if (!$isFirstTime) {
Ejemplo n.º 28
0
                if ($rs) {
                    if (safe_num_rows($rs) == 1) {
                        $myRow = safe_fetch($rs);
                        if ($num4session < $myRow->HowMany + 1) {
                            $tooMany = 1;
                            $msg = get_text('NoMoreAth4Session', 'Tournament');
                        }
                    }
                }
            }
            if ($tooMany == 0) {
                $query = "UPDATE " . "Qualifications " . "SET " . "QuSession=" . StrSafe_DB($session) . " " . "WHERE " . "QuId=" . StrSafe_DB($id) . " ";
                $rs = safe_w_sql($query);
                // se la riga è stata aggiornata significa che la session è cambiata quindi annullo il target
                if (safe_w_affected_rows() == 1) {
                    $query = "UPDATE " . "Qualifications " . "SET " . "QuTargetNo='', QuBacknoPrinted=0 " . "WHERE " . "QuId=" . StrSafe_DB($id) . " ";
                    $rs = safe_w_sql($query);
                    $resetTarget = 1;
                }
            }
        } else {
            $error = 1;
        }
    } else {
        $error = 1;
    }
} else {
    $error = 1;
}
/****** End Controller ******/
/****** Output ******/
Ejemplo n.º 29
0
include 'Common/Templates/head.php';
?>
<div align="center">
<div class="medium">
<table class="Tabella">
<tr><th class="Title" colspan="4"><?php 
print get_text('ManSubClasses', 'Tournament');
?>
</th></tr>
<tbody id="tbody_subclass">
<tr><th class="Title" colspan="4"><?php 
print get_text('SubClasses', 'Tournament');
?>
</th></tr>
<?php 
$Select = "SELECT * " . "FROM `SubClass` " . "WHERE ScTournament=" . StrSafe_DB($_SESSION['TourId']) . " " . "ORDER BY ScViewOrder ASC ";
$Rs = safe_r_sql($Select);
if (safe_num_rows($Rs) > 0) {
    ?>
<tr><th width="5%"><?php 
    print get_text('SubClass', 'Tournament');
    ?>
</th><th width="30%"><?php 
    print get_text('Descr', 'Tournament');
    ?>
</th><th width="10%"><?php 
    print get_text('Progr');
    ?>
</th><th width="15%">&nbsp;</th></tr>
<?php 
    while ($MyRow = safe_fetch($Rs)) {
Ejemplo n.º 30
0
<tr>
	<td colspan="2"><?php 
echo ComboSes(RowTour(), 'Teams');
?>
</td>
</tr>
<tr>
<th class="TitleLeft" colspan="2"><?php 
print get_text('Event');
?>
</th>
</tr>
<tr>
<td colspan="2">
<?php 
$Select = "SELECT EvCode,EvEventName " . "FROM Events " . "WHERE EvTournament = " . StrSafe_DB($_SESSION['TourId']) . "\tAND EvTeamEvent='1' AND EvFinalFirstPhase!=0 " . "ORDER BY EvProgr ASC ";
$Rs = safe_r_sql($Select);
print '<select name="d_Event[]" id="d_Event" multiple="multiple" onChange="javascript:ChangeEvent(1);">' . "\n";
if (safe_num_rows($Rs) > 0) {
    while ($Row = safe_fetch($Rs)) {
        print '<option value="' . $Row->EvCode . '">' . $Row->EvCode . ' - ' . get_text($Row->EvEventName, '', '', true) . '</option>' . "\n";
    }
}
print '</select>' . "\n";
?>
</td>
</tr>
<tr>
<td width="15%" align="right"><b><?php 
print get_text('Phase');
?>