7) borra_cache_antiguo_mash(); // procesa URL amigable procesa_sef_mash(); global $_GP; // activa session del admin if(GP("mtadmin")!="") { $_SESSION["mtadmin"]=GP("mtadmin"); $_SESSION["mtadmin_servicio"]=GP("mtids"); if($_SESSION["mtadmin"]!="si") borra_cache_mash(); } if(GP("mtadmin")=="no") { unset($_SESSION["mtadmin"]); unset($_SESSION["mtadmin_servicio"]); unset($_SESSION["mtadmin_nombre_servicio"]); unset($_SESSION["conf_servicio"]); unset($_SESSION["id_servicio_mash"]); $url_redireccion=$masheditor["url"]; redirecciona_mash($url_redireccion); } $html_final_masheditor=lee_cache_portal(); if(($html_final_masheditor=="")OR($_SESSION["mtadmin"]=="si")) // si no hay valor en cache, o es panel de administracion entra { //idioma //idioma_mash();// mash aki cambiar a dentro de servicio // procesa alias if(alias_sef()) { procesa_sef_mash(); } //procesa contador universal if($estadisticas_me_==1) contador_universal_mash(); //////////////////////////////////////////////////////////////////////////////////////////////// // php pre plantilla portal se movio abajo // if($datos_plantilla_masheditor["phpPre"]!="") // eval($datos_plantilla_masheditor["phpPre"]); //////////////////////////////////////////////////////////////////////////////////////////////// /// llena variables del masheditor $masheditor["categoria"]=intval(GP("mtcat")); $masheditor["servicio"]=intval(GP("mtids")); $mtcat=$masheditor["categoria"]; //////////////////////////////////////////////////////////////////////////////////////////////// /// lee valores de la categoria $mtcat=intval(GP("mtcat")); $sql="SELECT * FROM masheditor_cat WHERE (masheditor_cat.idCat = $mtcat)"; $masheditor["datos_categoria"]=mysql_fetch_array(mysql_query($sql)); //////////////////////////////////////////////////////////////////////////////////////////////// /// lee valores del servicio $mtids=intval(GP("mtids")); $sql="SELECT * FROM `masheditor_tiposervicio` WHERE (`masheditor_tiposervicio`.idTipoServicio = $mtids)"; $masheditor["datos_servicio"]=mysql_fetch_array(mysql_query($sql)); //////////////////////////////////////////////////////////////////////////////////////////////// // detecta cetegoria raiz list($___nombres___,$___categorias___)=split('[|]',$masheditor["datos_categoria"]["AtributosExtras"]); $___cat___=split('/',$___categorias___); $tipo_CategoriaRaiz_masheditor=$___cat___[1]; $masheditor["categoriaraiz"]=$tipo_CategoriaRaiz_masheditor; //////////////////////////////////////////////////////////////////////////////////////////////// /// lee servicio $idserv_actual_____=$masheditor["servicio"]; $idserv_actual_____=$_SESSION["mtadmin_servicio"]; //OR usuario_permiso_mash("ADMINCONTENIDO",$idserv_actual_____) OR usuario_permiso_mash("ADMINSERVICIO",$idserv_actual_____) // if($_SESSION["mtadmin"]=="si" AND (usuario_permiso_mash("SUPERADMIN") OR usuario_permiso_mash("ADMINCONTENIDO") OR usuario_permiso_mash("ADMINSERVICIO") OR usuario_permiso_mash("ADMINCONTENIDO",$idserv_actual_____) OR usuario_permiso_mash("ADMINSERVICIO",$idserv_actual_____) ))// ver admin del servicio if($_SESSION["mtadmin"]=="si" AND (usuario_ver_permiso_mash("SUPERADMIN") OR usuario_ver_permiso_mash("ADMINCONTENIDO") OR usuario_ver_permiso_mash("ADMINSERVICIO") OR usuario_ver_permiso_mash("ADMINCONTENIDO",$idserv_actual_____) OR usuario_ver_permiso_mash("ADMINSERVICIO",$idserv_actual_____) ))// ver admin del servicio { $servicio=$_SESSION["conf_servicio"]["id_servicio_mash"]; $url=$masheditor["url"]; $URL="$url/admin/mtids,$servicio/mtadmin,no/login.asp"; $nombre=$masheditor["datos_servicio"]["NombreServicio"]; $nombre_servicio=$_SESSION["mtadmin_nombre_servicio"]; $__contenido__masheditor__= " Salir Admin $nombre_servicio
"; $id_servicio_admin_mash=$_SESSION["mtadmin_servicio"]; $masheditor["lee_servicio_mash"]="NO_ACTIVO"; $__contenido__masheditor__.=configurar_servicio_mash($id_servicio_admin_mash,0); $masheditor["lee_servicio_mash"]="NO_ACTIVO"; } else // ver contenido del servicio { $masheditor["lee_servicio_mash"]="ACTIVO"; $tipo_Servicio_masheditor=$masheditor["servicio"]; $__contenido__masheditor__=lee_servicio_mash($tipo_Servicio_masheditor); // $__contenido__masheditor__ = str_replace('\'','\\\'',$__contenido__masheditor__); $masheditor["lee_servicio_mash"]="NOACTIVO"; } //////////////////////////////////////////////////////////////////////////////////////////////// /// lee plantilla principal $tipo_Servicio_masheditor=intval(GP("mtids")); $tipo_Categoria_masheditor=intval(GP("mtcat")); //////// inicio plantilla portal if($plantilla_portal_ME>0) // plantilla portal asignado manual { $id_plantilla_portal_mash=$plantilla_portal_ME; $sql_selecciona_plantilla_html_final_masheditor=" SELECT * FROM `masheditor_plantillaportal` WHERE (`masheditor_plantillaportal`.idPlantillaPortal = $plantilla_portal_ME) "; } else { ////////////// busca plantilla categoria $sql_=" SELECT * FROM masheditor_plantillaconf WHERE ((masheditor_plantillaconf.TipoServicio_idTipoServicio = 0) AND (masheditor_plantillaconf.cat_idCat = $tipo_Categoria_masheditor)) "; $res_=mysql_query($sql_); $datos_plantilla_conf_mash__=mysql_fetch_array($res_); $id_plantilla_portal_mash=$datos_plantilla_conf_mash__["plantillaportal_idPlantillaPortal"]; $id_plantilla_portal_mash=intval($id_plantilla_portal_mash); if($id_plantilla_portal_mash>0) { $sql_selecciona_plantilla_html_final_masheditor=" SELECT * FROM `masheditor_plantillaportal` WHERE (`masheditor_plantillaportal`.idPlantillaPortal = $id_plantilla_portal_mash) "; } else ////////////// busca plantilla de servicio { $sql_=" SELECT * FROM masheditor_plantillaconf WHERE ((masheditor_plantillaconf.TipoServicio_idTipoServicio = $tipo_Servicio_masheditor) AND (masheditor_plantillaconf.cat_idCat = 0)) "; $res_=mysql_query($sql_); $datos_plantilla_conf_mash__=mysql_fetch_array($res_); $id_plantilla_portal_mash=intval($datos_plantilla_conf_mash__["plantillaportal_idPlantillaPortal"]); if($id_plantilla_portal_mash>0) { $sql_selecciona_plantilla_html_final_masheditor=" SELECT * FROM `masheditor_plantillaportal` WHERE (`masheditor_plantillaportal`.idPlantillaPortal = $id_plantilla_portal_mash) "; } else ////////////// busca plantilla de portada { $sql_=" SELECT * FROM masheditor_plantillaconf WHERE ((masheditor_plantillaconf.TipoServicio_idTipoServicio = 0) AND (masheditor_plantillaconf.cat_idCat = 0)) "; $res_=mysql_query($sql_); $datos_plantilla_conf_mash__=mysql_fetch_array($res_); $id_plantilla_portal_mash=intval($datos_plantilla_conf_mash__["plantillaportal_idPlantillaPortal"]); $sql_selecciona_plantilla_html_final_masheditor=" SELECT * FROM `masheditor_plantillaportal` WHERE (`masheditor_plantillaportal`.idPlantillaPortal = $id_plantilla_portal_mash) "; }// fin plantilla portada }// fin plantilla servicio }// fin plantilla portal manual // $res_plantilla_masheditor=mysql_query($sql_selecciona_plantilla_html_final_masheditor); $datos_plantilla_masheditor=mysql_fetch_array($res_plantilla_masheditor); // plantilla cargada $idPlantillaConf=$datos_plantilla_masheditor["idPlantillaConf"]; // selecciona el html de portada o contenido // if((count($_GET)+count($_POST)-count($_GET["mtpagina"]))<=2) $cnt___=count($_GP); if(GP("mtpagina")!="") $cnt___--; if(GP("mt_idioma")!="") $cnt___--; if($cnt___<=2) $html_final_masheditor=$datos_plantilla_masheditor["HTMLportada"]; else $html_final_masheditor=$datos_plantilla_masheditor["HTMLcontenido"]; // selecciona plantilla de contenido para mostrar el admin if($_SESSION["mtadmin"]=="si") { $html_final_masheditor=$datos_plantilla_masheditor["HTMLcontenido"]; } //////////// fin plantilla portal //////////////////////////////////////////////////////////////////////////////////////////////// // prepara los bloques $idbloques_masheditor=$id_plantilla_portal_mash; $sql_bloques_masheditor="SELECT * FROM `masheditor_plantillaparam` WHERE (`masheditor_plantillaparam`.PlantillaPortal_idPlantillaPortal = $idbloques_masheditor)"; $resmysql_bloques_masheditor=mysql_query($sql_bloques_masheditor); while($datos_bloques_masheditor=mysql_fetch_array($resmysql_bloques_masheditor)) { $valor_masheditor=""; $idplantillaparam_masheditor=intval($datos_bloques_masheditor["idPlantillaParam"]);// lee ID de base de datos de configuracion del bloke $tiempo_cache_masheditor=intval($datos_bloques_masheditor["cachebloques"]);// 1 min de cache aki flalta agregar que lea configuracion de cache $idnombre_masheditor=$datos_bloques_masheditor["idnombre"]; $masheditor["lee_servicio_mash"]="NO_ACTIVO"; $valor_masheditor=lee_bloque_mash($datos_bloques_masheditor); $variables_portal_masheditor["$idnombre_masheditor"]=$valor_masheditor; } // fin prepara los bloques //////////////////////////////////////////////////////////////////////////////////////////////// // php post plantilla portal if($datos_plantilla_masheditor["phpPost"]!="") eval($datos_plantilla_masheditor["phpPost"]); //////////////////////////////////////////////////////////////////////////////////////////////// // eval portal $variables_html_final_masheditor=""; foreach($variables_portal_masheditor as $nombre_campo => $valor){ $variables_html_final_masheditor.= "\$" . $nombre_campo . "='" . $valor. "';"; } //////////////////////////////////////////////////////////////////////////////////////////////// // php pre plantilla portal if($datos_plantilla_masheditor["phpPre"]!="") $variables_html_final_masheditor=$variables_html_final_masheditor.$datos_plantilla_masheditor["phpPre"]; //eval($datos_plantilla_masheditor["phpPre"]); // $variables_html_final_masheditor = str_replace('\\\'','\'',$variables_html_final_masheditor); //echo $variables_html_final_masheditor; //die(); eval($variables_html_final_masheditor); $html_final_masheditor= str_replace("\"","\\\"",$html_final_masheditor); eval( "\$html_final_masheditor2=\"".$html_final_masheditor. "\";"); $html_final_masheditor2 = str_replace('\\\'','\'',$html_final_masheditor2); //////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// imprime html //////////////////////////////////////////////////////////////////////////////////////////////// AgregarHeader_mash($datos_plantilla_masheditor["HEAD_extra"]); AgregarJS_mash($datos_plantilla_masheditor["JavaScriptHead"]); $DocType_masheditor=$datos_plantilla_masheditor["DocType"]; AgregarHeader_mash(Genera_MetaTags_mash()); // $html_final_masheditor="$DocType_masheditor $HEAD_masheditor___ $JavaScriptHead_masheditor $html_final_masheditor2 "; $url___=$masheditor["url"]; $urls___=$masheditor["urls"]; $html_final_masheditor=str_replace("{URL}",$url___,$html_final_masheditor); $html_final_masheditor=str_replace("{URLS}",$urls___,$html_final_masheditor); echo $html_final_masheditor; // graba cache portal $tiempo_cache_min=intval($datos_plantilla_conf_mash__["TipoCache"]); if($tiempo_cache_min<0) // si es infinito $tiempo_cache_min=999999; if($tiempo_cache_min>0) // si el cache esta activo graba lo generado graba_cache_portal($html_final_masheditor,$tiempo_cache_min); } //final genera pagina else // imprime cache { echo $html_final_masheditor; } global $_MYSQL_PERSISTENTE_; if($_MYSQL_PERSISTENTE_==0) { mysql_close(); } $tiempo_mash = microtime(); $tiempo_mash = explode(" ",$tiempo_mash); $tiempo_mash = $tiempo_mash[1] + $tiempo_mash[0]; $tiempoFin_mash = $tiempo_mash; $tiempoReal_mash = ($tiempoFin_mash - $tiempoInicio_mash); $idserv_actual_____=$masheditor["servicio"]; //if(($_SESSION["mtadmin"]!="si") AND ($masheditor["servicio"]>0) AND (usuario_permiso_mash("SUPERADMIN") OR usuario_permiso_mash("ADMINCONTENIDO") OR usuario_permiso_mash("ADMINSERVICIO")OR usuario_permiso_mash("ADMINCONTENIDO",$idserv_actual_____) OR usuario_permiso_mash("ADMINSERVICIO",$idserv_actual_____) )) if( ($_SESSION["mtadmin"]!="si") AND ($masheditor["servicio"]>0) AND ( usuario_ver_permiso_mash("SUPERADMIN") OR usuario_ver_permiso_mash("ADMINCONTENIDO") OR usuario_ver_permiso_mash("ADMINSERVICIO")OR usuario_ver_permiso_mash("ADMINCONTENIDO",$idserv_actual_____) OR usuario_ver_permiso_mash("ADMINSERVICIO",$idserv_actual_____) )) { $servicio=$masheditor["servicio"]; $url=$masheditor["url"]; $URL="$url/adm/mtids,$servicio/mtadmin,si/login.asp"; $nombre=$masheditor["datos_servicio"]["NombreServicio"]; $_SESSION["mtadmin_nombre_servicio"]=$nombre; echo "
Admin $nombre
"; } //echo "

