From f78e12d7f843424b2ce383ca006096062b84dc4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Fri, 23 Oct 2009 23:25:07 +0000 Subject: [PATCH] Add test on url syntax --- htdocs/langs/en_US/companies.lang | 1 + htdocs/langs/fr_FR/companies.lang | 1 + htdocs/soc.php | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index f7ccac2d0e0..4a4bd24c377 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -1,6 +1,7 @@ # Dolibarr language file - en_US - companies CHARSET=UTF-8 ErrorBadEMail=EMail %s is wrong +ErrorBadUrl=Url %s is wrong ErrorCompanyNameAlreadyExists=Company name %s already exists. Choose another one. ErrorPrefixAlreadyExists=Prefix %s already exists. Choose another one. ErrorSetACountryFirst=Set the country first diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index b76ac8644be..358ca945498 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -1,6 +1,7 @@ # Dolibarr language file - fr_FR - companies CHARSET=UTF-8 ErrorBadEMail=e-mail %s invalide +ErrorBadUrl=Url %s invalide ErrorCompanyNameAlreadyExists=Le nom de société %s existe déjà. Veuillez en choisir un autre. ErrorPrefixAlreadyExists=Le préfixe %s existe déjà. Veuillez en choisir un autre. ErrorSetACountryFirst=Définissez d'abord le pays diff --git a/htdocs/soc.php b/htdocs/soc.php index bf27e3623a9..8f895d52565 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -133,6 +133,12 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) $soc->error = $langs->trans("ErrorBadEMail",$soc->email); $_GET["action"] = $_POST["action"]=='add'?'create':'edit'; } + if (! empty($soc->url) && ! isValidUrl($soc->url)) + { + $error = 1; + $soc->error = $langs->trans("ErrorBadUrl",$soc->url); + $_GET["action"] = $_POST["action"]=='add'?'create':'edit'; + } if ($soc->fournisseur && ! $conf->fournisseur->enabled) { $error = 1; -- GitLab