mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 11:31:26 +01:00
Ajout de la possibilit de garder le http
This commit is contained in:
@@ -2670,18 +2670,20 @@ function dol_entity_decode($StringHtml)
|
|||||||
/**
|
/**
|
||||||
\brief Nettoie une url
|
\brief Nettoie une url
|
||||||
\param string url
|
\param string url
|
||||||
|
\param string http (1: avec http, 0: sans http)
|
||||||
\return string CleanUrl
|
\return string CleanUrl
|
||||||
*/
|
*/
|
||||||
function clean_url($url)
|
function clean_url($url,$http=1)
|
||||||
{
|
{
|
||||||
//Todo: voir plus tard pour les url avec accent
|
//Todo: voir plus tard pour les url avec accent
|
||||||
$url = unaccent(trim($url));
|
$url = unaccent(trim($url));
|
||||||
|
|
||||||
// On supprime le http
|
// Si d<>fini on supprime le http
|
||||||
$url = eregi_replace('^http(s)?:[\\\/]+','',$url);
|
// TODO: supprimer les slashs en trop
|
||||||
|
if ($http==0) $url = eregi_replace('^http(s)?:[\\\/]+','',$url);
|
||||||
|
|
||||||
// On r<>cup<75>re le nom de domaine
|
// On r<>cup<75>re le nom de domaine
|
||||||
$domain = eregi('^[0-9A-Z-]+\.([0-9A-Z-]+\.)+[A-Z]{2,4}(:[0-9]+)?',$url,$regs);
|
$domain = eregi('^(http(s)?:[\\\/]+)?[0-9A-Z-]+\.([0-9A-Z-]+\.)+[A-Z]{2,4}(:[0-9]+)?',$url,$regs);
|
||||||
|
|
||||||
// On passe le nom de domaine en minuscule
|
// On passe le nom de domaine en minuscule
|
||||||
$url = eregi_replace($regs[0],strtolower($regs[0]),$url);
|
$url = eregi_replace($regs[0],strtolower($regs[0]),$url);
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ class Societe
|
|||||||
$this->fax = ereg_replace(" ","",$this->fax);
|
$this->fax = ereg_replace(" ","",$this->fax);
|
||||||
$this->fax = ereg_replace("\.","",$this->fax);
|
$this->fax = ereg_replace("\.","",$this->fax);
|
||||||
$this->email=trim($this->email);
|
$this->email=trim($this->email);
|
||||||
$this->url=clean_url($this->url);
|
$this->url=clean_url($this->url,0);
|
||||||
$this->siren=trim($this->siren);
|
$this->siren=trim($this->siren);
|
||||||
$this->siret=trim($this->siret);
|
$this->siret=trim($this->siret);
|
||||||
$this->ape=trim($this->ape);
|
$this->ape=trim($this->ape);
|
||||||
|
|||||||
Reference in New Issue
Block a user