Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-04-19 14:00:18 +02:00
commit 8aab183567
15 changed files with 49 additions and 94 deletions

View File

@ -29,19 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
$langs->load("members"); $langs->loadLangs(array("members","errors"));
$langs->load("errors");
// Choix de l'annee d'impression ou annee courante. // Choix de l'annee d'impression ou annee courante.
$now = dol_now(); $now = dol_now();
$year=dol_print_date($now,'%Y'); $year=dol_print_date($now,'%Y');
$month=dol_print_date($now,'%m'); $month=dol_print_date($now,'%m');
$day=dol_print_date($now,'%d'); $day=dol_print_date($now,'%d');
$foruserid=GETPOST('foruserid'); $foruserid=GETPOST('foruserid','alphanohtml');
$foruserlogin=GETPOST('foruserlogin'); $foruserlogin=GETPOST('foruserlogin','alphanohtml');
$mode=GETPOST('mode'); $mode=GETPOST('mode','aZ09');
$model=GETPOST("model"); // Doc template to use for business cards $model=GETPOST("model",'aZ09'); // Doc template to use for business cards
$modellabel=GETPOST("modellabel"); // Doc template to use for address sheet $modellabel=GETPOST("modellabel",'aZ09'); // Doc template to use for address sheet
$mesg=''; $mesg='';
$adherentstatic=new Adherent($db); $adherentstatic=new Adherent($db);

View File

@ -43,7 +43,7 @@ $toselect = GETPOST('toselect', 'array');
$result=restrictedArea($user,'adherent'); $result=restrictedArea($user,'adherent');
$filter=GETPOST("filter",'alpha'); $filter=GETPOST("filter",'alpha');
$statut=GETPOST("statut",'alpha'); $statut=GETPOST("statut",'intcomma');
$search=GETPOST("search",'alpha'); $search=GETPOST("search",'alpha');
$search_ref=GETPOST("search_ref",'alpha'); $search_ref=GETPOST("search_ref",'alpha');
$search_lastname=GETPOST("search_lastname",'alpha'); $search_lastname=GETPOST("search_lastname",'alpha');

View File

@ -75,6 +75,12 @@ else
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{ {
$search_event = ''; $search_event = '';
$action = '';
}
if (GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') ||GETPOST('button_search','alpha')) // To avoid the save when we click on search
{
$action = '';
} }
if ($action == "save" && empty($cancel)) if ($action == "save" && empty($cancel))
@ -106,34 +112,6 @@ if ($action == "save" && empty($cancel))
} }
} }
if (preg_match('/set_(.*)/',$action,$reg))
{
$code=$reg[1];
$value=(GETPOST($code) ? GETPOST($code) : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if (preg_match('/del_(.*)/',$action,$reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
/** /**

View File

@ -52,10 +52,10 @@ $type = 'action';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if (preg_match('/set_(.*)/',$action,$reg)) if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
$value=(GETPOST($code) ? GETPOST($code) : 1); $value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
@ -67,7 +67,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
} }
} }
if (preg_match('/del_(.*)/',$action,$reg)) if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)

View File

@ -47,10 +47,10 @@ $type = 'action';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if (preg_match('/set_(.*)/',$action,$reg)) if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
$value=(GETPOST($code) ? GETPOST($code) : 1); $value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
@ -62,7 +62,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
} }
} }
if (preg_match('/del_(.*)/',$action,$reg)) if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)

View File

@ -33,7 +33,7 @@ if (! $user->admin) accessforbidden();
/* /*
* Action * Action
*/ */
if (preg_match('/set_(.*)/',$action,$reg)) if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
@ -47,7 +47,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
} }
} }
if (preg_match('/del_(.*)/',$action,$reg)) if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)

View File

@ -48,10 +48,11 @@ $action = GETPOST('action', 'alpha');
*/ */
if (preg_match('/set_(.*)/',$action,$reg)) if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) $value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
@ -62,7 +63,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
} }
} }
if (preg_match('/del_(.*)/',$action,$reg)) if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, 0) > 0) if (dolibarr_del_const($db, $code, 0) > 0)

View File

