link); @mkdir("../client/gfx/magasin",0755); @mkdir("../client/cache/magasin",0755); $variable = new Variable(); if(!$variable->charger("cle_google_map")){ $variable->nom = "cle_google_map"; $variable->add(); } } function Magasin(){ $this->PluginsClassiques(); } function charger($id){ return $this->getVars("select * from $this->table where id=\"$id\""); } function charger_ville($ville){ return $this->getVars("select * from $this->table where ville=\"$ville\""); } function boucle($texte, $args){ // r?cup?ration des arguments $boucle = lireTag($args, "boucle"); if($boucle == "codepostal") return $this->boucle_codepostal($texte, $args); if($boucle == "ville") return $this->boucle_ville($texte, $args); else if($boucle == "magasin") return $this->boucle_magasin($texte, $args); } function boucle_codepostal($texte, $args){ $search=""; $res=""; $order = "order by cp"; $query = "select distinct(cp) from $this->table $order"; $resul = mysql_query($query); $nbres = mysql_num_rows($resul); if(!$nbres) return ""; while( $row = mysql_fetch_object($resul)){ $temp = str_replace("#CP", "$row->cp", $texte); if(isset($_GET['cp']) && $_GET['cp'] == $row->cp) $temp = str_replace("#SELECTED", "selected=\"selected\"", $temp); else $temp = str_replace("#SELECTED", "", $temp); $res .= $temp; } return $res; } function boucle_ville($texte, $args){ $search=""; $res=""; $order = "order by ville"; $query = "select distinct(ville) from $this->table $order"; $resul = mysql_query($query); $nbres = mysql_num_rows($resul); if(!$nbres) return ""; while( $row = mysql_fetch_object($resul)){ $temp = str_replace("#VILLE", "$row->ville", $texte); $this->charger_ville($row->ville); $temp = str_replace("#CP", "$this->cp", $temp); if(isset($_GET['cp']) && $_GET['cp'] == $this->cp) $temp = str_replace("#SELECTED", "selected=\"selected\"", $temp); else $temp = str_replace("#SELECTED", "", $temp); $res .= $temp; } return $res; } function boucle_magasin($texte, $args){ $cp = lireTag($args, "cp"); $largeur_image = lireTag($args, "largeur_image"); $search=""; $res=""; if($cp != "") $search .= " and cp=\"$cp\""; if($ville != "") $search .= " and ville=\"$ville\""; $order = "order by cp"; $query = "select * from $this->table where 1 $search $order"; $resul = mysql_query($query); $nbres = mysql_num_rows($resul); if(!$nbres) return ""; while( $row = mysql_fetch_object($resul)){ $temp = str_replace("#CP", "$row->cp", $texte); $temp = str_replace("#NOM", "$row->nom", $temp); $temp = str_replace("#ADRESSE", "$row->adresse", $temp); $temp = str_replace("#CP", "$row->cp", $temp); $temp = str_replace("#VILLE", "$row->ville", $temp); $temp = str_replace("#TEL", "$row->tel", $temp); $temp = str_replace("#FAX", "$row->fax", $temp); $temp = str_replace("#LAT", "$row->lat", $temp); $temp = str_replace("#LON", "$row->lon", $temp); if(file_exists("client/gfx/magasin/" . $row->id . ".jpg")) $temp = str_replace("#IMAGE", "client/plugins/magasin/redimlive.php?nomorig=../../gfx/magasin/" . $row->id . ".jpg&width=$largeur_image", $temp); else $temp = str_replace("#IMAGE", "", $temp); $res .= $temp; } return $res; } function action(){ global $res; if($_GET['cp']) $res = str_replace("#MAGASIN_CP", $_GET['cp'], $res); else $res = str_replace("#MAGASIN_CP", "75020", $res); } } ?>