diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php
index 7d837a551a5..9d6e26d3501 100644
--- a/htdocs/adherents/adherent.class.php
+++ b/htdocs/adherents/adherent.class.php
@@ -34,6 +34,7 @@
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
/**
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 0dd51c2f806..d8aa740126b 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -28,6 +28,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
@@ -864,11 +865,11 @@ if ($rowid && $action != 'edit')
{
if ($adh->societe) $name.=' ('.$adh->societe.')';
}
- else
+ else
{
$name=$adh->societe;
}
-
+
// Create a form array
$formquestion=array(
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
@@ -1038,7 +1039,7 @@ if ($rowid && $action != 'edit')
}
print '';
}
-
+
// Other attributs
foreach($adho->attribute_label as $key=>$value)
{
@@ -1144,7 +1145,7 @@ if ($rowid && $action != 'edit')
print "".$langs->trans("CreateDolibarrThirdParty")."";
}
}
-
+
// Supprimer
if ($user->rights->adherent->supprimer)
{
diff --git a/htdocs/includes/modules/mailings/peche.modules.php b/htdocs/includes/modules/mailings/peche.modules.php
index 68340074ab9..859b1e28faf 100644
--- a/htdocs/includes/modules/mailings/peche.modules.php
+++ b/htdocs/includes/modules/mailings/peche.modules.php
@@ -25,6 +25,7 @@
*/
include_once DOL_DOCUMENT_ROOT.'/includes/modules/mailings/modules_mailings.php';
+require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
/**
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 0e1aa99cf77..cd4992f9668 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -36,45 +36,6 @@ if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '..');
if (! defined('ADODB_DATE_VERSION')) include_once(DOL_DOCUMENT_ROOT."/includes/adodbtime/adodb-time.inc.php");
-
-/**
- * \brief Return true if email syntax is ok
- * \param address email (Ex: "toto@titi.com", "John Do ")
- * \return boolean true if email ok, false if ko
- */
-function ValidEmail($address)
-{
- if (eregi(".*<(.+)>", $address, $regs)) {
- $address = $regs[1];
- }
- if (eregi("^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|asso|aero|biz|com|coop|edu|gov|info|int|mil|name|net|org|pro)\$",$address))
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-/**
- * \brief Renvoi vrai si l'email a un nom de domaine qui r�soud via dns
- * \param mail adresse email (Ex: "toto@titi.com", "John Do ")
- * \return boolean true si email valide, false sinon
- */
-function check_mail($mail)
-{
- list($user, $domain) = split("@", $mail, 2);
- if (checkdnsrr($domain, "MX"))
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
/**
* \brief Clean a string to use it as a file name.
* \param str String to clean
@@ -739,8 +700,6 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64)
if (empty($email)) return ' ';
- if (! ValidEmail($email)) return "Bad email";
-
if (! empty($addlink))
{
$newemail='")
+ * \return boolean true if email ok, false if ko
+ */
+function ValidEmail($address)
+{
+ if (eregi(".*<(.+)>", $address, $regs)) {
+ $address = $regs[1];
+ }
+ if (eregi("^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|asso|aero|biz|com|coop|edu|gov|info|int|mil|name|net|org|pro)\$",$address))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/**
+ * \brief Renvoi vrai si l'email a un nom de domaine qui r�soud via dns
+ * \param mail adresse email (Ex: "toto@titi.com", "John Do ")
+ * \return boolean true si email valide, false sinon
+ */
+function CheckMailDomain($mail)
+{
+ list($user, $domain) = split("@", $mail, 2);
+ if (checkdnsrr($domain, "MX"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
/**
* \brief Return lines of an html table from an array
* \remarks Used by array2table function only
diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php
index 7832432bd15..3a8267f55f3 100644
--- a/htdocs/public/paybox/newpayment.php
+++ b/htdocs/public/paybox/newpayment.php
@@ -28,6 +28,7 @@
require("../../master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paybox/paybox.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
diff --git a/htdocs/telephonie/client/new.php b/htdocs/telephonie/client/new.php
index ccba9dfb8d4..15bc572b46c 100644
--- a/htdocs/telephonie/client/new.php
+++ b/htdocs/telephonie/client/new.php
@@ -17,28 +17,24 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- * $Source$
- *
*/
/**
\file htdocs/telephonie/client/new.php
\ingroup telephonie
\brief Creation d'un nouveau client
- \version $Revision$
+ \version $Id$
*/
require("pre.inc.php");
-
-if (!$user->rights->telephonie->ligne->creer) accessforbidden();
-
+require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/contact.class.php');
require_once(DOL_DOCUMENT_ROOT.'/companybankaccount.class.php');
require_once(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
require_once(DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php");
+if (!$user->rights->telephonie->ligne->creer) accessforbidden();
+
$user->getrights('societe');
$langs->load("companies");
@@ -143,7 +139,7 @@ if ($_POST["action"] == 'add')
$verif = "nok";
}
- if (!check_mail(trim($contact->email)) && $verif == 'ok')
+ if (!CheckMailDomain(trim($contact->email)) && $verif == 'ok')
{
$mesg = "Email invalide (domaine invalide)";
$verif = "nok";
@@ -248,7 +244,7 @@ if ($_POST["action"] == 'add')
$verif = "nok";
$mesg .= "Tarif France Invalide : $temporel > 0.04 !";
}
-
+
if ($temporel < 0.016 )
{
$error = 1031;
@@ -396,7 +392,7 @@ if ($_POST["action"] == 'add')
if ( $ligne->create($user, $_POST["mode_paiement"]) == 0)
{
-
+
}
else
{
@@ -431,7 +427,7 @@ if ($_POST["action"] == 'add')
$ligne->concurrent = $_POST["concurrent"];
$ligne->remise = "0";
$ligne->note = $_POST["note"];
-
+
if ( $ligne->create($user, $_POST["mode_paiement"]) == 0)
{
@@ -469,7 +465,7 @@ if ($_POST["action"] == 'add')
if ( $ligne->create($user, $_POST["mode_paiement"]) == 0)
{
-
+
}
else
{
@@ -501,7 +497,7 @@ if ($_POST["action"] == 'add')
if ( $ligne->create($user, $_POST["mode_paiement"]) == 0)
{
-
+
}
else
{
@@ -562,25 +558,25 @@ if ($_POST["action"] == 'add')
if (!$error)
{
$db->begin();
-
+
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client";
$sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES ";
$sql .= " (".$mobil_id.",".$soc->id.",'".$temporel."','0',".$user->id.")";
-
+
if (! $db->query($sql) )
{
$error++;
}
-
+
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log";
$sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES ";
$sql .= " (".$mobil_id.",".$soc->id.",'".$temporel."','0',".$user->id.",now())";
-
+
if (! $db->query($sql) )
{
$error++;
}
-
+
if ( $error == 0 )
{
$db->commit();