Fix when there is several php part in same page

This commit is contained in:
Laurent Destailleur 2017-07-21 19:01:06 +02:00
parent f3271791f8
commit 2514c02817
2 changed files with 3 additions and 3 deletions

View File

@ -14,8 +14,8 @@ EditMenu=Edit menu
EditPageMeta=Edit Meta
EditPageContent=Edit Content
Website=Web site
Webpage=Web page
AddPage=Add page
Webpage=Web page/container
AddPage=Add page/container
HomePage=Home Page
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> 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.

View File

@ -1215,7 +1215,7 @@ if ($action == 'preview')
$out.='<div id="bodywebsite" class="bodywebsite">'."\n";
// Replace php code. Note $objectpage->content come from database and does not contains body tags.
$content = preg_replace('/<\?php.*\?>/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $objectpage->content);
$content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $objectpage->content);
// 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);