El tiempo de proceso de la pagina es ". $tiempoReal_mash ; function valida_url_mala_mash() { global $masheditor; // ini copia configuracion.php $masheditor["dominio"]=$_SERVER["HTTP_HOST"]; $php_ejecucion___tmp=$_SERVER["PHP_SELF"]; $array_php_ejecucion___tmp=split('/',$php_ejecucion___tmp); $contador_array_ruta__=count($array_php_ejecucion___tmp); $php_ejecucion____=""; $contador_tmp_ruta=0; foreach($array_php_ejecucion___tmp as $nombre_campo_ruta_tmp_ => $valor_ruta_tmp_) { $contador_tmp_ruta++; if($contador_tmp_ruta!=$contador_array_ruta__) $php_ejecucion____.="/$valor_ruta_tmp_"; } $php_ejecucion____=str_replace('//','/',$php_ejecucion____); if($php_ejecucion____=='/') $php_ejecucion____=""; $masheditor["carpeta_web"]=$php_ejecucion____; $masheditor["url"]="http://".$masheditor["dominio"]."$php_ejecucion____"; // fin copia configuracion.php $buscar=$_SERVER["REQUEST_URI"]; $extencion=split('[.]',$buscar); $cantidad=count($extencion); $extencion[$cantidad-1]=strtolower($extencion[$cantidad-1]); $carpeta= $masheditor["carpeta_web"]; //die("B=$buscar C=$carpeta"); $url=$masheditor["url"]; if(ereg("^$carpeta/imagenes/[0-9]+(.+)",$buscar)) { die(); } if(($extencion[$cantidad-1]=="jpg")OR($extencion[$cantidad-1]=="gif")OR($extencion[$cantidad-1]=="txt")OR($extencion[$cantidad-1]=="png")OR($extencion[$cantidad-1]=="swf")OR($extencion[$cantidad-1]=="ico")OR($extencion[$cantidad-1]=="txt")OR($extencion[$cantidad-1]=="js")OR($extencion[$cantidad-1]=="pdf")OR($extencion[$cantidad-1]=="doc")OR($extencion[$cantidad-1]=="css")) { if( ereg("(.+)masheditor/(.+)",$buscar,$res) ) { $final=$res[2]; //redirecciona_mash("$url/masheditor/$final"); $url_final="$url/masheditor/$final"; @header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past @header("Location: $url_final",true); exit(); die(); } die(); return; } } ?>