set_time_limit(60); include "common/config.php"; include "common/funciones.php"; include_once("clases/DBClass.php"); include "clases/class.factory.php"; include "template/class.TemplatePower.inc.php"; // include the counter class $db_server= "localhost"; $db_database = "ceiuc"; $db_user = "ceiuc"; $db_password = "pwdceiuc"; include 'clases/SimpleCounter.php'; $counter = new SimpleCounter ($db_server, $db_database, $db_user, $db_password); $querys = ReplaceOne("&", "&", $_SERVER["QUERY_STRING"]); $output = array(); parse_str($querys, $output); foreach ( $output as $key => $value) { $_GET[$key] = $value; } unset($ouput, $querys); $opcion = $_GET["opc"]; $subtipo = $_GET["st"]; $tpl = new TemplatePower( RUTA_TEMPLATES."index.tpl" ); $tpl->assignInclude("index_header", RUTA_TEMPLATES."index_header.tpl"); $tpl->assignInclude("menu_principal", RUTA_TEMPLATES."index_menu_principal.tpl"); $tpl->assignInclude("index_footer", RUTA_TEMPLATES."index_footer.tpl"); // include the counter class //require_once ('common/SimpleCounter.php'); // create counter instance with standard session timeout // print counter state // print "Users online: " . $counter->getUsersOnlineCount () . ""; // print "Visits today: " . $counter->getTodaysVisitCount () . ""; // print "Hits today: " . $counter->getTodaysHitCount () . ""; // print "Counting since: " . $counter->getCounterStartDate () . ""; // print "Visits total: " . $counter->getTotalVisitCount () . ""; // print "Hits total: " . $counter->getTotalHitCount () . ""; switch ($opcion){ case "mapasitio": { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_mapa.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_mapa_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); asignaOpcionesLaterales($tpl,$opcion,$_GET["id"] ); break; } case "contacto": { $error = ''; // error message $name = ''; // sender's name $email_ori= ''; // sender's email address $subject = ''; // subject $message = ''; // the message itself $spamcheck = ''; // Spam check $email_dest = ''; // EmailDest if(isset($_POST['send'])) { $name = $_POST['name']; $email_ori = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $spamcheck = $_POST['spamcheck']; $email_dest = $_POST['email_dest']; $tip = $_POST['tip']; $id = $_POST['id']; $error = verficaDatosMail($name, $email_ori, $subject, $message, $spamcheck, "nada"); if($error == '') { if(get_magic_quotes_gpc()) { $message = stripslashes($message); } $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_enviomail.tpl"); if ( enviarContacto($name, $email_ori, $subject, $message)) { $error = "Correcto"; } else { $error = "Incorrecto"; } } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_contactenos.tpl"); } } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_contactenos.tpl"); $tip = $_GET['tip']; $id = $_GET['id']; } $tpl->prepare(); $tpl->assign("name", $name); $tpl->assign("email", $email_ori); $tpl->assign("subject", $subject); $tpl->assign("message", $message ); $tpl->assign("spamcheck", $spamcheck); $tpl->assign("email_dest", $email_dest); $tpl->assign("id_news", $id); $tpl->assign("tip", $tip); if(!isset($_POST['send']) || $error != '') { if ($error == "Correcto") { $tpl->assign("mail_texto1","El mail ha sido enviado a nuestro departamento."); $tpl->assign("mail_texto2",""); } else { $tpl->assign("mail_texto1", "" ); $tpl->assign("mail_texto2", "Tenemos problemas con nuestro servicio de correo, intentelo mas tarde."); } $tpl->assign("error_mail", $error); $tpl->assign("titulo_mail", "Contactenos"); } $tpl->assign("action_form", "index.php?opc=contacto&tip=".$_GET["opc"]."&id=".$_GET["id"]); asignaMenu($tpl); break; } // ==========> Fin Contactenos case ENVIAR_AMIGO: $error = ''; // error message $name = ''; // sender's name $email_ori= ''; // sender's email address $subject = ''; // subject $message = ''; // the message itself $spamcheck = ''; // Spam check $email_dest = ''; // EmailDest if(isset($_POST['send'])) { $name = $_POST['name']; $email_ori= $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $spamcheck = $_POST['spamcheck']; $email_dest = $_POST['email_dest']; $tip = $_POST['tip']; $id = $_POST['id']; $error = verficaDatosMail($name, $email_ori, $subject, $message, $spamcheck, $email_dest); if($error == '') { if(get_magic_quotes_gpc()) { $message = stripslashes($message); } $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_enviomail.tpl"); if ( enviarAmigo($name, $email_ori, $subject, $message, $email_dest, $tip,$id )) { $error = "Correcto"; } else { $error = "Incorrecto"; } } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_enviaramigo.tpl"); } } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_enviaramigo.tpl"); $tip = $_GET['tip']; $id = $_GET['id']; } $tpl->prepare(); $tpl->assign("name", $name); $tpl->assign("email", $email_ori); $tpl->assign("subject", $subject); $tpl->assign("message", $message ); $tpl->assign("spamcheck", $spamcheck); $tpl->assign("email_dest", $email_dest); $tpl->assign("id_news", $id); $tpl->assign("tip", $tip); if(!isset($_POST['send']) || $error != '') { if ($error == "Correcto") { $tpl->assign("mail_texto1","Un mail ha sido enviado a la casilla de su amigo."); $tpl->assign("mail_texto2",""); } else { $tpl->assign("mail_texto1", "" ); $tpl->assign("mail_texto2", "Tenemos problemas con nuestro servicio de correo, intentelo mas tarde."); } $tpl->assign("error_mail", $error); $tpl->assign("titulo_mail", "Enviar a un amigo"); } $tpl->assign("action_form", "index.php?opc=E&tip=".$_GET["opc"]."&id=".$_GET["id"]); asignaMenu($tpl); break; case DESCARGA_ARCHIVO: case IMPRIMIR: $tip = $_GET['tip']; $id = $_GET['id']; unset($tpl); $tpl = new TemplatePower( RUTA_TEMPLATES."index_imp.tpl" ); switch ($tip){ case "154": { // Noticias $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_noticias_imp.tpl"); $tpl->prepare(); asignaNoticia($tpl, $id); break; } case "156": { // FONDEF $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_fondef_imp.tpl"); $tpl->prepare(); break; } case "160": { // Diplomados if ($id != "") { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_diplomados_imp.tpl"); } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_home_diplomados_imp.tpl"); } $tpl->prepare(); asignaDiplomados($tpl, $id); break; } case "161": { // Extension $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_extension_imp.tpl"); $tpl->prepare(); asignaExtension($tpl, $id); break; } case "162":{ // Columnas de Opinión/Blog $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_noticias_imp.tpl"); $tpl->prepare(); asignaNoticia($tpl, $id, "Opinion"); break; } case "163":{ // Documentos de Interes $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_multimedia_imp.tpl"); $tpl->prepare(); asignaMultimedia($tpl, $id, "DocInteres"); break; } case "164": { // Multimedia $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_multimedia_imp.tpl"); $tpl->prepare(); asignaMultimedia($tpl, $id, "Multimedia"); break; } case "165":{ // Programa Radio. $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_multimedia_imp.tpl"); $tpl->prepare(); asignaMultimedia($tpl, $id, "ProgRadio"); break; } case "183":{ // Cuadernos de Difucion if ($id != "") { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_publicaciones_imp.tpl"); } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_home_publicaciones_imp.tpl"); } //$tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_multimedia_imp.tpl"); $tpl->prepare(); asignaMultimedia($tpl, $id, "Cuaderno_difucion"); break; } case "166": case "171": { // Misión/Visión if ($tip=="166") { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_mision_vision_imp.tpl"); } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_mision_vision_eng_imp.tpl"); } $tpl->prepare(); break; } case "167": case "172": { // Quienes somos o Equipo de trabajo if ($tip=="167") { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_quienessomos_imp.tpl"); } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_quienessomos_eng_imp.tpl"); } $tpl->prepare(); break; } case "170": { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_cuaderno_difucion_imp.tpl"); $tpl->prepare(); break; } case "200":{ // recomendados $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_recomendamos_imp.tpl"); $tpl->prepare(); break; } } $tpl->assignGlobal("ruta_imagenes", RUTA_IMAGENES); $tpl->assign("titulo", TITULO); if ($opcion == IMPRIMIR ) { crearPDF($tpl, $tip, $id, true); } else { crearPDF($tpl, $tip, $id); } header("location: index.php?opc=$tip&id=$id"); break; case SUBSCRIBIR: $tip = $_GET['tip']; $id = $_GET['id']; asignaRSS($tip); exit; //$tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_enviaramigo.tpl"); // $tpl->prepare(); //asignaMenu($tpl); break; case "5000": //Inscribite case "5100":{ //Confirmacion $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_inscripcion.tpl"); $tpl->prepare(); asignaMenu($tpl); if ($opcion=="5000") { enviaMail($tpl, $_POST["txtmail"], 0, 0); } else { enviaMail($tpl, "", 1, $_GET["id"]); } break; } case "154": { // Noticias $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_noticias.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_noticias_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaNoticia($tpl, $_GET["id"]); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], "Noticia"); asignaHistorico($tpl, $opcion, "Noticia"); break; } case "156": { // FONDEF $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_fondef.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_fondef_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); asignaOpcionesLaterales($tpl,$opcion,$_GET["id"] ); break; } case "160": { // Diplomados if (isset($_GET["id"])) { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_diplomados.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_diplomados_imp.tpl"); } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_home_diplomados.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_home_diplomados_imp.tpl"); } $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaDiplomados($tpl, $_GET["id"]); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], "Diplomado"); asignaHistorico($tpl, $opcion, "Diplomado"); break; } case "161": { // Extension $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_extension.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_extension_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaExtension($tpl, $_GET["id"]); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], "Extension"); asignaHistorico($tpl, $opcion, "Extension"); break; } case "162":{ // Columnas de Opinión/Blog $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_noticias.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_noticias_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaNoticia($tpl, $_GET["id"], "Opinion"); asignaUltimasNoticias($tpl, $_GET["id"], "Opinion"); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaHistorico($tpl, $opcion,"Opinion"); break; } case "163":{ // Documentos de Interes $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_multimedia.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_multimedia_imp.tpl"); //$tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_documentos_interes.tpl"); //$tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_documentos_interes_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaMultimedia($tpl, $_GET["id"], "DocInteres"); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], "DocInteres"); asignaHistorico($tpl, $opcion,"DocInteres"); break; } case "164":{ // Multimedia $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_multimedia.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_multimedia_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaMultimedia($tpl, $_GET["id"], "Multimedia"); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], "Multimedia"); asignaHistorico($tpl, $opcion,"Multimedia"); break; } case "165":{ // Programa Radio. $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_multimedia.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_multimedia_imp.tpl"); //$tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_radio.tpl"); //$tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_radio_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaMultimedia($tpl, $_GET["id"], "ProgRadio"); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], "ProgRadio"); asignaHistorico($tpl, $opcion,"ProgRadio"); break; } case "183": { // Cuadernos de difucion if ($subtipo == "") { $clase = "Publicaciones"; } else { $clase = "Cuaderno_difucion"; $oN = TFactoryClass::factory("T".$clase); $registros = $oN->ultimas_noticias( 1 ); $_GET["id"] = $registros[0]["news_id"]; } if (isset($_GET["id"])) { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_publicaciones.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_publicaciones_imp.tpl"); } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_home_publicaciones.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_home_publicaciones_imp.tpl"); } $tpl->prepare(); asignaMenu($tpl); $_GET["id"] = asignaPublicaciones($tpl, $_GET["id"], $clase); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], $clase); asignaHistorico($tpl, $opcion,$clase); break; } case "200":{ // recomendados $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_recomendamos.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_recomendamos_imp.tpl"); $tpl->prepare(); asignaMenu($tpl); asignaRecomendados($tpl, $opcion, $_GET["id"]); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaUltimasNoticias($tpl, $_GET["id"], "Recomendamos"); asignaHistorico($tpl, $opcion, "Recomendamos"); break; } case "166": case "171": { // Misión/Visión if ($opcion=="166") { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_mision_vision.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_mision_vision_imp.tpl"); $menuquienessomos = 15000; } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_mision_vision_eng.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_mision_vision_eng_imp.tpl"); $menuquienessomos = 20000; } //$tpl->assignInclude("index_recomendado", RUTA_TEMPLATES."template_mision_vision_menu.tpl"); $tpl->prepare(); asignaMenu($tpl); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaQuienesSomos($tpl, $menuquienessomos); break; } case "167": case "172": { // Quienes somos o Equipo de trabajo if ($opcion=="167") { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_quienessomos.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_quienessomos_imp.tpl"); $menuquienessomos = 15000; } else { $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."template_quienessomos_eng.tpl"); $tpl->assignInclude("index_contenido_contenido", RUTA_TEMPLATES."template_quienessomos_eng_imp.tpl"); $menuquienessomos = 20000; } $tpl->prepare(); asignaMenu($tpl); asignaOpcionesLaterales($tpl, $opcion, $_GET["id"]); asignaQuienesSomos($tpl, $menuquienessomos ); break; } case "168":{ // red de contactos $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."red_contactos.tpl"); $tpl->prepare(); asignaMenu($tpl); break; } default: $tpl->assignInclude("index_destacado", RUTA_TEMPLATES."index_destacado.tpl"); $tpl->assignInclude("index_recomendado", RUTA_TEMPLATES."index_recomendado.tpl"); $tpl->assignInclude("index_contenido", RUTA_TEMPLATES."index_contenido.tpl"); $tpl->assignInclude("index_biblioteca", RUTA_TEMPLATES."index_biblioteca.tpl"); $tpl->assignInclude("index_inscribete", RUTA_TEMPLATES."index_inscribete.tpl"); $tpl->assignInclude("sabatico", RUTA_TEMPLATES."sabatico.tpl"); $tpl->prepare(); asignaMenu($tpl); asignaPortada($tpl); asignaDestacados($tpl); asignaRecomendados($tpl); asignaBiblioteca($tpl); } $bgcolor = "#FFFFFF"; if ($opcion=="156") $bgcolor = "#D8DDE1"; $tpl->assignGlobal("color_fondo", $bgcolor); $tpl->assignGlobal("ruta_imagenes", RUTA_IMAGENES); $tpl->assign("titulo", TITULO); $tpl->printToScreen(); //*************************************************************************************** // Menu //*************************************************************************************** function asignaMenu(&$tpl) { $numero_pantalla = 10000; $oMenu = TFactoryClass::factory("TMenu"); //$tpl->assign("menu_vertical", $oMenu->CreaMenu($numero_pantalla,-1)); $menu_principal = $oMenu->CreaMenuCSS($numero_pantalla); $tpl->gotoBlock("barra_menu"); foreach((array) $menu_principal as $line) { $nombreMenu = "top".$line["id_menu"]; $cdes_item = $line["cdes_itm"]; $nsub_pan = $line["nsub_pan"]; $cnom_pro = $line["cnom_pro"]; $menu_accion = $line["menu_accion"]; $menu_ventana = $line["cmenu_ventana"]; $menu_ancho = $line["cmenu_ancho"]; $tpl->newBlock("barra_menu"); $tpl->assign("ancho_menu", $menu_ancho); $tpl->assign("cdes_itm", $cdes_item); if ($nsub_pan == 0 ) { $tpl->assign("link_menubar", $cnom_pro); $tpl->assign("onclick", ""); $tpl->assign("onmouseover", ""); } else { $tpl->assign("link_menubar", ""); $tpl->assign("onclick", "return buttonClick(event, '".$nombreMenu."');"); $tpl->assign("onmouseover", "buttonMouseover(event, '".$nombreMenu."');"); } } foreach((array) $menu_principal as $line) { $nombreMenu = "top".$line["id_menu"]; $cdes_item = $line["cdes_itm"]; $nsub_pan = $line["nsub_pan"]; $cnom_pro = $line["cnom_pro"]; $menu_accion = $line["menu_accion"]; $menu_ventana = $line["cmenu_ventana"]; $menu_ancho = $line["cmenu_ancho"]; if ($nsub_pan != 0) { $tpl->newBlock("sub_menu"); $tpl->assign("nombre_menu",$nombreMenu ); $tpl->assign("ancho_menu", $menu_ancho ); $tpl->assign("ancho_box", $menu_ancho ); foreach((array) $oMenu->CreaMenuCSS($nsub_pan) as $linea) { $tpl->newBlock("menu_item"); $tpl->assign("link_menu_item",$linea["cnom_pro"]); $tpl->assign("nombre_menu_item", $linea["cdes_itm"]); } } } $tpl->gotoBlock("_ROOT"); //$tpl->assign("menu_vertical", $oMenu->CreaMenuCoolMenus($numero_pantalla,-1)); $tpl->assign("lnk_inicio", "index.php"); $tpl->assign("lnk_mapa", "index.php?opc=mapasitio"); $tpl->assign("lnk_contacto", "index.php?opc=contacto"); $tpl->assign("lnk_bandera", "index.php?opc=172"); } function asignaPublicaciones(&$tpl, $news_id = "", $clase='') { if ($news_id == "" ) asignaPublicacionesHome($tpl, $clase); else asignaPublicacionesPagina( $tpl, $news_id, $clase); return $news_id; } function asignaPublicacionesHome(&$tpl, $clase) { $oTabla = TFactoryClass::factory("TTablas"); switch ( strtolower($clase) ) { case "multimedia": $diplomados = TFactoryClass::factory("TMultimedia"); // $diplomados->set("news_tipo", TIPO_MULTIMEDIAA); $titulo_seccion = "MULTIMEDIA"; break; case "progradio": $diplomados = TFactoryClass::factory("TMultimedia"); //$diplomados->set("news_tipo", TIPO_PROGRAMA_RADIO_PORTADA); $titulo_seccion = "PROGRAMA DE RADIO"; break; case "docinteres": $diplomados = TFactoryClass::factory("TMultimedia"); //$diplomados->set("news_tipo", TIPO_DOCUMENTOS_DE_INTERES_PORTADA); $titulo_seccion = "DOCUMENTOS DE INTERÉS"; break; case "cuaderno_difucion": $diplomados = TFactoryClass::factory("TCuaderno_difucion"); //$diplomados->set("news_tipo", TIPO_CUADERNO_DIFUCION_PORTADA); $titulo_seccion = "CUADERNOS DE DIFUSION"; break; default: $diplomados = TFactoryClass::factory("TPublicaciones"); } $registros = $diplomados->ultimas_noticias( 3 ); $tpl->gotoBlock("lista_diplomados"); foreach ((array) $registros as $reg) { $tpl->newBlock("lista_diplomados"); $reg_epigrafe = $oTabla->saca_info_tabla_codigo('epigrafe_publicacion',$reg["news_epigrafe_id"]); if (count($reg_epigrafe)) $text_epigrafe = $reg_epigrafe["descripcion_corta"]; else $text_epigrafe = $reg["news_epigrafe_texto"]; $tpl->assign("diplomado_foto", $diplomados->get_fotografia( $reg["news_id"] )); $tpl->assign("diplomado_epigrafe", $text_epigrafe); $tpl->assign("diplomado_titulo", $reg["news_titulo_"]); $tpl->assign("diplomado_resumen", ucase($reg["news_resumen"])); $tpl->assign("diplomado_fecha_publicacion", fecha_en_chileno($reg["news_fecha_publicacion"])); $tpl->assign("diplomado_link", "index.php?opc=183&id=".$reg["news_id"]); } unset($diplomados, $oTabla, $registros); } function asignaPublicacionesPagina(&$tpl, $news_id, $clase) { $oTabla = TFactoryClass::factory("TTablas"); switch ( strtolower($clase) ) { case "multimedia": $diplomados = TFactoryClass::factory("TMultimedia"); // $diplomados->set("news_tipo", TIPO_MULTIMEDIAA); $titulo_seccion = "MULTIMEDIA"; break; case "progradio": $diplomados = TFactoryClass::factory("TMultimedia"); //$diplomados->set("news_tipo", TIPO_PROGRAMA_RADIO_PORTADA); $titulo_seccion = "PROGRAMA DE RADIO"; break; case "docinteres": $diplomados = TFactoryClass::factory("TMultimedia"); //$diplomados->set("news_tipo", TIPO_DOCUMENTOS_DE_INTERES_PORTADA); $titulo_seccion = "DOCUMENTOS DE INTERÉS"; break; case "cuaderno_difucion": $diplomados = TFactoryClass::factory("TCuaderno_difucion"); //$diplomados->set("news_tipo", TIPO_CUADERNO_DIFUCION_PORTADA); $titulo_seccion = "CUADERNOS DE DIFUSION"; break; default: $diplomados = TFactoryClass::factory("TPublicaciones"); } $registro = $diplomados->saca_noticiaById($news_id); $reg_epigrafe = $oTabla->saca_info_tabla_codigo('epigrafe_publicacion',$registro["news_epigrafe_id"]); if (count($reg_epigrafe)) $tpl->assign("diplomado_epigrafe", $reg_epigrafe["descripcion_corta"]); else $tpl->assign("diplomado_epigrafe", $registro["news_epigrafe_texto"]); $tpl->assign("diplomado_foto", $diplomados->get_fotografia( $reg["news_id"] )); $tpl->assign("diplomado_texto", $registro["news_texto"]); $tpl->assign("diplomado_fecha_publicacion", fecha_en_chileno($registro["news_fecha_publicacion"])); $tpl->assign("diplomado_resumen", ucase($registro["news_resumen"])); $tpl->assign("diplomado_titulo", $registro["news_titulo_"]); unset($diplomados, $oTabla, $registro); return $news_id; } //*************************************************************************************** // diplomados.tpl //*************************************************************************************** function asignaDiplomados(&$tpl, $news_id = "") { if ($news_id == "" ) asignaDiplomadosHome($tpl); else asignaDiplomadosPagina( $tpl, $news_id); return $news_id; } function asignaDiplomadosHome(&$tpl) { $oTabla = TFactoryClass::factory("TTablas"); $diplomados = TFactoryClass::factory("TDiplomado"); $registros = $diplomados->ultimas_noticias( 3 ); $tpl->gotoBlock("lista_diplomados"); foreach ((array) $registros as $reg) { $tpl->newBlock("lista_diplomados"); $reg_epigrafe = $oTabla->saca_info_tabla_codigo('epigrafe_diplomado',$reg["news_epigrafe_id"]); if (count($reg_epigrafe)) $text_epigrafe = $reg_epigrafe["descripcion_corta"]; else $text_epigrafe = $reg["news_epigrafe_texto"]; $tpl->assign("diplomado_foto", $diplomados->get_fotografia( $reg["news_id"] )); $tpl->assign("diplomado_epigrafe", $text_epigrafe); $tpl->assign("diplomado_titulo", $reg["news_titulo_"]); $tpl->assign("diplomado_resumen", ucase($reg["news_resumen"])); $tpl->assign("diplomado_fecha_publicacion", fecha_en_chileno($reg["news_fecha_publicacion"])); $tpl->assign("diplomado_link", "index.php?opc=160&id=".$reg["news_id"]); } unset($diplomados, $oTabla, $registros); } function asignaDiplomadosPagina(&$tpl, $news_id) { $oTabla = TFactoryClass::factory("TTablas"); $diplomados = TFactoryClass::factory("TDiplomado"); $registro = $diplomados->saca_noticiaById($news_id); $reg_epigrafe = $oTabla->saca_info_tabla_codigo('epigrafe_diplomado',$registro["news_epigrafe_id"]); if (count($reg_epigrafe)) $tpl->assign("diplomado_epigrafe", $reg_epigrafe["descripcion_corta"]); else $tpl->assign("diplomado_epigrafe", $registro["news_epigrafe_texto"]); $tpl->assign("diplomado_foto", $diplomados->get_fotografia( $reg["news_id"] )); $tpl->assign("diplomado_texto", $registro["news_texto"]); $tpl->assign("diplomado_fecha_publicacion", fecha_en_chileno($registro["news_fecha_publicacion"])); $tpl->assign("diplomado_resumen", ucase($registro["news_resumen"])); $tpl->assign("diplomado_titulo", $registro["news_titulo_"]); $tpl->assign("news_link", $registro["news_link"]); $tpl->assign("news_link_documento", $registro["news_link_documento"]); $tpl->assign("news_email", $registro["news_email"]); $tpl->assign("news_nombre_link", $registro["news_nombre_link"]); $tpl->assign("news_nombre_documento", $registro["news_nombre_documento"]); $tpl->assign("news_nombre_email", $registro["news_nombre_email"]); //$tpl->gotoBlock("_ROOT"); $tpl->gotoBlock("listado_secciones_diplomados"); asignaSeccion($tpl, "Descripción", $registro["news_texto"]); asignaSeccion($tpl, "Dirigido a", $registro["news_dirigido_a"]); asignaSeccion($tpl, "Objetivos", $registro["news_objetivo"]); asignaSeccion($tpl, "Contenidos", $registro["news_contenido"]); asignaSeccion($tpl, "Equipo Docente", $registro["news_equipo_docente"]); asignaSeccion($tpl, "Proceso de admisión", $registro["news_admision"]); asignaSeccion($tpl, "Requisitos", $registro["news_requisitos"]); asignaSeccion($tpl, "Metodología", $registro["news_metodologia"]); unset($diplomados, $oTabla, $registro); return $news_id; } function asignaSeccion(&$tpl, $titulo, $contenido ) { if ( $contenido != "") { $tpl->gotoBlock("listado_secciones_diplomados"); $tpl->newBlock("listado_secciones_diplomados"); $tpl->assign("titulo_seccion", $titulo); $tpl->assign("descripcion_seccion", $contenido); } } //*************************************************************************************** // Biblioteca //*************************************************************************************** function asignaBiblioteca($tpl){ $oMenu = TFactoryClass::factory("TMenu"); $tpl->gotoBlock("listado_bliblioteca"); foreach ((array) $oMenu->TraeMenuTopSitio(14000) as $reg) { $tpl->newBlock("listado_bliblioteca"); $tpl->assign("link_biblioteca", $reg["cnom_pro"]); $tpl->assign("titulo_link_biblioteca", ucase($reg["cdes_itm"])); } unset($oMenu); } //*************************************************************************************** // index_destacado.tpl //*************************************************************************************** function asignaDestacados(&$tpl) { $noticias_destacadas = TFactoryClass::factory("TDestacado"); $oTabla = TFactoryClass::factory("TTablas"); $i = 1; foreach ((array) $noticias_destacadas->trae_destacados( 2 ) as $reg) { $id_epigrafe = $reg["news_epigrafe_id"]; $text_epigrafe = $reg["news_epigrafe_texto"]; if ($text_epigrafe == "") { $reg_epigrafe = $oTabla->saca_info_tabla_codigo('epigrafe', $id_epigrafe); if (count($reg_epigrafe)) { $text_epigrafe = $reg_epigrafe["descripcion_corta"]; $text_epigrafe = $reg["news_epigrafe_texto"]; } } $tpl->assign("destacado_foto".$i, $noticias_destacadas->get_fotografia( $reg["news_id"] )); $tpl->assign("destacado_epigrafe".$i, $text_epigrafe); $tpl->assign("destacado_titulo".$i, $reg["news_titulo_"]); $strNews_resumen = html_entity_decode( $reg["news_resumen"] ) ; if ( strlen($strNews_resumen) > 105 ) { $strNews_resumen = substr($strNews_resumen, 0, 105)."..."; $strlink = "index.php?".convierteLink($reg["news_id"], $reg["news_tipo"]); $strlink1 = "Ver más"; } else { $strlink = "index.php?".convierteLink($reg["news_id"], $reg["news_tipo"]); $strlink1 = ""; } $tpl->assign("destacado_bajada".$i, ucase( $strNews_resumen ).$strlink1 ); $tpl->assignGlobal("destacado_link".$i, $strlink ); $i++; } unset($noticias_destacadas, $oTabla); } //*************************************************************************************** // index_destacado.tpl //*************************************************************************************** function asignaRecomendados(&$tpl, $tipo="", $news_id="" ) { $recomendamos = TFactoryClass::factory("TRecomendamos"); if ($news_id == ""){ $tpl->gotoBlock("lista_recomendados"); foreach ((array) $recomendamos->ultimas_noticias( 2 ) as $reg) { $tpl->newBlock("lista_recomendados"); $tpl->assign("recomendado_foto", $recomendamos->get_fotografia( $reg["news_id"] )); $tpl->assign("recomendado_epigrafe_texto", $reg["news_epigrafe_texto"]); $tpl->assign("recomendado_titulo", $reg["news_titulo_"]); //$tpl->assign("recomendado_bajada", ucase($reg["news_resumen"])); $tpl->assign("recomendado_link1", "index.php?".convierteLink($reg["news_id"], TIPO_RECOMENDAMOS)); $tpl->assign("recomendado_link2", "index.php?".convierteLink($reg["news_id"], TIPO_RECOMENDAMOS)); } } else { if ($news_id == "") $news_id = $oTNews->ultimaFecha(); $noticia = $recomendamos->saca_noticiaById($news_id); $foto = $recomendamos->get_fotografia($noticia["news_id"]); $tpl->assign("epigrafe_texto", $noticia["news_epigrafe_texto"]); $tpl->assign("news_fecha_publicacion", fecha_en_chileno($noticia["news_fecha_publicacion"])); $tpl->assign("recomendado_titulo", $noticia["news_titulo_"]); $tpl->assign("recomendamos_fuente", $noticia["news_fuente"]); $tpl->assign("recomendado_resumen", ucase($noticia["news_resumen"])); if ( $foto == "") $tpl->assign("recomendado_foto", " "); else $tpl->assign("recomendado_foto", ""); $tpl->assign("pie_fotografia", $noticia["pie fotografia"]); $tpl->assign("recomendado_texto", $noticia["news_texto"]); $tpl->assign("texto_destacado", $noticia["texto_destacado"]); $tpl->assign("news_link", $noticia["news_link"]); $tpl->assign("news_link_documento", $noticia["news_link_documento"]); $tpl->assign("news_email", $noticia["news_email"]); $tpl->assign("news_nombre_link", $noticia["news_nombre_link"]); $tpl->assign("news_nombre_documento", $noticia["news_nombre_documento"]); $tpl->assign("news_nombre_email", $noticia["news_nombre_email"]); } unset($recomendamos, $noticia, $oTabla); return $news_id; } function convierteLink($id, $tipo, $conAmpersand = true) { $lnk = ""; switch ($tipo){ case TIPO_NOTICIA: { //Noticia $lnk = "opc=154&id=".$id; break; } case TIPO_DIPLOMADO: { // Diplomado $lnk = "opc=160&id=".$id; break; } case TIPO_EXTENSION: { // Extension $lnk = "opc=161&id=".$id; break; } case TIPO_OPINION: { // Opinion $lnk = "opc=162&id=".$id; break; } case TIPO_RECOMENDAMOS: { // Recomendamos $lnk = "opc=200&id=".$id; break; } case TIPO_MULTIMEDIA: { $lnk = "opc=164&id=".$id; break; } case TIPO_PUBLICACION: case TIPO_CUADERNO_DIFUCION: { $lnk = "opc=183&id=".$id; break; } case TIPO_DOCUMENTOS_DE_INTERES: $lnk = "opc=163&id=".$id; break; case TIPO_PROGRAMA_RADIO: $lnk = "opc=165&id=".$id; break; default: $lnk = "opc=500"; } return $lnk; } function asignaPortada(&$tpl) { $portada_inicial = TFactoryClass::factory("TPortada"); $portada = $portada_inicial->saca_portada(); $imagen = $portada_inicial->get_fotografia($portada["news_id"]); if ( sacar_extension($imagen)=="swf") { $html_flash = ""; $html_flash .= " "; $html_flash .= " "; $html_flash .= " assign("foto_portada", $html_flash); } else { $tpl->assign("foto_portada", ""); } $tpl->assign("titulo_portada", $portada["news_titulo_"]); if ($portada["news_epigrafe_texto"]==".") { $portada["news_epigrafe_texto"] = ""; } $tpl->assign("epigrafe_portada", $portada["news_epigrafe_texto"]); $tpl->assign("texto_portada", $portada["news_resumen"]); unset($portada_inicial, $portada); } function asignaNoticia(&$tpl, $news_id = "", $Clase=""){ if ($Clase=="") { $oTNews = TFactoryClass::factory('TNoticia'); $titulo_seccion = "NOTICIAS"; } else { $oTNews = TFactoryClass::factory('TOpinion'); $titulo_seccion = "COLUNMAS DE OPINIÓN"; } $oTabla = TFactoryClass::factory('TTablas'); if ($news_id == "") $news_id = $oTNews->ultimaFecha(); $noticia = $oTNews->saca_noticiaById($news_id); $bExisteImagenEnTexto = ( eregi("gotoBlock( "_ROOT" ); $tpl->assign("titulo_seccion", $titulo_seccion); $tpl->assign("texto_destacado", $noticia["texto_destacado"]); $tpl->assign("epigrafe_texto", $noticia["news_epigrafe_texto"]); $tpl->assign("news_fecha_publicacion", fecha_en_chileno($noticia["news_fecha_publicacion"])); $tpl->assign("news_titulo_", ucase( $noticia["news_titulo_"] )); $tpl->assign("news_fuente", $noticia["news_fuente"] ); $tpl->assign("news_autor", $noticia["news_autor"] ); $tpl->assign("news_resumen", ucase( $noticia["news_resumen"] )); $tpl->assign("news_texto", $noticia["news_texto"]); if ($noticia["news_nombre_link"]!="") { $tpl->assign("news_link", $noticia["news_link"]); $tpl->assign("news_nombre_link", "→ ".$noticia["news_nombre_link"]); } if ($noticia["news_link_documento"]!="") { $tpl->assign("news_link_documento", $noticia["news_link_documento"]); $tpl->assign("news_nombre_documento", "→ ".$noticia["news_nombre_documento"]); } if ($noticia["news_email"]!="") { $tpl->assign("news_email", $noticia["news_email"]); $tpl->assign("news_nombre_email", "→ ".$noticia["news_nombre_email"]); } PoneArchivosAdicionales(&$tpl, $news_id, $bExisteImagenEnTexto); unset($oTNews, $noticia, $oTabla); return $news_id; } function PoneArchivosAdicionales(&$tpl, $news_id, $bExisteImagenEnTexto) { $oDocumentos = TFactoryClass::factory('TDocumentos'); $documentos = $oDocumentos->get_documentosByIdNews($news_id); $i = 0; foreach ((array) $documentos as $documento) { $imagen = $documento["news_documento"]; $tipo = $documento["tipo_documento"]; $nombreDocumento_link = RUTA_DOWNLOAD.$documento["news_nombre_documento"]; // .".".$tipo; if ($documento["news_nombre_documento"] != "" ) { $fp = fopen($nombreDocumento_link, 'wb'); fwrite($fp, $imagen); fclose($fp); if (( !$bExisteImagenEnTexto) && ($i==0)) { // primer Documento $tpl->newBlock("imagen_noticia"); $tpl->assign("fotografia", $nombreDocumento_link); } else { $tpl->newBlock("links_adicionales"); $tpl->assign("news_documento_adicional", $documento["news_nombre_documento"]); $tpl->assign("news_documento_adicional_link", $nombreDocumento_link); } } $i += 1; } } /************************************************************************************************************** Listado de noticias de los ultimos meses ***************************************************************************************************************/ function asignaUltimasNoticias(&$tpl, $news_id = "", $clase = "") { $oTNews = TFactoryClass::factory('T'.$clase); $ultimasNoticias = $oTNews->ultimas_noticias( 3 ); $tpl->gotoBlock("listado_noticias"); foreach ((array) $ultimasNoticias as $ultima) { $tpl->newBlock("listado_noticias"); $tpl->assign("noticia", $ultima["news_titulo_"]); $tpl->assign("link", "index.php?".convierteLink($ultima["news_id"], $ultima["news_tipo"])); } unset($oTNews, $ultimasNoticias); } /************************************************************************************************************** Listado de noticias de los ultimos meses ***************************************************************************************************************/ function asignaHistorico(&$tpl, $opcion, $clase) { $oTNews = TFactoryClass::factory('T'.$clase); $ultimasNoticias = $oTNews->noticias_ultimos_meses(); foreach ((array) $ultimasNoticias as $ultima) { $tpl->gotoBlock("archivo_noticias"); $tpl->newBlock("archivo_noticias"); $tpl->assign("mes_o_annio", nombre_mes($ultima["numero"])." (".$ultima["total"].")"); $tpl->gotoBlock("muestra_detalle_archivo_noticias"); foreach ((array) $oTNews->noticias_mes_annio($ultima["numero"]) as $ultimosMeses) { $tpl->newBlock("muestra_detalle_archivo_noticias"); $tpl->assign("detalle_mes_annio", $ultimosMeses["news_titulo_"] ); $tpl->assign("link_meses", "index.php?".convierteLink($ultimosMeses["news_id"], $ultimosMeses["news_tipo"])); } } $ultimasNoticias = $oTNews->noticias_ultimos_annios(); $tpl->gotoBlock("archivo_noticias"); foreach ((array) $ultimasNoticias as $ultima) { $tpl->newBlock("archivo_noticias"); $tpl->assign("mes_o_annio", $ultima["numero"]."(".$ultima["total"].")"); $tpl->gotoBlock("muestra_detalle_archivo_noticias"); foreach ((array) $oTNews->noticias_mes_annio("", $ultima["numero"]) as $ultimosMeses) { $tpl->newBlock("muestra_detalle_archivo_noticias"); $tpl->assign("detalle_mes_annio", $ultimosMeses["news_titulo_"]); $tpl->assign("link_meses", "index.php?".convierteLink($ultimosMeses["news_id"], $ultimosMeses["news_tipo"])); } } } /************************************************************************************************************** Listado de las aplicaciones que estan al costado ***************************************************************************************************************/ function asignaOpcionesLaterales(&$tpl, $opcion, $id="") { $oTabla = TFactoryClass::factory("TTablas"); $registros = $oTabla->trae_opciones_laterales(); $tpl->gotoBlock('opciones'); foreach ((array) $registros as $registro) { $tpl->newBlock("opciones"); $tpl->assign("icono", $registro["opcion_icono"] ); if (( $opcion == "171") || ($opcion == "172") ) { // opcion en Ingles $tpl->assign("opcion", $registro["opcion_nombre_eng"]); } else { $tpl->assign("opcion", $registro["opcion_nombre"]); } $tpl->assign("opcion_link", $registro["opcion_link"]."&tip=$opcion&id=$id"); } $tpl->gotoBlock("_ROOT"); if (( $opcion == "171") || ($opcion == "172") ) // opcion en Ingles $tpl->assign("nombre_compartir", "Share"); else $tpl->assign("nombre_compartir", "Compartir"); unset($oTabla, $registros, $registro); } function enviaMail(&$tpl, $mailpersona, $confirmacion, $id_mail) { $mensaje = ""; $newsletter = TFactoryClass::factory("TNewsletter"); if ($mailpersona != "") { $newsletter->set("newsletter_mail", $mailpersona); } $newsletter->set("newsletter_esta_confirmado", $confirmacion ); if ($confirmacion == 0) { $newsletter->agregar(); if (componeMail($mailpersona, $newsletter->ultimoid())) { $tpl->assign("mail_texto1","Un mail ha sido enviado a la casilla que ha inscrito."); $tpl->assign("mail_texto2","Para confirmar su inscripción haga click sobre el vinculo que se le enviará."); } else { $tpl->assign("mail_texto1", "" ); $tpl->assign("mail_texto2", "Tenemos problemas con nuestro servicio de correo, intentelo mas tarde."); } } else { $newsletter->modificar($id_mail); $tpl->assign("mail_texto1", "" ); $tpl->assign("mail_texto2","Confirmación exitosa"); } $tpl->assign("titulo_inscribete", "Inscríbete" ); } function componeMail($mailpersona, $idmail) { $mensaje = ""; $mail = TFactoryClass::factory("PHPMailer"); //$mail = new PHPMailer(); // $mail->IsSMTP(); // telling the class to use SMTP $mail->SetLanguage('es', RUTA_CLASES); // Manda Mail $mail->ClearAddresses(); $mail->ClearAttachments(); $mail->Mailer = "smtp"; $mail->Host = "localhost"; //SVR_MAIL; //$mail->SMTPAuth = true; //$mail->Port = PORT_MAIL; $mail->Username = USR_MAIL; $mail->Password = PWD_MAIL; $mail->From = CONTACTO_MAIL; /// $mail->Username; $mail->FromName = "CEIUC"; $mail->AddAddress($mailpersona, $mailpersona); $mail->Subject = "CEIUC"; $mail->isHTML(true); $body = "Su email ha sido inscrito para recibir el newsletter del Centro de Estudios Internacionales de la Universidad Católica."; $body .= "Agradecemos su interés". $body .= "CEIUC"; //$body .= "Para confirmar su inscripción haga click aquí\n"; $body .= "Para confirmar su inscripción haga click aquí\n"; $mail->Body=$body; //se envia el mensaje, si no ha habido problemas la variable $exito tendra el valor true $exito = $mail->Send(); //Si el mensaje no ha podido ser enviado se realizaran 4 intentos mas como mucho //para intentar enviar el mensaje, cada intento se hara 5 segundos despues //del anterior, para ello se usa la funcion sleep $intentos = 1; while ((!$exito) && ($intentos < 5)) { sleep(5); //echo $mail->ErrorInfo; $exito = $mail->Send(); $intentos=$intentos+1; } return $exito; } //*************************************************************************************** // Biblioteca //*************************************************************************************** function asignaQuienesSomos($tpl, $opcion){ $oMenu = TFactoryClass::factory("TMenu"); $tpl->gotoBlock("listado_quienes_somos"); foreach ((array) $oMenu->TraeMenuTopSitio($opcion) as $reg) { $tpl->newBlock("listado_quienes_somos"); $tpl->assign("link_quienes_somos", $reg["cnom_pro"]); $tpl->assign("titulo_link_quienes_somos", $reg["cdes_itm"]); } unset($oMenu); } function asignaExtension(&$tpl, $news_id = "" ) { $oTNews = TFactoryClass::factory('TExtension'); $oTabla = TFactoryClass::factory('TTablas'); if ($news_id == ""){ $news_id = $oTNews->ultimaFecha(); } $noticia = $oTNews->saca_extensionById($news_id); $id_epigrafe = $noticia["news_epigrafe_id"]; $reg_epigrafe = $oTabla->saca_info_tabla_codigo('epigrafe_extension', $id_epigrafe); if (count($reg_epigrafe)) $text_epigrafe = $reg_epigrafe["descripcion_corta"]; $tpl->assign("epigrafe_texto", $text_epigrafe); $tpl->assign("news_fecha_publicacion", fecha_en_chileno($noticia["news_fecha_publicacion"])); $tpl->assign("news_titulo", $noticia["news_titulo_"]); $tpl->assign("news_texto", $noticia["news_texto"]); $tpl->assign("news_fuente", $noticia["news_fuente"]); $tpl->assign("news_resumen", ucase($noticia["news_resumen"])); $tpl->assign("news_fecha_hora_inicio", fecha_en_chileno( $noticia["news_fecha_hora_inicio"]) ); $tpl->assign("news_fecha_hora_termino", fecha_en_chileno( $noticia["news_fecha_hora_termino"]) ); $tpl->assign("news_lugar", $noticia["news_lugar"]); if ($noticia["news_nombre_link"]!="") { $tpl->assign("news_link", $noticia["news_link"]); $tpl->assign("news_nombre_link", "→ ".$noticia["news_nombre_link"]); } if ($noticia["news_link_documento"]!="") { $tpl->assign("news_link_documento", $noticia["news_link_documento"]); $tpl->assign("news_nombre_documento", "→ ".$noticia["news_nombre_documento"]); } if ($noticia["news_email"]!="") { $tpl->assign("news_email", $noticia["news_email"]); $tpl->assign("news_nombre_email", "→ ".$noticia["news_nombre_email"]); } $oAuspica = TFactoryClass::factory('TAuspicio'); $registros = $oAuspica->get_documentosByIdNews($news_id); $bloque_organiza = false; $bloque_patrocina = false; $bloque_auspicia = false; foreach ( (array) $registros as $registro) { switch ($registro["tipo_id"]) { case 1: // $bloque_padre = "bloque_organiza"; $bloque = "listado_organiza"; if (!$bloque_organiza) { $tpl->newBlock($bloque_padre); $bloque_organiza = true; } break; case 2: // $bloque_padre = "bloque_patrocina"; $bloque = "listado_patrocina"; if (!$bloque_patrocina) { $tpl->newBlock($bloque_padre); $bloque_patrocina = true; } break; case 3: // $bloque_padre = "bloque_auspicia"; $bloque = "listado_auspicia"; if (!$bloque_auspicia) { $tpl->newBlock($bloque_padre); $bloque_auspicia = true; } break; } $tpl->gotoBlock($bloque); $tpl->newBlock($bloque); $tpl->assign("logo_auspicia", $oAuspica->get_fotografia($registro["auspicio_id"])); } unset($oTNews, $noticia, $oTabla); return $news_id; } function enviarAmigo($name, $email_ori, $subject, $comentarios, $email_dest, $tipo = "", $news_id="") { $mensaje = ""; $mail = TFactoryClass::factory("PHPMailer"); $noticia = TFactoryClass::factory("TNoticia"); //$mail->IsSMTP(); // telling the class to use SMTP $mail->SetLanguage('es', RUTA_CLASES); $mail->ClearAddresses(); $mail->ClearAttachments(); $mail->Mailer = "smtp"; //$mail->SMTPAuth = TRUE; $mail->isHTML(TRUE); $mail->Host = "localhost"; //SVR_MAIL; //$mail->Port = PORT_MAIL; $mail->Username = USR_MAIL; $mail->Password = PWD_MAIL; $mail->From = CONTACTO_MAIL; //USR_MAIL; $mail->FromName = "CEIUC - ".$name; $mail->AddAddress($email_dest, $subject); //$mail->AddAddress($email_ori, "Prueba"); $mail->Subject = "Enviado desde CEIUC"; if ($news_id != "" ) { $reg = $noticia->saca_noticiaById($news_id); $mensaje = LeerArchivo( RUTA_TEMPLATES."enviar_amigo.tpl"); $mensaje = ReplaceOne( "{remitente}", $name, $mensaje ); $mensaje = ReplaceOne( "{destinatario}", $subject, $mensaje ); $mensaje = ReplaceOne( "{ruta}", RUTA_SITIO."index.php?opc=".$tipo."&id=".$news_id, $mensaje ); $mensaje = ReplaceOne( "{titulo}", $reg["news_titulo_"], $mensaje); $mensaje = ReplaceOne( "{comentarios}", $comentarios, $mensaje); $mail->Body = $mensaje; $exito = $mail->Send(); $intentos = 1; while ((!$exito) && ($intentos < 5)) { sleep(5); $exito = $mail->Send(); $intentos=$intentos+1; } } else { $exito = false; } unset($mail, $noticia); return $exito; } function enviarContacto($name, $email_ori, $subject, $message) { $mensaje = ""; $mail = TFactoryClass::factory("PHPMailer"); //$mail->IsSMTP(); // telling the class to use SMTP $mail->SetLanguage('es', RUTA_CLASES); $mail->ClearAddresses(); $mail->ClearAttachments(); $mail->Mailer = "smtp"; //$mail->SMTPAuth = TRUE; $mail->isHTML(true); $mail->Host = "localhost"; //SVR_MAIL; $mail->Port = PORT_MAIL; $mail->Username = USR_MAIL; $mail->Password = PWD_MAIL; $mail->From = CONTACTO_MAIL; $mail->FromName = "CEIUC - ".CONTACTO_NOMBRE; $mail->AddAddress(CONTACTO_MAIL, "Enviado desde CEIUC - Contactos"); $mail->AddCC($email_ori, $name); $mail->Subject = "Enviado desde CEIUC - Contactos"; $mail->Body = "".$message.""; $exito = $mail->Send(); $intentos = 1; while ((!$exito) && ($intentos < 5)) { sleep(5); $exito = $mail->Send(); $intentos=$intentos+1; } return $exito; } function asignaMultimedia(&$tpl, $news_id = "", $Clase=""){ $oTNews = TFactoryClass::factory('T'.$Clase); if ($news_id=="") $news_id = $oTNews->ultimaFecha(); $ultima = $oTNews->saca_noticiaById($news_id); switch ( strtolower($Clase) ) { case "multimedia": $oTNews->set("news_tipo", TIPO_MULTIMEDIA_PORTADA); $titulo_seccion = "MULTIMEDIA"; break; case "progradio": $oTNews->set("news_tipo", TIPO_PROGRAMA_RADIO_PORTADA); $titulo_seccion = "PROGRAMA DE RADIO"; break; case "docinteres": $oTNews->set("news_tipo", TIPO_DOCUMENTOS_DE_INTERES_PORTADA); $titulo_seccion = "DOCUMENTOS DE INTERÉS"; break; case "cuaderno_difucion": $oTNews->set("news_tipo", TIPO_CUADERNO_DIFUCION_PORTADA); $titulo_seccion = "PUBLICACIONES"; break; } $news_portada = $oTNews->saca_contenido(); $tpl->gotoBlock("_ROOT"); $tpl->assign("titulo_seccion", $titulo_seccion); $tpl->assign("titulo_multimedia", $titulo_seccion); $tpl->assign("resumen_multimedia1", $news_portada["news_texto"]); $foto = $oTNews->get_fotografia($ultima["news_id"]); $tpl->gotoBlock("_ROOT"); if ($oTNews->Existe(" news_id = ".$news_id)) { $tpl->newBlock("listado_multimedia"); $tpl->assign("news_fecha_publicacion", fecha_en_chileno($ultima["news_fecha_publicacion"])); $tpl->assign("descripcion_multimedia", $ultima["news_texto"]); $tpl->assign("nombre_link", $ultima["news_titulo_"]); if (strpos($foto, "sin_foto.jpg")===false) { $tpl->newBlock("listado_link"); $tpl->assign("link_multimedia", $foto); $tpl->assign("link_peso", "0"); $tpl->assign("link_duracion", "0"); $tpl->gotoBlock("listado_multimedia"); } else { $tpl->gotoBlock("listado_multimedia"); } } unset($oTNews, $noticia, $news_portada); return $news_id; } /********************************************************************************* FUNCIONES GENERALES *********************************************************************************/ function ucase($cadena) { return strtr(strtoupper($cadena),"àèìòùáéíóúçñäëïöü","ÀÈÌÒÙÁÉÍÓÚÇÑÄËÏÖÜ"); } function lcase($cadena) { return strtr(strtolower($cadena),"ÀÈÌÒÙÁÉÍÓÚÇÑÄËÏÖÜ","àèìòùáéíóúçñäëïöü"); } function ucapitalizado($cadena) { return strtr(ucfirst(lcase($cadena)),"ÀÈÌÒÙÁÉÍÓÚÇÑÄËÏÖÜ","àèìòùáéíóúçñäëïöü"); } function crearPDF(&$tpl, $tipo, $id="", $imprimir = false ) { define('_MPDF_PATH','mpdf2_5/'); include("mpdf2_5/mpdf.php"); if ($imprimir) { $mpdf = new PDF_AutoPrint(); $mpdf->title2annots = true; $mpdf->WriteHTML($tpl->getOutputContent()); $mpdf->AutoPrint(); $mpdf->Output(); } else { $mpdf = new mPDF(); //$mpdf->SetProtection(array('copy', 'print', 'modify', 'annot-forms' ),''); // ensure to set annot-forms if encrypting //$mpdf->SetUserRights(); // **** does NOT work as of Reader 9.0 $mpdf->title2annots = true; //$mpdf->annotMargin = 12; //$mpdf->use_embeddedfonts_1252 = true; // false is default $mpdf->WriteHTML($tpl->getOutputContent()); $mpdf->Output("CEIUC_".date("Ymd").".pdf", "I"); } } function isEmail($email) { return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i" ,$email)); } function verficaDatosMail($name, $email, $subject, $message, $spamcheck, $email_dest) { $error = ""; //if(trim($name) == '') $error = 'Ingrese su Nombre'; if(trim($email) == '') $error = 'Ingrese su Email'; if(!isEmail($email)) $error = 'Puede que su Email esté incorrecto'; //if(trim($subject) == '') $error = 'Ingrese Nombre destinatario'; //if(trim($message) == '') $error = 'Ingrese el mensaje'; //if(trim($spamcheck) == '') $error = 'Ingrese el numero de Spam Check'; //if(trim($spamcheck) != '5') $error = 'El numero ingresado es incorrecto. 2 + 3 = ???'; if(trim($email_dest) == '') $error = 'Ingrese el mail del destinatario'; if(trim($email_dest) != 'nada') { if(!isEmail($email_dest)) $error = 'El correo del destinatario puede estar incorrecto'; } return $error; } function sacar_extension($file) { $trozos = explode("." , $file); $cuantos = count($trozos); $ext = $trozos[$cuantos - 1]; return (string) $ext; } function fecha_en_chileno($fecha) { $arrFecha = date_parse($fecha); $strFecha = $arrFecha["day"]." de ".nombre_mes(cero_dia($arrFecha["month"]))." de ".$arrFecha["year"]; if ($arrFecha["hour"]+$arrFecha["minute"] !=0) $strFecha .= " ".$arrFecha["hour"].":".$arrFecha["minute"]; return $strFecha; } function asignaRSS($tipo) { $clase = idToClase($tipo); include("rss/FeedWriter.php"); $oTNews = TFactoryClass::factory('T'.$clase); $ultimasNoticias = $oTNews->ultimas_noticias( 10 ); //Creating an instance of FeedWriter class. //The constant RSS1 is passed to mention the version $TestFeed = new FeedWriter(RSS1); //Setting the channel elements //Use wrapper functions for common elements For other optional channel elements, use setChannelElement() function $TestFeed->setTitle(xmlEntities(TITULO)); $TestFeed->setLink('http://www.ceiuc.cl'); $TestFeed->setDescription(xmlEntities(TITULO)); //It's important for RSS 1.0 $TestFeed->setChannelAbout('http://www.ceiuc.cl'); //Adding a feed. Genarally this protion will be in a loop and add all feeds. foreach ($ultimasNoticias as $ultima) { //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Add elements to the feed item //Use wrapper functions to add common feed elements $newItem->setTitle(xmlEntities( $ultima["news_titulo_"]) ); $newItem->setLink( xmlEntities( RUTA_SITIO."index.php?". convierteLink( $ultima["news_id"], $ultima["news_tipo"], false ))); //The parameter is a timestamp for setDate() function $newItem->setDate( $ultima["news_fecha_publicacion"] ); $newItem->setDescription( xmlEntities( $ultima["news_resumen"]) ); //Use core addElement() function for other supported optional elements $newItem->addElement( 'dc:subject', 'ceiuc' ); //Now add the feed item $TestFeed->addItem( $newItem ); unset($newItem); } //OK. Everything is done. Now genarate the feed. $TestFeed->genarateFeed(); } function xmlEntities($data) { return utf8_encode(htmlspecialchars($data)); } function _html_to_utf8 ($data) { if ($data > 127) { $i = 5; while (($i--) > 0) { if ($data != ($a = $data % ($p = pow(64, $i)))) { $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); for ($i; $i > 0; $i--) $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); break; } } } else $ret = "$data;"; return $ret; } function idToClase($idtiponoticia) { switch ($idtiponoticia) { case 154: { //Noticia $clase = "Noticia"; break; } case 160: $clase = "Diplomado"; break; case TIPO_EXTENSION: { // Extension $clase = "Extension"; break; } case TIPO_OPINION: { // Opinion $clase = "Opinion"; break; } case TIPO_RECOMENDAMOS: { // Recomendamos $clase = "Recomendado".$id; break; } case TIPO_MULTIMEDIA: { $clase = "Multimedia"; break; } case TIPO_CUADERNO_DIFUCION: { $clase = "Cuaderno_difucion"; break; } case TIPO_DOCUMENTOS_DE_INTERES: $clase = "DocInteres"; break; case TIPO_PROGRAMA_RADIO: $clase = "ProgRadio"; break; default: $clase = "Noticia"; } return $clase; } /* function urls_amigables($url) { // Tranformamos todo a minusculas $url = lcase($url); //Rememplazamos caracteres especiales latinos $find = array('á', 'é', 'í', 'ó', 'ú', 'ñ'); $repl = array('a', 'e', 'i', 'o', 'u', 'n'); $url = str_replace ($find, $repl, $url); // Añaadimos los guiones $find = array(' ', '&', '\r\n', '\n', '+'); $url = str_replace ($find, '-', $url); // Eliminamos y Reemplazamos demás caracteres especiales $find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/'); $repl = array('', '-', ''); $url = preg_replace ($find, $repl, $url); return $url; } */ ?>
".$message."