diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index d5d4f2d3826..9bf00e8d6e3 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -62,8 +62,9 @@ function dolWebsiteOutput($content) { global $website; - // Replace relative link with dolibarr URL + // Replace relative link / with dolibarr URL $content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep); + // Replace relative link /xxx.php with dolibarr URL $content=preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep); } diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index c9cf66fc6d1..aeff9078d0f 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -19,9 +19,9 @@ AddPage=Add page HomePage=Home Page PreviewOfSiteNotYetAvailable=Preview of your website %s not yet available. You must first add a page. RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this. -PageContent=Page/Content -PageDeleted=Page/Content '%s' of website %s deleted -PageAdded=Page/Content '%s' added +PageContent=Page/Contenair +PageDeleted=Page/Contenair '%s' of website %s deleted +PageAdded=Page/Contenair '%s' added ViewSiteInNewTab=View site in new tab ViewPageInNewTab=View page in new tab SetAsHomePage=Set as Home page @@ -33,4 +33,4 @@ PreviewSiteServedByDolibarr=Preview %s in a new tab.

The %s will be serve VirtualHostUrlNotDefined=URL of the virtual host served by external web server not defined NoPageYet=No pages yet SyntaxHelp=Help on code syntax -YouCanEditHtmlSource=You can edit HTML source code using the "Source" button in editor. You can also include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.

You can also include content of another Page/Content with the following syntax: <?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?>

To include a link to download a file stored into the documents/medias directory, use syntax:
<a href="/document.php?modulepart=medias&file=filename.ext">. +YouCanEditHtmlSource=You can edit HTML source code using the "Source" button in editor. You can also include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.

You can also include content of another Page/Container with the following syntax: <?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?>

To include a link to download a file stored into the documents/medias directory, use syntax:
<a href="/document.php?modulepart=medias&file=filename.ext">. diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 1130d760649..a576a00e025 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -1176,8 +1176,10 @@ if ($action == 'preview') // Replace php code. Note $objectpage->content come from database and does not contains body tags. $content = preg_replace('/<\?php.*\?>/ims', '...php...', $objectpage->content); - // Replace internal relative links with Dolibarr links - // TODO + // Replace relative link / with dolibarr URL + $content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageid='.$object->fk_default_home.'"', $content, -1, $nbrep); + // Replace relative link /xxx.php with dolibarr URL + $content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageref=\2"', $content, -1, $nbrep); $out.=$content."\n";