From 2e6a2115776a66329a885a923f78763151600eed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Aug 2017 04:17:28 +0200 Subject: [PATCH] Clean code --- htdocs/public/websites/index.php | 2 +- htdocs/websites/index.php | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/public/websites/index.php b/htdocs/public/websites/index.php index 81b5f985186..c82ff9975d0 100644 --- a/htdocs/public/websites/index.php +++ b/htdocs/public/websites/index.php @@ -190,7 +190,7 @@ if (! file_exists($original_file_osencoded)) // Output page content define('USEDOLIBARRSERVER', 1); -print ''."\n"; +print ''."\n"; include_once $original_file_osencoded; diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 1982d08af01..5b2ac181e03 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -323,6 +323,7 @@ if ($action == 'updatecss') // Html header file $htmlheadercontent =''; + /* We disable php code since htmlheader is never executed as an include but only read by fgets_content. $htmlheadercontent.= "\n"; + $htmlheadercontent.= "// END PHP ?>\n";*/ $htmlheadercontent.= preg_replace(array('/\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER')); - $htmlheadercontent.= "\n".'"."\n"; + $htmlheadercontent.= "// END PHP ?>"."\n";*/ - dol_syslog("Save file css into ".$filehtmlheader); + $htmlheadercontent = trim($htmlheadercontent)."\n"; + + dol_syslog("Save html header into ".$filehtmlheader); dol_mkdir($pathofwebsite); $result = file_put_contents($filehtmlheader, $htmlheadercontent); @@ -369,7 +372,7 @@ if ($action == 'updatecss') $csscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n"; $csscontent.= "// END PHP ?>"."\n"; - dol_syslog("Save file css into ".$filecss); + dol_syslog("Save css content into ".$filecss); dol_mkdir($pathofwebsite); $result = file_put_contents($filecss, $csscontent); @@ -1179,7 +1182,7 @@ if ($action == 'editcss') } $htaccesscontent = @file_get_contents($filehtaccess); - // Clean the php htmlheader file to remove php code and get only html part + // Clean the php htaccesscontent file to remove php code and get only html part $htaccesscontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htaccesscontent); if (! trim($htaccesscontent)) {