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);