@ -51,41 +51,17 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
dol_add_file_process($upload_dir, 0, 0, 'userfile'); dol_add_file_process($upload_dir, 0, 0, 'userfile');
} }
if (preg_match('/set_(.*)/',$action,$reg)) if ($action == 'updateform')
{ {
$code=$reg[1]; $antivircommand = GETPOST('MAIN_ANTIVIRUS_COMMAND','none'); // Use GETPOST none because we must accept ". Example c:\Progra~1\ClamWin\bin\clamscan.exe
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1); $antivirparam = GETPOST('MAIN_ANTIVIRUS_PARAM','none'); // Use GETPOST none because we must accept ". Example --database="C:\Program Files (x86)\ClamWin\lib"
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) $antivircommand = dol_string_nospecial($antivircommand, '', array("|", ";", "<", ">", "&")); // Sanitize command
{ $antivirparam = dol_string_nospecial($antivirparam, '', array("|", ";", "<", ">", "&")); // Sanitize params
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
else if (preg_match('/del_(.*)/',$action,$reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
else if ($action == 'updateform')
{
$res3=dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',GETPOST('MAIN_UPLOAD_DOC','alpha'),'chaine',0,'',$conf->entity); $res3=dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',GETPOST('MAIN_UPLOAD_DOC','alpha'),'chaine',0,'',$conf->entity);
$res4=dolibarr_set_const($db, "MAIN_UMASK", GETPOST('MAIN_UMASK','alpha'),'chaine',0,'',$conf->entity); $res4=dolibarr_set_const($db, "MAIN_UMASK", GETPOST('MAIN_UMASK','alpha'),'chaine',0,'',$conf->entity);
$res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", trim(GETPOST('MAIN_ANTIVIRUS_COMMAND','none')),'chaine',0,'',$conf->entity); // Use GETPOST none because we must accept " $res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", trim($antivircommand),'chaine',0,'',$conf->entity);
$res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", trim(GETPOST('MAIN_ANTIVIRUS_PARAM','none')),'chaine',0,'',$conf->entity); // Use GETPOST none because we must accept " $res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", trim($antivirparam),'chaine',0,'',$conf->entity);
if ($res3 && $res4 && $res5 && $res6) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); if ($res3 && $res4 && $res5 && $res6) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
} }
@ -95,10 +71,10 @@ else if ($action == 'updateform')
else if ($action == 'delete') else if ($action == 'delete')
{ {
$langs->load("other"); $langs->load("other");
$file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile','alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile','alpha')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile','alpha')), null, 'errors');
Header('Location: '.$_SERVER["PHP_SELF"]); Header('Location: '.$_SERVER["PHP_SELF"]);
exit; exit;
} }

View File

@ -43,10 +43,10 @@ $action=GETPOST('action','alpha');
* Actions * Actions
*/ */
if (preg_match('/set_(.*)/',$action,$reg)) if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
$value=(GETPOST($code) ? GETPOST($code) : 1); $value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
@ -58,7 +58,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
} }
} }
else if (preg_match('/del_(.*)/',$action,$reg)) else if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)

View File

@ -86,7 +86,7 @@ elseif ($action == 'setdoc')
} }
$res = true; $res = true;
} }
elseif (preg_match('/set_(.*)/',$action,$reg)) elseif (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
@ -100,7 +100,7 @@ elseif (preg_match('/set_(.*)/',$action,$reg))
} }
} }
elseif (preg_match('/del_(.*)/',$action,$reg)) elseif (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)

View File

@ -83,7 +83,7 @@ elseif ($action == 'setdoc')
} }
$res = true; $res = true;
} }
elseif (preg_match('/set_(.*)/',$action,$reg)) elseif (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
@ -97,7 +97,7 @@ elseif (preg_match('/set_(.*)/',$action,$reg))
} }
} }
elseif (preg_match('/del_(.*)/',$action,$reg)) elseif (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)

View File

@ -38,7 +38,7 @@ $action=GETPOST('action','aZ09');
* Actions * Actions
*/ */
if (preg_match('/set_(.*)/',$action,$reg)) if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
@ -52,7 +52,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
} }
} }
if (preg_match('/del_(.*)/',$action,$reg)) if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)

View File

@ -5,7 +5,8 @@ CountryIT=Italy
CountryES=Spain CountryES=Spain
CountryDE=Germany CountryDE=Germany
CountryCH=Switzerland CountryCH=Switzerland
CountryGB=Great Britain # Warning, country code GB is for United Kingdom. UK Does not exists as country code in ISO standard.
CountryGB=United Kingdom
CountryUK=United Kingdom CountryUK=United Kingdom
CountryIE=Ireland CountryIE=Ireland
CountryCN=China CountryCN=China

View File

@ -198,7 +198,7 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
{ {
$tmpautoset=explode(':',$_POST["DOL_AUTOSET_COOKIE"],2); $tmpautoset=explode(':',$_POST["DOL_AUTOSET_COOKIE"],2);
$tmplist=explode(',',$tmpautoset[1]); $tmplist=explode(',',$tmpautoset[1]);
$cookiearrayvalue=''; $cookiearrayvalue=array();
foreach ($tmplist as $tmpkey) foreach ($tmplist as $tmpkey)
{ {
$postkey=$tmpautoset[0].'_'.$tmpkey; $postkey=$tmpautoset[0].'_'.$tmpkey;

View File

@ -42,7 +42,7 @@ $action=GETPOST('action','alpha');
/* /*
* Action * Action
*/ */
if (preg_match('/set_(.*)/',$action,$reg)) if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'yesno', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'yesno', 0, '', $conf->entity) > 0)
@ -56,7 +56,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
} }
} }
if (preg_match('/del_(.*)/',$action,$reg)) if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{ {
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)