mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
870c2a8f50 | ||
|
|
01aa901f93 | ||
|
|
96a74c4976 | ||
|
|
a69ba88857 | ||
|
|
b05be5e1df | ||
|
|
247c38923f | ||
|
|
2d55195982 | ||
|
|
5788438864 | ||
|
|
4f684df12f | ||
|
|
adbbf9e3b2 | ||
|
|
1f29c7758c | ||
|
|
07512d1dad |
30
ChangeLog
30
ChangeLog
@@ -2,6 +2,36 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 18.0.8 compared to 18.0.7 *****
|
||||
35 files changed, 647 insertions(+), 298 deletions(-)
|
||||
|
||||
FIX: #34746 - More complete fix for CVE-2024-40137
|
||||
FIX: Correct the calculation of the amount of the current period between the period provided (#35083)
|
||||
FIX: Add security test for show terminal selection if no terminal selected when invoice.php is call (#34717)
|
||||
FIX: Add security test for show terminal selection if no terminal selected when invoice.php is call
|
||||
FIX: missing quick edit for extrafields (baclport commit 4fc66c6) (#35160)
|
||||
FIX: Missing sentence part (#35144)
|
||||
FIX: set global mysoc and load langs in API access (#35041)
|
||||
FIX: set global mysoc and load langs in API access
|
||||
FIX: reset mysoc and langs only if entity of API has changed
|
||||
FIX: accountancy general ledger: bad handling of hook return (#34029)
|
||||
FIX: accountancy general ledger: bad handling of hook return
|
||||
FIX: accountancy balance: bad handling of hook return
|
||||
FIX: - Fix missing token for disable custom group category for compta report (page /htdocs/accountancy/admin/categories_list.php) (#35084)
|
||||
FIX: The combo of custom groups has disappeared (backport v19) (#35016)
|
||||
FIX: #34893 (#34897)
|
||||
FIX: #34893
|
||||
FIX: change error code to USERNOTALLOWEDTOCHANGEPASS
|
||||
FIX: asset: could not select invoice in disposal pop-in (#34725)
|
||||
FIX: 17.0 SQL syntax error and/or constraint error when calling Facture::update() after a clone (e.g. in a trigger) (#34778)
|
||||
FIX: 17.0: when you clone an invoice that was created from a template invoice, the clone should not be linked to the template invoice (#34777)
|
||||
FIX: pre-send mail mass action: keep __EMAIL__ substitution (#34522)
|
||||
FIX: pre-send mail mass action: keep __EMAIL__ substitution
|
||||
FIX: comment
|
||||
FIX: massaction email tpl: keep preset
|
||||
FIX: loop interrupt if an error occurs in sendEmailsRemindersOnInvoiceDueDate (#34657)
|
||||
FIX: #34654
|
||||
|
||||
***** ChangeLog for 18.0.7 compared to 18.0.6 *****
|
||||
138 files changed, 1622 insertions(+), 530 deletions(-)
|
||||
|
||||
|
||||
@@ -896,7 +896,7 @@ if ($resql) {
|
||||
// Active
|
||||
print '<td class="center" class="nowrap">';
|
||||
if ($canbedisabled) {
|
||||
print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
print '<a href="'.$url.'action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
|
||||
} else {
|
||||
print $langs->trans("AlwaysActive");
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ if ($action != 'export_csv') {
|
||||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
$newcardbutton .= '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
@@ -675,7 +675,7 @@ if ($reshook < 0) {
|
||||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
if ($type == 'sub') {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
|
||||
@@ -81,7 +81,7 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
public function __isAllowed()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $db, $user;
|
||||
global $conf, $db, $langs, $mysoc, $user;
|
||||
|
||||
$login = '';
|
||||
$stored_key = '';
|
||||
@@ -132,6 +132,56 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
// We must also reload global conf to get params from the entity
|
||||
dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity.") and we have to reload configuration.", LOG_WARNING);
|
||||
$conf->setValues($this->db);
|
||||
|
||||
// set global mysoc after setting conf entity (the entity can be changed with the user logged)
|
||||
// see master.inc.php
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$fmysoc = new Societe($db);
|
||||
$fmysoc->setMysoc($conf);
|
||||
|
||||
// We set some specific default values according to country
|
||||
if ($fmysoc->country_code == 'DE' && !isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
|
||||
// For DE, we need to invert our address with customer address
|
||||
$conf->global->MAIN_INVERT_SENDER_RECIPIENT = 1;
|
||||
}
|
||||
if ($fmysoc->country_code == 'FR' && !isset($conf->global->INVOICE_CATEGORY_OF_OPERATION)) {
|
||||
// For FR, default value of option to show category of operations is on by default. Decret n°2099-1299 2022-10-07
|
||||
$conf->global->INVOICE_CATEGORY_OF_OPERATION = 1;
|
||||
}
|
||||
if ($fmysoc->country_code == 'FR' && !isset($conf->global->INVOICE_DISABLE_REPLACEMENT)) {
|
||||
// For FR, the replacement invoice type is not allowed.
|
||||
// From an accounting point of view, this creates holes in the numbering of the invoice.
|
||||
// This is very problematic during a fiscal control.
|
||||
$conf->global->INVOICE_DISABLE_REPLACEMENT = 1;
|
||||
}
|
||||
if ($fmysoc->country_code == 'GR' && !isset($conf->global->INVOICE_DISABLE_REPLACEMENT)) {
|
||||
// The replacement invoice type is not allowed in Greece.
|
||||
$conf->global->INVOICE_DISABLE_REPLACEMENT = 1;
|
||||
}
|
||||
if ($fmysoc->country_code == 'GR' && !isset($conf->global->INVOICE_DISABLE_DEPOSIT)) {
|
||||
// The deposit invoice type is not allowed in Greece.
|
||||
$conf->global->INVOICE_DISABLE_DEPOSIT = 1;
|
||||
}
|
||||
|
||||
if (($fmysoc->localtax1_assuj || $fmysoc->localtax2_assuj) && !isset($conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX)) {
|
||||
// For countries using the 2nd or 3rd tax, we disable input/edit of lines using the price including tax (because 2nb and 3rd tax not yet taken into account).
|
||||
// Work In Progress to support all taxes into unit price entry when MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES is set.
|
||||
$conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1;
|
||||
}
|
||||
// Set also the global variable $mysoc
|
||||
$mysoc = $fmysoc;
|
||||
|
||||
// Reload langs
|
||||
$langcode = (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
|
||||
if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
|
||||
$langcode = $user->conf->MAIN_LANG_DEFAULT;
|
||||
}
|
||||
if ($langs->getDefaultLang() != $langcode) {
|
||||
$langs->setDefaultLang($langcode);
|
||||
$langs->tab_translate = array();
|
||||
$langs->loadLangs(array('main'));
|
||||
}
|
||||
}
|
||||
} elseif ($nbrows > 1) {
|
||||
throw new RestException(503, 'Error when fetching user api_key : More than 1 user with this apikey');
|
||||
|
||||
@@ -505,6 +505,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$yeartoprocess++;
|
||||
}
|
||||
|
||||
if (($yeartoprocess == $start_year && ($k + 1) >= $date_startmonth && $k < $date_endmonth) ||
|
||||
($yeartoprocess == $start_year + 1 && ($k + 1) < $date_startmonth)
|
||||
) {
|
||||
//var_dump($monthtoprocess.'_'.$yeartoprocess);
|
||||
if (isset($cpt['account_number'])) {
|
||||
$return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, empty($cat['dc']) ? 0 : $cat['dc'], 'nofilter', $monthtoprocess, $yeartoprocess);
|
||||
@@ -533,6 +536,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
$resultN += $resultM;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($totCat)) {
|
||||
$totCat['N'] = $resultN;
|
||||
|
||||
@@ -756,10 +756,11 @@ if (empty($reshook)) {
|
||||
|
||||
$price_ht = price2num(GETPOST('elprice'), 'MU');
|
||||
$remise_percent = price2num(GETPOST('elremise_percent'), 2);
|
||||
if ($remise_percent > 0) {
|
||||
// Discount applied 2 times => see line 803
|
||||
/*if ($remise_percent > 0) {
|
||||
$remise = round(($price_ht * $remise_percent / 100), 2);
|
||||
$price_ht = ($price_ht - $remise);
|
||||
}
|
||||
}*/
|
||||
|
||||
$objectline->fk_product = GETPOST('idprod', 'int');
|
||||
$objectline->description = GETPOST('product_desc', 'restricthtml');
|
||||
|
||||
@@ -7251,8 +7251,23 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
|
||||
*/
|
||||
function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes = array("allow", "allowfullscreen", "alt", "class", "contenteditable", "data-html", "frameborder", "height", "href", "id", "name", "src", "style", "target", "title", "width"))
|
||||
{
|
||||
if (is_null($allowed_attributes)) {
|
||||
$allowed_attributes = array(
|
||||
"allow", "allowfullscreen", "alt", "async", "class", "contenteditable", "crossorigin", "data-html", "frameborder", "height", "href", "id", "name", "property", "rel", "src", "style", "target", "title", "type", "width",
|
||||
// HTML5
|
||||
"header", "footer", "nav", "section", "menu", "menuitem"
|
||||
);
|
||||
}
|
||||
// Always add content and http-equiv for meta tags, required to force encoding and keep html content in utf8 by load/saveHTML functions.
|
||||
if (!in_array("content", $allowed_attributes)) {
|
||||
$allowed_attributes[] = "content";
|
||||
}
|
||||
if (!in_array("http-equiv", $allowed_attributes)) {
|
||||
$allowed_attributes[] = "http-equiv";
|
||||
}
|
||||
|
||||
if (class_exists('DOMDocument') && !empty($stringtoclean)) {
|
||||
$stringtoclean = '<?xml encoding="UTF-8"><html><body>'.$stringtoclean.'</body></html>';
|
||||
$stringtoclean = '<?xml encoding="UTF-8"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>'.$stringtoclean.'</body></html>';
|
||||
|
||||
$dom = new DOMDocument(null, 'UTF-8');
|
||||
$dom->loadHTML($stringtoclean, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL);
|
||||
@@ -7293,12 +7308,15 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
|
||||
}
|
||||
}
|
||||
|
||||
$dom->encoding = 'UTF-8';
|
||||
|
||||
$return = $dom->saveHTML(); // This may add a LF at end of lines, so we will trim later
|
||||
//$return = '<html><body>aaaa</p>bb<p>ssdd</p>'."\n<p>aaa</p>aa<p>bb</p>";
|
||||
|
||||
$return = preg_replace('/^'.preg_quote('<?xml encoding="UTF-8">', '/').'/', '', $return);
|
||||
$return = preg_replace('/^'.preg_quote('<html><body>', '/').'/', '', $return);
|
||||
$return = preg_replace('/'.preg_quote('</body></html>', '/').'$/', '', $return);
|
||||
$return = preg_replace('/^'.preg_quote('<html><head><', '/').'[^<>]*'.preg_quote('></head><body>', '/').'/', '', $return);
|
||||
$return = preg_replace('/'.preg_quote('</body></html>', '/').'$/', '', trim($return));
|
||||
|
||||
return trim($return);
|
||||
} else {
|
||||
return $stringtoclean;
|
||||
@@ -7448,13 +7466,26 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
|
||||
// Add a trick to solve pb with text without parent tag
|
||||
// like '<h1>Foo</h1><p>bar</p>' that wrongly ends up, without the trick, with '<h1>Foo<p>bar</p></h1>'
|
||||
// like 'abc' that wrongly ends up, without the trick, with '<p>abc</p>'
|
||||
$out = '<div class="tricktoremove">'.$out.'</div>';
|
||||
$dom->loadHTML($out, LIBXML_HTML_NODEFDTD|LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL);
|
||||
|
||||
if (dol_textishtml($out)) {
|
||||
$out = '<?xml encoding="UTF-8"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body><div class="tricktoremove">'.$out.'</div></body></html>';
|
||||
} else {
|
||||
$out = '<?xml encoding="UTF-8"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body><div class="tricktoremove">'.dol_nl2br($out).'</div></body></html>';
|
||||
}
|
||||
|
||||
$dom->loadHTML($out, LIBXML_HTML_NODEFDTD | LIBXML_ERR_NONE | LIBXML_HTML_NOIMPLIED | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOERROR | LIBXML_NOXMLDECL);
|
||||
|
||||
$dom->encoding = 'UTF-8';
|
||||
|
||||
$out = trim($dom->saveHTML());
|
||||
|
||||
// Remove the trick added to solve pb with text without parent tag
|
||||
$out = preg_replace('/^<div class="tricktoremove">/', '', $out);
|
||||
$out = preg_replace('/<\/div>$/', '', $out);
|
||||
// Remove the trick added to solve pb with text in utf8 and text without parent tag
|
||||
$out = preg_replace('/^'.preg_quote('<?xml encoding="UTF-8">', '/').'/', '', $out);
|
||||
$out = preg_replace('/^'.preg_quote('<html><head><', '/').'[^<>]+'.preg_quote('></head><body><div class="tricktoremove">', '/').'/', '', $out);
|
||||
$out = preg_replace('/'.preg_quote('</div></body></html>', '/').'$/', '', trim($out));
|
||||
// $out = preg_replace('/^<\?xml encoding="UTF-8"><div class="tricktoremove">/', '', $out);
|
||||
// $out = preg_replace('/<\/div>$/', '', $out);
|
||||
// var_dump('rrrrrrrrrrrrrrrrrrrrrrrrrrrrr'.$out);
|
||||
} catch (Exception $e) {
|
||||
// If error, invalid HTML string with no way to clean it
|
||||
//print $e->getMessage();
|
||||
@@ -7492,7 +7523,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
|
||||
} while ($oldstringtoclean != $out);
|
||||
|
||||
// Check the limit of external links that are automatically executed in a Rich text content. We count:
|
||||
// '<img' to avoid <img src="http...">
|
||||
// '<img' to avoid <img src="http...">, we can only accept "<img src="data:..."
|
||||
// 'url(' to avoid inline style like background: url(http...
|
||||
// '<link' to avoid <link href="http...">
|
||||
$reg = array();
|
||||
@@ -9228,7 +9259,7 @@ function verifCond($strToEvaluate)
|
||||
|
||||
/**
|
||||
* Replace eval function to add more security.
|
||||
* This function is called by verifCond() or trans() and transnoentitiesnoconv().
|
||||
* This function is called by verifCond() for example.
|
||||
*
|
||||
* @param string $s String to evaluate
|
||||
* @param int $returnvalue 0=No return (used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
|
||||
@@ -9319,14 +9350,32 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
||||
$forbiddenphpstrings = array('$$');
|
||||
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST', 'ReflectionFunction'));
|
||||
|
||||
$forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen");
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode", "str_rot13", "hex2bin")); // decode string functions used to obfuscated function name
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
|
||||
// We list all forbidden function as keywords we don't want to see (we don't mind it if is "kewyord(" or just "keyword", we don't want "keyword" at all)
|
||||
// We must exclude all functions that allow to execute another function. This includes all function that has a parameter with type "callable" to avoid things
|
||||
// like we can do with array_map and its callable parameter: dol_eval('json_encode(array_map(implode("",["ex","ec"]), ["id"]))', 1, 1, '0')
|
||||
$forbiddenphpfunctions = array();
|
||||
// @phpcs:ignore
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64"."_"."decode", "rawurl"."decode", "url"."decode", "str"."_rot13", "hex"."2bin")); // name of forbidden functions are split to avoid false positive
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("override_function", "session_id", "session_create_id", "session_regenerate_id"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func", "call_user_func_array"));
|
||||
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("array_all", "array_any", "array_diff_ukey", "array_filter", "array_find", "array_find_key", "array_map", "array_reduce", "array_intersect_uassoc", "array_intersect_ukey", "array_walk", "array_walk_recursive"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("usort", "uasort", "uksort", "preg_replace_callback", "preg_replace_callback_array", "header_register_callback"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("set_error_handler", "set_exception_handler", "libxml_set_external_entity_loader", "register_shutdown_function", "register_tick_function", "unregister_tick_function"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("spl_autoload_register", "spl_autoload_unregister", "iterator_apply", "session_set_save_handler"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("forward_static_call", "forward_static_call_array", "register_postsend_function"));
|
||||
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("ob_start"));
|
||||
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace", "mb_ereg_replace_callback")); // function with eval capabilities
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("readline_completion_function", "readline_callback_handler_install"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include"));
|
||||
|
||||
$forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function
|
||||
|
||||
|
||||
@@ -159,6 +159,9 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att
|
||||
if ($object->element == 'product') {
|
||||
$keyforperm = 'produit';
|
||||
}
|
||||
if ($object->element == 'project') {
|
||||
$keyforperm = 'projet';
|
||||
}
|
||||
if (isset($user->rights->$keyforperm)) {
|
||||
$permok = $user->hasRight($keyforperm, 'creer') || $user->hasRight($keyforperm, 'create') || $user->hasRight($keyforperm, 'write');
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) {
|
||||
define('DOL_APPLICATION_TITLE', 'Dolibarr');
|
||||
}
|
||||
if (!defined('DOL_VERSION')) {
|
||||
define('DOL_VERSION', '18.0.7'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
define('DOL_VERSION', '18.0.8'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
}
|
||||
|
||||
if (!defined('EURO')) {
|
||||
|
||||
@@ -1229,8 +1229,11 @@ class FactureFournisseur extends CommonInvoice
|
||||
if (empty($this->fk_project)) $this->fk_project = null;
|
||||
else $this->fk_project = intval($this->fk_project);
|
||||
}
|
||||
if (isset($this->mode_reglement_id)) {
|
||||
$this->mode_reglement_id = (int) $this->mode_reglement_id;
|
||||
}
|
||||
if (isset($this->cond_reglement_id)) {
|
||||
$this->cond_reglement_id = trim($this->cond_reglement_id);
|
||||
$this->cond_reglement_id = (int) $this->cond_reglement_id;
|
||||
}
|
||||
if (isset($this->note_private)) {
|
||||
$this->note = trim($this->note_private);
|
||||
@@ -1277,6 +1280,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql .= " fk_facture_source=".($this->fk_facture_source ? ((int) $this->fk_facture_source) : "null").",";
|
||||
$sql .= " vat_reverse_charge = ".($this->vat_reverse_charge != '' ? ((int) $this->db->escape($this->vat_reverse_charge)) : 0).",";
|
||||
$sql .= " fk_projet=".(!empty($this->fk_project) ? ((int) $this->fk_project) : "null").",";
|
||||
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : "null").",";
|
||||
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : "null").",";
|
||||
$sql .= " date_lim_reglement=".(dol_strlen($this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').",";
|
||||
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
|
||||
define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1);
|
||||
include_once 'inc.php';
|
||||
|
||||
/**
|
||||
* @var string $conffile
|
||||
*/
|
||||
|
||||
if (!file_exists($conffile)) {
|
||||
print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").';
|
||||
}
|
||||
@@ -46,6 +51,11 @@ require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
|
||||
|
||||
global $langs;
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var Translate $langs
|
||||
*/
|
||||
|
||||
$grant_query = '';
|
||||
$step = 2;
|
||||
$ok = 0;
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
|
||||
define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1);
|
||||
include_once 'inc.php';
|
||||
|
||||
/**
|
||||
* @var string $conffile
|
||||
*/
|
||||
|
||||
if (!file_exists($conffile)) {
|
||||
print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").';
|
||||
}
|
||||
@@ -56,13 +61,17 @@ require_once $dolibarr_main_document_root.'/core/lib/files.lib.php';
|
||||
|
||||
global $langs;
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var Translate $langs
|
||||
*/
|
||||
|
||||
$grant_query = '';
|
||||
$step = 2;
|
||||
$error = 0;
|
||||
|
||||
|
||||
// Cette page peut etre longue. On augmente le delai autorise.
|
||||
// Ne fonctionne que si on est pas en safe_mode.
|
||||
// This page can be long. We increase the allowed delay, but this does not work when we are in safe_mode.
|
||||
$err = error_reporting();
|
||||
error_reporting(0);
|
||||
if (!empty($conf->global->MAIN_OVERRIDE_TIME_LIMIT)) {
|
||||
@@ -224,8 +233,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$db->begin();
|
||||
|
||||
foreach ($listofentities as $entity) {
|
||||
dol_syslog("Process upgrade2 for entity ".$entity);
|
||||
|
||||
// Set $conf context for entity
|
||||
$conf->setEntityValues($db, $entity);
|
||||
|
||||
// Reset forced setup after the setValues
|
||||
if (defined('SYSLOG_FILE')) {
|
||||
$conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
|
||||
@@ -248,10 +260,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$versiontoarray = explode('.', $versionto);
|
||||
$versionranarray = explode('.', DOL_VERSION);
|
||||
|
||||
|
||||
$afterversionarray = explode('.', '2.0.0');
|
||||
$beforeversionarray = explode('.', '2.7.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
// Script pour V2 -> V2.1
|
||||
migrate_paiements($db, $langs, $conf);
|
||||
|
||||
@@ -315,6 +328,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$beforeversionarray = explode('.', '2.8.9');
|
||||
//print $versionto.' '.versioncompare($versiontoarray,$afterversionarray).' '.versioncompare($versiontoarray,$beforeversionarray);
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_price_facture($db, $langs, $conf); // Code of this function works for 2.8+ because need a field tva_tx
|
||||
|
||||
migrate_relationship_tables($db, $langs, $conf, 'co_exp', 'fk_commande', 'commande', 'fk_expedition', 'shipping');
|
||||
@@ -340,6 +355,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '2.8.9');
|
||||
$beforeversionarray = explode('.', '2.9.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_element_time($db, $langs, $conf);
|
||||
|
||||
migrate_customerorder_shipping($db, $langs, $conf);
|
||||
@@ -360,6 +377,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '3.0.9');
|
||||
$beforeversionarray = explode('.', '3.1.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_rename_directories($db, $langs, $conf, '/rss', '/externalrss');
|
||||
|
||||
migrate_actioncomm_element($db, $langs, $conf);
|
||||
@@ -369,6 +388,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '3.1.9');
|
||||
$beforeversionarray = explode('.', '3.2.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_price_contrat($db, $langs, $conf);
|
||||
|
||||
migrate_mode_reglement($db, $langs, $conf);
|
||||
@@ -380,6 +401,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '3.2.9');
|
||||
$beforeversionarray = explode('.', '3.3.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_categorie_association($db, $langs, $conf);
|
||||
}
|
||||
|
||||
@@ -390,6 +413,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '3.6.9'); // target is after this
|
||||
$beforeversionarray = explode('.', '3.7.9'); // target is before this
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_event_assignement($db, $langs, $conf);
|
||||
}
|
||||
|
||||
@@ -404,6 +429,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '3.9.9');
|
||||
$beforeversionarray = explode('.', '4.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_rename_directories($db, $langs, $conf, '/fckeditor', '/medias');
|
||||
}
|
||||
|
||||
@@ -411,6 +438,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '4.0.9');
|
||||
$beforeversionarray = explode('.', '5.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
// Migrate to add entity value into llx_societe_remise
|
||||
migrate_remise_entity($db, $langs, $conf);
|
||||
|
||||
@@ -427,6 +456,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
|
||||
// Only if the transverse mode is not used
|
||||
if (empty($multicompany_transverse_mode)) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
// Migrate to add entity value into llx_user_rights
|
||||
migrate_user_rights_entity($db, $langs, $conf);
|
||||
|
||||
@@ -440,6 +471,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '6.0.9');
|
||||
$beforeversionarray = explode('.', '7.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
// Migrate contact association
|
||||
migrate_event_assignement_contact($db, $langs, $conf);
|
||||
|
||||
@@ -450,6 +483,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '7.0.9');
|
||||
$beforeversionarray = explode('.', '8.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_rename_directories($db, $langs, $conf, '/contracts', '/contract');
|
||||
}
|
||||
|
||||
@@ -464,6 +499,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '10.0.9');
|
||||
$beforeversionarray = explode('.', '11.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_users_socialnetworks();
|
||||
migrate_members_socialnetworks();
|
||||
migrate_contacts_socialnetworks();
|
||||
@@ -474,6 +511,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '13.0.9');
|
||||
$beforeversionarray = explode('.', '14.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_export_import_profiles('export');
|
||||
migrate_export_import_profiles('import');
|
||||
}
|
||||
@@ -482,6 +521,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '15.0.9');
|
||||
$beforeversionarray = explode('.', '16.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_user_photospath();
|
||||
migrate_user_photospath2();
|
||||
}
|
||||
@@ -490,6 +531,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '16.0.9');
|
||||
$beforeversionarray = explode('.', '17.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_contractdet_rank();
|
||||
}
|
||||
|
||||
@@ -497,13 +540,16 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '17.0.9');
|
||||
$beforeversionarray = explode('.', '18.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray));
|
||||
|
||||
migrate_contractdet_rank();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Code executed only if migration is LAST ONE. Must always be done.
|
||||
if (versioncompare($versiontoarray, $versionranarray) >= 0 || versioncompare($versiontoarray, $versionranarray) <= -3) {
|
||||
dol_syslog("Run migrate_... if migration is LAST ONE");
|
||||
|
||||
// Reload modules (this must be always done and only into last targeted version, because code to reload module may need table structure of last version)
|
||||
$listofmodule = array(
|
||||
'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly',
|
||||
@@ -546,6 +592,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Reload menus (this must be always and only into last targeted version)
|
||||
$result = migrate_reload_menu($db, $langs, $conf);
|
||||
if ($result < 0) {
|
||||
|
||||
@@ -196,7 +196,7 @@ ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Account (from the Chart Of Account) to b
|
||||
|
||||
ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Account (from the Chart Of Account) to be used as the default account to register customer deposit
|
||||
UseAuxiliaryAccountOnCustomerDeposit=Store customer account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty)
|
||||
ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Account (from the Chart Of Account) to be used as the default
|
||||
ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Account (from the Chart Of Account) to be used as the default account to register supplier deposit
|
||||
UseAuxiliaryAccountOnSupplierDeposit=Store supplier account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty)
|
||||
ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY=Accounting account by default to register customer retained warranty
|
||||
|
||||
|
||||
@@ -108,12 +108,13 @@ if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $acti
|
||||
$permissiontoadd = $user->hasRight('projet', 'creer');
|
||||
$permissiontodelete = $user->hasRight('projet', 'supprimer');
|
||||
$permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoeditextra = $permissiontoadd;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$error = 0;
|
||||
$parameters = array('id'=>$socid, 'objcanvas'=>$objcanvas);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
@@ -505,6 +506,31 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Quick edit for extrafields
|
||||
if ($action == 'update_extras' && $permissiontoeditextra) {
|
||||
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
|
||||
$attribute_name = GETPOST('attribute', 'aZ09');
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $object->updateExtraField($attribute_name, 'PROJECT_MODIFY');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'PROJECT_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
|
||||
@@ -78,6 +78,23 @@ if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->la
|
||||
}
|
||||
}
|
||||
|
||||
// When session has expired (selected terminal has been lost from session), redirect to the terminal selection.
|
||||
if (empty($_SESSION["takeposterminal"])) {
|
||||
if (getDolGlobalInt('TAKEPOS_NUM_TERMINALS') == 1) {
|
||||
$_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal
|
||||
} elseif (!empty($_COOKIE["takeposterminal"])) {
|
||||
$_SESSION["takeposterminal"] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE["takeposterminal"]); // Restore takeposterminal from previous session
|
||||
} else {
|
||||
print <<<SCRIPT
|
||||
<script language="javascript">
|
||||
$( document ).ready(function() {
|
||||
ModalBox('ModalTerminal');
|
||||
});
|
||||
</script>
|
||||
SCRIPT;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abort invoice creationg with a given error message
|
||||
|
||||
1
test/phpunit/.gitignore
vendored
Normal file
1
test/phpunit/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/DemoTest.php
|
||||
@@ -581,7 +581,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
|
||||
$result=GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
|
||||
//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
|
||||
//$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned
|
||||
|
||||
|
||||
@@ -730,7 +730,8 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
$stringtotest = 'eée';
|
||||
$decodedstring = dol_string_onlythesehtmlattributes($stringtotest);
|
||||
$this->assertEquals('eée', $decodedstring, 'Function did not sanitize correclty with test 1');
|
||||
//$this->assertEquals('eée', $decodedstring, 'Function did not sanitize correctly with test 1');
|
||||
$this->assertEquals('eée', $decodedstring, 'Function did not sanitize correctly with test 1');
|
||||
|
||||
$stringtotest = '<div onload="ee"><a href="123"><span class="abc">abc</span></a></div>';
|
||||
$decodedstring = dol_string_onlythesehtmlattributes($stringtotest);
|
||||
@@ -986,6 +987,22 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
print "result = ".$result."\n";
|
||||
$this->assertStringContainsString('Bad string syntax to evaluate', $result);
|
||||
|
||||
$result = dol_eval('json_encode(array_map(implode("",["ex","ec"]), ["id"]))', 1, 1, '1'); // result of dol_eval may be an object Closure
|
||||
print "result4a = ".json_encode($result)."\n";
|
||||
$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil, it should due to the [ char and method "2"');
|
||||
|
||||
$result = dol_eval('json_encode(array_map(implode("",["ex","ec"]), ["id"]))', 1, 1, '2'); // result of dol_eval may be an object Closure
|
||||
print "result4b = ".json_encode($result)."\n";
|
||||
$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil, it should due to the use of array_map');
|
||||
|
||||
$result = dol_eval('json_encode(array_map(implode("",array("ex","ec"), array("id")))', 1, 1, '1'); // result of dol_eval may be an object Closure
|
||||
print "result4c = ".json_encode($result)."\n";
|
||||
$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil, it should due to the use of array_map');
|
||||
|
||||
$result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure
|
||||
print "result5 = ".json_encode($result)."\n";
|
||||
$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil');
|
||||
|
||||
$result=dol_eval('$a=exec ("ls")', 1, 1);
|
||||
print "result = ".$result."\n";
|
||||
$this->assertStringContainsString('Bad string syntax to evaluate', $result);
|
||||
|
||||
Reference in New Issue
Block a user