%@ $Language=JScript /* PARA COLORES PHP */ %><%
/*Setea cooikie de encuesta*/
if($encID && $accion=="enviar_enc"){
setcookie("ck_encuesta", $encID, time() + 3600*24*60); // Expire in 60 days
$ck_encuesta=$encID;
}
/*setcookie("ck_encuesta", "", time() + 3600*24*60); // Expire in 60 days
$ck_encuesta="";
*/
/**************************************************************/
/*
Trae el campo en el idioma default o en el idioma alternativo,
si el idioma alternativo esta vacío trae el default y un mensaje }
"(no traducido)"
rsname: nombre del recordset
campo: nombre del campo a chequear
msje: si es 0 no devuelve mensaje
si es 1 devuelve mensaje "(no traducido)" al final
si es 2 devuelve mensaje "(no traducido)
" al comienzo
*/
function campo_ia2($rsname,$campo,$msje=0){
global $var_idioma,$$rsname;
if($msje==1){
$err_ia="";
$err="";
//$err_ia=" (no traducido)";
//$err=" (not translated)";
}
else if($msje==2){
$err_ia="";
$err="";
//$err_ia="(no traducido)
";
//$err="(not translated)
";
}
else{$err_ia="";$err="";}
if(!$var_idioma || $var_idioma == "DEF")
{
if($$rsname->field("$campo")!="" && $$rsname->field("$campo")!="
" && $$rsname->field("$campo")!="
"){
//
o
editor HTML guardado vacío
return $$rsname->field("$campo");
}else{
$campo_ia=$campo."_IA";
if($msje==1){return $$rsname->field("$campo_ia").$err;}
else if($msje==2){return $err.$$rsname->field("$campo_ia");}
else{return $$rsname->field("$campo_ia");}
}
}else{
$campo_ia=$campo."_IA";
if($$rsname->field("$campo_ia")!="" && $$rsname->field("$campo_ia")!="
" && $$rsname->field("$campo_ia")!="
"){
//
o
editor HTML guardado vacío
return $$rsname->field("$campo_ia");
}else{
if($msje==1){return $$rsname->field("$campo").$err_ia;}
else if($msje==2){return $err_ia.$$rsname->field("$campo");}
else{return $$rsname->field("$campo");}
}
}
}
/***************************************************************/
function title()
{
global $conn;
$sql = "select * from Custom where cusVariable='title'";
$rs = $conn->execute($sql);
$valor = $rs->field(campo_ia("cusValor")) . " - Sailgroup.com";
return $valor;
}
/**************************************************************/
/*Devuelve el nombre del campo correspondiente al idioma que está activo*/
function campo_ia($campo)
{
global $var_idioma;
if(!$var_idioma || $var_idioma == "DEF")
{
return $campo;
}
else
{
return ($campo . $var_idioma);
}
}
/**************************************************************/
//Trae el nombre de las páginas de ABM relacionadas a la tabla Site Menu
function getPageTitle($page){
global $conn;
$page=substr($page,strrpos($page,"/")+1);
$sql="select ABM.admABMTipo,MEN.menNombre,MEN.menEstructura
from segAdminABM ABM,MenuSite MEN
where ABM.admABMLink='$page' and
MEN.menID=ABM.menID";
$rspt=$conn->execute($sql);
if($rspt->field(admABMTipo)!="New" && $rspt->field(admABMTipo)!="Add" && $rspt->field(admABMTipo)!="Create"){
return($rspt->field(menNombre)." ".$rspt->field(admABMTipo)." (".$rspt->field(menEstructura).")");
}else{
return($rspt->field(admABMTipo)." ".$rspt->field(menNombre)." (".$rspt->field(menEstructura).")");
}
}
/**************************************************************/
/*Devuelve fecha en formato especificado*/
/*verfecha(fecha,caracter separador,mostrar hora)*/
function verFecha($fecha,$separa="",$formato="",$hora=0){
global $conn,$var_idioma;
if($hora!=0){
$fecha_hora=substr($fecha,10);
} else{
$fecha_hora="";
}
if(!$separa){
//$separa="/";
if($var_idioma=="DEF"){$var_idioma="";}
$sql="select cusID,cusValor$var_idioma as valor
from Custom
where cusVariable='fecha_sep'";
$rssep=$conn->execute($sql);
$separa=$rssep->field(valor);
}
$fecha=substr($fecha,0,10);
$array=explode("-",$fecha);
if(!$formato){
//$formato="dd-mm-yyyy";
$sql="select cusID,cusValor$var_idioma as valor
from Custom
where cusVariable='fecha_orden'";
$rssep=$conn->execute($sql);
$formato=$rssep->field(valor);
}
$array_format=explode("-",$formato);
if($array_format[0]=="dd"){$pos1=2;}
else if($array_format[0]=="mm"){$pos1=1;}
else if($array_format[0]=="yyyy"){$pos1=0;}
if($array_format[1]=="dd"){$pos2=2;}
else if($array_format[1]=="mm"){$pos2=1;}
else if($array_format[1]=="yyyy"){$pos2=0;}
if($array_format[2]=="dd"){$pos3=2;}
else if($array_format[2]=="mm"){$pos3=1;}
else if($array_format[2]=="yyyy"){$pos3=0;}
$fecha="$array[$pos1]$separa$array[$pos2]$separa$array[$pos3]".$fecha_hora;
return $fecha;
}
/**************************************************************/
//$tipo: sale de sailTablas
//ejemplo ver_foto("Corredores",133,1,$ima,"align=right vspace=5");
function ver_Foto($tipo,$id,$ubicacion=1,$alterna=0,$param="",$pie=0)
{
global $conn, $var_path, $app_path;
//busco la imagen
$sql="select * from ADVF A, Tablas B,ADVF_Vinculante C where C.tabID=B.tabID and A.advID=C.advID and tabNombre = '$tipo' and fgnID='$id' and adrUbicacion='$ubicacion' and A.advTipo='F'";
//echo $sql;
$qry=$conn->execute($sql);
//$qry->display();
if(!$qry)
{
return -1;
}
$aux = $app_path .$qry->field(advLink);
$ret = fileType( $aux );
$aux = $var_path .$qry->field(advLink);//esto es por que es distinto para vincularlo
if( $ret == "link" || $ret == "file" )
{
$size = GetImageSize($app_path .$qry->field(advLink));
if($pie){
echo "
".$qry->field(advTitulo);
} else{
echo "
";
}
return $qry->field(advID);
}
else
{
if($alterna)
{
$ret1 = fileType($alterna);
if( $ret1 == "link" || $ret1 == "file" )
{
echo "
";
return 2;
}
else
{
if($param==""){echo" ";}
else{echo"";}
return 0;
}
}
else
{
if($param==""){echo" ";}
else{echo"";}
return 0;
}
}
}
/********************************************************************************************/
//$tipo: sale de sailTablas
//existe_Foto("Corredor",133,1)
function existe_Foto($tipo,$id,$ubicacion=1)
{
global $conn, $var_path, $app_path;
//busco la imagen
$sql="select * from sailADVF A, sailTablas B,sailADVF_Vinculante C where C.tabID=B.tabID and A.advID=C.advID and tabNombre = '$tipo' and fgnID='$id' and adrUbicacion='$ubicacion' and A.advTipo='F'";
//echo $sql;
$qry=$conn->execute($sql);
//$qry->display();
if(!$qry)
{
return -1;
}
$aux = $app_path .$qry->field(advLink);
$ret = fileType( $aux );
if( $ret == "link" || $ret == "file" )
{
return $qry->field(advID);
}
else
{
return 0;
}
}
/**************************************************************/
/*Foro: Reemplaza códigos por gifs de caras*/
function reemplaza_caras($string){
$string=str_replace("[:)]","
",$string);
$string=str_replace("[:(]","
",$string);
$string=str_replace("[:D]","
",$string);
$string=str_replace("[8)]","
",$string);
$string=str_replace("[9)]","
",$string);
$string=str_replace("[xx(]","
",$string);
$string=str_replace("[;)]","
",$string);
$string=str_replace("[^]","
",$string);
$string=str_replace("[v]","
",$string);
$string=str_replace("[?]","
",$string);
$string=str_replace("[8D]","
",$string);
$string=str_replace("[:O]","
",$string);
$string=str_replace("[<(]","
",$string);
$string=str_replace("[:(!]","
",$string);
$string=str_replace("[:P]","
",$string);
$string=str_replace("[U]","
",$string);
return $string;
}
/**************************************************************/
/*Foro: Reemplaza códigos por texto HTML*/
function reemplaza_texto($string){
$string=str_replace("[b]","",$string);
$string=str_replace("[/b]","",$string);
$string=str_replace("[i]","",$string);
$string=str_replace("[/i]","",$string);
$string=str_replace("[s]","",$string);
$string=str_replace("[/s]","",$string);
$string=str_replace("[u]","",$string);
$string=str_replace("[/u]","",$string);
$string=str_replace("[izq]","",$string);
$string=str_replace("[/izq]","
",$string);
$string=str_replace("[der]","",$string);
$string=str_replace("[/der]","
",$string);
$string=str_replace("[cent]","",$string);
$string=str_replace("[/cent]","
",$string);
$string=str_replace("[amarillo]","",$string);
$string=str_replace("[azul]","",$string);
$string=str_replace("[blanco]","",$string);
$string=str_replace("[marron]","",$string);
$string=str_replace("[naranja]","",$string);
$string=str_replace("[negro]","",$string);
$string=str_replace("[purpura]","",$string);
$string=str_replace("[rojo]","",$string);
$string=str_replace("[rosa]","",$string);
$string=str_replace("[verde]","",$string);
$string=str_replace("[violeta]","",$string);
$string=str_replace("[/amarillo]","",$string);
$string=str_replace("[/azul]","",$string);
$string=str_replace("[/blanco]","",$string);
$string=str_replace("[/marron]","",$string);
$string=str_replace("[/naranja]","",$string);
$string=str_replace("[/negro]","",$string);
$string=str_replace("[/purpura]","",$string);
$string=str_replace("[/rojo]","",$string);
$string=str_replace("[/rosa]","",$string);
$string=str_replace("[/verde]","",$string);
$string=str_replace("[/violeta]","",$string);
$string=str_replace("[tam=1]","",$string);
$string=str_replace("[tam=2]","",$string);
$string=str_replace("[tam=3]","",$string);
$string=str_replace("[tam=4]","",$string);
$string=str_replace("[tam=5]","",$string);
$string=str_replace("[tam=6]","",$string);
$string=str_replace("[/tam=1]","",$string);
$string=str_replace("[/tam=2]","",$string);
$string=str_replace("[/tam=3]","",$string);
$string=str_replace("[/tam=4]","",$string);
$string=str_replace("[/tam=5]","",$string);
$string=str_replace("[/tam=6]","",$string);
$string=str_replace("[h1]","",$string);
$string=str_replace("[h2]","",$string);
$string=str_replace("[h3]","",$string);
$string=str_replace("[h4]","",$string);
$string=str_replace("[h5]","",$string);
$string=str_replace("[h6]","",$string);
$string=str_replace("[/h1]","
",$string);
$string=str_replace("[/h2]","",$string);
$string=str_replace("[/h3]","",$string);
$string=str_replace("[/h4]","",$string);
$string=str_replace("[/h5]","",$string);
$string=str_replace("[/h6]","",$string);
return $string;
}
/*******************************************************************************/
//showError("Error XM3265","javascript: window.history.back()","Volver",1)
function showError($texto,$link,$textolink,$muere=1)
{
echo "$texto
";
echo "$textolink
";
if($muere){ die();}
}
/********************************************************************************/
function doc_Ruta($id,$separador="/")
{
global $conn, $var_path, $app_path;
$sql = "select catNombre,Cat_catID from extDocumentos A, extCategorias B where A.docID = '$id' and A.catID=B.catID ";
$qry = $conn->execute($sql);
if($qry->numrows)
{
$catNombre = $qry->field(catNombre);
$Cat_catID = $qry->field(Cat_catID);
$texto = $separador.$catNombre;
$i=0;
while($Cat_catID!=0 && $i < 30)
{
$sql = "select catNombre,Cat_catID from extCategorias where catID='$Cat_catID'";
$qry = $conn->execute($sql);
$catNombre = $qry->field(catNombre);
$Cat_catID = $qry->field(Cat_catID);
if($Cat_catID!=0)
{
$texto = $separador.$catNombre.$texto;
}
$i++;
}
if($i==30)
{
return showError("Se ha superado el limite maximo de Directorios, probablemente haya inconsistencia en la base de datos","window.history.back()","Volver",1);
}
else
{
return $texto;
}
}
else
{
return 0;
}
}
/********************************************************************************/
//Devuelve
/*function Art_Ruta($id,$separador="/")
{
global $conn, $var_path, $app_path;
$sql="select A.ejeRuta,A.ejeNombre
from Ejes A,Acciones B
where B.ejeID=A.ejeID and
B.accID='$id'";
$rsruta=$conn->execute($sql);
$ruta=str_replace("/",$separador,$rsruta->field(ejeRuta) . $separador . $rsruta->field(ejeNombre));
return substr($ruta,strlen($separador));
}*/
/************************************************************************************/
function cat_Ancestro($id)
{
//asi anda pero esta medio hardcode revisar
global $conn, $var_path, $app_path;
$sql = "select Cat_catID,catID,catAncestro from extCategorias where catID = '$id'";
$qry = $conn->execute($sql);
if($qry->numrows)
{
$catID = $qry->field(catID);
$Cat_catID = $qry->field(Cat_catID);
$catAncestro = $qry->field(catAncestro);
if($catAncestro!=0)
{
return $catAncestro;
}
else
{
if($Cat_catID==0)
{
return 0;
}
else
{
return $catID;
}
}
}
else
{
return -1;
}
}
/********************************************************************************/
//Devuelve "$caracter" si la cadena está vacía, sino devuelve la cadena
function checkVar($str,$caracter=" "){
if($str==""){return $caracter;}
else{return $str;}
}
/********************************************************************************/
function ver_Icono($doc)
{
global $var_path;
$ext = StrToLower(SubStr($doc, StrRPos($doc, ".") + 1));
switch($ext)
{
case "doc":
echo "
";
break;
case "xls":
echo "
";
break;
case "pdf":
echo "
";
break;
case "gif":
echo "
";
break;
case "jpeg":
case "jpg":
echo "
";
break;
case "mid":
case "wav":
case "mp3":
echo "
";
break;
case "avi":
case "mov":
case "mpg":
echo "
";
break;
case "zip":
echo "
";
break;
default:
echo "
";
break;
}
}
/********************************************************************************/
//Devuelve tamaño de imagen como alto x ancho
function img_size($link){
global $app_path;
$size=getimagesize($app_path.$link);
return("$size[0] x $size[1]");
}
/********************************************************************************/
//Devuelve un rs con el/los ultimos articulos del eje solicitado
/*function articulos($eje,$secID=1,$jerarquia=1,$cant=1)
{
global $conn,$condate;
if($secID==1 || !$secID)
{
$sql = "select * from Acciones A, Ejes B where A.ejeID=B.ejeID and (B.ejeID='$eje' or B.ejeAncestro='$eje') and ejeVarios='N' and accActiva='S' and accJerarquia='$jerarquia' and accFechaPub < '$condate' and (accFechaExp > '$condate' or accFechaExp = '0000-00-00 00:00:00' ) and estID='W' order by accFechaPub desc limit $cant";
}
else
{
$sql = "select * from Acciones A, Ejes B where A.ejeID=B.ejeID and (B.ejeID='$eje' or B.ejeAncestro='$eje') and ejeVarios='N' and accActiva='S' and accFechaPub < '$condate' and (accFechaExp > '$condate' or accFechaExp = '0000-00-00 00:00:00' ) and estID='W' and A.secID='$secID' order by accFechaPub desc limit $cant";
}
$qry = $conn->execute($sql);
if($qry)
{
return $qry;
}
else
{
return 0;
}
}*/
/********************************************************************************/
//Crea el nombre del Thumbnail de una imagen
function GetThumbnailName ($srcimage, $resolution) {
// funcion que retorna el nombre propuesto del thumbnail.
// Usar tambien para mostrar el thumbnail
$srcimagevector = explode(".", $srcimage);
$thumbnailname="";
$cantelem = count($srcimagevector);
for ($i = 0; $i < $cantelem -1 ; $i++) {
if ($i > 0) $thumbnailname .= ".";
$thumbnailname .= $srcimagevector[$i];
}
$thumbnailname .= "-tn-$resolution." . $srcimagevector[$cantelem - 1];
return $thumbnailname;
}
/**************************************************************************************************/
function ver_thumbnail($tipo,$id,$ubicacion=1,$alterna=0,$param="",$pie=0)
{
global $conn, $var_path, $app_path;
//busco la imagen
$sql="select * from ADVF A, Tablas B,ADVF_Vinculante C where C.tabID=B.tabID and A.advID=C.advID and tabNombre = '$tipo' and fgnID='$id' and adrUbicacion='$ubicacion' and A.advTipo='F'";
//echo $sql;
$qry=$conn->execute($sql);
//$qry->display();
if(!$qry)
{
return -1;
}
$thunb = GetThumbnailName ($qry->field(advLink),"100x100");
$aux = $app_path . $thunb;
$ret = @fileType($aux);
$aux = $var_path . $thunb;//esto es por que es distinto para vincularlo
if( $ret == "link" || $ret == "file" )
{
$size = GetImageSize($app_path . $thunb);
if($pie){
echo "
".$qry->field(advTitulo);
} else{
echo "
";
}
return $qry->field(advID);
}
else
{
if($alterna)
{
$auxalt = $app_path . $alterna;
$ret1 = fileType($auxalt);
$auxalt = $var_path . $alterna;
if( $ret1 == "link" || $ret1 == "file" )
{
echo "
";
return 2;
}
else
{
if($param==""){echo" ";}
else{echo"";}
return 0;
}
}
else
{
if($param==""){echo" ";}
else{echo"";}
return 0;
}
}
}
/***********************************************************************************************/
/*Devuelve fotos de la Galeria
slidefotos($id,$tamano,$asocOrden)
Parámetros:
$id:codigo del slideshow
$adrOrden: si se especifica el asocOrden trae sólo esa foto (esto se usa
al ver c/foto del slide).
*/
function slidefotos($id,$adrOrden=0){
global $conn;
if($adrOrden){$whereorden=" C.adrOrden=$adrOrden and ";}
else {$whereorden="";}
$sql="select A.*,C.adrOrden
from ADVF A,
ADVF_Vinculante C
where C.tabID='7' and
$whereorden
C.fgnID='$id' and
A.advID=C.advID
order by C.adrOrden desc";
$rs=$conn->execute($sql);
if(!$rs){
echo "Ha ocurrido un error en galeria.
";
die();
}
else{return $rs;}
}
/*********************************************************************/
//se fija que haya banners cargados y activos,
//en la ubicacion lateral devuelve la cantidad que encontro
function hay_banners($posi=0)
{
global $conn;
$sql = "select count(*) as CANT from Banners A, BannersPara B where A.banID=B.banID and A.banActivo='S' and (B.bapFbaja IS NULL OR B.bapFbaja > '$condate' or B.bapFbaja = '0000-00-00 00:00') ";
if($posi)
{
$sql .= " and bapPosicion = '$posi'";
}
$rs=$conn->execute($sql);
if(!$rs)
{
echo "Banner error Xm3254
";
die();
}
else
{
return $rs->field(CANT);
}
}
%>