diff --git a/ChangeLog b/ChangeLog
index 7bfd43947b6..1f4afc83e82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@ Following changes may create regressions for some external modules, but were nec
* Property num_paiement has been renamed num_payment everywhere for better code consistency.
* If you build a class that implement CommonObject to use the incoterm properties or method (->fk_incoterm, ->label_incoterm, ->location_incoterm),
you must now also include declaration of the Trait CommonIncoterm in your class. All incoterm functions were moved into this Trait.
+* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alpahnohtml');
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of
returns NaN because body is not loaded yet
diff --git a/SECURITY.md b/SECURITY.md
index 59311cf71ba..06d1407229a 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -62,13 +62,19 @@ No vulnerability disclosure, including partial is allowed for the moment.
## Scope for qualified vulnerabilities
-ONLY vulnerabilities discovered, when the following setup on tested platform is used, are accepted:
+ONLY vulnerabilities discovered, when the following setup on test platform is used, are accepted:
* $dolibarr_main_prod must be set to 1 into conf.php
-* $dolibarr_nocsrfcheck must be kept to the value 1 into conf.php (this is the default value)
-* The module DebugBar must NOT be enabled (by default, this module is not enabled)
+* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
+* $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be enabled soon by default)
-* ONLY security reports on "stable" modules are allowed (troubles into "experimental" and "developement" modules are not accepted).
+* The module DebugBar must NOT be enabled (by default, this module is not enabled. This is a developer tool)
+* The module ModuleBuilder must NOT be enabled (by default, this module is not enabled. This is a developer tool)
+* ONLY security reports on modules provided by default and with the "stable" status are allowed (troubles into "experimental", "developement" or external modules are not accepted).
+* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
+* The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly.
+* CSRF attacks are accepted for all when using a POST URL, but are accepted only for creating or updating data resctricted to the admin user when using GET URL.
+* Ability for a high level user to edit web site pages in the CMS by including javascript is an expected feature.
Scope is the web application (back office) and the APIs.
diff --git a/dev/initdemo/initdemo.sh b/dev/initdemo/initdemo.sh
index 7fd9eb551d4..1b32161b44b 100755
--- a/dev/initdemo/initdemo.sh
+++ b/dev/initdemo/initdemo.sh
@@ -69,6 +69,7 @@ then
255)
exit;;
esac
+ rm $fichtemp
# ----------------------------- database name
DIALOG=${DIALOG=dialog}
@@ -86,6 +87,7 @@ then
255)
exit;;
esac
+ rm $fichtemp
# ---------------------------- database port
DIALOG=${DIALOG=dialog}
@@ -104,6 +106,7 @@ then
255)
exit;;
esac
+ rm $fichtemp
# ---------------------------- compte admin mysql
DIALOG=${DIALOG=dialog}
@@ -122,6 +125,7 @@ then
255)
exit;;
esac
+ rm $fichtemp
# ---------------------------- mot de passe admin mysql
DIALOG=${DIALOG=dialog}
@@ -140,6 +144,7 @@ then
255)
exit;;
esac
+ rm $fichtemp
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
diff --git a/dev/initdemo/initdemopassword.sh b/dev/initdemo/initdemopassword.sh
new file mode 100755
index 00000000000..d5aa9c1ef0e
--- /dev/null
+++ b/dev/initdemo/initdemopassword.sh
@@ -0,0 +1,166 @@
+#!/bin/sh
+#------------------------------------------------------
+# Script to reinit admin password.
+# Note: "dialog" tool need to be available if no parameter provided.
+#
+# Laurent Destailleur - eldy@users.sourceforge.net
+#------------------------------------------------------
+# Usage: initdemopassword.sh confirm
+# usage: initdemopassword.sh confirm base port login pass
+#------------------------------------------------------
+
+
+export mydir=`echo "$0" | sed -e 's/initdemopassword.sh//'`;
+if [ "x$mydir" = 'x' -o "x$mydir" = 'x./' ]
+then
+ export mydir="."
+fi
+export id=`id -u`;
+
+
+# ----------------------------- check if root
+if [ "x$id" != "x0" -a "x$id" != "x1001" ]
+then
+ echo "Script must be ran as root"
+ exit
+fi
+
+
+# ----------------------------- command line params
+confirm=$1;
+base=$2;
+port=$3;
+demologin=$4;
+demopass=$5;
+
+# ----------------------------- check params
+if [ "x$confirm" != "xconfirm" ]
+then
+ echo "----- $0 -----"
+ echo "Usage: initdemopassword.sh confirm [base port login pass]"
+ exit
+fi
+
+
+# ----------------------------- if no params on command line
+if [ "x$demopass" = "x" ]
+then
+ export dumpfile=`ls -v $mydir/mysqldump_dolibarr_*.sql | tail -n 1`
+ export dumpfile=`basename $dumpfile`
+
+ # ----------------------------- database name
+ DIALOG=${DIALOG=dialog}
+ DIALOG="$DIALOG --ascii-lines"
+ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
+ trap "rm -f $fichtemp" 0 1 2 5 15
+ $DIALOG --title "Init Dolibarr with demo values" --clear \
+ --inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
+ valret=$?
+ case $valret in
+ 0)
+ base=`cat $fichtemp`;;
+ 1)
+ exit;;
+ 255)
+ exit;;
+ esac
+ rm $fichtemp
+
+ # ---------------------------- database port
+ DIALOG=${DIALOG=dialog}
+ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
+ trap "rm -f $fichtemp" 0 1 2 5 15
+ $DIALOG --title "Init Dolibarr with demo values" --clear \
+ --inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
+
+ valret=$?
+
+ case $valret in
+ 0)
+ port=`cat $fichtemp`;;
+ 1)
+ exit;;
+ 255)
+ exit;;
+ esac
+ rm $fichtemp
+
+
+ # ----------------------------- demo login
+ DIALOG=${DIALOG=dialog}
+ DIALOG="$DIALOG --ascii-lines"
+ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
+ trap "rm -f $fichtemp" 0 1 2 5 15
+ $DIALOG --title "Reset login password" --clear \
+ --inputbox "Login to reset :" 16 55 dolibarrdemologin 2> $fichtemp
+ valret=$?
+ case $valret in
+ 0)
+ demologin=`cat $fichtemp`;;
+ 1)
+ exit;;
+ 255)
+ exit;;
+ esac
+ rm fichtemp
+
+ # ----------------------------- demo pass
+ DIALOG=${DIALOG=dialog}
+ DIALOG="$DIALOG --ascii-lines"
+ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
+ trap "rm -f $fichtemp" 0 1 2 5 15
+ $DIALOG --title "Reset login password" --clear \
+ --inputbox "Pass to set :" 16 55 dolibarrdemopass 2> $fichtemp
+ valret=$?
+ case $valret in
+ 0)
+ demopass=`cat $fichtemp`;;
+ 1)
+ exit;;
+ 255)
+ exit;;
+ esac
+ rm fichtemp
+
+
+ export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
+
+
+ # ---------------------------- confirmation
+ DIALOG=${DIALOG=dialog}
+ $DIALOG --title "Init demo login with demo values" --clear \
+ --yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55
+
+ case $? in
+ 0) echo "Ok, start process...";;
+ 1) exit;;
+ 255) exit;;
+ esac
+
+fi
+
+
+# ---------------------------- run sql file
+if [ "x$passwd" != "x" ]
+then
+ export passwd="-p$passwd"
+fi
+#echo "mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile"
+#mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
+echo "echo \"UPDATE llx_user SET pass_crypted = MD5('$demopass') WHERE login = '$demologin';\" | mysql -P$port $base"
+echo "UPDATE llx_user SET pass_crypted = MD5('$demopass') WHERE login = '$demologin';" | mysql -P$port $base
+export res=$?
+
+if [ $res -ne 0 ]; then
+ echo "Error to execute sql with mysql -P$port -u$admin -p***** $base"
+ exit
+fi
+
+
+if [ "x$res" = "x0" ]
+then
+ echo "Success, file successfully loaded."
+else
+ echo "Error, load failed."
+fi
+echo
diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index e6264648159..93241901524 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -55,7 +55,7 @@ if (!$user->rights->accounting->chartofaccount) accessforbidden();
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php
index 89aad6e2d0d..5728f78b791 100644
--- a/htdocs/accountancy/admin/fiscalyear.php
+++ b/htdocs/accountancy/admin/fiscalyear.php
@@ -30,7 +30,7 @@ $action = GETPOST('action', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index a5000dda461..9079d95d670 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -47,7 +47,7 @@ $action = GETPOST('action', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 987f7f3fd28..f8f0cad1996 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -92,7 +92,7 @@ $search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index e5a18626b42..6e7b9dfb54f 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
@@ -69,7 +69,7 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php
index 34a23b377b9..ed8f347a177 100644
--- a/htdocs/accountancy/customer/card.php
+++ b/htdocs/accountancy/customer/card.php
@@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 6b326ec872f..2baed5d4653 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -62,7 +62,7 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) $page = 0;
$offset = $limit * $page;
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 96750389cc0..79a693978d1 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
@@ -70,7 +70,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php
index b21882b9461..ab02592f6b8 100644
--- a/htdocs/accountancy/expensereport/card.php
+++ b/htdocs/accountancy/expensereport/card.php
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy", "trips"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index 4fdc29b2c0f..afb6ae13a6e 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -56,7 +56,7 @@ $search_year = GETPOST("search_year", "int");
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) $page = 0;
$pageprev = $page - 1;
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index 76d13b99805..61e2a95fd88 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch", "hrm"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
@@ -66,7 +66,7 @@ $search_year = GETPOST("search_year", "int");
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php
index 07f3117c266..4a4747cfaf4 100644
--- a/htdocs/accountancy/supplier/card.php
+++ b/htdocs/accountancy/supplier/card.php
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index 6a5e234532c..dacca2a226d 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -63,7 +63,7 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) $page = 0;
$offset = $limit * $page;
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 9e0b64160e1..9b700aeac56 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
@@ -70,7 +70,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php
index ca1d1cc2a33..f2c52daa4b0 100644
--- a/htdocs/adherents/admin/adherent.php
+++ b/htdocs/adherents/admin/adherent.php
@@ -41,7 +41,7 @@ if (!$user->admin) accessforbidden();
$type = array('yesno', 'texte', 'chaine');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
/*
diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php
index 1b26a029a01..a3550e4a35a 100644
--- a/htdocs/adherents/admin/adherent_emails.php
+++ b/htdocs/adherents/admin/adherent_emails.php
@@ -41,7 +41,7 @@ if (!$user->admin) accessforbidden();
$oldtypetonewone = array('texte'=>'text', 'chaine'=>'string'); // old type to new ones
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$error = 0;
@@ -83,9 +83,9 @@ if ($action == 'update' || $action == 'add') {
$constlineid = GETPOST('rowid', 'int');
$constname = GETPOST('constname', 'alpha');
- $constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
+ $constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alphanohtml') : GETPOST('constvalue'));
$consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
- $constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
+ $constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'restricthtml') : GETPOST('constnote'));
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
$constvalue = preg_replace('/:member$/', '', $constvalue);
diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php
index d3d91ecba09..8ca29286cab 100644
--- a/htdocs/adherents/admin/adherent_extrafields.php
+++ b/htdocs/adherents/admin/adherent_extrafields.php
@@ -39,7 +39,7 @@ $tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'adherent'; //Must be the $table_element of the class that manage extrafield
diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php
index fe7989a70b9..5546a99a334 100644
--- a/htdocs/adherents/admin/adherent_type_extrafields.php
+++ b/htdocs/adherents/admin/adherent_type_extrafields.php
@@ -42,7 +42,7 @@ $tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'adherent_type'; //Must be the $table_element of the class that manage extrafield
diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php
index 0dbb998f764..64f16f8ef57 100644
--- a/htdocs/adherents/admin/website.php
+++ b/htdocs/adherents/admin/website.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "members"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
if (!$user->admin) accessforbidden();
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index cf1614bbb6e..d7a05a1805e 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal"));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
@@ -82,7 +82,7 @@ if (!empty($canvas)) {
}
// Security check
-$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas);
+$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
if ($id > 0) {
// Load member
@@ -254,7 +254,7 @@ if (empty($reshook)) {
$object->firstname = trim(GETPOST("firstname", 'alphanohtml'));
$object->lastname = trim(GETPOST("lastname", 'alphanohtml'));
$object->gender = trim(GETPOST("gender", 'alphanohtml'));
- $object->login = trim(GETPOST("login", 'alpha'));
+ $object->login = trim(GETPOST("login", 'alphanohtml'));
$object->pass = trim(GETPOST("pass", 'alpha'));
$object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated
@@ -404,10 +404,9 @@ if (empty($reshook)) {
// $facebook=GETPOST("member_facebook", 'alpha');
// $linkedin=GETPOST("member_linkedin", 'alpha');
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
- $login = GETPOST("member_login", 'alpha');
+ $login = GETPOST("member_login", 'alphanohtml');
$pass = GETPOST("password", 'alpha');
$photo = GETPOST("photo", 'alpha');
- //$comment=GETPOST("comment",'none');
$morphy = GETPOST("morphy", 'alphanohtml');
$public = GETPOST("public", 'alphanohtml');
@@ -836,7 +835,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
- print '
';
print '';
diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php
index 4acfd34a53a..85f56d298df 100644
--- a/htdocs/compta/paiement/card.php
+++ b/htdocs/compta/paiement/card.php
@@ -39,7 +39,7 @@ $langs->loadLangs(array('bills', 'banks', 'companies'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
@@ -60,7 +60,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
$db->begin();
$object->fetch($id);
- $result = $object->update_note(GETPOST('note', 'none'));
+ $result = $object->update_note(GETPOST('note', 'restricthtml'));
if ($result > 0)
{
$db->commit();
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index aaf216a7558..1691fe3ecfc 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -38,7 +38,7 @@ $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'compta'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
@@ -47,7 +47,7 @@ if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname);
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "b.dateo,b.rowid";
diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php
index 00c3440b868..68d987b06ff 100644
--- a/htdocs/compta/paiement/info.php
+++ b/htdocs/compta/paiement/info.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array('bills', 'companies'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
/*
diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php
index 349c483a5db..df0b92b5f44 100644
--- a/htdocs/compta/paiement/tovalidate.php
+++ b/htdocs/compta/paiement/tovalidate.php
@@ -41,7 +41,7 @@ if ($user->socid > 0)
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index 298866a2020..5f442ab0b18 100644
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("bills");
$chid = GETPOST("id", 'int');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$amounts = array();
// Security check
@@ -112,8 +112,8 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
$paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
- $paiement->note = GETPOST("note", 'none');
- $paiement->note_private = GETPOST("note", 'none');
+ $paiement->note = GETPOST("note", 'restricthtml');
+ $paiement->note_private = GETPOST("note", 'restricthtml');
if (!$error)
{
diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php
index 608c9fe594d..cb702174434 100644
--- a/htdocs/compta/prelevement/bons.php
+++ b/htdocs/compta/prelevement/bons.php
@@ -42,7 +42,7 @@ $type = GETPOST('type', 'aZ09');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php
index 6349660c59c..a70a464b428 100644
--- a/htdocs/compta/prelevement/card.php
+++ b/htdocs/compta/prelevement/card.php
@@ -37,7 +37,7 @@ $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawal
if ($user->socid > 0) accessforbidden();
// Get supervariables
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
@@ -46,7 +46,7 @@ $type = GETPOST('type', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index 8642e9ad7ab..8c8dc01a22c 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -46,7 +46,7 @@ $result = restrictedArea($user, 'prelevement', '', '', 'bons');
$type = GETPOST('type', 'aZ09');
// Get supervariables
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
$format = GETPOST('format', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index c4cb6f0c7c4..4104633e111 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -46,7 +46,7 @@ $type = GETPOST('type', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index 2cfc40bb30c..29d799a8554 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -46,7 +46,7 @@ $type = GETPOST('type', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index c59ed2d4232..3bb71f8c441 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -44,7 +44,7 @@ $type = GETPOST('type', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php
index ae146522f39..4120672b44e 100644
--- a/htdocs/compta/prelevement/line.php
+++ b/htdocs/compta/prelevement/line.php
@@ -39,14 +39,14 @@ $langs->loadlangs(array('banks', 'categories', 'bills', 'withdrawals'));
if ($user->socid > 0) accessforbidden();
// Get supervariables
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$type = GETPOST('type', 'aZ09');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$sortfield = GETPOST('sortfield', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if ($page == -1 || $page == null) { $page = 0; }
diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php
index 2666e8587e6..1255a2b861e 100644
--- a/htdocs/compta/prelevement/list.php
+++ b/htdocs/compta/prelevement/list.php
@@ -51,7 +51,7 @@ $type = GETPOST('type', 'aZ09');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php
index a8481d25f7a..6c38e65981b 100644
--- a/htdocs/compta/prelevement/rejets.php
+++ b/htdocs/compta/prelevement/rejets.php
@@ -42,7 +42,7 @@ $type = GETPOST('type', 'aZ09');
// Get supervariables
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$sortfield = GETPOST('sortfield', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index 8b75ec38fce..3106235430e 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -47,7 +47,7 @@ $hookmanager->initHooks(array('recapcomptacard', 'globalcard'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php
index 40ebcd1cb7c..341799a686a 100644
--- a/htdocs/compta/sociales/list.php
+++ b/htdocs/compta/sociales/list.php
@@ -35,7 +35,7 @@ if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/clas
// Load translation files required by the page
$langs->loadLangs(array('compta', 'banks', 'bills'));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index 78105cf9585..717b584fe44 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -98,7 +98,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
}
$object->amount = $amount;
$object->label = GETPOST("label", 'alpha');
- $object->note = GETPOST("note", 'none');
+ $object->note = GETPOST("note", 'restricthtml');
if (empty($object->datep))
{
diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example
index 32c37301a0e..6b1b5e0ea0a 100644
--- a/htdocs/conf/conf.php.example
+++ b/htdocs/conf/conf.php.example
@@ -219,10 +219,10 @@ $dolibarr_main_authentication='dolibarr';
// 1 = Force redirect to https, until SCRIPT_URI start with https into response
// 2 = Force redirect to https, until SERVER["HTTPS"] is 'on' into response
// 'https://my.domain.com' = Force redirect to https using this domain name.
-// Warning: If you enable this parameter, your web server must be configured to
-// respond URL with https protocol.
-// According to your web server setup, some values may works and other not. Try
-// different values (1,2 or 'https://my.domain.com') if you experience problems.
+// Warning: If you enable this parameter, your web server must be configured to respond URL with https protocol.
+// According to your web server setup, some values may works and other not. Try different values (1,2 or 'https://my.domain.com') if you experience problems.
+// Even if a redirect to HTTPS is forced by the webserver, it is recommanded to set this value to another value than 0, so your session cookies will be
+// flagged as secured.
// Default value: 0
// Possible values: 0, 1, 2 or 'https://my.domain.com'
// Examples:
@@ -233,12 +233,12 @@ $dolibarr_main_force_https='0';
// dolibarr_main_prod
// When this parameter is defined, all errors messages are not reported.
// This feature exists for production usage to avoid to give any information to hackers.
-// Default value: 0
+// Default value: 1
// Possible values: 0 or 1
// Examples:
-// $dolibarr_main_prod='0';
+// $dolibarr_main_prod='1';
//
-$dolibarr_main_prod='0';
+$dolibarr_main_prod='1';
// $dolibarr_main_restrict_os_commands
// To restrict commands you can execute by the backup feature, enter allowed command here.
@@ -260,8 +260,8 @@ $dolibarr_main_restrict_ip='';
// dolibarr_nocsrfcheck
// This parameter can be used to disable CSRF protection.
-// This might be required if you access Dolibarr behind a proxy that make
-// URL rewriting, to avoid false alarms.
+// This might be required if you access Dolibarr behind a proxy that make bad URL rewriting, to avoid false alarms.
+// In most cases, you should always keep this to 0.
// Default value: 0
// Possible values: 0 or 1
// Examples:
@@ -269,6 +269,12 @@ $dolibarr_main_restrict_ip='';
//
$dolibarr_nocsrfcheck='0';
+// dolibarr_cron_allow_cli
+// If set to 1, you will be able to define some command line in the internale Job scheduler module.
+// Default value: '0'
+// Examples: '1'
+$dolibarr_cron_allow_cli='0';
+
// dolibarr_mailing_limit_sendbyweb
// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
// Default value: '25'
diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php
index 0ea0018632b..7ac512bd32f 100644
--- a/htdocs/contact/agenda.php
+++ b/htdocs/contact/agenda.php
@@ -83,7 +83,7 @@ $search_agenda_label = GETPOST('search_agenda_label');
// Security check
if ($user->socid) $socid = $user->socid;
-$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', 0); // If we create a contact with no company (shared contacts), no check on write permission
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 6afef016d47..dab7242b598 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -78,7 +78,7 @@ if (!empty($canvas))
// Security check
if ($user->socid) $socid = $user->socid;
-$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', 0); // If we create a contact with no company (shared contacts), no check on write permission
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('contactcard', 'globalcard'));
@@ -207,8 +207,8 @@ if (empty($reshook))
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
$object->fax = GETPOST("fax", 'alpha');
$object->priv = GETPOST("priv", 'int');
- $object->note_public = GETPOST("note_public", 'none');
- $object->note_private = GETPOST("note_private", 'none');
+ $object->note_public = GETPOST("note_public", 'restricthtml');
+ $object->note_private = GETPOST("note_private", 'restricthtml');
$object->roles = GETPOST("roles", 'array');
$object->statut = 1; //Defult status to Actif
@@ -395,8 +395,8 @@ if (empty($reshook))
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
$object->fax = GETPOST("fax", 'alpha');
$object->priv = GETPOST("priv", 'int');
- $object->note_public = GETPOST("note_public", 'none');
- $object->note_private = GETPOST("note_private", 'none');
+ $object->note_public = GETPOST("note_public", 'restricthtml');
+ $object->note_private = GETPOST("note_private", 'restricthtml');
$object->roles = GETPOST("roles", 'array');
// Fill array 'array_options' with data from add form
diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php
index e21ee3e492b..f8498ddae9a 100644
--- a/htdocs/contact/document.php
+++ b/htdocs/contact/document.php
@@ -52,7 +52,7 @@ if (!empty($canvas))
// Security check
if ($user->socid) $socid = $user->socid;
-$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', 0); // If we create a contact with no company (shared contacts), no check on write permission
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 03324ed26c4..7bf82aa9379 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -44,7 +44,7 @@ $langs->loadLangs(array("companies", "suppliers", "categories"));
$socialnetworks = getArrayOfSocialNetworks();
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
@@ -105,7 +105,7 @@ $view = GETPOST("view", 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$userid = GETPOST('userid', 'int');
$begin = GETPOST('begin');
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index 724d9077ff1..1710b4dda6a 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
$langs->loadLangs(array('companies', 'other'));
$id = GETPOST('id', 'int');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
// Security check
if ($user->socid) $socid = $user->socid;
diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php
index 031a1b7498d..5343ab8f349 100644
--- a/htdocs/contrat/admin/contract_extrafields.php
+++ b/htdocs/contrat/admin/contract_extrafields.php
@@ -42,7 +42,7 @@ $tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'contrat'; //Must be the $element of the class that manage extrafield
diff --git a/htdocs/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php
index 3e068f5650b..bd0c7b132d0 100644
--- a/htdocs/contrat/admin/contractdet_extrafields.php
+++ b/htdocs/contrat/admin/contractdet_extrafields.php
@@ -42,7 +42,7 @@ $tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'contratdet'; //Must be the $element of the class that manage extrafield
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index cd622b38c28..fadf0831ada 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array("contracts", "orders", "companies", "bills", "products", 'compta'));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
@@ -665,7 +665,7 @@ if (empty($reshook))
$fk_unit = GETPOST('unit', 'alpha');
- $objectline->description = GETPOST('product_desc', 'none');
+ $objectline->description = GETPOST('product_desc', 'restricthtml');
$objectline->price_ht = GETPOST('elprice');
$objectline->subprice = GETPOST('elprice');
$objectline->qty = GETPOST('elqty');
@@ -811,7 +811,7 @@ if (empty($reshook))
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
- $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
+ $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
if ($ret < 0) $error++;
if (!$error) {
diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php
index 02d9c71776d..38a97d0aaa8 100644
--- a/htdocs/contrat/contact.php
+++ b/htdocs/contrat/contact.php
@@ -36,7 +36,7 @@ if (!empty($conf->projet->enabled)) {
// Load translation files required by the page
$langs->loadLangs(array('contracts', 'companies'));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php
index 40a9a4100da..1293da8cf26 100644
--- a/htdocs/contrat/index.php
+++ b/htdocs/contrat/index.php
@@ -38,7 +38,7 @@ $hookmanager->initHooks(array('contractindex'));
$langs->loadLangs(array('products', 'companies', 'contracts'));
$sortfield = GETPOST('sortfield', 'alpha');
-$sortorder = GETPOST('sortorder', 'alpha');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$statut = GETPOST('statut') ?GETPOST('statut') : 1;
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 945e6a7d936..608fc6c0d81 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('contracts', 'products', 'companies', 'compta'));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php
index d782ad5b3f5..d9eb8e3ccdc 100644
--- a/htdocs/contrat/note.php
+++ b/htdocs/contrat/note.php
@@ -34,7 +34,7 @@ if (!empty($conf->projet->enabled)) {
// Load translation files required by the page
$langs->loadLangs(array('companies', 'contracts'));
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 09f1c7cf314..4d4c12ce473 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -64,7 +64,7 @@ if ($action == 'add' && !empty($permissiontoadd))
// Set value to insert
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
- $value = GETPOST($key, 'none');
+ $value = GETPOST($key, 'restricthtml');
} elseif ($object->fields[$key]['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
} elseif ($object->fields[$key]['type'] == 'datetime') {
@@ -72,7 +72,7 @@ if ($action == 'add' && !empty($permissiontoadd))
} elseif ($object->fields[$key]['type'] == 'duration') {
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
- $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
+ $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = (GETPOST($key) == 'on' ? 1 : 0);
} else {
@@ -142,7 +142,7 @@ if ($action == 'update' && !empty($permissiontoadd))
// Set value to update
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
- $value = GETPOST($key, 'none');
+ $value = GETPOST($key, 'restricthtml');
} elseif ($object->fields[$key]['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} elseif ($object->fields[$key]['type'] == 'datetime') {
@@ -154,7 +154,7 @@ if ($action == 'update' && !empty($permissiontoadd))
$value = '';
}
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
- $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
+ $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
} else {
diff --git a/htdocs/core/actions_changeselectedfields.inc.php b/htdocs/core/actions_changeselectedfields.inc.php
index 9a03ba0d29e..f4e7f01d234 100644
--- a/htdocs/core/actions_changeselectedfields.inc.php
+++ b/htdocs/core/actions_changeselectedfields.inc.php
@@ -28,7 +28,7 @@
// $object must be defined (object is loaded in this file with fetch)
// Save selection
-if (GETPOST('formfilteraction', 'none') == 'listafterchangingselectedfields')
+if (GETPOST('formfilteraction', 'alphanohtml') == 'listafterchangingselectedfields')
{
$tabparam = array();
diff --git a/htdocs/core/actions_comments.inc.php b/htdocs/core/actions_comments.inc.php
index c352f07f9f7..079f207b4a4 100644
--- a/htdocs/core/actions_comments.inc.php
+++ b/htdocs/core/actions_comments.inc.php
@@ -35,7 +35,7 @@ $comment = new Comment($db);
if ($action == 'addcomment')
{
- $description = GETPOST('comment_description', 'none');
+ $description = GETPOST('comment_description', 'restricthtml');
if (!empty($description))
{
$comment->description = $description;
@@ -59,7 +59,7 @@ if ($action === 'updatecomment')
{
if ($comment->fetch($idcomment) >= 0)
{
- $comment->description = GETPOST('comment_description', 'none');
+ $comment->description = GETPOST('comment_description', 'restricthtml');
if ($comment->update($user) > 0)
{
setEventMessages($langs->trans("CommentAdded"), null, 'mesgs');
diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php
index 7884fc09e67..3caeeed6678 100644
--- a/htdocs/core/actions_linkedfiles.inc.php
+++ b/htdocs/core/actions_linkedfiles.inc.php
@@ -63,7 +63,7 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC))
}
}
}
-} elseif (GETPOST('linkit', 'none') && !empty($conf->global->MAIN_UPLOAD_DOC))
+} elseif (GETPOST('linkit', 'restricthtml') && !empty($conf->global->MAIN_UPLOAD_DOC))
{
$link = GETPOST('link', 'alpha');
if ($link)
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 612f988305f..4db4c94f007 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -141,7 +141,7 @@ if (!$error && $massaction == 'confirm_presend')
$massaction = 'presend';
}
- if (!GETPOST('subject', 'none'))
+ if (!GETPOST('subject', 'restricthtml'))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings');
@@ -376,8 +376,8 @@ if (!$error && $massaction == 'confirm_presend')
}
$replyto = $from;
- $subject = GETPOST('subject', 'none');
- $message = GETPOST('message', 'none');
+ $subject = GETPOST('subject', 'restricthtml');
+ $message = GETPOST('message', 'restricthtml');
$sendtobcc = GETPOST('sendtoccc');
if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index da010380276..5be25002079 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -300,8 +300,8 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
}
$replyto = dol_string_nospecial($_POST['replytoname'], ' ', array(",")).' <'.$_POST['replytomail'].'>';
- $message = GETPOST('message', 'none');
- $subject = GETPOST('subject', 'none');
+ $message = GETPOST('message', 'restricthtml');
+ $subject = GETPOST('subject', 'restricthtml');
// Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
//
diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php
index 7ea3dd5016f..61db9b9fc55 100644
--- a/htdocs/core/actions_setnotes.inc.php
+++ b/htdocs/core/actions_setnotes.inc.php
@@ -33,7 +33,7 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel',
if (empty($action) || !is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
- $result_update = $object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES, 'UTF-8', 1), '_public');
+ $result_update = $object->update_note(dol_html_entity_decode(GETPOST('note_public', 'restricthtml'), ENT_QUOTES, 'UTF-8', 1), '_public');
if ($result_update < 0) setEventMessages($object->error, $object->errors, 'errors');
elseif (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture')))
@@ -63,6 +63,6 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel',
// Set public note
if (empty($action) || !is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
- $result = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES), '_private');
+ $result = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES), '_private');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php
index 1ed8ca34076..456542e331e 100644
--- a/htdocs/core/ajax/constantonoff.php
+++ b/htdocs/core/ajax/constantonoff.php
@@ -30,7 +30,7 @@ if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$name = GETPOST('name', 'alpha');
/*
diff --git a/htdocs/core/ajax/contacts.php b/htdocs/core/ajax/contacts.php
index 67e769ab17f..6b476a8f59a 100644
--- a/htdocs/core/ajax/contacts.php
+++ b/htdocs/core/ajax/contacts.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2016 Laurent Destailleur
+ * Copyright (C) 2020 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,11 +27,15 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../../main.inc.php';
-$id = GETPOST('id', 'int');
-$action = GETPOST('action', 'alpha');
+$id = GETPOST('id', 'int'); // id of thirdparty
+$action = GETPOST('action', 'aZ09');
$htmlname = GETPOST('htmlname', 'alpha');
$showempty = GETPOST('showempty', 'int');
+// Security check
+$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
+
+
/*
* View
*/
diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php
index 6c9f97bfbb0..ceb221b4870 100644
--- a/htdocs/core/ajax/objectonoff.php
+++ b/htdocs/core/ajax/objectonoff.php
@@ -30,7 +30,7 @@ if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$value = GETPOST('value', 'int');
$field = GETPOST('field', 'alpha');
diff --git a/htdocs/core/ajax/pingresult.php b/htdocs/core/ajax/pingresult.php
index e08b2c5efcf..e58895a967f 100644
--- a/htdocs/core/ajax/pingresult.php
+++ b/htdocs/core/ajax/pingresult.php
@@ -30,7 +30,7 @@ if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$hash_unique_id = GETPOST('hash_unique_id', 'alpha');
$hash_algo = GETPOST('hash_algo', 'alpha');
diff --git a/htdocs/core/ajax/selectobject.php b/htdocs/core/ajax/selectobject.php
index eed6c21c126..a672510555b 100644
--- a/htdocs/core/ajax/selectobject.php
+++ b/htdocs/core/ajax/selectobject.php
@@ -33,7 +33,7 @@ $objectdesc = GETPOST('objectdesc', 'alpha');
$htmlname = GETPOST('htmlname', 'aZ09');
$sqlfilter = GETPOST('sqlfilter', 'alpha');
$outjson = (GETPOST('outjson', 'int') ? GETPOST('outjson', 'int') : 0);
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php
index 00b66ced374..29aeb9cc7eb 100644
--- a/htdocs/core/ajax/selectsearchbox.php
+++ b/htdocs/core/ajax/selectsearchbox.php
@@ -48,7 +48,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
//global $hookmanager;
$hookmanager->initHooks(array('searchform'));
-$search_boxvalue = GETPOST('q', 'none');
+$search_boxvalue = GETPOST('q', 'restricthtml');
$arrayresult = array();
diff --git a/htdocs/core/ajax/vatrates.php b/htdocs/core/ajax/vatrates.php
index b0ab6ed2a7e..0bd16eb6449 100644
--- a/htdocs/core/ajax/vatrates.php
+++ b/htdocs/core/ajax/vatrates.php
@@ -27,7 +27,7 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../../main.inc.php';
$id = GETPOST('id', 'int');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
$htmlname = GETPOST('htmlname', 'alpha');
$selected = (GETPOST('selected') ?GETPOST('selected') : '-1');
$productid = (GETPOST('productid', 'int') ?GETPOST('productid', 'int') : 0);
diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php
index e5fa9d8fb0d..51719ec6c15 100644
--- a/htdocs/core/boxes/modules_boxes.php
+++ b/htdocs/core/boxes/modules_boxes.php
@@ -422,6 +422,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
{
while (($file = readdir($handle)) !== false)
{
+ $reg = array();
if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $file, $reg))
{
if (preg_match('/\.back$/', $file)) continue;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index a381014983b..ef519f388a7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6690,7 +6690,9 @@ abstract class CommonObject
break;
case "create":
case "edit":
- $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
+ $check = 'restricthtml';
+ // TODO Use check = 'alphahtml' or 'int' for some types
+ $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, $check); // GETPOST can get value from GET, POST or setup of default values.
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix))
{
@@ -6765,7 +6767,7 @@ abstract class CommonObject
// HTML, select, integer and text add default value
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
{
- if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
+ if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'restricthtml', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
else $value = $this->array_options['options_'.$key];
}
@@ -6775,7 +6777,7 @@ abstract class CommonObject
$out .= '
';
$out .= '
browser->layout == 'phone') $ret.='';
- $ret .= '
';
+ $ret .= '
';
// For thirdparty, contact, user, member, the ref is the id, so we show something else
if ($object->element == 'societe')
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 70f68a31894..360248a741e 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1207,7 +1207,7 @@ class FormFile
$editline = 1;
} else {
$filenametoshow = preg_replace('/\.noexe$/', '', $file['name']);
- print dol_trunc($filenametoshow, 200);
+ print dol_escape_htmltag(dol_trunc($filenametoshow, 200));
print '';
}
// Preview link
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 3c006d8810f..f7acd09dbd1 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -675,7 +675,7 @@ class FormMail extends Form
{
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoselected = GETPOST("receiver", 'none'); // Array of selected value
+ $withtoselected = GETPOST("receiver", 'restricthtml'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
@@ -699,7 +699,7 @@ class FormMail extends Form
{
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoselected = GETPOST("receiveruser", 'none'); // Array of selected value
+ $withtoselected = GETPOST("receiveruser", 'restricthtml'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
@@ -763,7 +763,7 @@ class FormMail extends Form
{
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoselected = GETPOST("receiverccuser", 'none'); // Array of selected value
+ $withtoselected = GETPOST("receiverccuser", 'restricthtml'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
@@ -886,7 +886,7 @@ class FormMail extends Form
// Message
if (!empty($this->withbody))
{
- $defaultmessage = GETPOST('message', 'none');
+ $defaultmessage = GETPOST('message', 'restricthtml');
if (!GETPOST('modelselected', 'alpha') || GETPOST('modelmailselected') != '-1')
{
if ($arraydefaultmessage && $arraydefaultmessage->content) {
@@ -1144,7 +1144,7 @@ class FormMail extends Form
{
global $conf, $langs, $form;
- $defaulttopic = GETPOST('subject', 'none');
+ $defaulttopic = GETPOST('subject', 'restricthtml');
if (!GETPOST('modelselected', 'alpha') || GETPOST('modelmailselected') != '-1') {
if ($arraydefaultmessage && $arraydefaultmessage->topic) {
$defaulttopic = $arraydefaultmessage->topic;
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index f6973314101..35ad4b83a7f 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -231,7 +231,7 @@ class FormTicket
}
// MESSAGE
- $msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : '';
+ $msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : '';
print '
';
// If public form, display more information
diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php
index a8bd9e93c3c..fa30da5b10a 100644
--- a/htdocs/core/customreports.php
+++ b/htdocs/core/customreports.php
@@ -55,7 +55,7 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
- $sortorder = GETPOST('sortorder', 'alpha');
+ $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
diff --git a/htdocs/core/data/cloud_metadata_for_ssrf_test.txt b/htdocs/core/data/cloud_metadata_for_ssrf_test.txt
new file mode 100644
index 00000000000..4d98b656b3c
--- /dev/null
+++ b/htdocs/core/data/cloud_metadata_for_ssrf_test.txt
@@ -0,0 +1,23 @@
+## This file is a list of predefined URLs to block when trying to access them from the application,
+## for example when using the grab website feature of module website
+## Allowing grabbing local url allow to get metadata.
+
+10.0.0.0/8
+0.0.0.0/8
+100.64.0.0/10
+127.0.0.0/8
+169.254.0.0/16
+172.16.0.0/12
+192.0.0.0/29
+192.0.2.0/24
+192.88.99.0/24
+192.168.0.0/16
+198.18.0.0/15
+198.51.100.0/24
+203.0.113.0/24
+224.0.0.0/4
+240.0.0.0/4
+metadata.google.internal
+100.100.100.200 (Alibaba Metadata)
+[::]
+[::1]
diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php
index d1d5d434b5b..8f7ff82ecff 100644
--- a/htdocs/core/filemanagerdol/browser/default/browser.php
+++ b/htdocs/core/filemanagerdol/browser/default/browser.php
@@ -95,6 +95,10 @@ var sServerPath = GetUrlParam( 'ServerPath' );
if ( sServerPath.length > 0 )
oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ;
+/* @CHANGE LDR Overwrite value coming from parameters for security purpose */
+oConnector.ConnectorUrl = '';
+console.log('ConnectorUrl='+oConnector.ConnectorUrl);
+
oConnector.ResourceType = GetUrlParam( 'Type' );
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 );
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index ba96efbfd62..d8bf9ca5a1e 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2013,8 +2013,10 @@ function dol_uncompress($inputfile, $outputdir)
dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir);
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
$archive = new PclZip($inputfile);
- $result = $archive->extract(PCLZIP_OPT_PATH, $outputdir);
- //var_dump($result);
+
+ // Extract into outputdir, but only files that match the regex '/^((?!\.\.).)*$/' that means "does not include .."
+ $result = $archive->extract(PCLZIP_OPT_PATH, $outputdir, PCLZIP_OPT_BY_PREG, '/^((?!\.\.).)*$/');
+
if (!is_array($result) && $result <= 0) return array('error'=>$archive->errorInfo(true));
else {
$ok = 1; $errmsg = '';
@@ -2035,14 +2037,26 @@ function dol_uncompress($inputfile, $outputdir)
}
}
- if (class_exists('ZipArchive'))
+ if (class_exists('ZipArchive')) // Must install php-zip to have it
{
dol_syslog("Class ZipArchive is set so we unzip using ZipArchive to unzip into ".$outputdir);
$zip = new ZipArchive;
$res = $zip->open($inputfile);
if ($res === true)
{
- $zip->extractTo($outputdir.'/');
+ //$zip->extractTo($outputdir.'/');
+ // We must extract one file at time so we can check that file name does not contains '..' to avoid transversal path of zip built for example using
+ // python3 path_traversal_archiver.py test.zip -l 10 -p tmp/
+ // with -l is the range of dot to go back in path.
+ // and path_traversal_archiver.py found at https://github.com/Alamot/code-snippets/blob/master/path_traversal/path_traversal_archiver.py
+ for ($i = 0; $i < $zip->numFiles; $i++) {
+ if (preg_match('/\.\./', $zip->getNameIndex($i))) {
+ dol_syslog("Warning: Try to unzip a file with a transversal path ".$zip->getNameIndex($i), LOG_WARNING);
+ continue; // Discard the file
+ }
+ $zip->extractTo($outputdir.'/', array($zip->getNameIndex($i)));
+ }
+
$zip->close();
return array();
} else {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 7abe2e50236..051f8a031ca 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -82,6 +82,12 @@ function getEntity($element, $shared = 1, $currentobject = null)
{
global $conf, $mc;
+ // fix different element names (France to English)
+ switch ($element) {
+ case 'contrat': $element = 'contract'; break; // "/contrat/class/contrat.class.php"
+ case 'order_supplier': $element = 'supplier_order'; break; // "/fourn/class/fournisseur.commande.class.php"
+ }
+
if (is_object($mc))
{
return $mc->getEntity($element, $shared, $currentobject);
@@ -271,12 +277,13 @@ function GETPOSTISSET($paramname)
* 'none'=no check (only for param that should have very rich content)
* 'int'=check it's numeric (integer or float)
* 'intcomma'=check it's integer+comma ('1,2,3,4...')
- * 'alpha'=check it's text and sign
+ * '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', 'alphanohtml'=check there is no html content
+ * 'nohtml'=check there is no html content and no " and no ../
* 'restricthtml'=check html content is restricted to some tags only
* 'custom'= custom filter specify $filter and $options)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
@@ -549,13 +556,6 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
case 'intcomma':
if (preg_match('/[^0-9,-]+/i', $out)) $out = '';
break;
- case 'alpha':
- if (!is_array($out)) {
- // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
- // '../' is dangerous because it allows dir transversals
- $out = str_replace(array('"', '../'), '', trim($out));
- }
- break;
case 'san_alpha':
$out = filter_var($out, FILTER_SANITIZE_STRING);
break;
@@ -586,12 +586,13 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
case 'nohtml':
$out = dol_string_nohtmltag($out, 0);
break;
+ case 'alpha': // No html and no " and no ../
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
if (!is_array($out))
{
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
- $out = str_replace(array('"', '../'), '', trim($out));
+ $out = str_replace(array('"', '"', '../'), '', trim($out));
$out = dol_string_nohtmltag($out, 0);
}
break;
@@ -1197,11 +1198,11 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
if ($morehtmlright) $out .= '