<%@ $Language=JScript /* PARA COLORES PHP */ %><% //********FUNCIONES RIRH //genera lista options para selects de lookuptables SOLO FOROS function option_list_foros($lookuptable,$field, $type=""){ global $conn; $where="where id='10' or id='8'"; $sql_sel="select * from $lookuptable $where order by description asc"; $rs_sel=$conn->execute($sql_sel); while(!$rs_sel->eof){ $id_sel=$rs_sel->field("id"); $description_sel=$rs_sel->field("description"); if($field==$id_sel){$selected="selected";}else{$selected="";} echo "\n"; $rs_sel->movenext(); } } //devuelve desc de id en lookuptables function data_field($lookuptable,$id, $data="description"){ global $conn; $sql="select $data from $lookuptable where id='$id'"; $rs=$conn->execute($sql); $desc=$rs->field($data); return $desc; } function data_query($sql, $field){ global $conn; $rs=$conn->execute($sql); $desc=$rs->field($field); return $desc; } //genera lista options para selects de lookuptables function option_list($lookuptable,$field, $type=""){ global $conn; if($type){$where="where type='$type'";} $sql_sel="select * from $lookuptable $where order by description asc"; $rs_sel=$conn->execute($sql_sel); while(!$rs_sel->eof){ $id_sel=$rs_sel->field("id"); $description_sel=$rs_sel->field("description"); if($field==$id_sel){$selected="selected";}else{$selected="";} echo "\n"; $rs_sel->movenext(); } } //genera option list de select multiples tomados de tablas de link function option_list_links($lookuptable, $linktable,$type="", $document_id, $link_id="coverage_id"){ global $conn; if($type){$addtype="type='$type' and";} list( $aaa, $field, $bbbb ) = split( '[_]', $linktable );//document, organization, personnel, etc //if($field=="coverage"){$field="coverage_spatial";}//parche horrible $sql_1="select * from $linktable where $addtype {$field}_id='$document_id'"; $rs_1=$conn->execute($sql_1); while(!$rs_1->eof){ $ii++; $in_1.="'".$rs_1->field($link_id)."',"; $rs_1->movenext(); } $in_1.="'0'"; $sql_2="select * from $lookuptable where $addtype id in ($in_1) order by description asc"; $rs_2=$conn->execute($sql_2); while(!$rs_2->eof){ echo ""; $rs_2->movenext(); } $sql_3="select * from $lookuptable where $addtype id not in ($in_1) order by description asc"; $rs_3=$conn->execute($sql_3); while(!$rs_3->eof){ echo ""; $rs_3->movenext(); } } //actualiza links vinculando dos tablas function update_links($tabla1, $tabla2, $matriz, $id, $type){ global $conn; $tabla2b=$tabla2; //obsolueto if($type){ $where_type_del="and type='$type'"; $where_type_act=", type='$type'"; $tabla2b="coverage"; } if(strpos($tabla2,"spatial")){ $tabla2b="coverage"; } $sql_link_del="delete from link_".$tabla1."_".$tabla2." where ".$tabla1."_id='$id' $where_type_del"; $conn->execute($sql_link_del); if($matriz){ foreach($matriz as $value){ $sql_link_act="insert into link_".$tabla1."_".$tabla2." set ".$tabla1."_id='$id', ".$tabla2b."_id='$value' $where_type_act"; $conn->execute($sql_link_act); } } } //Arma un string con codigo html de lista de autores, con link si hay function autores($id){ global $conn; $sql1="select * from link_document_personnel where document_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $pers_id=$rs1->field(personnel_id); $sql2="select * from data_personnel where id='$pers_id'"; $rs2=$conn->execute($sql2); $pers_apeynom=$rs2->field(vcard_name_lastname); $pers_apeynom.=", ".$rs2->field(vcard_name_firstname); $public=$rs2->field('public'); if($public){ $autores.="$pers_apeynom; "; }else{ $autores.="$pers_apeynom; "; } $rs1->movenext(); } $manual_aut=data_query("select dc_creator from data_document where id='$id'","dc_creator"); if(!$manual_aut){ $autores=substr($autores,0,strlen($autores)-2); }else{ $autores.=$manual_aut; } return $autores; } //Arma un string con codigo html de lista de organizaciones, con link si hay function organizaciones($id){ global $conn; $sql1="select * from link_document_organization where document_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $org_id=$rs1->field(organization_id); $sql2="select * from data_organization where id='$org_id'"; $rs2=$conn->execute($sql2); $org_nom=$rs2->field(dc_title); $organizacion.="$org_nom; "; $rs1->movenext(); } $manual_org=data_query("select dc_publisher from data_document where id='$id'","dc_publisher"); if(!$manual_org){ $organizacion=substr($organizacion,0,strlen($organizacion)-2); }else{ $organizacion.=$manual_org; } return $organizacion; } //lista paises vinculados function paises($id,$fieldlink,$tablalink,$tablalookup){ global $conn; if (strpos("_local",$tablalink)){ $where="and provincia='S'"; } $sql1="select * from $tablalink where $fieldlink='$id' $where"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $lang.=data_field($tablalookup,$rs1->field(coverage_id)).", "; $rs1->movenext(); } $lang=substr($lang,0,strlen($lang)-2); return $lang; } function linklista($id,$fieldlink,$tablalink,$tablalookup){ return paises($id,$fieldlink,$tablalink,$tablalookup); } //lista subject personnel function subject($id, $table="personnel"){ global $conn; $sql1="select * from link_{$table}_subject where {$table}_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $lang.=data_field("lookup_subject",$rs1->field(subject_id)).", "; $rs1->movenext(); } $lang=substr($lang,0,strlen($lang)-2); return $lang; } //lista wmo topic category (field of action) de organizaciones function field_of_action($id){ global $conn; $sql1="select * from link_organization_topical where organization_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $wmo.=data_field("lookup_organizationtopical",$rs1->field(topical_id)).", "; $rs1->movenext(); } $wmo=substr($wmo,0,strlen($wmo)-2); return $wmo; } //lista tipos de act function acttype($id){ global $conn; $sql1="select * from link_activity_type where activity_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $lang.=data_field("lookup_activitytype",$rs1->field(type_id)).", "; $rs1->movenext(); } $lang=substr($lang,0,strlen($lang)-2); return $lang; } //lista topical de act function acttopical($id){ global $conn; $sql1="select * from link_activity_topical where activity_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $lang.=data_field("lookup_activitytopical",$rs1->field(topical_id)).", "; $rs1->movenext(); } $lang=substr($lang,0,strlen($lang)-2); return $lang; } //convierte formato mysql a europeo (arg) function date_mysql2eur($date){ list( $anio, $mes, $dia ) = split( '[/.-]', substr($date,0,10)); return $dia."/".$mes."/".$anio; } //convierte formato mysql a Ingles pero sin hora function date_us($date){ list( $anio, $mes, $dia ) = split( '[/.-]', substr($date,0,10)); return $anio."/".$mes."/".$dia; } //genera lista options para las direcciones function option_list_address($address_id){ global $conn; $sql_adr="select * from data_address order by vcard_adr_street asc"; $rs_adr=$conn->execute($sql_adr); while(!$rs_adr->eof){ $vcard_adr_street=$rs_adr->field(vcard_adr_street); $vcard_adr_locality=$rs_adr->field(vcard_adr_locality); $vcard_adr_stateprovince=$rs_adr->field(vcard_adr_stateprovince); $vcard_adr_postalcode=$rs_adr->field(vcard_adr_postalcode); $vcard_tel_work=$rs_adr->field(vcard_tel_work); $vcard_tel_fax=$rs_adr->field(vcard_tel_fax); $vcard_adr_countryid=$rs_adr->field(vcard_adr_countryname); $id=$rs_adr->field(id); $vcard_adr_countryname=data_query("select * from lookup_coverage_spatial_iso3166 where id='$vcard_adr_countryid'","description"); if($address_id==$id){$selected="selected";}else{$selected="";} echo "\n"; $rs_adr->movenext(); } } //genera lista de expertisias de personnel function expertisias($id){ global $conn; $sql1="select * from link_personnel_specialization where personnel_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $exp.=data_field("lookup_personnelspecialization",$rs1->field(specialization_id)).", "; $rs1->movenext(); } $exp=substr($exp,0,strlen($exp)-2); return $exp; } //genera options de languages para IDs concatenados function multilanguage($dc_language){ global $conn; $sql_sel="select * from lookup_language order by description asc"; $rs_sel=$conn->execute($sql_sel); while(!$rs_sel->eof){ $id_sel=$rs_sel->field("id"); $description_sel=$rs_sel->field("description"); if(strpos($dc_language, $id_sel)===false){ $selected=""; $sel_nook.= "\n"; }else{ $selected="selected"; $sel_ok.= "\n"; } $rs_sel->movenext(); } echo $sel_ok.$sel_nook; } //genera lista de languages desc, a partir de id anidados function language_desc($dc_language){ if($dc_language){ $lang=explode(", ",$dc_language); foreach($lang as $value){ $langlist.=data_field("lookup_language",$value).", "; } $langlist=substr($langlist,0,strlen($langlist)-2); } return $langlist; } //crea links malto y http function linko($url){ if(strpos($url,"@")===false){$a=$a;}else{ return "$url"; } if(strpos($url,"http://")===false && strpos($url,"www")===false){ return $url; } if(strpos($url, "http://")===false){ $url="http://".$url; } $url2=limit_str($url,50); return "$url2"; } //lista de niveles de cursos function nivel($id){ global $conn; $sql1="select * from link_activity_topical a, lookup_activitytopical b where a.activity_id='$id' and a.topical_id=b.id and b.tid='2'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $exp.=data_field("lookup_activitytopical",$rs1->field(topical_id)).", "; $rs1->movenext(); } $exp=substr($exp,0,strlen($exp)-2); return $exp; } //lista de niveles de cursos function ambito($id){ global $conn; $sql1="select * from link_activity_coverage_spatial where activity_id='$id'"; $rs1=$conn->execute($sql1); while(!$rs1->eof){ $exp.=data_field("lookup_coverage_spatial",$rs1->field(coverage_id)).", "; $rs1->movenext(); } $exp=substr($exp,0,strlen($exp)-2); return $exp; } //crea option list para formularios y envio function form_optionlist($lookuptable,$values,$type=""){ global $conn; if($values){ if(is_array($values)){ foreach($values as $value){ $in.="'".$value."',"; } $in=substr($in,0,strlen($in)-1); }else{ $in="'".$values."'"; } $where="and id in ($in)"; $sel="selected"; } if($lookuptable=="lookup_coverage_spatial_local"){$order2="pais,";} if($type=="legal"){$where.=" and legal='S'";} $sql="select * from $lookuptable where 1=1 $where order by $order2 description asc"; $rs=$conn->execute($sql); $outp=""; while(!$rs->eof){ $id=$rs->field(id); $desc=$rs->field(description); $outp.= "\n"; $rs->movenext(); } return $outp; } function hayasociacion($lookuptable,$id){ global $conn; $tabla=substr($lookuptable,7,strlen($lookuptable)); if($tabla=="activitytopical"){$tabla="topical";} //chequeo en tablas link $sql_lnk1="show tables like 'link_%$tabla'"; $rs_lnk1=$conn->execute($sql_lnk1); while(!$rs_lnk1->eof){ $link_table=$rs_lnk1->field(0); $sql_lnk2="show fields from $link_table"; $rs_lnk2=$conn->execute($sql_lnk2); $rs_lnk2->movenext(); $rs_lnk2->movenext(); $link_field=$rs_lnk2->field(Field); $sql_lnk3="select * from $link_table where $link_field = '$id'"; $rs_lnk3=$conn->execute($sql_lnk3); if($rs_lnk3->numrows > 0){return true;} $rs_lnk1->movenext(); } if($lookuptable=="lookup_coverage_spatial_iso3166"){ $sql_lnk4="select * from z_notNoticias where notPais='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} $sql_lnk5="select * from data_address where vcard_adr_countryname='$id'"; $rs_lnk5=$conn->execute($sql_lnk5); if($rs_lnk5->numrows > 0){return true;} } if($lookuptable=="lookup_coverage_spatial_basin"){ $sql_lnk4="select * from z_notNoticias where notCuenca='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_coverage_spatial_local"){ $sql_lnk4="select * from z_notNoticias where notProvincia='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_activitytype"){ $sql_lnk4="select * from data_activity where dc_type='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_activitytopical"){ $sql_lnk4="select * from data_activity where dc_type='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_documenttype"){ $sql_lnk4="select * from data_document where dc_type='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_documenttopical"){ $sql_lnk4="select * from data_document where wmo_topic_category='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_organizationtopical"){ $sql_lnk4="select * from data_organization where wmo_topic_category='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_membertype"){ $sql_lnk4="select * from data_organization where wp_membertype='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_language"){ $sql_lnk4="select * from data_activity where dc_language = '$id' or dc_language like '$id,%' or dc_language like '%,$id' or dc_language like '%,$id,%'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} $sql_lnk4="select * from data_document where dc_language = '$id' or dc_language like '$id,%' or dc_language like '%,$id' or dc_language like '%,$id,%'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} $sql_lnk4="select * from data_organization where dc_language = '$id' or dc_language like '$id,%' or dc_language like '%,$id' or dc_language like '%,$id,%'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} $sql_lnk4="select * from data_personnel where dc_language = '$id' or dc_language like '$id,%' or dc_language like '%,$id' or dc_language like '%,$id,%'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_formattype"){ $sql_lnk4="select * from data_document where dc_format='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } if($lookuptable=="lookup_formatmedium"){ $sql_lnk4="select * from data_document where dc_format_medium='$id'"; $rs_lnk4=$conn->execute($sql_lnk4); if($rs_lnk4->numrows > 0){return true;} } return false; } function limit_str($str,$limit){ if(strlen($str)>$limit){ $str=substr($str,0,$limit-3)."..."; } return $str; } ///////////////////////// //FUNCIONES SPI //Carga variables con el idioma seleccionado para el ADMIN if (strpos($PHP_SELF,"admin")) { //chequea si viene del admin o no include("inc_idioma_admin_castellano.php"); //include("inc_idioma_admin_english.php"); } /*Setea cooikie de encuesta*/ if(isset ($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 z_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.menNombre_IA,MEN.menEstructura from z_segAdminABM ABM,z_MenuSite MEN where ABM.admABMLink='$page' and MEN.menID=ABM.menID"; $rspt=$conn->execute($sql); $admABMTipoAux=$rspt->field(admABMTipo); $admABMTipo=$$admABMTipoAux; $menNombre=$rspt->field(menNombre); $menNombre_IA=$rspt->field(menNombre_IA); $menEstructura=$rspt->field(menEstructura); if($idiomaAdmin=="English") { if($admABMTipo!="New" && $admABMTipo!="Add" && $admABMTipo!="Create"){ return $menNombre." ".$admABMTipo." (".$menEstructura.")"; } else { return $admABMTipo." ".$menNombre." (".$menEstructura.")"; } } else { return $admABMTipo." ".$menNombre_IA." (".$menEstructura.")"; } // 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 z_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 z_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 sailz_Tablas //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 z_ADVF A, z_Tablas B,z_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{ if (substr($aux, -3)=="swf"){ echo ""; }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 sailz_Tablas //existe_Foto("Corredor",133,1) function existe_Foto($tipo,$id,$ubicacion=1) { global $conn, $var_path, $app_path; //busco la imagen $sql="select * from sailz_ADVF A, sailz_Tablas B,sailz_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 ); 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();} } /********************************************************************************/ //Devuelve la ruta del elemento o rubro ya sea documento, servicio, etc. //tipo: "R" -> Rubro, "E" -> Elemento de un rubro. //$tabID: para saber si es un servicio,producto,etc. //$id: id del rubro o del elemento. function Obj_Ruta($tipo,$tabID,$id,$separador="/") { global $conn, $var_path, $app_path; $sql="select tabNombre from z_Tablas where tabID='$tabID'"; $rstab=$conn->execute($sql); $tabNombre=$rstab->field(tabNombre); switch($tabNombre) { case 'DocRubro': if($tipo=="R"){ $sql1 = "select * from docRubros where rubdocID = '$id'"; }else if($tipo=="E"){ $sql1 = "select * from docRubros A, docDocumentos B where A.rubdocID=B.rubdocID and docID = '$id'"; } $qry = $conn->execute($sql1); if($qry->numrows) { $catNombre = $qry->field(campo_ia(rubdocNombre)); $Cat_catID = $qry->field(rubdocPadre); if($catNombre!="") { $texto = $separador.$catNombre; } $i=0; while($Cat_catID!=0 && $i < 30) { $sql2 = "select * from docRubros where rubdocID='$Cat_catID'"; $qry = $conn->execute($sql2); $catNombre = $qry->field(campo_ia(rubdocNombre)); $Cat_catID = $qry->field(rubdocPadre); 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; } break; case 'ProdRubro': if($tipo=="R"){ $sql1 = "select * from prodRubros where rubID = '$id'"; }else if($tipo=="E"){ $sql1 = "select * from prodRubros A, prodProductos B where A.rubID=B.rubID and prodID = '$id'"; } $qry = $conn->execute($sql1); if($qry->numrows) { $catNombre = $qry->field(campo_ia(rubNombre)); $Cat_catID = $qry->field(rubPadre); if($catNombre!="") { $texto = $separador.$catNombre; } $i=0; while($Cat_catID!=0 && $i < 30) { $sql2 = "select * from prodRubros where rubID='$Cat_catID'"; $qry = $conn->execute($sql2); $catNombre = $qry->field(campo_ia(rubNombre)); $Cat_catID = $qry->field(rubPadre); 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; } break; case 'ServRubro': if($tipo=="R"){ $sql1 = "select * from servRubros where rubservID = '$id'"; }else if($tipo=="E"){ $sql1 = "select * from servRubros A, servServicios B where A.rubservID=B.rubservID and servID = '$id'"; } $qry = $conn->execute($sql1); if($qry->numrows) { $catNombre = $qry->field(campo_ia(rubservNombre)); $Cat_catID = $qry->field(rubservPadre); if($catNombre!="") { $texto = $separador.$catNombre; } $i=0; while($Cat_catID!=0 && $i < 30) { $sql2 = "select * from servRubros where rubservID='$Cat_catID'"; $qry = $conn->execute($sql2); $catNombre = $qry->field(campo_ia(rubservNombre)); $Cat_catID = $qry->field(rubservPadre); 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; } break; } } /********************************************************************************/ //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 "Documento de MS Word"; break; case "xls": echo "Planilla de MS Excel"; break; case "pdf": echo "Documento de Adobe Acrobat"; 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 "Archivo de formato No Identificado"; 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]"); } /********************************************************************************/ //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 genthumbnail($i,$nw,$p,$nn) { //funcion genera thumbnails nativo php (no usa perl pero admite solo jpg) $img=imagecreatefromjpeg("$i"); $ow=imagesx($img); $oh=imagesy($img); $scale=$nw/$ow; $nh=ceil($oh*$scale); $newimg=imagecreate($nw,$nh); imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh); imagejpeg($newimg, $p.$nn); return true; } /**************************************************************************************************/ function ver_thumbnail($tipo,$id,$ubicacion=1,$alterna=0,$param="",$pie=0) { global $conn, $var_path, $app_path; //busco la imagen $sql="select * from z_ADVF A, z_Tablas B,z_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; } if (substr($qry->field(advLink), -3)=="swf"){ $thunb=$qry->field(advLink); }else { $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" || substr($aux,-3)=="swf") { $size = GetImageSize($app_path . $thunb); if($pie){ echo "
".$qry->field(advTitulo); } else{ if (substr($aux, -3)=="swf") { echo ""; }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 z_ADVF A, z_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); } } /*********************************************************************/ //pone la barra lateral si está habilitada function barra_lateral($tabID){ global $conn,$var_idioma; $sql="select * from z_z_TablasBarras where tabID='$tabID'"; $rstb=$conn->execute($sql); if($rstb->field("barLat")=="S"){ if(!$var_idioma || $var_idioma == "DEF") { if($rstb->field("barLatData")!="" && $rstb->field("barLatData")!="

 

