diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 9bf00e8d6e3..354da07c6f2 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -56,6 +56,7 @@ function dolWebsiteOutput($content) else { $content=preg_replace('/()/', '\1medias/\4\5', $content, -1, $nbrep); + $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep); } } else diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 151ac85d532..3b29f51e29d 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -34,3 +34,5 @@ VirtualHostUrlNotDefined=URL of the virtual host served by external web server n 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/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">. +ClonePage=Clone page/container +CloneSite=Clone site \ No newline at end of file diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index cda5d0ee836..0ae1902613c 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -260,16 +260,22 @@ if ($action == 'updatecss') // Html header file $htmlheadercontent =''; - /* Not required. htmlheader.html is never call as a standalone page - $htmlheadercontent.= '"."\n"; - */ - $htmlheadercontent.= ''."\n"; - $htmlheadercontent.= ''."\n"; - $htmlheadercontent.= ''."\n"; + + $htmlheadercontent.= "\n"; + $htmlheadercontent.= preg_replace(array('/\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER')); + $htmlheadercontent.= "\n".'"."\n"; + dol_syslog("Save file css into ".$filehtmlheader); dol_mkdir($pathofwebsite); @@ -285,14 +291,23 @@ if ($action == 'updatecss') // Css file $csscontent =''; - $csscontent.= '"."\n"; - $csscontent.= '/* BEGIN DOLIBARR-WEBSITE-CSS-ADDED-HEADER */'."\n"; - $csscontent.= '/* File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THE FILE styles.css.php. Change affects all pages of website. */'."\n"; - $csscontent.= '/* END */'."\n"; + $csscontent.= "// END PHP ?>\n"; + $csscontent.= GETPOST('WEBSITE_CSS_INLINE'); + $csscontent.= "\n".'"."\n"; + + dol_syslog("Save file css into ".$filecss); dol_mkdir($pathofwebsite); @@ -1035,19 +1050,19 @@ if ($action == 'editcss') $csscontent = @file_get_contents($filecss); // Clean the php css file to remove php code and get only css part - $csscontent = preg_replace('/^<\?php[^\?]+\?>\n*/ims', '', $csscontent); - $csscontent = preg_replace('/\/\* BEGIN DOLIBARR.*END \*\/\n*/ims', '', $csscontent); + $csscontent = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $csscontent); + + $csscontent.= GETPOST('WEBSITE_CSS_INLINE'); if (! trim($csscontent)) $csscontent='/* CSS content (all pages) */'."\n".'body.bodywebsite { margin: 0; }'; $htmlheader = @file_get_contents($filehtmlheader); // Clean the php htmlheader file to remove php code and get only html part - $htmlheader = preg_replace('/^<\?php[^\?]+\?>\n*/ims', '', $htmlheader); - $htmlheader = preg_replace('/\n*/ims', '', $htmlheader); + $htmlheader = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $htmlheader); - if (! trim($htmlheader)) $htmlheader=''; - else $htmlheader=''.$htmlheader.''; + if (! trim($htmlheader)) $htmlheader=''."\n".''."\n".''; + else $htmlheader=''."\n".$htmlheader."\n".''; dol_fiche_head(); @@ -1084,12 +1099,6 @@ if ($action == 'editcss') print '';*/ print ''; - /*print ''; - print $langs->trans('WEBSITE_CSS_URL'); - print ''; - print ''; - print '';*/ - print ''; dol_fiche_end();