diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php
index b7a69dddd26..783d6916c7b 100644
--- a/htdocs/admin/const.php
+++ b/htdocs/admin/const.php
@@ -30,10 +30,16 @@ $langs->load("admin");
if (! $user->admin) accessforbidden();
-$action = GETPOST('action');
-$debug = GETPOST('debug');
+$rowid=GETPOST('rowid','int');
+$entity=GETPOST('entity','int');
+$action=GETPOST('action');
+$update=GETPOST('update');
+$delete=GETPOST('delete');
+$debug=GETPOST('debug');
+$consts=GETPOST('const');
$typeconst=array('yesno','texte','chaine');
+$mesg='';
/*
@@ -64,9 +70,9 @@ if ($action == 'add')
}
}
-if (($_POST["const"] && isset($_POST["update"]) && $_POST["update"] == $langs->trans("Modify")))
+if (! empty($consts) && $update == $langs->trans("Modify"))
{
- foreach($_POST["const"] as $const)
+ foreach($consts as $const)
{
if ($const["check"])
{
@@ -79,9 +85,9 @@ if (($_POST["const"] && isset($_POST["update"]) && $_POST["update"] == $langs->t
}
// Delete several lines at once
-if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("Delete"))
+if (! empty($consts) && $delete == $langs->trans("Delete"))
{
- foreach($_POST["const"] as $const)
+ foreach($consts as $const)
{
if ($const["check"]) // Is checkbox checked
{
@@ -96,7 +102,7 @@ if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("De
// Delete line from delete picto
if ($action == 'delete')
{
- if (dolibarr_del_const($db, $_GET["rowid"], $_GET["entity"]) < 0)
+ if (dolibarr_del_const($db, $rowid, $entity) < 0)
{
dol_print_error($db);
}
@@ -136,7 +142,7 @@ print_fiche_titre($langs->trans("OtherSetup"),'','setup');
print $langs->trans("ConstDesc")." \n";
print " \n";
-if ($mesg) print $mesg;
+dol_htmloutput_mesg($mesg);
print '
';
print '
';
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 71ec16150b6..13864a37183 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville
* Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2004 Benoit Mortier
- * Copyright (C) 2005-2010 Regis Houssin
+ * Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2011 Philippe Grand
* Copyright (C) 2011 Remy Younes
@@ -279,24 +279,24 @@ $tabcond[1] = true;
$tabcond[2] = true;
$tabcond[3] = true;
$tabcond[4] = true;
-$tabcond[5] = $conf->societe->enabled||$conf->adherent->enabled;
-$tabcond[6] = $conf->agenda->enabled;
-$tabcond[7] = $conf->tax->enabled;
-$tabcond[8] = $conf->societe->enabled;
+$tabcond[5] = (! empty($conf->societe->enabled) || ! empty($conf->adherent->enabled));
+$tabcond[6] = ! empty($conf->agenda->enabled);
+$tabcond[7] = ! empty($conf->tax->enabled);
+$tabcond[8] = ! empty($conf->societe->enabled);
$tabcond[9] = true;
$tabcond[10]= true;
$tabcond[11]= true;
-$tabcond[12]= $conf->commande->enabled||$conf->propal->enabled||$conf->facture->enabled||$conf->fournisseur->enabled;
-$tabcond[13]= $conf->commande->enabled||$conf->propal->enabled||$conf->facture->enabled||$conf->fournisseur->enabled;
-$tabcond[14]= $conf->product->enabled&&$conf->ecotax->enabled;
+$tabcond[12]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
+$tabcond[13]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
+$tabcond[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled));
$tabcond[15]= true;
-$tabcond[16]= $conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS);
-$tabcond[17]= $conf->deplacement->enabled;
-$tabcond[18]= $conf->expedition->enabled;
-$tabcond[19]= $conf->societe->enabled;
-$tabcond[20]= $conf->fournisseur->enabled;
-$tabcond[21]= $conf->propal->enabled;
-$tabcond[22]= $conf->commande->enabled||$conf->propal->enabled;
+$tabcond[16]= (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
+$tabcond[17]= ! empty($conf->deplacement->enabled);
+$tabcond[18]= ! empty($conf->expedition->enabled);
+$tabcond[19]= ! empty($conf->societe->enabled);
+$tabcond[20]= ! empty($conf->fournisseur->enabled);
+$tabcond[21]= ! empty($conf->propal->enabled);
+$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
// List of help for fields
$tabhelp=array();
@@ -347,7 +347,7 @@ if ($id == 11)
"facture"=>$langs->trans("Bill"),
"facture_fourn"=>$langs->trans("SupplierBill"),
"fichinter"=>$langs->trans("InterventionCard"));
- if ($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES) $elementList["societe"]=$langs->trans("ThirdParty");
+ if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"]=$langs->trans("ThirdParty");
$sourceList = array("internal"=>$langs->trans("Internal"),
"external"=>$langs->trans("External"));
}
@@ -356,7 +356,7 @@ $msg='';
// Actions ajout ou modification d'une entree dans un dictionnaire de donnee
-if ($_POST["actionadd"] || $_POST["actionmodify"])
+if (GETPOST('actionadd') || GETPOST('actionmodify'))
{
$listfield=explode(',',$tabfield[$id]);
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
@@ -401,7 +401,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
}
// Si verif ok et action add, on ajoute la ligne
- if ($ok && $_POST["actionadd"])
+ if ($ok && GETPOST('actionadd'))
{
if ($tabrowid[$id])
{
@@ -466,7 +466,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
}
// Si verif ok et action modify, on modifie la ligne
- if ($ok && $_POST["actionmodify"])
+ if ($ok && GETPOST('actionmodify'))
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
@@ -509,7 +509,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition
}
-if ($_POST["actioncancel"])
+if (GETPOST('actioncancel'))
{
$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition
}
@@ -619,7 +619,7 @@ if ($id)
// Complete requete recherche valeurs avec critere de tri
$sql=$tabsql[$id];
- if ($_GET["sortfield"])
+ if (GETPOST('sortfield'))
{
// If sort order is "pays", we use pays_code instead
if ($_GET["sortfield"] == 'pays') $_GET["sortfield"]='pays_code';
@@ -687,7 +687,7 @@ if ($id)
if ($valuetoshow != '')
{
print '
';
- if (preg_match('/http:/i',$tabhelp[$id][$value])) print ''.$valuetoshow.'';
+ if (! empty($tabhelp[$id][$value]) && preg_match('/http:/i',$tabhelp[$id][$value])) print ''.$valuetoshow.'';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else print $valuetoshow;
print '
';
@@ -704,7 +704,7 @@ if ($id)
$obj='';
// If data was already input, we define them in obj to populate input fields.
- if ($_POST["actionadd"])
+ if (GETPOST('actionadd'))
{
foreach ($fieldlist as $key=>$val)
{
@@ -795,7 +795,7 @@ if ($id)
//print_r($obj);
print "
';
llxFooter();
+$db->close();
?>
\ No newline at end of file
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index b31d36406f5..55d7628ab19 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2005-2011 Regis Houssin
+ * Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2010-2011 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
@@ -245,7 +245,7 @@ class FormMail
$out.= '
'."\n";
// Substitution array
- if ($this->withsubstit)
+ if (! empty($this->withsubstit))
{
$out.= '
';
$help="";
@@ -258,9 +258,9 @@ class FormMail
}
// From
- if ($this->withfrom)
+ if (! empty($this->withfrom))
{
- if ($this->withfromreadonly)
+ if (! empty($this->withfromreadonly))
{
$out.= '';
$out.= '';
@@ -302,7 +302,7 @@ class FormMail
}
// Replyto
- if ($this->withreplyto)
+ if (! empty($this->withreplyto))
{
if ($this->withreplytoreadonly)
{
@@ -314,7 +314,7 @@ class FormMail
}
// Errorsto
- if ($this->witherrorsto)
+ if (! empty($this->witherrorsto))
{
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
$errorstomail = (! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail);
@@ -334,7 +334,7 @@ class FormMail
}
// To
- if ($this->withto || is_array($this->withto))
+ if (! empty($this->withto) || is_array($this->withto))
{
$out.= '
';
if ($this->withtofree) $out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
@@ -375,16 +375,16 @@ class FormMail
}
else
{
- if ($this->withtofree)
+ if (! empty($this->withtofree))
{
$out.= 'withto) :"").'" />';
}
- if (is_array($this->withto))
+ if (! empty($this->withto) && is_array($this->withto))
{
- if ($this->withtofree) $out.= " ".$langs->trans("or")." ";
+ if (! empty($this->withtofree)) $out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1);
}
- if ($this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
+ if (isset($this->withtosocid) && $this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
{
$liste=array();
$soc=new Societe($this->db);
@@ -401,7 +401,7 @@ class FormMail
}
// CC
- if ($this->withtocc || is_array($this->withtocc))
+ if (! empty($this->withtocc) || is_array($this->withtocc))
{
$out.= '
';
$out.= $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
@@ -413,12 +413,12 @@ class FormMail
else
{
$out.= 'withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
- if (is_array($this->withto))
+ if (! empty($this->withto) && is_array($this->withto))
{
$out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1);
}
- if ($this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
+ if (! empty($this->withtoccsocid) && $this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
{
$liste=array();
$soc=new Societe($this->db);
@@ -435,24 +435,24 @@ class FormMail
}
// CCC
- if ($this->withtoccc || is_array($this->withtoccc))
+ if (! empty($this->withtoccc) || is_array($this->withtoccc))
{
$out.= '