diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index 4ca0812c9ee..610cbb3cc55 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -31,6 +31,7 @@
* @param string $content Content to replace
* @param int $removephppart 0=Replace PHP sections with a PHP badge. 1=Remove completely PHP sections.
* @return boolean True if OK
+ * @see dolWebsiteOutput for function used to replace content in a web server context
*/
function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
{
@@ -48,10 +49,16 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
// Replace relative link /xxx.php with dolibarr URL
$content = preg_replace('/(href=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $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);
+ $content = preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
+ //
]*src=")(medias\/)/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
//
]*src=")(?!(http|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
+ $content = preg_replace('/(]*src=")(?!(http|\/?viewimage|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
+ //
]*src=")(\/?viewimage\.php)/', '\1'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
@@ -70,7 +77,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
*
* @param string $content Content string
* @return void
- * @see dolWebsiteSaveContent
+ * @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice editor context
*/
function dolWebsiteOutput($content)
{
@@ -98,15 +105,24 @@ function dolWebsiteOutput($content)
$content=preg_replace('/(href=")\/?([a-zA-Z0-9\-]+)(\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep);
$content=preg_replace('/(href=")\/?([a-zA-Z0-9\-]+)(\?)/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep);
- // Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
+ // Fix relative link /document.php with correct URL after the DOL_URL_ROOT: href="/document.php?modulepart=" => href="/dolibarr/document.php?modulepart="
$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="
+ // 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);
// 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);
+ $content=preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
+
+ //
]*src=")(medias\/)/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
+ //
]*src=")(?!(http|\/?viewimage|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
+ //
]*src=")(\/?viewimage\.php)/', '\1'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/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 6286f19b8dc..e18f397d393 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -22,6 +22,7 @@ EditCss=Edit Style/CSS or HTML header
EditMenu=Edit menu
EditMedias=Edit medias
EditPageMeta=Edit Meta
+EditInline=Edit inline
AddWebsite=Add website
Webpage=Web page/container
AddPage=Add page/container
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index e1460f497f1..94346b8a04f 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -1651,16 +1651,29 @@ if (count($object->records) > 0)
print ' ';
print '';
+
+ print '';
+
if ($websitepage->grabbed_from)
{
- print '';
+ //print '';
+ print ''.dol_escape_htmltag($langs->trans("EditInLine")).'';
}
else
{
- print '';
+ //print '';
+ if (empty($conf->global->WEBSITE_EDITINLINE))
+ {
+ print 'id.'&pageid='.$websitepage->id.'&action=seteditinline">'.dol_escape_htmltag($langs->trans("EditInLine")).'';
+ }
+ else
+ {
+ print 'id.'&pageid='.$websitepage->id.'&action=unseteditinline">'.dol_escape_htmltag($langs->trans("EditInLine")).'';
+ }
}
- print '';
+ print ' ';
+
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '';
else print '';
print '';
@@ -2305,8 +2318,6 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
$out.='