Qual: Remove unnecessary use of $_GET

This commit is contained in:
Laurent Destailleur 2024-03-28 20:19:28 +01:00
parent 3e8c3edd6d
commit e73f79ca96
51 changed files with 103 additions and 127 deletions

View File

@ -61,6 +61,7 @@ if (isset($_GET["hashp"]) && !defined("NOLOGIN")) {
}
}
// Some value of modulepart can be used to get resources that are public so no login are required.
// Keep $_GET here, GETPOST is not available yet
if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
@ -98,7 +99,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$encoding = '';
$action = GETPOST('action', 'aZ09');
$original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$original_file = GETPOST('file', 'alphanohtml');
$hashp = GETPOST('hashp', 'aZ09');
$modulepart = GETPOST('modulepart', 'alpha');
$urlsource = GETPOST('urlsource', 'alpha');

View File

@ -219,11 +219,11 @@ if ($action == 'selectfield') { // Selection of field at step 2
}
}
if ($action == 'unselectfield') {
if ($_GET["field"] == 'all') {
if (GETPOST("field") == 'all') {
$array_selected = array();
$_SESSION["export_selected_fields"] = $array_selected;
} else {
unset($array_selected[$_GET["field"]]);
unset($array_selected[GETPOST("field")]);
// Renumber fields of array_selected (from 1 to nb_elements)
asort($array_selected);
$i = 0;
@ -238,7 +238,7 @@ if ($action == 'unselectfield') {
}
if ($action == 'downfield' || $action == 'upfield') {
$pos = $array_selected[$_GET["field"]];
$pos = $array_selected[GETPOST("field")];
if ($action == 'downfield') {
$newpos = $pos + 1;
}
@ -253,9 +253,9 @@ if ($action == 'downfield' || $action == 'upfield') {
break;
}
}
//print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)");
//print("Switch pos=$pos (code=".GETPOST("field").") and newpos=$newpos (code=$newcode)");
if ($newcode) { // Si newcode trouve (protection contre resoumission de page)
$array_selected[$_GET["field"]] = $newpos;
$array_selected[GETPOST("field")] = $newpos;
$array_selected[$newcode] = $pos;
$_SESSION["export_selected_fields"] = $array_selected;
}
@ -290,7 +290,7 @@ if ($action == 'builddoc') {
// Delete file
if ($step == 5 && $action == 'confirm_deletefile' && $confirm == 'yes') {
$file = $upload_dir."/".GETPOST('file'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$file = $upload_dir."/".GETPOST('file');
$ret = dol_delete_file($file);
if ($ret) {

View File

@ -1420,7 +1420,7 @@ if (empty($reshook)) {
$langs->load("errors");
$db->rollback();
$action = 'create';
$_GET['socid'] = $_POST['socid'];
//$_GET['socid'] = $_POST['socid'];
} else {
$db->commit();
header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode((string) ($id)));

View File

@ -730,8 +730,8 @@ if (empty($reshook)) {
} else {
$db->rollback();
$action = 'create';
$_GET["origin"] = $_POST["origin"];
$_GET["originid"] = $_POST["originid"];
$_GET["origin"] = $_POST["origin"]; // Keep this ?
$_GET["originid"] = $_POST["originid"]; // Keep this ?
setEventMessages("Error", null, 'errors');
$error++;
}

View File

@ -801,7 +801,7 @@ if (empty($reshook)) {
if (empty($dateinvoice)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
$action = 'create';
$_GET['socid'] = $_POST['socid'];
//$_GET['socid'] = $_POST['socid'];
$error++;
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
@ -867,7 +867,7 @@ if (empty($reshook)) {
if (empty($dateinvoice)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
$action = 'create';
$_GET['socid'] = $_POST['socid'];
//$_GET['socid'] = $_POST['socid'];
$error++;
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
@ -878,7 +878,7 @@ if (empty($reshook)) {
if (!GETPOST('ref_supplier')) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplierBill')), null, 'errors');
$action = 'create';
$_GET['socid'] = $_POST['socid'];
//$_GET['socid'] = $_POST['socid'];
$error++;
}
@ -1035,7 +1035,7 @@ if (empty($reshook)) {
if (empty($dateinvoice)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
$action = 'create';
$_GET['socid'] = $_POST['socid'];
//$_GET['socid'] = $_POST['socid'];
$error++;
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
@ -1046,7 +1046,7 @@ if (empty($reshook)) {
if (!GETPOST('ref_supplier')) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplierBill')), null, 'errors');
$action = 'create';
$_GET['socid'] = $_POST['socid'];
//$_GET['socid'] = $_POST['socid'];
$error++;
}
@ -1405,7 +1405,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
$_GET['socid'] = $_POST['socid'];
//$_GET['socid'] = $_POST['socid'];
} else {
$db->commit();

View File

@ -157,7 +157,7 @@ if ($object->id > 0) {
* Confirm delete file
*/
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
}
print '<table class="border tableforfield centpercent">';

View File

@ -137,7 +137,6 @@ $socid = GETPOSTINT('socid');
// Security check
if ($user->socid > 0) {
$action = '';
$_GET["action"] = '';
$socid = $user->socid;
}

View File

@ -80,13 +80,13 @@ $fieldstarget = $objimport->array_import_fields[0];
$valuestarget = $objimport->array_import_examplevalues[0];
$attachment = true;
if (isset($_GET["attachment"])) {
$attachment = $_GET["attachment"];
if (GETPOSTISSET("attachment")) {
$attachment = GETPOST("attachment");
}
//$attachment = false;
$contenttype = dol_mimetype($format);
if (isset($_GET["contenttype"])) {
$contenttype = $_GET["contenttype"];
if (GETPOSTISSET("contenttype")) {
$contenttype = GETPOST("contenttype");
}
//$contenttype='text/plain';
$outputencoding = 'UTF-8';

View File

@ -184,41 +184,6 @@ if (empty($array_match_file_to_database)) {
* Actions
*/
/*
if ($action=='downfield' || $action=='upfield')
{
$pos=$array_match_file_to_database[$_GET["field"]];
if ($action=='downfield') $newpos=$pos+1;
if ($action=='upfield') $newpos=$pos-1;
// Recherche code avec qui switcher
$newcode="";
foreach($array_match_file_to_database as $code=>$value)
{
if ($value == $newpos)
{
$newcode=$code;
break;
}
}
//print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)");
if ($newcode) // Si newcode trouve (protection contre resoumission de page)
{
$array_match_file_to_database[$_GET["field"]]=$newpos;
$array_match_file_to_database[$newcode]=$pos;
$_SESSION["dol_array_match_file_to_database"]=$serialized_array_match_file_to_database;
}
}
*/
// if ($action == 'builddoc') {
// // Build import file
// $result = $objimport->build_file($user, GETPOST('model', 'alpha'), $datatoimport, $array_match_file_to_database);
// if ($result < 0) {
// setEventMessages($objimport->error, $objimport->errors, 'errors');
// } else {
// setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs');
// }
// }
if ($action == 'deleteprof') {
if (GETPOSTINT("id")) {
$objimport->fetch(GETPOSTINT("id"));
@ -286,7 +251,7 @@ if ($step == 3 && $datatoimport) {
$param .= '&endatlinenb='.urlencode($endatlinenb);
}
$file = $conf->import->dir_temp.'/'.GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$file = $conf->import->dir_temp.'/'.GETPOST('urlfile');
$ret = dol_delete_file($file);
if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
@ -2085,7 +2050,7 @@ if ($step == 6 && $datatoimport) {
$obj->import_close_file();
}
$nboflines = (!empty($_GET["nboflines"]) ? $_GET["nboflines"] : dol_count_nb_of_line($conf->import->dir_temp.'/'.$filetoimport));
$nboflines = GETPOST("nboflines", dol_count_nb_of_line($conf->import->dir_temp.'/'.$filetoimport));
$param = '&format='.$format.'&datatoimport='.urlencode($datatoimport).'&filetoimport='.urlencode($filetoimport).'&nboflines='.urlencode($nboflines);
if ($excludefirstline) {

View File

@ -32,7 +32,7 @@ require 'main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// If not defined, we select menu "home"
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home';
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home'; // Keep this ?
$action = GETPOST('action', 'aZ09');
$hookmanager->initHooks(array('index'));

View File

@ -87,13 +87,13 @@ if ($db->ok) {
print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password" minlength="8"></td></tr>';
print '</table>';
if (isset($_GET["error"]) && $_GET["error"] == 1) {
if (GETPOSTINT("error") == 1) {
print '<br>';
print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
$error = 0; // We show button
}
if (isset($_GET["error"]) && $_GET["error"] == 2) {
if (GETPOSTINT("error") == 2) {
print '<br>';
print '<div class="error">';
print $langs->trans("PleaseTypePassword");
@ -101,7 +101,7 @@ if ($db->ok) {
$error = 0; // We show button
}
if (isset($_GET["error"]) && $_GET["error"] == 3) {
if (GETPOSTINT("error") == 3) {
print '<br>';
print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
$error = 0; // We show button

View File

@ -418,9 +418,9 @@ if (!$ok && isset($argv[1])) {
}
dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("--- upgrade: end ".((int) (!$ok && empty($_GET["ignoreerrors"])))." dirmodule=".$dirmodule);
dolibarr_install_syslog("--- upgrade: end ".((int) (!$ok && !GETPOST("ignoreerrors")))." dirmodule=".$dirmodule);
$nonext = (!$ok && empty($_GET["ignoreerrors"])) ? 2 : 0;
$nonext = (!$ok && !GETPOST("ignoreerrors")) ? 2 : 0;
if ($dirmodule) {
$nonext = 1;
}

View File

@ -35,7 +35,7 @@ if (!defined('NOREQUIREHTML')) {
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (empty($_GET['keysearch']) && !defined('NOREQUIREHTML')) {
if (empty($_GET['keysearch']) && !defined('NOREQUIREHTML')) { // Keep $_GET here, GETPOST is not yet defined
define('NOREQUIREHTML', '1');
}
@ -67,7 +67,6 @@ restrictedArea($user, 'produit|service|commande|propal|facture', 0, 'product&pro
*/
// print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
// print_r($_GET);
if ($action == 'fetch' && !empty($id)) {
// action='fetch' is used to get product information on a product. So when action='fetch', id must be the product id.

View File

@ -66,8 +66,8 @@ $extrafields = new ExtraFields($db);
// If socid provided by ajax company selector
if (GETPOSTINT('search_fourn_id')) {
$_GET['id_fourn'] = GETPOSTINT('search_fourn_id');
$_POST['id_fourn'] = GETPOSTINT('search_fourn_id');
$_GET['id_fourn'] = GETPOSTINT('search_fourn_id'); // Keep set to $_GET an $_POST. Used later.
$_POST['id_fourn'] = GETPOSTINT('search_fourn_id'); // Keep set to $_GET an $_POST. Used later.
}
// Security check

View File

@ -519,7 +519,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
$param .= '&endatlinenb='.urlencode($endatlinenb);
}
$file = $conf->stock->dir_temp.'/'.GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$file = $conf->stock->dir_temp.'/'.GETPOST('urlfile');
$ret = dol_delete_file($file);
if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');

View File

@ -70,7 +70,7 @@ $ref = GETPOST('ref', 'alpha');
$stocklimit = (float) GETPOST('seuil_stock_alerte');
$desiredstock = GETPOST('desiredstock');
$cancel = GETPOST('cancel', 'alpha');
$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
$d_eatby = dol_mktime(0, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear'));
$d_sellby = dol_mktime(0, 0, 0, GETPOSTINT('sellbymonth'), GETPOSTINT('sellbyday'), GETPOSTINT('sellbyyear'));
$pdluoid = GETPOSTINT('pdluoid');

View File

@ -30,30 +30,32 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
// Load translation files required by the page
$langs->load("stocks");
// Security check
$result = restrictedArea($user, 'stock');
$sref = GETPOST("sref", 'alpha');
$snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;
if (!$sortfield) {
$sortfield = "e.ref";
}
if (!$sortorder) {
$sortorder = "ASC";
}
$page = $_GET["page"];
if ($page < 0) {
$page = 0;
}
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$offset = $limit * $page;
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
// Security check
$result = restrictedArea($user, 'stock');
/*
* View

View File

@ -426,7 +426,7 @@ if ($id > 0 || !empty($ref)) {
print '<td>';
$thirdpartyofproject = $projectstatic->getListContactId('thirdparty');
$selectedCompany = isset($_GET["newcompany"]) ? $_GET["newcompany"] : $projectstatic->socid;
$selectedCompany = GETPOSISSET("newcompany") ? GETPOST("newcompany") : $projectstatic->socid;
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, '&withproject='.$withproject);
print '</td>';

View File

@ -2338,7 +2338,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Product
if (!empty($arrayfields['t.fk_product']['checked'])) {
print '<td class="nowraponall">';
if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) {
if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
print img_picto('', 'service');
print $form->select_produits($task_time->fk_product, 'fk_product', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 1, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500', 0, '', null, 1);
} elseif (!empty($task_time->fk_product)) {
@ -2395,7 +2395,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if ($task_time->invoice_id) {
$result = $tmpinvoice->fetch($task_time->invoice_id);
if ($result > 0) {
if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) {
if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
print $formproject->selectInvoiceAndLine($task_time->invoice_id, $task_time->invoice_line_id, 'invoiceid', 'invoicelineid', 'maxwidth500', array('p.rowid' => $projectstatic->id));
} else {
print $tmpinvoice->getNomUrl(1);

View File

@ -178,7 +178,7 @@ if ($reshook < 0) {
llxFooterVierge();
} elseif (empty($reshook)) {
// Check exportkey
if (empty($_GET["exportkey"]) || getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY') != $_GET["exportkey"]) {
if (!GETPOST("exportkey") || getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY') != GETPOST("exportkey")) {
$user->getrights();
top_httphead();
@ -328,13 +328,13 @@ if ($format == 'rss') {
$result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholidays);
if ($result >= 0) {
$attachment = false;
if (isset($_GET["attachment"])) {
$attachment = $_GET["attachment"];
if (GETPOSTISSET("attachment")) {
$attachment = GETPOST("attachment");
}
//$attachment = false;
$contenttype = 'application/rss+xml';
if (isset($_GET["contenttype"])) {
$contenttype = $_GET["contenttype"];
if (GETPOSTISSET("contenttype")) {
$contenttype = GETPOST("contenttype");
}
//$contenttype='text/plain';
$outputencoding = 'UTF-8';

View File

@ -42,7 +42,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
// 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['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);

View File

@ -53,6 +53,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);

View File

@ -40,7 +40,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
// 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);

View File

@ -39,7 +39,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
// 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);

View File

@ -45,7 +45,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
// 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);

View File

@ -51,6 +51,7 @@ if (!defined('NOBROWSERNOTIF')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and get of entity 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'] : (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1))));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);

View File

@ -40,7 +40,7 @@ if (!defined('NOBROWSERNOTIF')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and this test 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['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);

View File

@ -44,7 +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
// 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['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);

View File

@ -36,6 +36,7 @@ if (!defined('NOBROWSERNOTIF')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and get of entity 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'] : (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1))));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);

View File

@ -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);

View File

@ -38,7 +38,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
// 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);

View File

@ -38,7 +38,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
// 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);

View File

@ -36,6 +36,7 @@ if (!defined('NOBROWSERNOTIF')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and get of entity 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'] : (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1))));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);

View File

@ -31,6 +31,7 @@ if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
// 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);
@ -58,8 +59,8 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
// You can find your endpoint's secret in your webhook settings
if (isset($_GET['connect'])) {
if (isset($_GET['test'])) {
if (GETPOSTISSET('connect')) {
if (GETPOSTISSET('test')) {
$endpoint_secret = getDolGlobalString('STRIPE_TEST_WEBHOOK_CONNECT_KEY');
$service = 'StripeTest';
$servicestatus = 0;
@ -69,7 +70,7 @@ if (isset($_GET['connect'])) {
$servicestatus = 1;
}
} else {
if (isset($_GET['test'])) {
if (GETPOSTISSET('test')) {
$endpoint_secret = getDolGlobalString('STRIPE_TEST_WEBHOOK_KEY');
$service = 'StripeTest';
$servicestatus = 0;

View File

@ -53,7 +53,7 @@ if (empty($usedolheader)) {
<!-- Includes for JQuery (Ajax library) -->
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/base/jquery-ui.css" />
<!-- <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css" /> -->
<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1) ? '?dol_use_jmobile=1&dol_optimize_smallscreen=1' : ''; ?>" />
<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo (GETPOST("dol_use_jmobile") == 1) ? '?dol_use_jmobile=1&dol_optimize_smallscreen=1' : ''; ?>" />
<!-- Includes JS for JQuery -->
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery.min.js"></script>
<!-- migration fixes for removed Jquery functions -->

View File

@ -45,6 +45,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);

View File

@ -40,6 +40,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);

View File

@ -38,6 +38,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);

View File

@ -40,6 +40,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);

View File

@ -450,7 +450,7 @@ if (empty($reshook)) {
exit;
} else {
$db->rollback();
$_GET["commande_id"] = GETPOSTINT('commande_id');
//$_GET["commande_id"] = GETPOSTINT('commande_id');
$action = 'create';
}
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $permissiontovalidate) {

View File

@ -571,8 +571,8 @@ if (empty($reshook)) {
$db->rollback();
$action = 'create';
$_GET["origin"] = $_POST["origin"];
$_GET["originid"] = $_POST["originid"];
$_GET["origin"] = $_POST["origin"]; // Keep this ?
$_GET["originid"] = $_POST["originid"]; // Keep this ?
setEventMessages($object->error, $errors, 'errors');
$error++;
}

View File

@ -74,7 +74,6 @@ restrictedArea($user, 'societe', $object->id, '&societe');
top_httphead('application/json');
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
//print_r($_GET);
if (!empty($action) && $action == 'fetch' && !empty($id)) {
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';

View File

@ -93,19 +93,19 @@ abstract class ActionsCardCommon
$this->assign_post($action);
}
if ($_GET["type"] == 'f') {
if (GETPOST("type") == 'f') {
$this->object->fournisseur = 1;
}
if ($_GET["type"] == 'c') {
if (GETPOST("type") == 'c') {
$this->object->client = 1;
}
if ($_GET["type"] == 'p') {
if (GETPOST("type") == 'p') {
$this->object->client = 2;
}
if ($_GET["type"] == 'cp') {
if (GETPOST("type") == 'cp') {
$this->object->client = 3;
}
if ($_REQUEST["private"] == 1) {
if (GETPOST("private") == 1) {
$this->object->particulier = 1;
}

View File

@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
// If socid provided by ajax company selector
if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) {
$_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
if (GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha')) {
$_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); // Keep this ?
$_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); // Keep this ?
$_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); // Keep this ?
}
// Security check

View File

@ -33,7 +33,7 @@ $langs->load("cashdesk");
$id = GETPOSTINT('id');
$_GET['optioncss'] = "print";
//$_GET['optioncss'] = "print";
print '<center>';

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// If socid provided by ajax company selector
if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) {
if (GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha')) {
$_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');

View File

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$terminal = GETPOSTINT('terminal');
// If socid provided by ajax company selector
if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id'])) {
if (GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha')) {
$_GET['CASHDESK_ID_THIRDPARTY'.$terminal] = GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha');
$_POST['CASHDESK_ID_THIRDPARTY'.$terminal] = GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha');
$_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal] = GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha');

View File

@ -107,9 +107,9 @@ if (!$sortorder) {
$sortorder = "DESC";
}
if (GETPOST('search_fk_status', 'alpha') == 'non_closed') {
/*if (GETPOST('search_fk_status', 'alpha') == 'non_closed') {
$_GET['search_fk_statut'][] = 'openall'; // For backward compatibility
}
}*/
// Initialize array of search criteria
$search_all = (GETPOSTISSET("search_all") ? GETPOST("search_all", 'alpha') : GETPOST('sall'));

View File

@ -55,6 +55,7 @@ if (!defined('NOREQUIREAJAX')) {
// Some value of modulepart can be used to get resources that are public so no login are required.
// Note that only directory logo is free to access without login.
$needlogin = 1;
// Keep $_GET here, GETPOST is not available yet
if (isset($_GET["modulepart"])) {
// Some value of modulepart can be used to get resources that are public so no login are required.
@ -129,9 +130,9 @@ require 'main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$action = GETPOST('action', 'aZ09');
$original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp = GETPOST('hashp', 'aZ09', 1); // Must be read only by GET
$modulepart = GETPOST('modulepart', 'alpha', 1); // Must be read only by GET
$original_file = GETPOST('file', 'alphanohtml');
$hashp = GETPOST('hashp', 'aZ09', 1);
$modulepart = GETPOST('modulepart', 'alpha', 1);
$urlsource = GETPOST('urlsource', 'alpha');
$entity = (GETPOSTINT('entity') ? GETPOSTINT('entity') : $conf->entity);

View File

@ -110,7 +110,7 @@ class DocumentController extends Controller
if (preg_match('/\.(html|htm)$/i', $original_file)) {
$attachment = false;
}
if (isset($_GET["attachment"])) {
if (GETPOSTISSET("attachment")) {
$attachment = GETPOST("attachment", 'alpha') ? true : false;
}
if (getDolGlobalString('MAIN_DISABLE_FORCE_SAVEAS')) {

View File

@ -62,7 +62,7 @@ $attachment = true;
if (preg_match('/\.(html|htm)$/i', $original_file)) {
$attachment = false;
}
if (isset($_GET["attachment"])) {
if (GETPOSTISSET("attachment")) {
$attachment = (GETPOST("attachment", 'alphanohtml') ? true : false);
}
if (getDolGlobalString('MAIN_DISABLE_FORCE_SAVEAS_WEBSITE')) {
@ -183,13 +183,13 @@ if ($rss) {
if ($result >= 0) {
$attachment = false;
if (isset($_GET["attachment"])) {
$attachment = $_GET["attachment"];
if (GETPOSTISSET("attachment")) {
$attachment = GETPOST("attachment");
}
//$attachment = false;
$contenttype = 'application/rss+xml';
if (isset($_GET["contenttype"])) {
$contenttype = $_GET["contenttype"];
if (GETPOSTISSET("contenttype")) {
$contenttype = GETPOST("contenttype");
}
//$contenttype='text/plain';
$outputencoding = 'UTF-8';