diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index fcd7199137c..e2749c5e183 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -653,7 +653,7 @@ class FormMail extends Form
$out .= ' <'.$this->tomail.'>';
if ($this->withtofree)
{
- $out .= '
'.$langs->trans("and").' withto) : "").'" />';
+ $out .= '
'.$langs->trans("and").' withto) : "").'" />';
}
} else {
// Note withto may be a text like 'AllRecipientSelected'
@@ -663,7 +663,7 @@ class FormMail extends Form
// The free input of email
if (!empty($this->withtofree))
{
- $out .= 'withto) : "")).'" />';
+ $out .= 'withto) : "")).'" />';
}
// The select combo
if (!empty($this->withto) && is_array($this->withto))
@@ -675,7 +675,9 @@ class FormMail extends Form
{
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoselected = GETPOST("receiver", 'restricthtml'); // Array of selected value
+
+ $withtoselected = GETPOST("receiver", 'array'); // Array of selected value
+
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
@@ -699,7 +701,7 @@ class FormMail extends Form
{
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoselected = GETPOST("receiveruser", 'restricthtml'); // Array of selected value
+ $withtoselected = GETPOST("receiveruser", 'array'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
@@ -743,7 +745,7 @@ class FormMail extends Form
{
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoccselected = GETPOST("receivercc"); // Array of selected value
+ $withtoccselected = GETPOST("receivercc", 'array'); // Array of selected value
$out .= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, null, null, 'inline-block minwidth500', null, "");
}
}
@@ -763,7 +765,7 @@ class FormMail extends Form
{
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoselected = GETPOST("receiverccuser", 'restricthtml'); // Array of selected value
+ $withtoselected = GETPOST("receiverccuser", 'array'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
@@ -1060,7 +1062,7 @@ class FormMail extends Form
if (!empty($this->withtocccreadonly)) {
$out .= (!is_array($this->withtoccc) && !is_numeric($this->withtoccc)) ? $this->withtoccc : "";
} else {
- $out .= 'withtoccc) && !is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
+ $out .= 'withtoccc) && !is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
if (!empty($this->withtoccc) && is_array($this->withtoccc)) {
$out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
@@ -1068,7 +1070,7 @@ class FormMail extends Form
foreach ($tmparray as $key => $val) {
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtocccselected = GETPOST("receiverccc"); // Array of selected value
+ $withtocccselected = GETPOST("receiverccc", 'array'); // Array of selected value
$out .= $form->multiselectarray("receiverccc", $tmparray, $withtocccselected, null, null, null, null, "90%");
}
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index f34f2997af2..4fe156b249b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -545,12 +545,18 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
}
// Check rule
- if ($check == 'array') {
+ if (preg_match('/^array/', $check)) { // If 'array' or 'array:restricthtml' or 'array:aZ09'
if (!is_array($out) || empty($out)) {
$out = array();
} else {
+ $tmparray = explode(':', $check);
+ if (!empty($tmparray[1])) {
+ $tmpcheck = $tmparray[1];
+ } else {
+ $tmpcheck = 'alphanohtml';
+ }
foreach ($out as $outkey => $outval) {
- $out[$outkey] = checkVal($outval, 'alphanohtml', $filter, $options);
+ $out[$outkey] = checkVal($outval, $tmpcheck, $filter, $options);
}
}
}