From a300fcb8d9c81e0eaa169c0c96b878bd28c9bffb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Apr 2026 00:29:04 +0200 Subject: [PATCH 1/9] Fix leak test missing on permission website->writephpwhen editing htmlheader - Reported by Ahmed Alshammari --- htdocs/website/class/websitepage.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index a84d278c1a6..83b8472d2b5 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -285,7 +285,16 @@ class WebsitePage extends CommonObject $phpcontent = dolKeepOnlyPhpCode($this->content); if ($phpcontent) { - $this->error = 'Error: you try to create a page with PHP content without having permissions for that.'; + $this->error = 'Error: you try to create a page with PHP content in HTML body without having permissions for that.'; + $this->errors[] = $this->error; + return -1; + } + + // Check there is no PHP content into the imported file (must be only HTML + JS) + $phpcontent = dolKeepOnlyPhpCode($this->htmlheader); + + if ($phpcontent) { + $this->error = 'Error: you try to create a page with PHP content in HTML header without having permissions for that.'; $this->errors[] = $this->error; return -1; } From 7989c723b4fe5d3cab86bbfed0b8df145be2371c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Apr 2026 01:19:32 +0200 Subject: [PATCH 2/9] Fix image of layout --- htdocs/core/class/html.formwebsite.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 9bc9d5fe8e1..f2ac69198f6 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -349,6 +349,7 @@ class FormWebsite * * @param string $htmlContent HTML name of WYSIWYG field * @return string HTML for model page boxes + * @see getEmailLayoutSelector() */ public function getContentPageTemplate($htmlContent = 'message') { @@ -359,8 +360,12 @@ class FormWebsite require_once DOL_DOCUMENT_ROOT.'/core/lib/emaillayout.lib.php'; $listofsamples = dol_dir_list(DOL_DOCUMENT_ROOT.'/website/samples', 'files', 0, '^page-sample-.*\.html$'); - $arrayofsamples = array(); - $arrayofsamples['empty'] = 'EmptyPage'; // Always this one first + + // Define list of layouts to use + $arrayofsamples = array( + 'empty' => 'EmptyPage', + ); + foreach ($listofsamples as $sample) { $reg = array(); if (preg_match('/^page-sample-(.*)\.html$/', $sample['name'], $reg)) { @@ -391,7 +396,7 @@ class FormWebsite $contentHtml = file_exists($pathtoTemplateFile) ? make_substitutions(@file_get_contents($pathtoTemplateFile), $substitutionarray) : ''; $out .= '
'; - $out .= ''.$template.''; + $out .= ''.$template.''; $out .= ''.($template != 'text' ? ucfirst($template) : ucfirst($templateFunction)).''; $out .= '
'; } From 8bc5464979e9a2423a02d560b66fd04012d39b09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Apr 2026 02:09:39 +0200 Subject: [PATCH 3/9] Fix ACE editor content was not read on webpage creation. --- htdocs/core/class/doleditor.class.php | 2 +- htdocs/website/index.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 6b90c1fec67..03342f40607 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -457,7 +457,7 @@ class DolEditor $out .= 'jQuery(document).ready(function() {'; $out .= ' jQuery(".buttonforacesave").click(function() { - console.log("We click on savefile button for component '.dol_escape_js($this->htmlname).'"); + console.log("We click on button (with class .buttonforacesave) that must fill ace fields for component '.dol_escape_js($this->htmlname).'"); var aceEditor = window.ace.edit("'.dol_escape_js($this->htmlname).'aceeditorid"); if (aceEditor) { var cursorPos = aceEditor.getCursorPosition(); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e838146800e..be8cb52d003 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1182,6 +1182,7 @@ if ($action == 'addcontainer' && $usercanedit) { $objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml')); $objectpage->allowed_in_frames = GETPOST('WEBSITE_ALLOWED_IN_FRAMES', 'aZ09') ? 1 : 0; $objectpage->htmlheader = GETPOST('htmlheader', 'none'); // Must accept tags like '