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

This commit is contained in:
Laurent Destailleur 2023-02-18 21:09:58 +01:00
commit 0300ccebfd
7 changed files with 37 additions and 19 deletions

View File

@ -32,10 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
// Load translation files required by the page
$langs->load("admin");
if (!$user->admin) {
accessforbidden();
}
$rowid = GETPOST('rowid', 'int');
$entity = GETPOST('entity', 'int');
$action = GETPOST('action', 'aZ09');
@ -44,7 +40,6 @@ $consts = GETPOST('const', 'array');
$constname = GETPOST('constname', 'alphanohtml');
$constvalue = GETPOST('constvalue', 'restricthtml'); // We should be able to send everything here
$constnote = GETPOST('constnote', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@ -63,12 +58,30 @@ if (empty($sortorder)) {
$sortorder = 'ASC';
}
if ($action == 'add' && GETPOST('update')) { // Click on button update must be used in priority before param $action
$action = 'update';
}
if ($action == 'add' && GETPOST('delete')) { // Click on button update must be used in priority before param $action
$action = 'delete';
}
if ($action == 'update' && GETPOST('add')) { // Click on button add must be used in priority before param $action
$action = 'add';
}
if ($action == 'delete' && GETPOST('add')) { // Click on button add must be used in priority before param $action
$action = 'add';
}
if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
if ($action == 'add' || (GETPOST('add') && $action != 'update')) {
// Add a new record
if ($action == 'add') {
$error = 0;
if (empty($constname)) {
@ -157,13 +170,12 @@ jQuery(document).ready(function() {
jQuery("#delconst").hide();
jQuery(".checkboxfordelete").click(function() {
jQuery("#delconst").show();
jQuery("#action").val('delete');
});
jQuery(".inputforupdate").keyup(function() { // keypress does not support back
var field_id = jQuery(this).attr("id");
var row_num = field_id.split("_");
jQuery("#updateconst").show();
jQuery("#action").val('update');
jQuery("#action").val('update'); // so default action if we type enter will be update, but correct action is also detected correctly without that when clicking on "Update" button.
jQuery("#check_" + row_num[1]).prop("checked",true);
});
});
@ -180,7 +192,7 @@ $param = '';
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" id="action" name="action" value="">';
print '<input type="hidden" id="action" name="action" value="add">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';

View File

@ -580,14 +580,15 @@ print '<br>';
print '<strong>MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED</strong> = '.getDolGlobalString('MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
print '<br>';
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; img-src *;\")</span><br>";
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src *; img-src *; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';\")</span><br>";
print '<br>';
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>";
print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src https://cdn.transifex.com https://www.googletagmanager.com 'unsafe-inline'; object-src https://youtube.com; frame-src https://youtube.com; img-src *;\")</span><br>";
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com 'unsafe-inline'; script-src https://cdn.transifex.com https://www.googletagmanager.com 'unsafe-inline'; object-src https://youtube.com; frame-src https://youtube.com; img-src *;\")</span><br>";
print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";

View File

@ -8797,9 +8797,9 @@ abstract class CommonObject
if ($usesharelink) {
if ($val['share']) {
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
$return .= '<!-- Show original file (thumb not yet available with shared links) -->';
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
} else {
$return .= '<!-- Show original file -->';
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
@ -8809,9 +8809,9 @@ abstract class CommonObject
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="'.dol_escape_htmltag($alt).'">';
}
} else {
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
$return .= '<!-- Show thumb -->';
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').' maxwidth150onsmartphone maxwidth200" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
} else {
$return .= '<!-- Show original file -->';
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';

View File

@ -130,8 +130,12 @@ function dol_getImageSize($file, $url = false)
if ($filetoread) {
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
$ret['width'] = $infoImg[0]; // Largeur de l'image
$ret['height'] = $infoImg[1]; // Hauteur de l'image
if ($infoImg) {
$ret['width'] = $infoImg[0]; // Largeur de l'image
$ret['height'] = $infoImg[1]; // Hauteur de l'image
} else {
$ret['width'] = $ret['height'] = '';
}
}
return $ret;

View File

@ -7678,7 +7678,7 @@ div.clipboardCPValue.hidewithsize {
}
.dropdown dd ul {
max-width: 350px;
max-width: 370px;
}
}
/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */

View File

@ -4924,7 +4924,7 @@ div.titre {
color: var(--colortexttitlenotab);
}
.tertiary {
color: var(--colortexttitlenotab);
color: var(--colortexttitlenotab2);
}
table.centpercent.notopnoleftnoright.table-fiche-title {

View File

@ -60,6 +60,7 @@ $colorbacklinepairchecked = '230,237,244'; // line checked
$colorbacklinebreak = '250,246,251';
$colorbackbody = '248,248,248';
$colortexttitlenotab = '80,71,5';
$colortexttitlenotab2 = '100,0,100';
$colortexttitle = '20,20,20';
$colortexttitlelink = '0,0,120';
$colortext = '0,0,0';