From df5382642603a9c3b115ecba0757bdc27c52f9fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Aug 2019 18:22:18 +0200 Subject: [PATCH] FIX Missing some replacements in website module --- htdocs/core/lib/website.lib.php | 6 +++++- htdocs/website/index.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 4d89210cd44..3a6a580d43f 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -93,6 +93,9 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c $content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep); $content=preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep); + // Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart=" + $content=preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep); + dol_syslog('dolWebsiteReplacementOfLinks end', LOG_DEBUG); return $content; @@ -185,7 +188,7 @@ function dolKeepOnlyPhpCode($str) * @param string $contenttype Content type * @param int $containerid Contenair id * @return void - * @see dolWebsiteReplacementOfLinks() for function used to replace content in the backoffice context when USEDOLIBARREDITOR is not on + * @see dolWebsiteReplacementOfLinks() for function used to replace content in the backoffice context. */ function dolWebsiteOutput($content, $contenttype='html', $containerid='') { @@ -228,6 +231,7 @@ function dolWebsiteOutput($content, $contenttype='html', $containerid='') // Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: href="/viewimage.php?modulepart=" => href="/dolibarr/viewimage.php?modulepart=" $content=preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep); $content=preg_replace('/(src=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep); + $content=preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep); // Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/ $content=preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 35b5444e0b2..8ac8de1a5ca 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3057,9 +3057,10 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print '
'; print ''; print ''; + print ''; - print ''."\n"; + print ''."\n"; print '

'; print load_fiche_titre($langs->trans("ReplaceWebsiteContent"));