diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index a35aef780d2..57b4b5aad06 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -51,10 +51,10 @@ $type = 'bom'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstbom = GETPOST('maskconstBom', 'alpha'); + $maskconstbom = GETPOST('maskconstBom', 'aZ09'); $maskbom = GETPOST('maskBom', 'alpha'); - if ($maskconstbom) { + if ($maskconstbom && preg_match('/_MASK$/', $maskconstbom)) { $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index ed05180ef24..77994debadb 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -54,9 +54,9 @@ if (empty($conf->global->CHEQUERECEIPTS_ADDON)) { */ if ($action == 'updateMask') { - $maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'alpha'); + $maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'aZ09'); $maskchequereceipts = GETPOST('maskchequereceipts', 'alpha'); - if ($maskconstchequereceipts) { + if ($maskconstchequereceipts && preg_match('/_MASK$/', $maskconstchequereceipts)) { $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 34a5e281fac..79c42f6e2db 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -61,10 +61,10 @@ $type = 'order'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstorder = GETPOST('maskconstorder', 'alpha'); + $maskconstorder = GETPOST('maskconstorder', 'aZ09'); $maskorder = GETPOST('maskorder', 'alpha'); - if ($maskconstorder) { + if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) { $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 48247bf0b8e..c5a4d1a3463 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -58,9 +58,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; $error=0; if ($action == 'updateMask') { - $maskconst = GETPOST('maskconstcontract', 'alpha'); + $maskconst = GETPOST('maskconstcontract', 'aZ09'); $maskvalue = GETPOST('maskcontract', 'alpha'); - if ($maskconst) { + if ($maskconst && preg_match('/_MASK$/', $maskconst)) { $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index a1fef4091ce..9094762f68d 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -90,9 +90,9 @@ if ($action == 'activate_delivery') { } if ($action == 'updateMask') { - $maskconstdelivery = GETPOST('maskconstdelivery', 'alpha'); + $maskconstdelivery = GETPOST('maskconstdelivery', 'aZ09'); $maskdelivery = GETPOST('maskdelivery', 'alpha'); - if ($maskconstdelivery) { + if ($maskconstdelivery && preg_match('/_MASK$/', $maskconstdelivery)) { $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index cc9b8d7bca8..31df0ffe142 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -88,10 +88,10 @@ if ((float) DOL_VERSION >= 6) { } if ($action == 'updateMask') { - $maskconstorder = GETPOST('maskconstorder', 'alpha'); + $maskconstorder = GETPOST('maskconstorder', 'aZ09'); $maskorder = GETPOST('maskorder', 'alpha'); - if ($maskconstorder) { + if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) { $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 485ce901e5c..1db6a9cc9d6 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -62,9 +62,9 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconst = GETPOST('maskconstexpedition', 'alpha'); + $maskconst = GETPOST('maskconstexpedition', 'aZ09'); $maskvalue = GETPOST('maskexpedition', 'alpha'); - if (!empty($maskconst)) { + if (!empty($maskconst) && preg_match('/_MASK$/', $maskconst)) { $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 8c20b493105..25bef9fde22 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -58,9 +58,9 @@ $type = 'expensereport'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconst = GETPOST('maskconst', 'alpha'); + $maskconst = GETPOST('maskconst', 'aZ09'); $maskvalue = GETPOST('maskvalue', 'alpha'); - if ($maskconst) { + if ($maskconst && preg_match('/_MASK$/', $maskconst)) { $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 10746c794be..a715004529e 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -58,24 +58,24 @@ $type = 'invoice'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstinvoice = GETPOST('maskconstinvoice', 'alpha'); - $maskconstreplacement = GETPOST('maskconstreplacement', 'alpha'); - $maskconstcredit = GETPOST('maskconstcredit', 'alpha'); - $maskconstdeposit = GETPOST('maskconstdeposit', 'alpha'); + $maskconstinvoice = GETPOST('maskconstinvoice', 'aZ09'); + $maskconstreplacement = GETPOST('maskconstreplacement', 'aZ09'); + $maskconstcredit = GETPOST('maskconstcredit', 'aZ09'); + $maskconstdeposit = GETPOST('maskconstdeposit', 'aZ09'); $maskinvoice = GETPOST('maskinvoice', 'alpha'); $maskreplacement = GETPOST('maskreplacement', 'alpha'); $maskcredit = GETPOST('maskcredit', 'alpha'); $maskdeposit = GETPOST('maskdeposit', 'alpha'); - if ($maskconstinvoice) { + if ($maskconstinvoice && preg_match('/_MASK_/', $maskconstinvoice)) { $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity); } - if ($maskconstreplacement) { + if ($maskconstreplacement && preg_match('/_MASK_/', $maskconstreplacement)) { $res = dolibarr_set_const($db, $maskconstreplacement, $maskreplacement, 'chaine', 0, '', $conf->entity); } - if ($maskconstcredit) { + if ($maskconstcredit && preg_match('/_MASK_/', $maskconstcredit)) { $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity); } - if ($maskconstdeposit) { + if ($maskconstdeposit && preg_match('/_MASK_/', $maskconstdeposit)) { $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index cf637d37329..2e331b3cc80 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -58,9 +58,9 @@ $type = 'ficheinter'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconst = GETPOST('maskconst', 'alpha'); + $maskconst = GETPOST('maskconst', 'aZ09'); $maskvalue = GETPOST('maskvalue', 'alpha'); - if ($maskconst) { + if ($maskconst && preg_match('/_MASK$/', $maskconst)) { $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 9a60c6b9b84..b85e257c69e 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -58,9 +58,9 @@ if (empty($conf->global->HOLIDAY_ADDON)) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconst = GETPOST('maskconstholiday', 'alpha'); + $maskconst = GETPOST('maskconstholiday', 'aZ09'); $maskvalue = GETPOST('maskholiday', 'alpha'); - if ($maskconst) { + if ($maskconst && preg_match('/_MASK$/', $maskconst)) { $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 08ece979e21..81968a945f1 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -91,10 +91,10 @@ if ($action == 'update') { } } } elseif ($action == 'updateMask') { - $maskconstorder = GETPOST('maskconstorder', 'alpha'); + $maskconstorder = GETPOST('maskconstorder', 'aZ09'); $maskorder = GETPOST('maskorder', 'alpha'); - if ($maskconstorder) { + if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) { $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index b1710a53839..e93128a6a0c 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -69,11 +69,11 @@ if (!$user->admin) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstorder = GETPOST('maskconstorder', 'alpha'); + $maskconst = GETPOST('maskconst', 'aZ09'); $maskorder = GETPOST('maskorder', 'alpha'); - if ($maskconstorder) { - $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); + if ($maskconst && preg_match('/_MASK$/', $maskconst)) { + $res = dolibarr_set_const($db, $maskconst, $maskorder, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 36a82e965f4..21fff1c45e6 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -52,10 +52,10 @@ $type = 'mrp'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstmrp = GETPOST('maskconstMo', 'alpha'); + $maskconstmrp = GETPOST('maskconstMo', 'aZ09'); $maskmrp = GETPOST('maskMo', 'alpha'); - if ($maskconstmrp) { + if ($maskconstmrp && preg_match('/_MASK$/', $maskconstmrp)) { $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 59da712b266..7b0d0acbf06 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -51,9 +51,9 @@ if (empty($conf->global->PAYMENT_ADDON)) { */ if ($action == 'updateMask') { - $maskconstpayment = GETPOST('maskconstpayment', 'alpha'); + $maskconstpayment = GETPOST('maskconstpayment', 'aZ09'); $maskpayment = GETPOST('maskpayment', 'alpha'); - if ($maskconstpayment) { + if ($maskconstpayment && preg_match('/_MASK$/', $maskconstpayment)) { $res = dolibarr_set_const($db, $maskconstpayment, $maskpayment, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 7883cc7da20..10044e33b5b 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -58,9 +58,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; $error = 0; if ($action == 'updateMask') { - $maskconstpropal = GETPOST('maskconstpropal', 'alpha'); + $maskconstpropal = GETPOST('maskconstpropal', 'aZ09'); $maskpropal = GETPOST('maskpropal', 'alpha'); - if ($maskconstpropal) { + if ($maskconstpropal && preg_match('/_MASK$/', $maskconstpropal)) { $res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index c86db66e464..32f6c5b226e 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -65,9 +65,9 @@ if (empty($conf->global->RECEPTION_ADDON_NUMBER)) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconst = GETPOST('maskconstreception', 'alpha'); + $maskconst = GETPOST('maskconstreception', 'aZ09'); $maskvalue = GETPOST('maskreception', 'alpha'); - if (!empty($maskconst)) { + if (!empty($maskconst) && preg_match('/_MASK$/', $maskconst)) { $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index 3bcd00c1fe8..02c73bb2a76 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -64,10 +64,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha'); + $maskconststocktransfer = GETPOST('maskconststocktransfer', 'aZ09'); $maskstocktransfer = GETPOST('maskStockTransfer', 'alpha'); - if ($maskconststocktransfer) { + if ($maskconststocktransfer && preg_match('/_MASK$/', $maskconststocktransfer)) { $res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity); if ($res <= 0) $error++; } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 3524111c96e..7b1831e759d 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -38,10 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "other", "orders")); -if (!$user->admin) { - accessforbidden(); -} - $type = GETPOST('type', 'alpha'); $value = GETPOST('value', 'alpha'); $action = GETPOST('action', 'aZ09'); @@ -52,26 +48,32 @@ $scandir = GETPOST('scan_dir', 'alpha'); $specimenthirdparty = new Societe($db); $specimenthirdparty->initAsSpecimen(); +$error = 0; + +if (!$user->admin) { + accessforbidden(); +} + /* * Actions */ if ($action == 'updateMask') { - $maskconstinvoice = GETPOST('maskconstinvoice', 'alpha'); - $maskconstcredit = GETPOST('maskconstcredit', 'alpha'); - $maskconstdeposit = GETPOST('maskconstdeposit', 'alpha'); + $maskconstinvoice = GETPOST('maskconstinvoice', 'aZ09'); + $maskconstcredit = GETPOST('maskconstcredit', 'aZ09'); + $maskconstdeposit = GETPOST('maskconstdeposit', 'aZ09'); $maskinvoice = GETPOST('maskinvoice', 'alpha'); $maskcredit = GETPOST('maskcredit', 'alpha'); $maskdeposit = GETPOST('maskdeposit', 'alpha'); - if ($maskconstinvoice) { + if ($maskconstinvoice && preg_match('/_MASK$/', $maskconstinvoice)) { $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity); } - if ($maskconstcredit) { + if ($maskconstcredit && preg_match('/_MASK$/', $maskconstcredit)) { $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity); } - if ($maskconstdeposit) { + if ($maskconstdeposit && preg_match('/_MASK$/', $maskconstdeposit)) { $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index bb1b94d4385..abee8200cef 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -61,10 +61,10 @@ $specimenthirdparty->initAsSpecimen(); include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstorder = GETPOST('maskconstorder', 'alpha'); + $maskconstorder = GETPOST('maskconstorder', 'aZ09'); $maskvalue = GETPOST('maskorder', 'alpha'); - if ($maskconstorder) { + if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) { $res = dolibarr_set_const($db, $maskconstorder, $maskvalue, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 86fcccfb8f2..ac00e4846ac 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -52,9 +52,9 @@ $type = 'supplier_payment'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstsupplierpayment = GETPOST('maskconstsupplierpayment', 'alpha'); + $maskconstsupplierpayment = GETPOST('maskconstsupplierpayment', 'aZ09'); $masksupplierpayment = GETPOST('masksupplierpayment', 'alpha'); - if ($maskconstsupplierpayment) { + if ($maskconstsupplierpayment && preg_match('/_MASK$/', $maskconstsupplierpayment)) { $res = dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 993e19fc796..62be111449d 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -55,9 +55,9 @@ $error = 0; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstsupplier_proposal = GETPOST('maskconstsupplier_proposal', 'alpha'); + $maskconstsupplier_proposal = GETPOST('maskconstsupplier_proposal', 'aZ09'); $masksupplier_proposal = GETPOST('masksupplier_proposal', 'alpha'); - if ($maskconstsupplier_proposal) { + if ($maskconstsupplier_proposal && preg_match('/_MASK$/', $maskconstsupplier_proposal)) { $res = dolibarr_set_const($db, $maskconstsupplier_proposal, $masksupplier_proposal, 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 9cebbc3b36d..6a6201642ee 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -47,7 +47,7 @@ $scandir = GETPOST('scandir', 'alpha'); $type = 'ticket'; $error = 0; - +$reg = array(); /* * Actions @@ -56,10 +56,10 @@ $error = 0; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstticket = GETPOST('maskconstticket', 'alpha'); + $maskconstticket = GETPOST('maskconstticket', 'aZ09'); $maskticket = GETPOST('maskticket', 'alpha'); - if ($maskconstticket) { + if ($maskconstticket && preg_match('/_MASK$/', $maskconstticket)) { $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity); } @@ -484,7 +484,7 @@ foreach ($dirmodels as $reldir) { // Preview print '