<?php
ob_start();

header("Expires: Mon, 20 Mar 1998 12:01:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

require_once("Sigma.php");
$tpl =& new HTML_Template_Sigma('.', './template/cache');

//redireccionamientos.
$tpl->loadTemplateFile('soc.htm');
$tpl->setVariable('fecha', date("d/m/Y"));
$colores = "";

$archivo = $_GET['file']; //"soc.xml";

if (file_exists($archivo)) {
    
    if (is_readable($archivo)) {
		
        if (!$myxml = simplexml_load_file($archivo))
            echo 'Error al Cargar Archivo XML';
        else {
            foreach ($myxml as $node) {
				if ($colores == "grey") {
					$tpl->setVariable('colores', '');
					$colores = "";
				} else {
					$tpl->setVariable('colores', ' class="grey"');
					$colores = "grey";
				}
				
                $tpl->setVariable('dep', $node->Liga);
                $tpl->setVariable('nu', BlankSpace($node->Orden));
                
                $timegame = explode(":", $node->TimeGame);
                $hora     = $timegame[0] . ':' . $timegame[1];
                
                if ($timegame[2] == 'p.' || $timegame[2] == 'P.')
                    $meridian = 'PM';
                elseif ($timegame[2] == 'a.' || $timegame[2] == 'A.')
                    $meridian = 'AM';
                else
                    $meridian = $timegame[2];
                
                $tpl->setVariable('hora', $hora);
                $tpl->setVariable('espa', $meridian);
                $tpl->setVariable('vId', $node->VisTeam);
                
                $tpl->setVariable('eq_visitante', $node->EquipoVisitante);
                $tpl->setVariable('lId', $node->LocTeam);
                
                $tpl->setVariable('eq_local', utf8_decode(BlankSpace($node->EquipoLocal)));
                $tpl->setVariable('jc_mlv', utf8_decode(BlankSpace($node->PriceMLJCVis)));
                
                $tpl->setVariable('jc_mll', utf8_decode(BlankSpace($node->PriceMLJCLoc)));
                $tpl->setVariable('jc_rlv', utf8_decode(BlankSpace($node->RLJCVis . ' ' . $node->PriceRLJCVis)));
                
                $tpl->setVariable('jc_rll', utf8_decode(BlankSpace($node->RLJCLoc . ' ' . $node->PriceRLJCLoc)));
                
                $tpl->setVariable('sjcv', utf8_decode(BlankSpace($node->TotalJC)));
                
                $tpl->setVariable('empv', utf8_decode(BlankSpace($node->PriceEmpateJCVis)));
                $tpl->setVariable('empl', utf8_decode(BlankSpace($node->PriceEmpateJCLoc)));
                
                $registro++;
                
                $tpl->parse('bloque1');
                
            } //for.
        } //else
    } //is readable.
}

$tpl->show();

?>