" && $rstb->field("barLatData")!="

 

"){ return "".$rstb->field("barLatData").""; }else{ return "".$rstb->field("barLatData_IA").""; } }else{ if($rstb->field("barLatData_IA")!="" && $rstb->field("barLatData_IA")!="

 

" && $rstb->field("barLatData_IA")!="

 

"){ return "".$rstb->field("barLatData_IA").""; }else{ return "".$rstb->field("barLatData").""; } } }else{ return false; } } /*********************************************************************/ //pone la barra superior si está habilitada function barra_superior($tabID){ global $conn,$var_idioma; $sql="select * from z_z_TablasBarras where tabID='$tabID'"; $rstb=$conn->execute($sql); if($rstb->field("barSup")=="S"){ if(!$var_idioma || $var_idioma == "DEF") { if($rstb->field("barSupData")!="" && $rstb->field("barSupData")!="

 

" && $rstb->field("barSupData")!="

 

"){ return "
".$rstb->field("barSupData")."
"; }else{ return "
".$rstb->field("barSupData_IA")."
"; } }else{ if($rstb->field("barSupData_IA")!="" && $rstb->field("barSupData_IA")!="

 

" && $rstb->field("barSupData_IA")!="

 

"){ return "
".$rstb->field("barSupData_IA")."
"; }else{ return "
".$rstb->field("barSupData")."
"; } } }else{ return false; } } %>
Fatal error: Call to a member function field() on a non-object in /home/iwrn/public_html/rirh-caribe/index.php on line 10