diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 70f61055689..49486870a13 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -212,6 +212,10 @@ function dolWebsiteOutput($content) $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); + $content=preg_replace('/(]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep); + $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep); + $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep); + $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep); } else @@ -222,6 +226,10 @@ function dolWebsiteOutput($content) $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1medias/\4\5', $content, -1, $nbrep); $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep); + $content=preg_replace('/(]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep); + $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep); + $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep); + $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep); } } diff --git a/htdocs/install/doctemplates/websites/website_template-corporate.zip b/htdocs/install/doctemplates/websites/website_template-corporate.zip index 5aca2fbc8aa..f4b25d9a69e 100644 Binary files a/htdocs/install/doctemplates/websites/website_template-corporate.zip and b/htdocs/install/doctemplates/websites/website_template-corporate.zip differ diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index d96f2bfb1cb..d5dd5827a70 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -92,4 +92,5 @@ ZipOfWebsitePackageToImport=Zip file of website package ShowSubcontainers=Include dynamic content InternalURLOfPage=Internal URL of page ThisPageIsTranslationOf=This page/container is translation of -ThisPageHasTranslationPages=This page/container has translation \ No newline at end of file +ThisPageHasTranslationPages=This page/container has translation +NoWebSiteCreateOneFirst=No website created yet. Create on first. \ No newline at end of file diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 7ee5e2d8f6d..5913c32c71a 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -366,7 +366,7 @@ if ($action == 'addcontainer') $urltograb.='/'; } $pageurl = dol_sanitizeFileName(preg_replace('/[\/\.]/','-', preg_replace('/\/+$/', '', $urltograbwithoutdomainandparam))); - + $urltograbdirwithoutslash = dirname($urltograb.'.'); $urltograbdirrootwithoutslash = getRootURLFromURL($urltograbdirwithoutslash); // Exemple, now $urltograbdirwithoutslash is https://www.dolimed.com/screenshots @@ -869,14 +869,14 @@ if ($action == 'updatecss') $filemaster=$pathofwebsite.'/master.inc.php'; dol_syslog("Save master file ".$filemaster); - + dol_mkdir($pathofwebsite); // Now generate the master.inc.php page $result = dolSaveMasterFile($filemaster); if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); - + // Html header file $htmlheadercontent =''; @@ -1472,8 +1472,15 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf { if (! $error) { - setEventMessages($langs->trans("NoPageYet"), null, 'warnings'); - setEventMessages($langs->trans("YouCanCreatePageOrImportTemplate"), null, 'warnings'); + if (empty($websitekey) || $websitekey == '-1') + { + setEventMessages($langs->trans("NoWebSiteCreateOneFirst"), null, 'warnings'); + } + else + { + setEventMessages($langs->trans("NoPageYet"), null, 'warnings'); + setEventMessages($langs->trans("YouCanCreatePageOrImportTemplate"), null, 'warnings'); + } } } } @@ -1666,11 +1673,10 @@ if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') if (! GETPOST('hide_websitemenu')) { -//var_dump($objectpage);exit; -print '
'; + //var_dump($objectpage);exit; + print '
'; + -if (count($object->records) > 0) // There is at least one web site -{ // ***** Part for web sites print ''; print '
'; @@ -1713,12 +1719,15 @@ if (count($object->records) > 0) // There is at least one web site if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost; } - - $array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl'); + $array=array(); + if ($object->id > 0) + { + $array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl'); + } if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors); $atleastonepage=(is_array($array) && count($array) > 0); - if ($websitekey && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) + if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) { $disabled=''; if (empty($user->rights->website->write)) $disabled=' disabled="disabled"'; @@ -1828,7 +1837,7 @@ if (count($object->records) > 0) // There is at least one web site // Toolbar for pages - if ($websitekey && ! in_array($action, array('editcss','editmenu','importsite'))) + if ($websitekey && $websitekey != '-1' && ! in_array($action, array('editcss','editmenu','importsite'))) { print '
'; // Close current websitebar to open a new one @@ -2125,17 +2134,8 @@ if (count($object->records) > 0) // There is at least one web site } } } -} -else -{ - print '
'; - $langs->load("errors"); - print $langs->trans("ErrorModuleSetupNotComplete"); - print '
'; - $action=''; -} -print '
'; // end current websitebar + print '
'; // end current websitebar } @@ -2743,7 +2743,8 @@ if ($action == 'editsource') $doleditor->Create(0, '', false); }*/ -print "
\n\n"; +print "
\n"; +print "\n"; if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone') @@ -2874,8 +2875,16 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa } else { - print '

'.$langs->trans("PreviewOfSiteNotYetAvailable", $object->ref).'


'; - print '
'; + if (empty($websitekey) || $websitekey == '-1') + { + print '

'.$langs->trans("NoWebSiteCreateOneFirst").'


'; + print '
'; + } + else + { + print '

'.$langs->trans("PreviewOfSiteNotYetAvailable", $object->ref).'


'; + print '
'; + } } }