function do_rss($limit = "30")
{
    global $CFG;
    $sql = SQLlastTerms($limit);
    while ($array = $sql->FetchRow()) {
        $xml_seq .= '<li xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:resource="index.php?tema=' . $array[tema_id] . '"/>';
        $xml_item .= '<item xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="' . $_SESSION["CFGURL"] . '?tema=' . $arrayTT[tema_id] . '">';
        $xml_item .= '<title>' . $array[tema] . '</title>';
        $xml_item .= '<link>' . $_SESSION["CFGURL"] . '?tema=' . $array[tema_id] . '</link>';
        $xml_item .= '</item>';
    }
    header('content-type: text/xml');
    $xml .= '<?xml version="1.0" encoding="' . $CFG["_CHAR_ENCODE"] . '" standalone="yes"?>';
    $xml .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">';
    $xml .= '<channel rdf:about="' . $_SESSION["CFGURL"] . '">';
    $xml .= '<title xmlns:dc="http://purl.org/dc/elements/1.1/">' . xmlentities($_SESSION["CFGTitulo"]) . '</title>';
    $xml .= '<description xmlns:dc="http://purl.org/dc/elements/1.1/">' . xmlentities($_SESSION["CFGCobertura"], true) . '</description>';
    $xml .= '<link xmlns:dc="http://purl.org/dc/elements/1.1/">' . $_SESSION["CFGURL"] . '</link>';
    $xml .= '<items>';
    $xml .= '<rdf:Seq>';
    $xml .= $xml_seq;
    $xml .= '</rdf:Seq>';
    $xml .= '</items>';
    $xml .= '</channel>';
    $xml .= $xml_item;
    $xml .= '</rdf:RDF>';
    echo $xml;
}
 function fetchLast()
 {
     $sql = SQLlastTerms(50);
     while ($array = $sql->FetchRow()) {
         $array["cuando_final"] = $array["cuando_final"] > 0 ? $array["cuando_final"] : '';
         $result["result"]["{$array['tema_id']}"] = array("term_id" => $array["tema_id"], "code" => $array["code"], "lang" => $array["idioma"], "string" => FixEncoding($array["tema"]), "isMetaTerm" => $array["isMetaTerm"], "date_create" => $array["cuando"], "date_mod" => $array["cuando_final"]);
     }
     return $result;
 }
function HTMLlistaTerminosFecha($limite = "")
{
    //Descripcion de estados
    $arrayEstados = array("12" => LABEL_Candidatos, "13" => LABEL_Aceptados, "14" => LABEL_Rechazados);
    $sql = SQLlastTerms($limite);
    $rows .= '<div><h3>' . ucfirst(LABEL_newsTerm) . '</h3>';
    if (SQLcount($sql) > 0) {
        $rows .= '<div class="table-responsive"> ';
        $rows .= '<table class="table table-striped table-bordered table-condensed table-hover">
			<thead>
			<tr>
				<th>' . ucfirst(LABEL_Termino) . '</th>
				<th>' . ucfirst(LABEL_lastChangeDate) . '</th>
			</tr>
			</thead>
			<tbody>';
        while ($array = $sql->FetchRow()) {
            $css_class_MT = $array["isMetaTerm"] == 1 ? ' class="metaTerm" ' : '';
            $fecha = @$array["cuando_final"] ? $array["cuando_final"] : $array["cuando"];
            $rows .= '<tr>';
            $rows .= '     	<td><a class="estado_termino' . $array[estado_id] . '" title="' . $array[tema] . '" href="index.php?tema=' . $array[tema_id] . '&tipo=E">' . $array[tema] . '</a></td>';
            $rows .= '      <td>' . $fecha . '</td>';
            $rows .= ' </tr>';
        }
        $rows .= '        </tbody>		</table>';
        $rows .= '        </div>';
    }
    $rows .= '</div>';
    return $rows;
}