From 8093b0f7b557afa92cf2f014e9489f7d4554f085 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2007 13:47:15 +0000 Subject: [PATCH] Fix: nettoyage du champ url --- htdocs/lib/functions.inc.php | 15 +++++++++++++++ htdocs/societe.class.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 9968868a627..f76967e471d 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -2667,6 +2667,21 @@ function dol_entity_decode($StringHtml) return $DecodeString; } +/** + \brief Nettoie une url + \param string url + \return string CleanUrl +*/ +function clean_url($url) +{ + //Todo: voir plus tard pour les url avec accent + $url = unaccent(trim($url)); + $url = strtolower($url); + //Todo: voir pour améliorer + $url = ereg_replace('^http://','',$url); + return $url; +} + /** \brief Supprime le code html \param string StringHtml diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index d5b5bba8639..dbc4f11fc08 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -301,7 +301,7 @@ class Societe $this->fax = ereg_replace(" ","",$this->fax); $this->fax = ereg_replace("\.","",$this->fax); $this->email=trim($this->email); - $this->url=trim($this->url); + $this->url=clean_url($this->url); $this->siren=trim($this->siren); $this->siret=trim($this->siret); $this->ape=trim($this->ape);