diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 2bd2a84841e..6d621a7e101 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -187,7 +187,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; }*/ } - if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2)) + if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { $ok = 0; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index cd17e5a1538..d1cee5ff59d 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -247,7 +247,7 @@ if ($action == 'create') { // Chart of accounts type print ''.$langs->trans("Pcgtype").''; print ''; - print ''; + print ''; print ''; print ''; @@ -309,7 +309,7 @@ if ($action == 'create') { // Chart of accounts type print ''.$langs->trans("Pcgtype").''; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 2e51d3d1b38..53dfb1cd5f9 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -168,7 +168,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } } - if (isset($_POST["code"])) + if (GETPOSTISSET("code")) { if ($_POST["code"] == '0') { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 097eb38b47f..418dcc18f73 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -108,7 +108,7 @@ $hookmanager->initHooks(array('bookkeepinglist')); $formaccounting = new FormAccounting($db); $form = new Form($db); -if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) +if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values')) { diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index edd553b0d1b..4a26b8ddb5e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -382,14 +382,12 @@ if (empty($reshook)) { if ($action == 'add' && $user->rights->adherent->creer) { if ($canvas) $object->canvas = $canvas; $birthdate = ''; - if (isset($_POST["birthday"]) && $_POST["birthday"] - && isset($_POST["birthmonth"]) && $_POST["birthmonth"] - && isset($_POST["birthyear"]) && $_POST["birthyear"]) { - $birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + if (GETPOSTISSET("birthday") && GETPOST("birthday") && GETPOSTISSET("birthmonth") && GETPOST("birthmonth") && GETPOSTISSET("birthyear") && GETPOST("birthyear")) { + $birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int')); } $datesubscription = ''; - if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) { - $datesubscription = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) { + $datesubscription = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", "int"), GETPOST("reyear", "int")); } $typeid = GETPOST("typeid", 'int'); @@ -1075,7 +1073,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Password").'pass).'">'; + print ''.$langs->trans("Password").'pass).'">'; } // Morphy $morphys["phy"] = $langs->trans("Physical"); @@ -1134,7 +1132,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // EMail print ''.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').''; - print ''.img_picto('', 'object_email').' email).'">'; + print ''.img_picto('', 'object_email').' email).'">'; // Address print ''.$langs->trans("Address").''; @@ -1151,14 +1149,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Country //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined print ''.$langs->trans('Country').''; - print $form->select_country(isset($_POST["country_id"]) ? $_POST["country_id"] : $object->country_id, 'country_id'); + print $form->select_country(GETPOSTISSET("country_id") ? GETPOST("country_id", "alpha") : $object->country_id, 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; // State if (empty($conf->global->MEMBER_DISABLE_STATE)) { print ''.$langs->trans('State').''; - print $formcompany->select_state($object->state_id, isset($_POST["country_id"]) ?GETPOST("country_id") : $object->country_id); + print $formcompany->select_state($object->state_id, GETPOSTISSET("country_id") ? GETPOST("country_id", "alpha") : $object->country_id); print ''; } diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 19450905c23..4fc1ad28da7 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -54,19 +54,18 @@ if ($action == 'addconst') if ($action == 'add') { $error = 0; + $boxids = GETPOST('boxid', 'array'); + $db->begin(); - if (isset($_POST['boxid']) && is_array($_POST['boxid'])) - { - foreach ($_POST['boxid'] as $boxid) - { + if (is_array($boxids)) { + foreach ($boxids as $boxid) { if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) // 0=Home, 1=... { $pos = $boxid['pos']; // Initialize distinct fk_user with all already existing values of fk_user (user that use a personalized view of boxes for page "pos") $distinctfkuser = array(); - if (!$error) - { + if (!$error) { $sql = "SELECT fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."user_param"; $sql .= " WHERE param = 'MAIN_BOXES_".$db->escape($pos)."' AND value = '1'"; @@ -146,7 +145,7 @@ if ($action == 'add') { if ($action == 'delete') { $sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes"; - $sql .= " WHERE rowid=".$rowid; + $sql .= " WHERE rowid=".((int) $rowid); $resql = $db->query($sql); $obj = $db->fetch_object($resql); diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 5ff7f022ba4..d605f75c511 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -188,7 +188,7 @@ if ($action == 'update') if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; // Update values for ($i = 0; $i < 4; $i++) { - if (isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); } } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index a185071c227..3048625cd5f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -690,7 +690,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($value == 'formula' && empty($_POST['formula'])) continue; if ($value == 'dayrule' && empty($_POST['dayrule'])) continue; if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position' - if ((!isset($_POST[$value]) || $_POST[$value] == '') + if ((!GETPOSTISSET($value) || GETPOST($value) == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory && (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 ) @@ -719,7 +719,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } } // Other checks - if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system', 'systemauto'))) { + if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { $ok = 0; setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); } @@ -757,7 +757,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - if ($id == 10 && isset($_POST["code"])) // Spaces are not allowed into code + if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code { $_POST["code"] = preg_replace('/\s/', '', $_POST["code"]); } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index a89480314a6..e8b2b7bdc10 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -856,8 +856,8 @@ if ($action == 'edit') include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); - $formmail->fromname = (isset($_POST['fromname']) ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->frommail = (isset($_POST['frommail']) ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->fromname = (GETPOSTISSET('fromname') ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->frommail = (GETPOSTISSET('frommail') ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->fromid = $user->id; $formmail->fromalsorobot = 1; $formmail->fromtype = (GETPOSTISSET('fromtype') ?GETPOST('fromtype', 'aZ09') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); @@ -865,13 +865,13 @@ if ($action == 'edit') $formmail->withsubstit = 1; $formmail->withfrom = 1; $formmail->witherrorsto = 1; - $formmail->withto = (!empty($_POST['sendto']) ? $_POST['sendto'] : ($user->email ? $user->email : 1)); - $formmail->withtocc = (!empty($_POST['sendtocc']) ? $_POST['sendtocc'] : 1); // ! empty to keep field if empty - $formmail->withtoccc = (!empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1); // ! empty to keep field if empty - $formmail->withtopic = (isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test")); + $formmail->withto = (!empty($_POST['sendto']) ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1)); + $formmail->withtocc = (!empty($_POST['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withtoccc = (!empty($_POST['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test")); $formmail->withtopicreadonly = 0; $formmail->withfile = 2; - $formmail->withbody = (isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"))); + $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"))); $formmail->withbodyreadonly = 0; $formmail->withcancel = 1; $formmail->withdeliveryreceipt = 1; diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index faa72f4fc7c..84cc97d86d4 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -564,20 +564,20 @@ if ($action == 'edit') // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - $formmail->fromname = (isset($_POST['fromname']) ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->frommail = (isset($_POST['frommail']) ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); $formmail->withfromreadonly = 0; $formmail->withsubstit = 0; $formmail->withfrom = 1; $formmail->witherrorsto = 1; - $formmail->withto = (!empty($_POST['sendto']) ? $_POST['sendto'] : ($user->email ? $user->email : 1)); - $formmail->withtocc = (!empty($_POST['sendtocc']) ? $_POST['sendtocc'] : 1); // ! empty to keep field if empty - $formmail->withtoccc = (!empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1); // ! empty to keep field if empty - $formmail->withtopic = (isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test")); + $formmail->withto = (!GETPOST('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1)); + $formmail->withtocc = (!GETPOST(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withtoccc = (!GETPOST(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test")); $formmail->withtopicreadonly = 0; $formmail->withfile = 2; - $formmail->withbody = (isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"))); + $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"))); $formmail->withbodyreadonly = 0; $formmail->withcancel = 1; $formmail->withdeliveryreceipt = 1; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 872c0d414eb..de98c42b35a 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -271,7 +271,7 @@ if (empty($reshook)) { // Rename some POST variables into a generic name if (GETPOST('actionmodify', 'alpha') && $value == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid]; - if ((!isset($_POST[$value]) || $_POST[$value] == '' || $_POST[$value] == '-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') + if ((!GETPOSTISSET($value) || GETPOST($value) == '' || GETPOST($value) == '-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') { $ok = 0; $fieldnamekey = $listfield[$f]; diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 49dc61a270a..1e1c3db3fad 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -530,20 +530,20 @@ if ($action == 'edit') // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - $formmail->fromname = (isset($_POST['fromname']) ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->frommail = (isset($_POST['frommail']) ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->fromname = (GETPOSTISSET('fromname') ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->frommail = (GETPOSTISSET('frommail') ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); $formmail->withfromreadonly = 0; $formmail->withsubstit = 0; $formmail->withfrom = 1; $formmail->witherrorsto = 1; - $formmail->withto = (!empty($_POST['sendto']) ? $_POST['sendto'] : ($user->email ? $user->email : 1)); - $formmail->withtocc = (!empty($_POST['sendtocc']) ? $_POST['sendtocc'] : 1); // ! empty to keep field if empty - $formmail->withtoccc = (!empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1); // ! empty to keep field if empty - $formmail->withtopic = (isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test")); + $formmail->withto = (!empty($_POST['sendto']) ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1)); + $formmail->withtocc = (!empty($_POST['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withtoccc = (!empty($_POST['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test")); $formmail->withtopicreadonly = 0; $formmail->withfile = 2; - $formmail->withbody = (isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"))); + $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"))); $formmail->withbodyreadonly = 0; $formmail->withcancel = 1; $formmail->withdeliveryreceipt = 1; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 71bd50ef5ce..0349f8a3435 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -135,7 +135,7 @@ print ''; print ''.$langs->trans("ConnectionTimeout").''; print ''; print ''; -print 'global->MAIN_USE_CONNECT_TIMEOUT).'">'; +print 'global->MAIN_USE_CONNECT_TIMEOUT).'">'; print ' '.strtolower($langs->trans("Seconds")); print ''; print ''; diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 6d84b4a0e2d..45500843aed 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -85,7 +85,7 @@ if ($action == 'set') $db->begin(); $newActiveModules = array(); - $selectedModules = (isset($_POST['SYSLOG_HANDLERS']) ? $_POST['SYSLOG_HANDLERS'] : array()); + $selectedModules = (GETPOSTISSET('SYSLOG_HANDLERS') ? GETPOST('SYSLOG_HANDLERS') : array()); // Save options of handler foreach ($syslogModules as $syslogHandler) @@ -97,11 +97,10 @@ if ($action == 'set') if (in_array($syslogHandler, $selectedModules)) $newActiveModules[] = $syslogHandler; foreach ($module->configure() as $option) { - if (isset($_POST[$option['constant']])) + if (GETPOSTISSET($option['constant'])) { - $_POST[$option['constant']] = trim($_POST[$option['constant']]); dolibarr_del_const($db, $option['constant'], -1); - dolibarr_set_const($db, $option['constant'], $_POST[$option['constant']], 'chaine', 0, '', 0); + dolibarr_set_const($db, $option['constant'], trim(GETPOST($option['constant'])), 'chaine', 0, '', 0); } } } @@ -229,7 +228,7 @@ foreach ($syslogModules as $moduleName) $tmpoption = $option['constant']; if (!empty($tmpoption)) { - if (isset($_POST[$tmpoption])) $value = $_POST[$tmpoption]; + if (GETPOSTISSET($tmpoption)) $value = GETPOST($tmpoption); elseif (!empty($conf->global->$tmpoption)) $value = $conf->global->$tmpoption; } else $value = (isset($option['default']) ? $option['default'] : ''); @@ -240,7 +239,7 @@ foreach ($syslogModules as $moduleName) { $filelogparam = ' ('; $filelogparam .= $langs->trans('Download'); - $filelogparam .= $filelog.')'; + $filelogparam .= ' '.basename($value).')'; print $filelogparam; } } diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index a509cea32d3..03f5c60f607 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -93,7 +93,7 @@ if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) print ''; print 'GET and POST support'; -if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["mainmenu"])) +if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["mainmenu"])) // We must keep $_GET and $_POST here { print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); print ' ('.$langs->trans("Recheck").')'; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6dfdf41e679..1a61a4a0c82 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -280,7 +280,7 @@ if (empty($reshook) && $action == 'add') } } } - $object->fk_project = isset($_POST["projectid"]) ? $_POST["projectid"] : 0; + $object->fk_project = GETPOSTISSET("projectid") ? GETPOST("projectid", 'int') : 0; $taskid = GETPOST('taskid', 'int'); if (!empty($taskid)) { @@ -324,7 +324,7 @@ if (empty($reshook) && $action == 'add') $object->note_private = trim(GETPOST("note", "restricthtml")); - if (isset($_POST["contactid"])) $object->contact = $contact; + if (GETPOSTISSET("contactid")) $object->contact = $contact; if (GETPOST('socid', 'int') > 0) { @@ -1051,8 +1051,8 @@ if ($action == 'create') print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print ''; $percent = -1; - if (isset($_GET['status']) || isset($_POST['status'])) $percent = GETPOST('status'); - elseif (isset($_GET['percentage']) || isset($_POST['percentage'])) $percent = GETPOST('percentage'); + if (GETPOSTISSET('status')) $percent = GETPOST('status'); + elseif (GETPOSTISSET('percentage')) $percent = GETPOST('percentage'); else { if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) $percent = '0'; elseif (GETPOST('complete') == 100 || GETPOST("afaire") == 2) $percent = 100; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 313aaa0e2e4..f540a8d6e4e 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -336,7 +336,7 @@ if ($status == 'todo') $title = $langs->trans("ToDoActions"); */ $param = ''; -if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) { +if ($actioncode || GETPOSTISSET('search_actioncode')) { if (is_array($actioncode)) { foreach ($actioncode as $str_action) $param .= "&search_actioncode[]=".urlencode($str_action); } else $param .= "&search_actioncode=".urlencode($actioncode); diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 4f292047700..c5f81e358cc 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -122,8 +122,8 @@ $tmparray = explode('-', $tmp); $begin_d = 1; $end_d = 53; -if ($status == '' && !isset($_GET['status']) && !isset($_POST['status'])) $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); -if (empty($action) && !isset($_GET['action']) && !isset($_POST['action'])) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); +if ($status == '' && !GETPOSTISSET('status')) $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action) && !GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); if (GETPOST('viewcal', 'alpha') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') { $action = 'show_month'; $day = ''; @@ -227,13 +227,13 @@ if ($status == 'done') $title = $langs->trans("DoneActions"); if ($status == 'todo') $title = $langs->trans("ToDoActions"); $param = ''; -if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) { +if ($actioncode || GETPOSTISSET('search_actioncode')) { if (is_array($actioncode)) { foreach ($actioncode as $str_action) $param .= "&search_actioncode[]=".urlencode($str_action); } else $param .= "&search_actioncode=".urlencode($actioncode); } if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid); -if ($status || isset($_GET['status']) || isset($_POST['status'])) $param .= "&search_status=".urlencode($status); +if ($status || GETPOSTISSET('status')) $param .= "&search_status=".urlencode($status); if ($filter) $param .= "&search_filter=".urlencode($filter); if ($filtert) $param .= "&search_filtert=".urlencode($filtert); if ($usergroup) $param .= "&search_usergroup=".urlencode($usergroup); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 8983dbff7f6..6161b6c820b 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -125,8 +125,8 @@ if ($begin_d < 1 || $begin_d > 7) $begin_d = 1; if ($end_d < 1 || $end_d > 7) $end_d = 7; if ($end_d < $begin_d) $end_d = $begin_d + 1; -if ($status == '' && !isset($_GET['status']) && !isset($_POST['status'])) $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); -if (empty($action) && !isset($_GET['action']) && !isset($_POST['action'])) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); +if ($status == '' && !GETPOSTISSET('status')) $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action) && !GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); if (GETPOST('viewcal', 'alpha') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') { $action = 'show_month'; $day = ''; @@ -227,13 +227,13 @@ if ($status == 'done') $title = $langs->trans("DoneActions"); if ($status == 'todo') $title = $langs->trans("ToDoActions"); $param = ''; -if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) { +if ($actioncode || GETPOSTISSET('search_actioncode')) { if (is_array($actioncode)) { foreach ($actioncode as $str_action) $param .= "&search_actioncode[]=".urlencode($str_action); } else $param .= "&search_actioncode=".urlencode($actioncode); } if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid); -if ($status || isset($_GET['status']) || isset($_POST['status'])) $param .= "&search_status=".urlencode($status); +if ($status || GETPOSTISSET('status')) $param .= "&search_status=".urlencode($status); if ($filter) $param .= "&search_filter=".urlencode($filter); if ($filtert) $param .= "&search_filtert=".urlencode($filtert); if ($usergroup) $param .= "&search_usergroup=".urlencode($usergroup); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 02c89772e94..902a96ec16c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -225,17 +225,16 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' if ($num_releve) { $bankline = new AccountLine($db); - if (isset($_POST['rowid']) && is_array($_POST['rowid'])) - { - foreach ($_POST['rowid'] as $row) - { - if ($row > 0) - { + + $rowids = GETPOST('rowid', 'array'); + + if (!empty($rowids) && is_array($rowids)) { + foreach ($rowids as $row) { + if ($row > 0) { $result = $bankline->fetch($row); $bankline->num_releve = $num_releve; //$_POST["num_releve"]; $result = $bankline->update_conciliation($user, GETPOST("cat"), GETPOST('confirm_reconcile', 'alpha') ? 1 : 0); // If we confirm_reconcile, we set flag 'rappro' to 1. - if ($result < 0) - { + if ($result < 0) { setEventMessages($bankline->error, $bankline->errors, 'errors'); $error++; break; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index a7841a72b22..813e0baa1b7 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -346,7 +346,7 @@ if ($action == 'create') // Type print ''.$langs->trans("AccountType").''; print ''; - $formbank->selectTypeOfBankAccount(isset($_POST["type"]) ? $_POST["type"] : Account::TYPE_CURRENT, "type"); + $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST("type") : Account::TYPE_CURRENT, "type"); print ''; // Currency @@ -354,7 +354,7 @@ if ($action == 'create') print ''; $selectedcode = $object->currency_code; if (!$selectedcode) $selectedcode = $conf->currency; - print $form->selectCurrency((isset($_POST["account_currency_code"]) ? $_POST["account_currency_code"] : $selectedcode), 'account_currency_code'); + print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); //print ''; print ''; @@ -367,9 +367,8 @@ if ($action == 'create') // Country $selectedcode = ''; - if (isset($_POST["account_country_id"])) - { - $selectedcode = $_POST["account_country_id"] ? $_POST["account_country_id"] : $object->country_code; + if (GETPOSTISSET("account_country_id")) { + $selectedcode = GETPOST("account_country_id") ? GETPOST("account_country_id") : $object->country_code; } elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code; $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules @@ -383,7 +382,7 @@ if ($action == 'create') print ''.$langs->trans('State').''; if ($selectedcode) { - $formcompany->select_departement(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : '', $selectedcode, 'account_state_id'); + $formcompany->select_departement(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : '', $selectedcode, 'account_state_id'); } else { print $countrynotdefined; } @@ -818,16 +817,16 @@ if ($action == 'create') // Ref print ''.$langs->trans("Ref").''; - print 'ref).'">'; + print 'ref).'">'; // Label print ''.$langs->trans("Label").''; - print 'label).'">'; + print 'label).'">'; // Type print ''.$langs->trans("AccountType").''; print ''; - $formbank->selectTypeOfBankAccount((isset($_POST["type"]) ? $_POST["type"] : $object->type), "type"); + $formbank->selectTypeOfBankAccount((GETPOSTISSET("type") ? GETPOST("type") : $object->type), "type"); print ''; // Currency @@ -837,7 +836,7 @@ if ($action == 'create') print ''; $selectedcode = $object->currency_code; if (!$selectedcode) $selectedcode = $conf->currency; - print $form->selectCurrency((isset($_POST["account_currency_code"]) ? $_POST["account_currency_code"] : $selectedcode), 'account_currency_code'); + print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); //print ''; print ''; @@ -845,13 +844,13 @@ if ($action == 'create') // Status print ''.$langs->trans("Status").''; print ''; - print $form->selectarray("clos", $object->status, (isset($_POST["clos"]) ? $_POST["clos"] : $object->clos)); + print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos") : $object->clos)); print ''; // Country $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id; $selectedcode = $object->country_code; - if (isset($_POST["account_country_id"])) $selectedcode = $_POST["account_country_id"]; + if (GETPOSTISSET("account_country_id")) $selectedcode = GETPOST("account_country_id"); elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code; $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules @@ -865,7 +864,7 @@ if ($action == 'create') print ''.$langs->trans('State').''; if ($selectedcode) { - print $formcompany->select_state(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : $object->state_id, $selectedcode, 'account_state_id'); + print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $object->state_id, $selectedcode, 'account_state_id'); } else { print $countrynotdefined; } @@ -882,14 +881,14 @@ if ($action == 'create') // Balance print ''.$langs->trans("BalanceMinimalAllowed").''; - print 'min_allowed).'">'; + print 'min_allowed).'">'; print ''.$langs->trans("BalanceMinimalDesired").''; - print 'min_desired).'">'; + print 'min_desired).'">'; // Web print ''.$langs->trans("Web").''; - print 'url).'">'; + print 'url).'">'; print ''; // Tags-Categories diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 42bddce5d28..33f7f3a0352 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -139,17 +139,17 @@ if ($user->rights->banque->modifier && $action == "update") $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; $sql .= " SET "; // Always opened - if (isset($_POST['value'])) $sql .= " fk_type='".$db->escape(GETPOST('value'))."',"; - if (isset($_POST['num_chq'])) $sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',"; - if (isset($_POST['banque'])) $sql .= " banque='".$db->escape(GETPOST("banque"))."',"; - if (isset($_POST['emetteur'])) $sql .= " emetteur='".$db->escape(GETPOST("emetteur"))."',"; + if (GETPOSTISSET('value')) $sql .= " fk_type='".$db->escape(GETPOST('value'))."',"; + if (GETPOSTISSET('num_chq')) $sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',"; + if (GETPOSTISSET('banque')) $sql .= " banque='".$db->escape(GETPOST("banque"))."',"; + if (GETPOSTISSET('emetteur')) $sql .= " emetteur='".$db->escape(GETPOST("emetteur"))."',"; // Blocked when conciliated if (!$acline->rappro) { - if (isset($_POST['label'])) $sql .= " label = '".$db->escape(GETPOST("label"))."',"; - if (isset($_POST['amount'])) $sql .= " amount= '".$db->escape($amount)."',"; - if (isset($_POST['dateomonth'])) $sql .= " dateo = '".$db->idate($dateop)."',"; - if (isset($_POST['datevmonth'])) $sql .= " datev = '".$db->idate($dateval)."',"; + if (GETPOSTISSET('label')) $sql .= " label = '".$db->escape(GETPOST("label"))."',"; + if (GETPOSTISSET('amount')) $sql .= " amount= '".$db->escape($amount)."',"; + if (GETPOSTISSET('dateomonth')) $sql .= " dateo = '".$db->idate($dateop)."',"; + if (GETPOSTISSET('datevmonth')) $sql .= " datev = '".$db->idate($dateval)."',"; } $sql .= " fk_account = ".$actarget->id; $sql .= " WHERE rowid = ".$acline->id; @@ -613,7 +613,7 @@ if ($result) if ($user->rights->banque->consolidate) { print ''; - print 'rappro ? ' checked="checked"' : '')).'">'; + print 'rappro ? ' checked="checked"' : '')).'">'; print ''; } else { print ''.yn($objp->rappro).''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index de5b64c28fe..01b5d4ea3a0 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3415,7 +3415,7 @@ if ($action == 'create') // Payment mode print ''.$langs->trans('PaymentMode').''; - $form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id', 'CRDT'); + $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT'); print ''; // Bank Account diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index b9aa625c06d..299cdf9a6c3 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -222,21 +222,21 @@ if ($action == 'create') print ''.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'';*/ print ''.$langs->trans("Date").''; - $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : 0; + $datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int')); + $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOSTISSET("remonth") ? $datepaye : -1) : 0; print $form->selectDate($datepayment, '', '', '', 0, "add_payment", 1, 1, 0, '', '', $charge->date_ech, '', 1, $langs->trans("DateOfSocialContribution")); print ""; print ''; print ''.$langs->trans("PaymentMode").''; - $form->select_types_paiements(isset($_POST["paiementtype"]) ? $_POST["paiementtype"] : $charge->paiementtype, "paiementtype"); + $form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype") : $charge->paiementtype, "paiementtype"); print "\n"; print ''; print ''; print ''.$langs->trans('AccountToDebit').''; print ''; - $form->select_comptes(isset($_POST["accountid"]) ? $_POST["accountid"] : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list + $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid") : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list print ''; // Number diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index bd97f88ff65..752bdc4d642 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -893,7 +893,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) */ // We set country_id, and country_code label of the chosen country - if (isset($_POST["country_id"]) || $object->country_id) + if (GETPOSTISSET("country_id") || $object->country_id) { $tmparray = getCountry($object->country_id, 'all'); $object->country_code = $tmparray['code']; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 999a5866c22..a4f936cfca0 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1133,7 +1133,7 @@ class FormMail extends Form if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_PROPOSAL) && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $defaultvaluefordeliveryreceipt = 1; if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_send') $defaultvaluefordeliveryreceipt = 1; if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') $defaultvaluefordeliveryreceipt = 1; - $out .= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"]) ? $_POST["deliveryreceipt"] : $defaultvaluefordeliveryreceipt), 1); + $out .= $form->selectyesno('deliveryreceipt', (GETPOSTISSET("deliveryreceipt") ? GETPOST("deliveryreceipt") : $defaultvaluefordeliveryreceipt), 1); } $out .= "\n"; return $out; @@ -1170,7 +1170,7 @@ class FormMail extends Form $out .= $defaulttopic; $out .= ''; } else { - $out .= ''; + $out .= ''; } $out .= "\n"; return $out; diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 2ef3545d335..96156ef3fd2 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -288,7 +288,7 @@ function limitChars(textarea, limit, infodiv) $defaultmessage = $this->withbody; } $defaultmessage = make_substitutions($defaultmessage, $this->substit); - if (isset($_POST["message"])) $defaultmessage = $_POST["message"]; + if (GETPOSTISSET("message")) $defaultmessage = GETPOST("message", 'restricthtml'); $defaultmessage = str_replace('\n', "\n", $defaultmessage); print ""; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index aa90ee7fa1c..60debed9f2d 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -999,8 +999,8 @@ class FormTicket } elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); } - if (isset($_POST["message"]) && !$_POST['modelselected']) { - $defaultmessage = GETPOST('message'); + if (GETPOSTISSET("message") && !$_POST['modelselected']) { + $defaultmessage = GETPOST('message', 'restricthtml'); } else { $defaultmessage = make_substitutions($defaultmessage, $this->substit); // Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3be5453c406..61360d66f51 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -224,14 +224,14 @@ function dol_shutdown() } /** - * Return true if we are in a context of submitting a parameter + * Return true if we are in a context of submitting the parameter $paramname * * @param string $paramname Name or parameter to test * @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty) */ function GETPOSTISSET($paramname) { - $isset = 0; + $isset = false; $relativepathstring = $_SERVER["PHP_SELF"]; // Clean $relativepathstring @@ -254,7 +254,7 @@ function GETPOSTISSET($paramname) { if ($key == $paramname) // We are on the requested parameter { - $isset = 1; + $isset = true; break; } } @@ -263,16 +263,16 @@ function GETPOSTISSET($paramname) // If there is saved contextpage, page or limit if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) { - $isset = 1; + $isset = true; } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) { - $isset = 1; + $isset = true; } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) { - $isset = 1; + $isset = true; } } else { - $isset = (isset($_POST[$paramname]) || isset($_GET[$paramname])); + $isset = (isset($_POST[$paramname]) || isset($_GET[$paramname])); // We must keep $_POST and $_GET here } return $isset; @@ -287,13 +287,13 @@ function GETPOSTISSET($paramname) * @param string $check Type of check * ''=no check (deprecated) * 'none'=no check (only for param that should have very rich content) + * 'array', 'array:restricthtml' or 'array:aZ09' to check it's an array * 'int'=check it's numeric (integer or float) * 'intcomma'=check it's integer+comma ('1,2,3,4...') * 'alpha'=Same than alphanohtml since v13 * 'alphanohtml'=check there is no html content and no " and no ../ * 'aZ'=check it's a-z only * 'aZ09'=check it's simple alpha string (recommended for keys) - * 'array'=check it's array * 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string) * 'nohtml'=check there is no html content and no " and no ../ * 'restricthtml'=check html content is restricted to some tags only @@ -411,7 +411,6 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } } } // Management of default search_filters and sort order - //elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) elseif (!empty($paramname) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { if (!empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values' @@ -476,6 +475,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null if ($qualified) { + // We must keep $_POST and $_GET here if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) { // We made a search from quick search menu, do we still use default filter ? diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index aea4158fb21..3f4431f3eb4 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -172,10 +172,10 @@ class mailing_pomme extends MailingTargets $sql .= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test $sql .= " AND u.entity IN (0,".$conf->entity.")"; $sql .= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; - if (isset($_POST["filter"]) && $_POST["filter"] == '1') $sql .= " AND u.statut=1"; - if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql .= " AND u.statut=0"; - if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '1') $sql .= " AND u.employee=1"; - if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '0') $sql .= " AND u.employee=0"; + if (GETPOSTISSET("filter") && GETPOST("filter") == '1') $sql .= " AND u.statut=1"; + if (GETPOSTISSET("filter") && GETPOST("filter") == '0') $sql .= " AND u.statut=0"; + if (GETPOSTISSET("filteremployee") && GETPOSt("filteremployee") == '1') $sql .= " AND u.employee=1"; + if (GETPOSTISSET("filteremployee") && GETPOST("filteremployee") == '0') $sql .= " AND u.employee=0"; $sql .= " ORDER BY u.email"; // Stocke destinataires dans cibles diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index b2a082498c6..44b9d51bbf3 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -81,9 +81,8 @@ class mailing_thirdparties extends MailingTargets $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; } else { $addFilter = ""; - if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1') - { - $addFilter .= " AND s.client=".$_POST["filter_client"]; + if (GETPOSTISSET("filter_client") && GETPOST("filter_client") <> '-1') { + $addFilter .= " AND s.client=".((int) GETPOST("filter_client", 'int')); $addDescription = $langs->trans('ProspectCustomer')."="; if ($_POST["filter_client"] == 0) { @@ -98,18 +97,15 @@ class mailing_thirdparties extends MailingTargets { $addDescription .= $langs->trans('ProspectCustomer'); } else { - $addDescription .= "Unknown status ".$_POST["filter_client"]; + $addDescription .= "Unknown status ".GETPOST("filter_client"); } } - if (isset($_POST["filter_status"])) - { - if (strlen($addDescription) > 0) - { + if (GETPOSTISSET("filter_status")) { + if (strlen($addDescription) > 0) { $addDescription .= ";"; } $addDescription .= $langs->trans("Status")."="; - if ($_POST["filter_status"] == '1') - { + if (GETPOST("filter_status") == '1') { $addFilter .= " AND s.status=1"; $addDescription .= $langs->trans("Enabled"); } else { @@ -124,7 +120,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; $sql .= " AND cs.fk_soc = s.rowid"; $sql .= " AND c.rowid = cs.fk_categorie"; - $sql .= " AND c.rowid='".$this->db->escape($_POST['filter'])."'"; + $sql .= " AND c.rowid=".((int) GETPOST('filter', 'int')); $sql .= $addFilter; $sql .= " UNION "; $sql .= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label"; @@ -134,7 +130,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; $sql .= " AND cs.fk_soc = s.rowid"; $sql .= " AND c.rowid = cs.fk_categorie"; - $sql .= " AND c.rowid='".$this->db->escape($_POST['filter'])."'"; + $sql .= " AND c.rowid=".((int) GETPOST('filter', 'int')); $sql .= $addFilter; } $sql .= " ORDER BY email"; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index c7035298beb..bc02e490c34 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -85,7 +85,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if (!empty($extrafields->attributes[$object->table_element]['langfile'][$tmpkeyextra])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$tmpkeyextra]); if ($action == 'edit_extras') { - $value = (isset($_POST["options_".$tmpkeyextra]) ? $_POST["options_".$tmpkeyextra] : $object->array_options["options_".$tmpkeyextra]); + $value = (GETPOSTISSET("options_".$tmpkeyextra) ? GETPOST("options_".$tmpkeyextra) : $object->array_options["options_".$tmpkeyextra]); } else { $value = $object->array_options["options_".$tmpkeyextra]; //var_dump($tmpkeyextra.' - '.$value); @@ -172,7 +172,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] $datenotinstring = $db->jdate($datenotinstring); } //print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); - $value = isset($_POST["options_".$tmpkeyextra]) ? dol_mktime($_POST["options_".$tmpkeyextra."hour"], $_POST["options_".$tmpkeyextra."min"], 0, $_POST["options_".$tmpkeyextra."month"], $_POST["options_".$tmpkeyextra."day"], $_POST["options_".$tmpkeyextra."year"]) : $datenotinstring; + $value = GETPOSTISSET("options_".$tmpkeyextra) ? dol_mktime(GETPOST("options_".$tmpkeyextra."hour", 'int'), GETPOST("options_".$tmpkeyextra."min", 'int'), 0, GETPOST("options_".$tmpkeyextra."month", 'int'), GETPOST("options_".$tmpkeyextra."day", 'int'), GETPOST("options_".$tmpkeyextra."year", 'int')) : $datenotinstring; } //TODO Improve element and rights detection diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 52b50475744..bc6f3313168 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -324,17 +324,17 @@ if ($nolinesbefore) { { $coldisplay++; ?> - "> + "> '; $coldisplay++; if ($seller->tva_assuj == "0") echo ''.vatrate(0, true); - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"]) ?GETPOST("tva_tx", 'alpha', 2) : -1), $seller, $buyer, 0, 0, '', false, 1); + else echo $form->load_tva('tva_tx', (GETPOSTISSET("tva_tx") ? GETPOST("tva_tx", 'alpha', 2) : -1), $seller, $buyer, 0, 0, '', false, 1); ?> - "> + "> - "> + "> - "> + "> - "> + "> global->PRODUCT_USE_UNITS)) { @@ -371,7 +371,7 @@ if ($nolinesbefore) { } $coldisplay++; ?> - ">% + ">% situation_cycle_ref) { $coldisplay++; @@ -389,17 +389,17 @@ if ($nolinesbefore) { - "> + "> global->DISPLAY_MARGIN_RATES)) { - echo '%'; + echo '%'; $coldisplay++; } if (!empty($conf->global->DISPLAY_MARK_RATES)) { - echo '%'; + echo '%'; $coldisplay++; } } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 5f0073a57b2..bc6b87a3353 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -234,7 +234,7 @@ $coldisplay++; if ($user->rights->margins->creer) { if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { - $margin_rate = (isset($_POST["np_marginRate"]) ?GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx))); + $margin_rate = (GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx))); // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''.$margin_rate.'%'; @@ -242,7 +242,7 @@ $coldisplay++; $coldisplay++; } elseif (!empty($conf->global->DISPLAY_MARK_RATES)) { - $mark_rate = (isset($_POST["np_markRate"]) ?GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx)); + $mark_rate = (GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx)); // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''.$mark_rate.'%'; diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 05b9d6fd50a..d1db4a819a5 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -32,8 +32,8 @@ $events = array(); $out .= $formresources->select_resource_list('', 'fk_resource', '', 1, 1, 0, $events, '', 2, null); $out .= ''; -$out .= '
'.$form->selectyesno('busy', (isset($_POST['busy']) ? $_POST['busy'] : 1), 1).'
'; -$out .= '
'.$form->selectyesno('mandatory', (isset($_POST['mandatory']) ? $_POST['mandatory'] : 0), 1).'
'; +$out .= '
'.$form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1).'
'; +$out .= '
'.$form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1).'
'; $out .= '
'; $out .= ''; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 0f4b2054619..c55751e913f 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -418,9 +418,9 @@ if ($action == 'create') // Zip / Town print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); + print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); print ' '; - print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print ''; // Country @@ -560,9 +560,9 @@ if (!empty($id) && $action == 'edit') // Zip / Town print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); + print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOSTISSET("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); print ' '; - print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print ''; // Country diff --git a/htdocs/install/check.php b/htdocs/install/check.php index bd34a0ac30c..93b99680b92 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -93,8 +93,8 @@ if (empty($force_install_nophpinfo)) print ' (\n"; -// Check PHP support for $_POST -if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) +// Check PHP support for $_GET and $_POST +if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) // We must keep $_GET and $_POST here { print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); print ' ('.$langs->trans("Recheck").')'; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index a0890866b51..12bab777edb 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -177,7 +177,7 @@ if (preg_match('/install\.lock/i', $_SERVER["SCRIPT_FILENAME"])) print $langs->trans("YouTryInstallDisabledByDirLock"); if (!empty($dolibarr_main_url_root)) { - print 'Click on following link, '; + print 'Click on following link, '; print $langs->trans("ClickHereToGoToApp"); print ''; } @@ -202,7 +202,7 @@ if (@file_exists($lockfile)) if (!empty($dolibarr_main_url_root)) { print $langs->trans("ClickOnLinkOrRemoveManualy").'
'; - print ''; + print ''; print $langs->trans("ClickHereToGoToApp"); print ''; } else { diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 798eb4472e6..14138dc5664 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1473,7 +1473,7 @@ if (empty($actiondone)) if ($oneoptionset) { - print '
'; + print ''; } else { diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 3c87b36dd82..ea07900ba67 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -204,7 +204,9 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D") } } - if ($_POST["nouvelleheuredebut"] == "vide" || (isset($_POST["nouvelleheuredebut"]) && isset($_POST["nouvelleheurefin"]) && (($_POST["nouvelleheuredebut"] < $_POST["nouvelleheurefin"]) || (($_POST["nouvelleheuredebut"] == $_POST["nouvelleheurefin"]) && ($_POST["nouvelleminutedebut"] < $_POST["nouvelleminutefin"]))))) { + if (GETPOST("nouvelleheuredebut") == "vide" || (GETPOSTISSET("nouvelleheuredebut") && GETPOSTISSET("nouvelleheurefin") + && (GETPOST("nouvelleheuredebut") < GETPOST("nouvelleheurefin") || (GETPOST("nouvelleheuredebut") == GETPOST("nouvelleheurefin") + && (GETPOST("nouvelleminutedebut") < GETPOST("nouvelleminutefin")))))) { $erreur_ajout_date = false; } else { $erreur_ajout_date = "yes"; @@ -907,7 +909,7 @@ while ($compteur < $num) //demande de confirmation pour modification de ligne for ($i = 0; $i < $nblines; $i++) { - if (isset($_POST["modifierligne".$i])) + if (GETPOSTISSET("modifierligne".$i)) { if ($compteur == $i) { @@ -938,7 +940,7 @@ if (empty($testligneamodifier)) if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { print 'trans("MoreChoices"), null, 'errors'); $erreur = true; } diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index b295f007ca8..73413f3255d 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -175,11 +175,11 @@ if ($_SESSION["mailsonde"]) $cochemail = "checked"; print ' '.$langs->trans("ToReceiveEMailForEachVote").'
'."\n"; if ($_SESSION['allow_comments']) $allow_comments = 'checked'; -if (isset($_POST['allow_comments'])) $allow_comments = GETPOST('allow_comments') ? 'checked' : ''; +if (GETPOSTISSET('allow_comments')) $allow_comments = GETPOST('allow_comments') ? 'checked' : ''; print ' '.$langs->trans('CanComment').'
'."\n"; if ($_SESSION['allow_spy']) $allow_spy = 'checked'; -if (isset($_POST['allow_spy'])) $allow_spy = GETPOST('allow_spy') ? 'checked' : ''; +if (GETPOSTISSET('allow_spy')) $allow_spy = GETPOST('allow_spy') ? 'checked' : ''; print ' '.$langs->trans('CanSeeOthersVote').'
'."\n"; if (GETPOST('choix_sondage')) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6fdfb82e354..ea0bc19eecb 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1034,8 +1034,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($showbarcode) { print ''.$langs->trans('BarcodeType').''; - if (isset($_POST['fk_barcode_type'])) - { + if (GETPOSTISSET('fk_barcode_type')) { $fk_barcode_type = GETPOST('fk_barcode_type'); } else { if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; @@ -1046,7 +1045,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; if ($conf->browser->layout == 'phone') print ''; print ''.$langs->trans("BarcodeValue").''; - $tmpcode = isset($_POST['barcode']) ?GETPOST('barcode') : $object->barcode; + $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $type); print ''; print ''; @@ -1497,8 +1496,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($showbarcode) { print ''.$langs->trans('BarcodeType').''; - if (isset($_POST['fk_barcode_type'])) - { + if (GETPOSTISSET('fk_barcode_type')) { $fk_barcode_type = GETPOST('fk_barcode_type'); } else { $fk_barcode_type = $object->barcode_type; @@ -1508,7 +1506,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $formbarcode = new FormBarCode($db); print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print ''.$langs->trans("BarcodeValue").''; - $tmpcode = isset($_POST['barcode']) ?GETPOST('barcode') : $object->barcode; + $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $type); print ''; print ''; @@ -1853,7 +1851,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; if ($action == 'editbarcode') { - $tmpcode = isset($_POST['barcode']) ?GETPOST('barcode') : $object->barcode; + $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $type); print '
'; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 90721f8bfda..4e35d3832e5 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -428,7 +428,7 @@ print ''; print ''; // Button to record mass movement -$codemove = (isset($_POST["codemove"]) ? GETPOST("codemove", 'alpha') : dol_print_date(dol_now(), '%Y%m%d%H%M%S')); +$codemove = (GETPOSTISSET("codemove") ? GETPOST("codemove", 'alpha') : dol_print_date(dol_now(), '%Y%m%d%H%M%S')); $labelmovement = GETPOST("label") ? GETPOST('label') : $langs->trans("StockTransfer").' '.dol_print_date($now, '%Y-%m-%d %H:%M'); print '
'; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 860044433d7..ed537f1bd4e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -108,7 +108,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e * Actions */ -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || isset($_POST['valid'])) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('valid')) // Both test are required to be compatible with all browsers { $search_ref = ''; $search_label = ''; @@ -120,7 +120,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if ($draftorder == 'on') $draftchecked = "checked"; // Create orders -if ($action == 'order' && isset($_POST['valid'])) +if ($action == 'order' && GETPOST('valid')) { $linecount = GETPOST('linecount', 'int'); $box = 0; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 1b6fafe9994..0885e9ef777 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -138,7 +138,7 @@ print ''.$langs->trans("MovementLabel").''; print ''; print ''; print ''; -print ''.$langs->trans("InventoryCode").''; +print ''.$langs->trans("InventoryCode").''; print ''; print ''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index dab7cd07b78..7e159a35b32 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -127,7 +127,7 @@ print ''.$langs->trans("MovementLabel").''; print ''; print ''; print ''; -print ''.$langs->trans("InventoryCode").''; +print ''.$langs->trans("InventoryCode").''; print ''; print ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index d30f3bf846e..cf6b864cd72 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -79,8 +79,7 @@ $dates = dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST $datee = dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear')); if (empty($dates) && !empty($datesrfc)) $dates = dol_stringtotime($datesrfc); if (empty($datee) && !empty($dateerfc)) $datee = dol_stringtotime($dateerfc); -if (!isset($_POST['datesrfc']) && !isset($_POST['datesday']) && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR)) -{ +if (!GETPOSTISSET('datesrfc') && !GETPOSTISSET('datesday') && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR)) { $new = dol_now(); $tmp = dol_getdate($new); //$datee=$now diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index c61ffd58819..1946125dbc2 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -182,7 +182,7 @@ if (empty($reshook) && $action == 'add') { $langs->load("errors"); $errmsg .= $langs->trans("ErrorLoginAlreadyExists")."
\n"; } - if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"] != $_POST["pass2"]) { + if (!GETPOSTISSET("pass1") || !GETPOSTISSET("pass2") || GETPOST("pass1", 'none') == '' || GETPOST("pass2", 'none') == '' || GETPOST("pass1", 'none') != GETPOST("pass2", 'none')) { $error++; $langs->load("errors"); $errmsg .= $langs->trans("ErrorPasswordsMustMatch")."
\n"; diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 5ba3ce65ebd..95045d2e943 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -108,13 +108,11 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout $nouveauchoix = ''; for ($i = 0; $i < $nbcolonnes; $i++) { - if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') - { + if (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '1') { $nouveauchoix .= "1"; - } elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') - { + } elseif (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '2') { $nouveauchoix .= "2"; - } else { // sinon c'est 0 + } else { $nouveauchoix .= "0"; } } @@ -182,14 +180,14 @@ $testligneamodifier = false; $ligneamodifier = -1; for ($i = 0; $i < $nblines; $i++) { - if (isset($_POST['modifierligne'.$i])) + if (GETPOSTISSET('modifierligne'.$i)) { $ligneamodifier = $i; $testligneamodifier = true; } //test to see if a line is to be modified - if (isset($_POST['validermodifier'.$i])) + if (GETPOSTISSET('validermodifier'.$i)) { $modifier = $i; $testmodifier = true; @@ -203,13 +201,11 @@ if ($testmodifier) for ($i = 0; $i < $nbcolonnes; $i++) { //var_dump($_POST["choix$i"]); - if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1') - { + if (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '1') { $nouveauchoix .= "1"; - } elseif (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') - { + } elseif (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '2') { $nouveauchoix .= "2"; - } else { // sinon c'est 0 + } else { $nouveauchoix .= "0"; } } @@ -545,7 +541,7 @@ while ($compteur < $num) //demande de confirmation pour modification de ligne for ($i = 0; $i < $nblines; $i++) { - if (isset($_POST["modifierligne".$i])) + if (GETPOSTISSET("modifierligne".$i)) { if ($compteur == $i) { @@ -581,8 +577,7 @@ if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { print ''; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index ffa4b24fc59..95265831670 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -162,8 +162,8 @@ if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/aja $nav = ''; $nav .= ''; -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav .= ''; -if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav .= ''; +if ($actioncode || GETPOSTISSET('actioncode')) $nav .= ''; +if ($status || GETPOSTISSET('status')) $nav .= ''; if ($filter) $nav .= ''; if ($filtert) $nav .= ''; if ($socid) $nav .= '';