$v) { if (!in_array($k,$nob)) unset($_SESSION[$k]); } } function get_mysqltable_update_time ($tabla) { $mytime=query("SHOW TABLE STATUS LIKE '".$tabla."'","","","0"); if (has_nodes($mytime)) { $time=$mytime[0]["Update_time"]; list($date, $time) = explode(' ', $time); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); $time=mktime($hour, $minute, $second, $month, $day, $year); return intval($time); } } function clean_keyword($k,$permitidos="") { if (trim($k)!="") { $perm = null; if (has_nodes($permitidos)) { foreach ($permitidos as $v) $perm .= "\\$v"; } $k = strtolower(tildesOut(strip_tags(html_entity_decode(html_entity_decode(trim($k)))))); $k = str_replace("--","-",$k); $k = str_replace("__","_",$k); $k = preg_replace("/[^{$perm}a-zA-Z0-9ñÑ_-]/","",$k); return $k; } } function my_url_convert($url) { $url = str_replace("ñ","ny",$url); $url = str_replace("ñ","ny",$url); $url = urldecode($url); $url = html_entity_decode($url); $url = str_replace("'","-",$url); $url = str_replace("ñ","ny",$url); $url = str_replace("-"," ",$url); $url = str_replace(" ","-",$url); $url = str_replace(",","-",$url); $url = str_replace(".","-",$url); $url = str_replace(":","-",$url); $url = str_replace(";","-",$url); $url = tildesOut($url); $url = preg_replace("/[^a-z0-9]/i","-",$url); $url = strtolower($url); while (strpos($url,"--")!=FALSE) $url = str_replace("--","-",$url); return $url; } function put_enviar_a($url="") { if ($url=="") { if (isset($_SERVER["SCRIPT_URI"]) && trim($_SERVER["SCRIPT_URI"])!="") $url = $_SERVER["SCRIPT_URI"]; if (isset($_SERVER["REQUEST_URI"]) && trim($_SERVER["REQUEST_URI"])!="" && isset($_SERVER["SERVER_NAME"]) && trim($_SERVER["SERVER_NAME"])!="") $url = "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } $href = urlencode($url); $title = urlencode(str_replace(" - "," ",$_SESSION["meta_title"])); $meneame = 'http://meneame.net/submit.php?url='.$href; $digg = 'http://digg.com/submit?phase=2&url='.$href.'&title='.$title; $delicious = 'http://del.icio.us/post?url='.$href.'&title='.$title; $facebook = 'http://www.facebook.com/share.php?u='.$href; $technorati = 'http://www.technorati.com/search/'.$title.'?sub=postcosm'; $yahoo = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u='.$href.'&t='.$title.'&ei=UTF-8'; $fresqui = 'http://tec.fresqui.com/post?url='.$href.'&title='.$title; $googlebm= 'http://www.google.com/bookmarks/mark?op=edit&bkmk='.$href.'&title='.$title; $twitter = 'http://twitter.com/home?status='.$href; $linkedin = 'http://www.linkedin.com/shareArticle?mini=true&url='.$href.'&title='.$title.'&summary=&source='; $result = ' '; return $result; } function put_sitio($re) { $lugar = ""; if (isset($re["provincia"]) && trim($re["provincia"])!="") $lugar = $re["provincia"]; elseif (isset($re["lugar"]) && trim($re["lugar"])=="") $lugar = $re["lugar"]; elseif (isset($re["poblacion"]) && trim($re["poblacion"])=="") $lugar = $re["poblacion"]; return $lugar; } function get_google_maps($url, $width="425", $height="350") { $url = str_replace('"','"',html_entity_decode($url)); $mapa = ""; $myurl = ""; $theurl = ""; $orig = split(" ",$url); if (has_nodes($orig)) { foreach ($orig as $o) { if (substr($o,0,4) == "src=") $theurl = substr($o,strpos($o,'"',0),strpos($o,'"',10)); } } unset($orig); // if ($theurl == "") $theurl = $url; $url = $theurl; $url = str_replace("http://","",$url); $url = str_replace("'","'",$url); $url = str_replace("&","&",$url); $url = substr($url,strpos($url,"?") + 1,strlen($url)); $urlparams = split("&",$url); $urlparametros = Array(); $allowedparams = Array("f","hl","geocode","time","date","ttype","q","sll","sspn","spn","ll","ie","iwloc","om","z","s","t","cd","output","msa","msid"); foreach ($urlparams as $param) { $tmp = split("=",$param); $name = ""; $value = ""; if (count($tmp)==2) { $name = $tmp[0]; $value = $tmp[1]; } if (in_array($name,$allowedparams)) $myurl .= "&".$name."=".alfanumerico($value,true,",\.\+\-%_'"); } if (trim($myurl)!="") { $type = "maps"; if (strpos($theurl,"maps/ms")!==FALSE) $type = "maps/ms"; $myurl = "http://maps.google.com/".$type."?z=16".$myurl;//."&output=embed"; $myurl = str_replace("&","&",$myurl); $mapa = '

 

'.__("ver_google_maps").' :

 

'; $mapa .= ''; } return $mapa; } function put_string_in_images($input) { $result = ""; $letras = Array("a" => "1920.png", "b" => "1921.png", "c" => "1922.png", "d" => "1923.png", "e" => "1924.png", "f" => "1925.png", "g" => "1926.png", "h" => "1927.png", "i" => "1928.png", "j" => "1929.png", "k" => "1930.png", "l" => "1931.png", "m" => "1932.png", "n" => "1933.png", "o" => "1934.png", "p" => "1935.png", "q" => "1936.png", "r" => "1937.png", "s" => "1938.png", "t" => "1939.png", "u" => "1940.png", "v" => "1941.png", "w" => "1942.png", "x" => "1943.png", "z" => "1944.png", "1" => "1945.png", "2" => "1946.png", "3" => "1947.png", "4" => "1948.png", "5" => "1949.png", "6" => "1950.png", "7" => "1951.png", "8" => "1952.png", "9" => "1953.png", "0" => "1954.png", "." => "1955.png", "-" => "1956.png", "_" => "1957.png", "@" => "1958.png", "y" => "1959.png"); for($i=0;$i'; } } return $result; } function myord($campo,$pagina="inici") { $r = "\n".'Ordernar de menor a major'; $r .= 'Ordernar de major a menor'; return $r; } function get_entitat_info($id_entitat,$link_ficha=true,$width="150",$height="75",$persona="",$ambos_links=false) { if (!$id_entitat>0) return false; $result = ''; $res = query("SELECT * FROM tbl_entidad_miembro WHERE activo=1 AND id = ".$id_entitat); if (has_nodes($res)) { $enti_nom = $res[0]["nombre"]; if (trim($res[0]["direccion"])!="") $enti_dir .= trim($res[0]["direccion"]); if (trim($res[0]["cp"])!="") $enti_dir .= " ".trim($res[0]["cp"]); if (trim($res[0]["poblacion"])!="") $enti_dir .= " ".trim($res[0]["poblacion"]); $enti_dir = trim($enti_dir); $enti_telf = $res[0]["telf"]; $enti_foto = get_images($res[0],$width,$height); $enti_id = $res[0]["id"]; $result = ''; if ($link_ficha) { if($enti_foto[1]!="") $result .= ''.$enti_nom.''; else $result .= '

'.$enti_nom.'

'; } else { if($enti_foto[1]!="" && trim($res[0]["url"])!="") $result .= ''.$enti_nom.''; elseif($enti_foto[1]!="") $result .= ''.$enti_nom.''; else $result .= '

'.$enti_nom.'

'; } if($enti_dir!="") $result .= '

'.$enti_dir.'

'; if($enti_telf!="") $result .= '

'.$enti_telf.'

'; if((!$link_ficha || $ambos_links) && trim($res[0]["url"])!="") $result .= '

Pàgina web de '.$res[0]["nombre"].'

'; if (trim($persona)=="") { $res = query("SELECT DISTINCT(tbl_usuario_miembro.id), tbl_usuario_miembro.nombre FROM tbl_usuario_miembro INNER JOIN tbl_rel_usuario_miembro_entidad_miembro_cargo ON tbl_rel_usuario_miembro_entidad_miembro_cargo.id__tbl_usuario_miembro__nombre = tbl_usuario_miembro.id WHERE tbl_usuario_miembro.activo=1 AND tbl_rel_usuario_miembro_entidad_miembro_cargo.id__tbl_entidad_miembro__nombre = ".$id_entitat); if (has_nodes($res)) { if (count($res)>1) $result .= '

Persones de Contacte:'; else $result .= '

Persona de Contacte:'; foreach ($res as $re) $result .= '
'.$re["nombre"]; $result .= '

'; } } else $result .= $persona; } return $result; } function get_entitats_logos($width="94",$height="55",$id=0,$sin_logo=false) { $result = ''; $query = "SELECT * FROM tbl_entidad_miembro WHERE activo=1 ORDER BY nombre ASC"; if ($id>0) $query = "SELECT * FROM tbl_entidad_miembro WHERE activo=1 AND id=".$id; $res = query($query); if (has_nodes($res)) { foreach ($res as $re) { $enti_foto = get_images($re,$width,$height); $enti_nom = $re["nombre"]; $enti_id = $re["id"]; if($enti_foto[1]!="") $result.= ''.$enti_nom.''; elseif ($enti_foto[1]=="" && $sin_logo) $result.= ''.$enti_nom.''; } } return $result; } function put_form_contacte() { global $config_mail_form_contacto; $result = ''; $sin_mail = false; if (!isset($_SESSION["contacte_email"]) || trim($_SESSION["contacte_email"])=="") { $email = $config_mail_form_contacto; $sin_mail = true; } else $email = trim($_SESSION["contacte_email"]); if (!isset($_SESSION["contacte_ok"])) { $pag = $_SESSION["pagina"]; $url = $pag; if ($pag == "entitat") $pag = "entidad"; elseif ($pag == "curs") $pag = "curso"; $_SESSION["contacte_subject"] = "Contacte"; if (isset($_SESSION[$pag."_id"]) && $_SESSION[$pag."_id"]>0 && isset($_SESSION[$pag."_titulo"]) && trim($_SESSION[$pag."_titulo"])!="") { $url = $_SESSION["pagina"]."/".$_SESSION[$pag."_id"]."/".my_url_convert($_SESSION[$pag."_titulo"]); $_SESSION["contacte_subject"] = ucwords($_SESSION["pagina"])." : ".$_SESSION[$pag."_titulo"]; } $_SESSION["contacte_url"] = $url; if (isset($_SESSION["errores"]["contacte"]) && has_nodes($_SESSION["errores"]["contacte"])) $result .= 'Els camps que et marquem son obligatoris'; $d = Array(); if (isset($_SESSION["contacte"]) && has_nodes($_SESSION["contacte"])) $d = $_SESSION["contacte"]; $result .= '


'.putinput("contacte-nom",$d["nom"],'','size="30"').'


'.putinput("contacte-telefon",$d["telefon"],'','size="30"').'


'.putinput("contacte-email",$d["email"],'','size="30"').'


'.puttextarea("contacte-comentari",$d["comentari"],'cols="30" rows="8"').'

'; } else { $result = '

'.$_SESSION["contacte_ok"].'

'; unset($_SESSION["contacte_ok"]); } if (isset($_SESSION["errores"]["contacte"])) unset($_SESSION["errores"]["contacte"]); if (isset($_SESSION["contacte"])) unset($_SESSION["contacte"]); return $result; } ?>