diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 2f97465cc2b..8da35576186 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1838,7 +1838,7 @@ class Adherent extends CommonObject
// Possibility to add external linked objects with hooks
$invoice->linked_objects['subscription'] = $subscriptionid;
if (GETPOSTISARRAY('other_linked_objects')) {
- $invoice->linked_objects = array_merge($invoice->linked_objects, GETPOST('other_linked_objects'));
+ $invoice->linked_objects = array_merge($invoice->linked_objects, GETPOST('other_linked_objects', 'array:int'));
}
$result = $invoice->create($user);
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 5753ce0bc89..a6210efa27a 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -164,7 +164,7 @@ if (empty($reshook)) {
$idprod = $bom_child->fk_product;
}
} else {
- $idprod = (!empty(GETPOSTINT('idprodservice')) ? GETPOSTINT('idprodservice') : GETPOSTINT('idprod'));
+ $idprod = (GETPOSTINT('idprodservice') ? GETPOSTINT('idprodservice') : GETPOSTINT('idprod'));
}
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 8044e284b73..af70409a70a 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -552,9 +552,9 @@ if (empty($reshook)) {
$object->origin_id = $originid;
// Possibility to add external linked objects with hooks
- $object->linked_objects [$object->origin] = $object->origin_id;
- if (is_array($_POST['other_linked_objects']) && !empty($_POST['other_linked_objects'])) {
- $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
+ $object->linked_objects[$object->origin] = $object->origin_id;
+ if (GETPOSTISARRAY('other_linked_objects')) {
+ $object->linked_objects = array_merge($object->linked_objects, GETPOST('other_linked_objects', 'array:int'));
}
$id = $object->create($user);
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 82184b9ecb7..4795d238d6a 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -1798,7 +1798,8 @@ if ($resql) {
if ($objp->num_releve) {
print ' ';
}
- print 'rowid]) ? ' checked' : '').'>';
+ $tmparray = GETPOST('rowid', 'array:int');
+ print 'rowid]) ? ' checked' : '').'>';
}
}
print '';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 56fc5218598..f13654b0a31 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1547,8 +1547,8 @@ if (empty($reshook)) {
}
}
- if (is_array($_POST['other_linked_objects']) && !empty($_POST['other_linked_objects'])) {
- $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
+ if (GETPOSTISARRAY('other_linked_objects')) {
+ $object->linked_objects = array_merge($object->linked_objects, GETPOST('other_linked_objects', 'array:int'));
}
$id = $object->create($user); // This include class to add_object_linked() and add add_contact()
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 47f524aba73..23890c825c7 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -289,8 +289,8 @@ if (empty($reshook)) {
// Possibility to add external linked objects with hooks
$object->linked_objects[$object->origin] = $object->origin_id;
- if (is_array($_POST['other_linked_objects']) && !empty($_POST['other_linked_objects'])) {
- $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
+ if (GETPOSTISARRAY('other_linked_objects')) {
+ $object->linked_objects = array_merge($object->linked_objects, GETPOST('other_linked_objects', 'array:int'));
}
$id = $object->create($user);
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 2fca6e22a33..9ccbbc4e671 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -167,7 +167,7 @@ if (!$error && $massaction == 'confirm_presend') {
$receiver = array($receiver);
}
}
- if (!trim($_POST['sendto']) && count($receiver) == 0 && count($listofobjectthirdparties) == 1) { // if only one recipient, receiver is mandatory
+ if (!trim(GETPOST('sendto', 'alphawithlgt')) && count($receiver) == 0 && count($listofobjectthirdparties) == 1) { // if only one recipient, receiver is mandatory
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings');
$massaction = 'presend';
@@ -195,7 +195,7 @@ if (!$error && $massaction == 'confirm_presend') {
// Define $sendto
$tmparray = array();
- if (trim($_POST['sendto'])) {
+ if (trim(GETPOST('sendto', 'alphawithlgt'))) {
// Recipients are provided into free text
$tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
}
@@ -222,7 +222,7 @@ if (!$error && $massaction == 'confirm_presend') {
}
}
$tmparray = array();
- if (trim($_POST['sendtocc'])) {
+ if (trim(GETPOST('sendtocc', 'alphawithlgt'))) {
$tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
}
if (count($receivercc) > 0) {
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index 7c8efdb5a98..d3039b5ccaf 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -190,12 +190,12 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
}
$tmparray = array();
- if (trim($_POST['sendto'])) {
+ if (trim(GETPOST('sendto', 'alphawithlgt'))) {
// Recipients are provided into free text field
$tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
}
- if (isset($_POST['tomail']) && trim($_POST['tomail'])) {
+ if (trim(GETPOST('tomail', 'alphawithlgt'))) {
// Recipients are provided into free hidden text field
$tmparray[] = trim(GETPOST('tomail', 'alphawithlgt'));
}
@@ -238,7 +238,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
}
}
$tmparray = array();
- if (trim($_POST['sendtocc'])) {
+ if (trim(GETPOST('sendtocc', 'alphawithlgt'))) {
$tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
}
if (count($receivercc) > 0) {
diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php
index b861d7c3796..8d04732aea4 100644
--- a/htdocs/core/ajax/onlineSign.php
+++ b/htdocs/core/ajax/onlineSign.php
@@ -61,7 +61,7 @@ $signature = GETPOST('signaturebase64');
$ref = GETPOST('ref', 'aZ09');
$mode = GETPOST('mode', 'aZ09'); // 'proposal', ...
$SECUREKEY = GETPOST("securekey"); // Secure key
-$online_sign_name = GETPOST("onlinesignname") ? GETPOST("onlinesignname") : '';
+$online_sign_name = GETPOST("onlinesignname");
$error = 0;
$response = "";
diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php
index 6b337a88c68..47fd89b1659 100644
--- a/htdocs/core/ajax/saveinplace.php
+++ b/htdocs/core/ajax/saveinplace.php
@@ -127,7 +127,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e
$newelement = $element;
}
- $_POST['action'] = 'update'; // Hack so restrictarea will test permissions on write too
+ $_POST['action'] = 'update'; // Keep this. It is a hack so restrictarea will test permissions on write too
$feature = $newelement;
$feature2 = $subelement;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 9f93e22fcda..d74538f288d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5636,7 +5636,7 @@ abstract class CommonObject
* Common function for all objects extending CommonObject for generating documents
*
* @param string $modelspath Relative folder where generators are placed
- * @param string $modele Generator to use. Caller must set it to obj->model_pdf or $_POST for example.
+ * @param string $modele Generator to use. Caller must set it to from obj->model_pdf or from GETPOST for example.
* @param Translate $outputlangs Output language to use
* @param int $hidedetails 1 to hide details. 0 by default
* @param int $hidedesc 1 to hide product description. 0 by default
@@ -6016,8 +6016,6 @@ abstract class CommonObject
**/
public function getDefaultCreateValueFor($fieldname, $alternatevalue = null, $type = 'alphanohtml')
{
- global $_POST;
-
// If param here has been posted, we use this value first.
if (GETPOSTISSET($fieldname)) {
return GETPOST($fieldname, $type, 3);
@@ -6176,8 +6174,6 @@ abstract class CommonObject
*/
public function setValuesForExtraLanguages($onlykey = '')
{
- global $_POST, $langs;
-
// Get extra fields
foreach ($_POST as $postfieldkey => $postfieldvalue) {
$tmparray = explode('-', $postfieldkey);
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 8e5befafd0a..7cfc5187d49 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -2129,7 +2129,7 @@ class ExtraFields
*/
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $todefaultifmissing = 0)
{
- global $conf, $_POST, $langs;
+ global $langs;
$nofillrequired = 0; // For error when required field left blank
$error_field_required = array();
diff --git a/htdocs/core/login/functions_googleoauth.php b/htdocs/core/login/functions_googleoauth.php
index 9a60b159586..0e61541192c 100644
--- a/htdocs/core/login/functions_googleoauth.php
+++ b/htdocs/core/login/functions_googleoauth.php
@@ -39,7 +39,7 @@
*/
function check_user_password_googleoauth($usertotest, $passwordtotest, $entitytotest)
{
- global $_POST, $conf;
+ global $conf;
dol_syslog("functions_googleoauth::check_user_password_googleoauth usertotest=".$usertotest." GETPOST('actionlogin')=".GETPOST('actionlogin'));
diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php
index fde4d4128f9..89c910b8cf2 100644
--- a/htdocs/core/login/functions_ldap.php
+++ b/htdocs/core/login/functions_ldap.php
@@ -37,7 +37,6 @@
function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
{
global $db, $conf, $langs;
- global $_POST;
global $dolibarr_main_auth_ldap_host, $dolibarr_main_auth_ldap_port;
global $dolibarr_main_auth_ldap_version, $dolibarr_main_auth_ldap_servertype;
global $dolibarr_main_auth_ldap_login_attribute, $dolibarr_main_auth_ldap_dn;
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index 1547ce1d866..6007b7adb95 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -233,7 +233,7 @@ class mailing_fraise extends MailingTargets
public function add_to_target($mailing_id)
{
// phpcs:enable
- global $conf, $langs, $_POST;
+ global $conf, $langs;
// Load translation files required by the page
$langs->loadLangs(array("members", "companies"));
diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php
index 2fc4a4a4b09..4f38e884481 100644
--- a/htdocs/core/modules/oauth/google_oauthcallback.php
+++ b/htdocs/core/modules/oauth/google_oauthcallback.php
@@ -161,22 +161,8 @@ if (!GETPOST('code')) {
$_SESSION['oauthstateanticsrf'] = $state;
// Save more data into session
- // Not required. All data are saved into $_SESSION['datafromloginform'] when form is posted with a click on Login with
- // Google with param actionlogin=login and beforeoauthloginredirect=google, by the functions_googleoauth.php.
- /*
- if (!empty($_POST["tz"])) {
- $_SESSION["tz"] = $_POST["tz"];
- }
- if (!empty($_POST["tz_string"])) {
- $_SESSION["tz_string"] = $_POST["tz_string"];
- }
- if (!empty($_POST["dst_first"])) {
- $_SESSION["dst_first"] = $_POST["dst_first"];
- }
- if (!empty($_POST["dst_second"])) {
- $_SESSION["dst_second"] = $_POST["dst_second"];
- }
- */
+ // No need to save more data in sessions. We have several info into $_SESSION['datafromloginform'], saved when form is posted with a click
+ // on "Login with Google" with param actionlogin=login and beforeoauthloginredirect=google, by the functions_googleoauth.php.
if ($forlogin) {
$apiService->setApprouvalPrompt('force');
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 416dd3959e0..199d54e3e50 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -404,7 +404,6 @@ if ($action == 'confirm_resize' && GETPOSTISSET("file") && GETPOSTISSET("sizex")
}
} else {
setEventMessages($result, null, 'errors');
- //$_GET['file'] = $_POST["file"];
$action = '';
}
}
@@ -467,7 +466,6 @@ if ($action == 'confirm_crop') {
}
} else {
setEventMessages($result, null, 'errors');
- //$_GET['file'] = $_POST["file"];
$action = '';
}
}
diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php
index 7acbddd72fa..0e75907dcba 100644
--- a/htdocs/core/tpl/filemanager.tpl.php
+++ b/htdocs/core/tpl/filemanager.tpl.php
@@ -316,7 +316,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
$_POST['modulepart'] = $module;
$_POST['openeddir'] = GETPOST('openeddir');
- $_POST['dir'] = empty($_POST['dir']) ? '/' : $_POST['dir'];
+ $_POST['dir'] = empty($_POST['dir']) ? '/' : GETPOST('dir');
// Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show)
print '
';
diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php
index 634264c83cf..67aaa624510 100644
--- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php
+++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php
@@ -109,7 +109,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') {
$receiver = array($receiver);
}
}
- if (!trim($_POST['sendto']) && count($receiver) == 0 && count($listofselectedid) == 0) { // if only one recipient, receiver is mandatory
+ if (!trim(GETPOST('sendto', 'alphawithlgt')) && count($receiver) == 0 && count($listofselectedid) == 0) { // if only one recipient, receiver is mandatory
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings');
$massaction = 'presend_attendees';
@@ -142,7 +142,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') {
}
}
$tmparray = array();
- if (trim($_POST['sendtocc'])) {
+ if (trim(GETPOST('sendtocc', 'alphawithlgt'))) {
$tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
}
$sendtocc = implode(',', $tmparray);
diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php
index 90439554f76..dac7cee794c 100644
--- a/htdocs/exports/export.php
+++ b/htdocs/exports/export.php
@@ -400,7 +400,6 @@ if ($step == 4 && $action == 'submitFormField') {
$filterqualified = 0;
}
if ($filterqualified) {
- //print 'Filter on '.$newcode.' type='.$type.' value='.$_POST[$newcode]."\n";
$objexport->array_export_FilterValue[0][$code] = GETPOST($newcode, $check);
}
}
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 507affb5fab..0091dd56dfe 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -293,8 +293,8 @@ if (empty($reshook)) {
// Possibility to add external linked objects with hooks
$object->linked_objects[$object->origin] = $object->origin_id;
- if (is_array($_POST['other_linked_objects']) && !empty($_POST['other_linked_objects'])) {
- $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
+ if (GETPOSTISARRAY('other_linked_objects')) {
+ $object->linked_objects = array_merge($object->linked_objects, GETPOST('other_linked_objects', 'array:int'));
}
// Extrafields
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 9b1c7d93518..c25d8afbdd6 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1420,7 +1420,6 @@ if (empty($reshook)) {
$langs->load("errors");
$db->rollback();
$action = 'create';
- //$_GET['socid'] = $_POST['socid'];
} else {
$db->commit();
header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode((string) ($id)));
diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php
index 10dd9fd4e45..f7b0db9ae7f 100644
--- a/htdocs/fourn/facture/card-rec.php
+++ b/htdocs/fourn/facture/card-rec.php
@@ -527,7 +527,7 @@ if (empty($reshook)) {
// Define special_code for special lines
$special_code = 0;
- // if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices
+ // if (!GETPOST('qty')) $special_code=3; // Options should not exists on invoices
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 5a1f7684755..bf8f1cca1ec 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -327,15 +327,15 @@ require_once 'filefunc.inc.php';
// If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it.
// This is used for example by form of boxes to save personalization of some options.
// DOL_AUTOSET_COOKIE=cookiename:val1,val2 and cookiename_val1=aaa cookiename_val2=bbb will set cookie_name with value json_encode(array('val1'=> , ))
-if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
- $tmpautoset = explode(':', $_POST["DOL_AUTOSET_COOKIE"], 2);
+if (GETPOST("DOL_AUTOSET_COOKIE")) {
+ $tmpautoset = explode(':', GETPOST("DOL_AUTOSET_COOKIE"), 2);
$tmplist = explode(',', $tmpautoset[1]);
$cookiearrayvalue = array();
foreach ($tmplist as $tmpkey) {
$postkey = $tmpautoset[0].'_'.$tmpkey;
- //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
- if (!empty($_POST[$postkey])) {
- $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
+ //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.GETPOST($postkey);
+ if (GETPOST($postkey)) {
+ $cookiearrayvalue[$tmpkey] = GETPOST($postkey);
}
}
$cookiename = $tmpautoset[0];
@@ -764,7 +764,6 @@ if (!defined('NOLOGIN')) {
$dol_optimize_smallscreen = GETPOSTINT('dol_optimize_smallscreen', 3);
$dol_no_mouse_hover = GETPOSTINT('dol_no_mouse_hover', 3);
$dol_use_jmobile = GETPOSTINT('dol_use_jmobile', 3); // 0=default, 1=to say we use app from a webview app, 2=to say we use app from a webview app and keep ajax
- //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,','));
// If in demo mode, we check we go to home page through the public/demo/index.php page
if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_URL_ROOT.'/index.php') { // We ask index page
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 1cee92393c0..f2261034547 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -2941,7 +2941,7 @@ if ($dirins && $action == "update_menu" && GETPOSTINT('menukey') && GETPOST('tab
}
}
} else {
- $_POST['type'] = '';
+ $_POST['type'] = ''; // TODO Use a var here and later
$_POST['titre'] = '';
$_POST['fk_menu'] = '';
$_POST['leftmenu'] = '';
diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php
index 5070ae77e0a..3b9d04b0e38 100644
--- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php
+++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php
@@ -108,7 +108,7 @@ class ActionsMyModule extends CommonHookActions
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
// Do what you want here...
- // You can for example call global vars like $fieldstosearchall to overwrite them, or update database depending on $action and $_POST values.
+ // You can for example load and use call global vars like $fieldstosearchall to overwrite them, or update database depending on $action and GETPOST values.
}
if (!$error) {
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index f006c4933ab..62cfd250fdd 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -282,8 +282,6 @@ if ($action == 'create') {
print dol_get_fiche_head(array(), '');
- // Set some default values
- //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '
'."\n";
diff --git a/htdocs/opensurvey/lib/opensurvey.lib.php b/htdocs/opensurvey/lib/opensurvey.lib.php
index 141f01ab5af..80e272eaf90 100644
--- a/htdocs/opensurvey/lib/opensurvey.lib.php
+++ b/htdocs/opensurvey/lib/opensurvey.lib.php
@@ -175,9 +175,9 @@ function get_server_name()
/**
* Fonction vérifiant l'existance et la valeur non vide d'une clé d'un tableau
*
- * @param string $name La clé à tester
- * @param array $tableau Le tableau où rechercher la clé ($_POST par défaut)
- * @return bool Vrai si la clé existe et renvoie une valeur non vide
+ * @param string $name Key to test
+ * @param array $tableau Array in which searching key ($_POST by default)
+ * @return bool True if key exists and return a non empty value
*/
function issetAndNoEmpty($name, $tableau = null)
{
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 0aab3be055c..a70a9a08faf 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -412,7 +412,7 @@ if (empty($reshook)) {
}
} else {
// Clear var
- $_POST['batch'] = '';
+ $_POST['batch'] = ''; // TODO Replace this with a var
$_POST['qtytoadd'] = '';
}
}
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
index 7521fb2ef3b..96b228fba9e 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
@@ -439,8 +439,6 @@ if ($action == 'create') {
print dol_get_fiche_head(array(), '');
- // Set some default values
- //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '
'."\n";
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php
index 33d2ff92f04..8f599eb71de 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php
@@ -78,7 +78,7 @@ $result = restrictedArea($user, 'stocktransfer', $id, '', 'stocktransfer');
if ($action == 'addcontact' && $user->hasRight('stocktransfer', 'stocktransfer', 'write')) {
if ($object->id > 0) {
$contactid = (GETPOSTINT('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
- $result = $object->add_contact($contactid, !empty($_POST["typecontact"]) ? $_POST["typecontact"] : $_POST["type"], $_POST["source"]);
+ $result = $object->add_contact($contactid, GETPOST("typecontact") ? GETPOST("typecontact") : GETPOST("type"), GETPOST("source"));
}
if ($result >= 0) {
@@ -106,12 +106,6 @@ if ($action == 'addcontact' && $user->hasRight('stocktransfer', 'stocktransfer',
dol_print_error($db);
}
}
-/*
-elseif ($action == 'setaddress' && $user->rights->stocktransfer->stocktransfer->write)
-{
- $result=$object->setDeliveryAddress($_POST['fk_address']);
- if ($result < 0) dol_print_error($db,$object->error);
-}*/
/*
diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php
index b4d6f415b33..0aa90ef50ec 100644
--- a/htdocs/public/agenda/agendaexport.php
+++ b/htdocs/public/agenda/agendaexport.php
@@ -74,6 +74,7 @@ function llxFooterVierge()
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// Because 2 entities can have the same ref
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
diff --git a/htdocs/public/company/new.php b/htdocs/public/company/new.php
index 0d26ad7ad9d..b6e84d2437b 100644
--- a/htdocs/public/company/new.php
+++ b/htdocs/public/company/new.php
@@ -44,6 +44,7 @@ if (!defined('NOBROWSERNOTIF')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// Because 2 entities can have the same ref
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
@@ -203,7 +204,7 @@ if (empty($reshook) && $action == 'add') {
// Check Captcha code if is enabled
if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) {
$sessionkey = 'dol_antispam_value';
- $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
+ $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code'))));
if (!$ok) {
$error++;
$errmsg .= $langs->trans("ErrorBadValueForCode") . " \n";
diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php
index ca3c8c06235..1ebf7b26347 100644
--- a/htdocs/public/cron/cron_run_jobs_by_url.php
+++ b/htdocs/public/cron/cron_run_jobs_by_url.php
@@ -50,6 +50,7 @@ if (!defined('USESUFFIXINLOG')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// Because 2 entities can have the same ref
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php
index bb3b23a3626..ac3f67baa9d 100644
--- a/htdocs/public/eventorganization/attendee_new.php
+++ b/htdocs/public/eventorganization/attendee_new.php
@@ -42,7 +42,7 @@ if (!defined('NOIPCHECK')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
-// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
+// Because 2 entities can have the same ref
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index 6f4525031ea..8fc8e514578 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -264,7 +264,7 @@ if (empty($reshook) && $action == 'add') {
// Check Captcha code if is enabled
if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) {
$sessionkey = 'dol_antispam_value';
- $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
+ $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code'))));
if (!$ok) {
$error++;
$errmsg .= $langs->trans("ErrorBadValueForCode")." \n";
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 79623a7d393..6723ca7c97f 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -390,7 +390,6 @@ if ($action == 'dopayment') {
$action = '';
}
- //var_dump($_POST);
if (empty($mesg)) {
dol_syslog("newpayment.php call paypal api and do redirect", LOG_DEBUG);
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index 0d5e20a7049..c3846425458 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -358,8 +358,8 @@ if (empty($reshook)) {
// Possibility to add external linked objects with hooks
$object->linked_objects [$object->origin] = $object->origin_id;
- if (is_array($_POST['other_linked_objects']) && !empty($_POST['other_linked_objects'])) {
- $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
+ if (GETPOSTISARRAY('other_linked_objects')) {
+ $object->linked_objects = array_merge($object->linked_objects, GETPOST('other_linked_objects', 'array:int'));
}
$id = $object->create($user);
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index 6daec2a1569..2ebe4c8e9a4 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -101,7 +101,9 @@ if (!$needlogin) {
}
}
-// For multicompany
+// For MultiCompany module.
+// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// Because 2 entities can have the same ref.
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php
index f12b7ee8869..5709df943f3 100644
--- a/htdocs/webhook/target_card.php
+++ b/htdocs/webhook/target_card.php
@@ -213,8 +213,6 @@ if ($action == 'create') {
print dol_get_fiche_head(array(), '');
- // Set some default values
- //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '