<?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");
mb_http_output('UTF-8');

$tpl =& new HTML_Template_Sigma('.', './template/cache');
$tpl->loadTemplateFile('ofd.htm');
$file = $_GET['file'];

$colores = "";
$tpl->setVariable('fecha', date("d/m/Y"));

if (file_exists($file) && is_readable($file)) {
    if (!$myxml = simplexml_load_file($file))
        echo 'Error al Cargar Archivo XML';
    else {
        foreach ($myxml as $node) {
            $tpl->setVariable('dep', $node->Liga);
            if ($colores == "grey") {
                $tpl->setVariable('colores', '');
                $colores = "";
            } else {
                $tpl->setVariable('colores', ' class="grey"');
                $colores = "grey";
            }
            
            $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 . $meridian);
            $tpl->setVariable('img1', '<img src="./logos/' . $node->Logo . '" width="79" height="80">');
            $tpl->setVariable('vId', $node->Team);
            
            $tpl->setVariable('eq_visitante', $node->Equipo);
            $tpl->setVariable('ml', utf8_decode($node->MLOffer));
            $tpl->setVariable('rl', utf8_decode($node->RLOffer));
            $tpl->setVariable('to', utf8_decode($node->TOffer));
            $tpl->setVariable('note', utf8_decode($node->Note));
            $tpl->parse('bloque1');
            
        } //for.
    } //else
}

$tpl->show();

?>