<?php require_once dirname(dirname(__FILE__)) . '/config.php'; $TourCode = stripslashes($_REQUEST['Tour']); $TourId = getIdFromCode($TourCode); // uguali ai valori di default nel db $TV_Carattere = 30; $TV_TR_BGColor = '#FFFFFF'; $TV_TRNext_BGColor = '#FFFFCC'; $TV_TR_Color = '#000000'; $TV_TRNext_Color = '#000000'; $TV_TH_BGColor = '#CCCCCC'; $TV_TH_Color = '#000000'; $TV_THTitle_BGColor = '#585858'; $TV_THTitle_Color = '#F4F4F4'; $TV_Content_BGColor = '#FEFEFE'; $TV_Page_BGColor = '#FFFFFF'; $Select = "SELECT TV_TR_BGColor,TV_TRNext_BGColor,TV_TR_Color,TV_TRNext_Color,TV_Content_BGColor,TV_Page_BGColor,TV_Carattere, " . "TV_TH_BGColor,TV_TH_Color,TV_THTitle_BGColor,TV_THTitle_Color " . "FROM TVRules " . "WHERE TVRId=" . StrSafe_DB($_REQUEST['Rule']) . " and TVRTournament={$TourId}"; $Rs = safe_r_sql($Select); //$RULE=safe_fetch($Rs); if ($MyRow = safe_fetch($Rs)) { $TV_Carattere = $MyRow->TV_Carattere; $TV_TR_BGColor = $MyRow->TV_TR_BGColor; $TV_TRNext_BGColor = $MyRow->TV_TRNext_BGColor; $TV_TR_Color = $MyRow->TV_TR_Color; $TV_TRNext_Color = $MyRow->TV_TRNext_Color; $TV_TH_BGColor = $MyRow->TV_TH_BGColor; $TV_TH_Color = $MyRow->TV_TH_Color; $TV_THTitle_BGColor = $MyRow->TV_THTitle_BGColor; $TV_THTitle_Color = $MyRow->TV_THTitle_Color; $TV_Content_BGColor = $MyRow->TV_Content_BGColor;
/** * Setta le info dell'header o ritorna un errore * * @return mixed: codice errore in caso di errore, array(tourId,phase,session,distance,end,arrows) in caso di successo */ private function makeHeader() { /* * Devono essere presenti i figli: * - direction: 'Input' * - tour_code: codice della gara da importare * - phase: nome della fase da importare * - session: sessione da importare * - end: volee da importare * - arrows: numero di frecce */ /* * <direction> */ $directions = $this->xmlHeader->getElementsByTagName('direction'); if ($directions->length != 1) { return 1; } $dirNode = $directions->item(0); /*if ($dirNode->parentNode!=$this->xmlHeader) { return 1; }*/ $direction = $dirNode->textContent; if ($direction != 'Input') { return 1; } /* * <tour_code> */ $tourCodes = $this->xmlHeader->getElementsByTagName('tour_code'); if ($tourCodes->length != 1) { return 1; } $tourCodeNode = $tourCodes->item(0); /*if ($tourCodeNode->parentNode!=$this->xmlHeader) { return 1; }*/ $tour_code = $tourCodeNode->textContent; // cerco l'id del torneo in base al codice gara $toId = getIdFromCode($tour_code); if ($toId == 0) { return 1; } /* * <phase> */ $phases = $this->xmlHeader->getElementsByTagName('phase'); if ($phases->length != 1) { return 1; } $phaseNode = $phases->item(0); /*if ($phaseNode->parentNode!=$this->xmlHeader) { return 1; }*/ $phase = $phaseNode->textContent; /* * <session> */ $sessions = $this->xmlHeader->getElementsByTagName('session'); if ($sessions->length != 1) { return 1; } $sessionNode = $sessions->item(0); /*if ($sessionNode->parentNode!=$this->xmlHeader) { return 1; }*/ $session = $sessionNode->textContent; /* * <end> */ $ends = $this->xmlHeader->getElementsByTagName('end'); if ($ends->length != 1) { return 1; } $endNode = $ends->item(0); /*if ($endNode->parentNode!=$this->xmlHeader) { return 1; }*/ $end = $endNode->textContent; /* * <distance> */ $distances = $this->xmlHeader->getElementsByTagName('distance'); if ($distances->length != 1) { return 1; } $distanceNode = $distances->item(0); $distance = $distanceNode->textContent; /* * <arrows> */ // NOTA: fa schifo il nome ma è per coerenza $arrowss = $this->xmlHeader->getElementsByTagName('arrows'); if ($arrowss->length != 1) { return 1; } $arrowsNode = $arrowss->item(0); /*if ($arrowsNode->parentNode!=$this->xmlHeader) { return 1; }*/ $arrows = $arrowsNode->textContent; return array($toId, $phase, $session, $distance, $end, $arrows); }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; require_once 'Common/ARF/ARFOutput.class.php'; $ToId = !isset($_REQUEST['Code']) ? $_SESSION['TourId'] : getIdFromCode($_REQUEST['Code']); $phase = $_REQUEST['phase']; $params = array(); foreach ($_REQUEST['params'] as $v) { $params[] = $v; } $arf = new ARFOutput($ToId, $phase, $params); if (isset($_REQUEST['download'])) { $arf->render2download(); } else { $arf->render2browser(); }
$AppMinVersion = '0.8.5'; $AppMaxVersion = '1.9.9'; require_once dirname(dirname(__FILE__)) . '/config.php'; // if there is no callback no need to go further... if (empty($_REQUEST["callback"])) { die; } $CompCode = empty($_REQUEST['compcode']) ? '' : $_REQUEST['compcode']; $DeviceId = empty($_REQUEST['devid']) ? '' : $_REQUEST['devid']; // should it be worth to send back an error to the device? if (!$CompCode) { if (empty($SkipCompCode)) { SendResult(array('error' => get_text('ISK-Lite-NoCompCode', 'Api'))); } } else { $CompId = getIdFromCode($CompCode); } function SendResult($Result) { header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json'); echo $_REQUEST["callback"] . '(' . json_encode($Result) . ')'; exit; } function getGroupedTargets($TargetNo, $Session = 0, $SesType = 'Q', $SesPhase = '') { global $CompId; // get all targets associated/grouped together with the target requested $SubSelect = "select TgGroup, TgSession, TgSesType\n\t\tfrom TargetGroups\n\t\twhere TgTournament={$CompId}\n\t\tand TgTargetNo='{$TargetNo}'"; if ($SesType != 'Q') { $SubSelect .= " and TgSesType='{$SesType}{$SesPhase}'";
require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; require_once 'Common/MySql2XML.class.php'; // documento xml $xmlDoc = new DOMDocument('1.0', 'UTF-8'); $xmlRoot = $xmlDoc->createElement('response'); $xmlDoc->appendChild($xmlRoot); $xmlVers = $xmlDoc->createElement('versions'); $xmlRoot->appendChild($xmlVers); $xmlVerInfo = $xmlDoc->createElement('arf_info', '20081119.01'); $xmlVers->appendChild($xmlVerInfo); $xmlVerOut = $xmlDoc->createElement('arf_output', '20081119.01'); $xmlVers->appendChild($xmlVerOut); $xmlVerIn = $xmlDoc->createElement('arf_info', '20081119.01'); $xmlVers->appendChild($xmlVerIn); // Estraggo l'id dato il codice gara $ToId = getIdFromCode($_REQUEST['Code']); if ($ToId != 0) { /* * - info gara * - numero di sessioni nella qualificazione e numero di distanze nella qualificazione */ /*$query = "SELECT " . "'Output' AS `header->direction`," . " ToCode AS `header->tour_code`," . "ToName AS `header->tour_name`," . "IF(TtElabTeam=1 || TtElabTeam=2,'1',IF(INSTR(TtName,'Indoor')=0,'0','2' )) AS `header->type`, " . "ToNumSession AS `info->qualification->number_sessions`," . "TtNumDist AS `info->qualification->number_distances` " . "FROM " . "Tournament INNER JOIN Tournament*Type ON ToType=TtId "
<?php require_once dirname(dirname(__FILE__)) . '/config.php'; require_once 'Common/Fun_FormatText.inc.php'; $CFG->TRACE_QUERRIES = false; if (!empty($_SESSION['TourId'])) { $TourId = $_SESSION['TourId']; } if (isset($_REQUEST['TourCode'])) { $TourId = getIdFromCode($_REQUEST['TourCode']); } if (empty($TourId)) { print get_text('CrackError'); exit; } include 'Common/Fun_Export.php'; $Gara = export_tournament($TourId, !empty($_REQUEST['Complete'])); // We'll be outputting a gzipped TExt File in UTF-8 pretending it's binary header('Content-type: application/octet-stream'); // It will be called ToCode.ianseo header("Content-Disposition: attachment; filename=\"{$Gara['Tournament']['ToCode']}.ianseo\""); ini_set('memory_limit', sprintf('%sM', 512)); //debug_svela($Gara, true); // The PDF source is in original.pdf echo gzcompress(serialize($Gara), 9); exit;
<?php define('debug', false); // settare a true per l'output di debug require_once dirname(dirname(__FILE__)) . '/config.php'; require_once 'Common/Lib/ArrTargets.inc.php'; require_once 'Common/Fun_FormatText.inc.php'; require_once 'Fun_Final.local.inc.php'; $Error = ''; if (empty($_REQUEST['TourCode']) and empty($_SESSION['TourId'])) { $Error = 'No Tournament Selected'; } else { $TourId = empty($_REQUEST['TourCode']) ? $_SESSION['TourId'] : getIdFromCode($_REQUEST['TourCode']); } $LastUpdated = empty($_REQUEST['Time']) ? 0 : $_REQUEST['Time']; $WinWidth = empty($_REQUEST['Width']) ? 800 : $_REQUEST['Width']; $XML = '<r>' . '<e>' . intval(!empty($Error)) . '</e>' . '<t>0</t>' . '<c><![CDATA[' . $Error . ']]></c>' . '</r>'; if ($Error) { header('Content-Type: text/xml'); die($XML); } $q = safe_r_sql("(select '0' as Team, FinEvent as Event, FinMatchNo as MatchNo, UNIX_TIMESTAMP(FinDateTime) DateTime, UNIX_TIMESTAMP(FinDateTime)>{$LastUpdated} Updated from Finals where FinTournament={$TourId} and FinLive='1')\n\t\tUNION\n\t\t(select '1' as Team, TfEvent as Event, TfMatchNo as MatchNo, UNIX_TIMESTAMP(TfDateTime) DateTime, UNIX_TIMESTAMP(TfDateTime)>{$LastUpdated} Updated from TeamFinals where TfTournament={$TourId} and TfLive='1') order by MatchNo"); if (!($r = safe_fetch($q))) { $Error = 'no match now'; } $XML = '<r>' . '<e>' . intval(!empty($Error)) . '</e>' . '<t>' . ($Error ? 0 : $r->DateTime) . '</t>' . '<c><![CDATA[' . $Error . ']]></c>' . '</r>'; // No changes so exits immediately if ($Error or !$r->Updated) { header('Content-Type: text/xml'); die($XML); }
<?php require_once '../../config.php'; if (empty($_GET['Tour']) or !($TourId = getIdFromCode($_GET['Tour'], true))) { exit('No Tournament Selected. Usage (TourCode is the Tournament Code, not ID!): IanseoAwards.php?Tour=TourCode'); } $TourCode = $_GET['Tour']; $TourCodeSafe = preg_replace('/[^a-z0-9_.-]/sim', '', $TourCode);
/** * This function is called on opening of a tournament and checks * if all flags and pictures are on disk (for TV output and Boinx Output) * and up to date * * It is also called on each TV Output or Boinx XML generation and only checks * if recent changes have been done getting the first file of the considered type * and checking its timestamp against the database. * * If a change has been done BUT the image seems to be wrong, the safest way is open the tournament * with another browser or from a different computer, to activate the first check! * */ function CheckPictures($TourCode = '', $open = false, $all = false, $force = false) { global $CFG; if ($all) { $TourCode = 'All'; $TourId = -1; } else { if (!$TourCode) { $TourCode = $_SESSION['TourCodeSafe']; } $TourId = getIdFromCode($TourCode); } $TourCodeSafe = preg_replace('/[^a-z0-9_.-]/sim', '', $TourCode); $OnlyNewer = ''; // starts with no filters at all if ($open) { $now = strtotime('-10 days'); // on opening of the tournament erase ALL the pictures older than 10 days; $Images = glob($CFG->DOCUMENT_PATH . 'TV/Photos/*.jpg'); foreach ($Images as $img) { if (filemtime($img) < $now) { unlink($img); } } } else { // in all other cases, sets the filter to one of the images of the tournament // NO GUARANTEE that it is the oldest or the most recent // but it should be enough because of the 1st step $Images = glob($CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-En-*.jpg'); if ($Images) { $OnlyNewer = filemtime($Images[0]); // create filter // speeds the process for the next time the function is called, as it will skip this file :) touch($Images[0]); } $Images = glob($CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-Fl-*.jpg'); if ($Images) { $OnlyNewer = max($OnlyNewer, filemtime($Images[0])); // create filter // speeds the process for the next time the function is called, as it will skip this file :) touch($Images[0]); } } if ($all) { // updates the multimedia content as well... $q = safe_r_sql("select * from TVContents where TVCMimeType in ('image/gif','image/jpeg','image/png') and TVCTournament in (-1, {$TourId})"); while ($r = safe_fetch($q)) { $im = imagecreatefromstring($r->TVCContent); imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/TV-' . ($r->TVCTournament == -1 ? 'BaseIanseo' : $TourCodeSafe) . '-' . ($r->TVCName == 'IdCardFooter' ? $r->TVCName : $r->TVCId) . '.jpg', 90); } // AND the Tour images as well... $q = safe_r_sql("select * from Tournament where ToId = {$TourId}"); if ($r = safe_fetch($q)) { @unlink($CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . 'ToLeft.jpg'); @unlink($CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . 'ToRight.jpg'); @unlink($CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . 'ToBottom.jpg'); if ($r->ToImgL and $im = @imagecreatefromstring($r->ToImgL)) { imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-ToLeft.jpg', 90); } if ($r->ToImgR and $im = @imagecreatefromstring($r->ToImgR)) { imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-ToRight.jpg', 90); } if ($r->ToImgB and $im = @imagecreatefromstring($r->ToImgB)) { imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-ToBottom.jpg', 90); } } // AND the Tour Backnumbers as well... $q = safe_r_sql("select BnFinal, BnBackground from BackNumber where BnTournament = {$TourId}"); if (!safe_num_rows($q)) { if (!$all) { createBackno($TourCodeSafe); } } else { while ($r = safe_fetch($q)) { if ($r->BnBackground and $im = @imagecreatefromstring($r->BnBackground)) { imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-BackNo-' . $r->BnFinal . '.jpg', 90); } } } // and the accreditation pictures too... $q = safe_r_sql("select IcBackground from IdCards where IcTournament = {$TourId}"); if ($r = safe_fetch($q)) { if ($r->IcBackground and $im = @imagecreatefromstring($r->IcBackground)) { imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-Accreditation.jpg', 90); } } $q = safe_r_sql("select IceContent, IceOrder from IdCardElements where IceTournament = {$TourId} and IceType='Image'"); while ($r = safe_fetch($q)) { if ($r->IceContent and $im = @imagecreatefromstring($r->IceContent)) { imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-Image-' . $r->IceOrder . '.jpg', 90); } } // and the Images too... $q = safe_r_sql("select * from Images where ImTournament = {$TourId}"); while ($r = safe_fetch($q)) { if ($r->ImContent and $im = @imagecreatefromstring($r->ImContent)) { imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-' . $r->ImIocCode . '-' . $r->ImSection . '-' . $r->ImReference . '-' . $r->ImType . '.jpg', 90); } } $Sql = "(select" . " 'Fl' PictureType, " . " FlCode PictureCode," . " FlJPG Picture," . " unix_timestamp(FlEntered) PictureTime " . "from" . " Flags " . "where" . " FlTournament = -1 " . " and FlJPG>'') " . "UNION " . "(select" . " 'Fl-svg', " . " FlCode," . " FlSVG," . " unix_timestamp(FlEntered) UnixTime " . "from" . " Flags " . "where" . " FlTournament = -1" . " and FlSVG>'') "; } else { $Sql = "(select" . " 'En' PictureType, " . " PhEnId PictureCode," . " PhPhoto Picture," . " unix_timestamp(PhPhotoEntered) PictureTime " . "from" . " Photos" . " left join Entries on EnId=PhEnId " . "where" . " EnTournament={$TourId} " . ($OnlyNewer ? " and unix_timestamp(PhPhotoEntered)>{$OnlyNewer} " : '') . " and PhPhoto>'') " . "UNION " . "(select" . " 'Fl', " . " FlCode," . " FlJPG," . " unix_timestamp(FlEntered) UnixTime " . "from" . " Flags " . " inner join Countries on FlCode=CoCode and CoTournament={$TourId} " . "where" . " FlTournament in (-1, {$TourId})" . ($OnlyNewer ? " and unix_timestamp(FlEntered)>{$OnlyNewer} " : '') . " and FlJPG>'') " . "UNION " . "(select" . " 'Fl-svg', " . " FlCode," . " FlSVG," . " unix_timestamp(FlEntered) UnixTime " . "from" . " Flags " . " inner join Countries on FlCode=CoCode and CoTournament={$TourId} " . "where" . " FlTournament in (-1, {$TourId})" . ($OnlyNewer ? " and unix_timestamp(FlEntered)>{$OnlyNewer} " : '') . " and FlSVG>'') "; } $q = safe_r_sql($Sql); while ($r = safe_fetch($q)) { if ($r->PictureType == 'Fl-svg') { $ImName = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-' . $r->PictureType . '-' . $r->PictureCode . '.svg'; if ($force or !file_exists($ImName) or filemtime($ImName) < $r->PictureTime) { $f = fopen($ImName, 'w'); fwrite($f, gzinflate($r->Picture)); fclose($f); } } else { $ImName = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $TourCodeSafe . '-' . $r->PictureType . '-' . $r->PictureCode . '.jpg'; if ($force or !file_exists($ImName) or filemtime($ImName) < $r->PictureTime) { if ($im = @imagecreatefromstring(base64_decode($r->Picture))) { Imagejpeg($im, $ImName, 95); } elseif ($r->PictureType == 'En') { safe_w_SQL("delete from Photos where PhEnId={$r->PictureCode}"); } } } } }
cd_redirect(); } // trucchetto per permettere o negare il debug nonostante il get di cui sopra $ERROR_REPORT = ($ERROR_REPORT and $_SESSION['debug']); if ($ERROR_REPORT) { error_reporting(E_ALL); ini_set('display_errors', 'On'); } else { error_reporting(0); ini_set('display_errors', 'off'); } $_SESSION['debug'] = $ERROR_REPORT; $CFG->TRACE_QUERRIES = ($CFG->TRACE_QUERRIES and $_SESSION['debug']); // Autocheckin if (!empty($CFG->ROOT_DIR) and dirname($_SERVER['PHP_SELF']) != $CFG->ROOT_DIR . 'Modules/AutoCheckin' and $Code = GetParameter('AutoCHK-Code') and !empty($_SERVER['REMOTE_ADDR']) && in_array($_SERVER['REMOTE_ADDR'], explode(',', GetParameter('AutoCHK-IP')))) { CreateTourSession(getIdFromCode($Code)); CD_redirect($CFG->ROOT_DIR . 'Modules/AutoCheckin/AutoCheckin.php'); die; } // RICONTROLLA TUTTE LE VOLTE GLI SPAREGGI! //set_qual_session_flags(); /* deposito temporaneo per Chris nelle modifiche degli header :D $JS_SCRIPT=array( '', '', '', '', ); include('Common/Templates/head.php'); include('Common/Templates/tail.php');