From 5aa92645bf876259fa327cf89a23df1f7034b1e3 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Wed, 31 Aug 2016 18:09:41 +0000 Subject: [PATCH] Added a check for config.php file to start with PHP opening tag. --- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index a91075bb..793494df 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.9.30.3528 | Copyright © Anuko | +  Anuko Time Tracker 1.9.30.3529 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 49d61f1e..46fc0fc7 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -55,6 +55,16 @@ if ($request->isGet()) { // Require the configuration file with application settings. if (file_exists(APP_DIR."/WEB-INF/config.php")) { echo('WEB-INF/config.php file exists.
'); + + // Config file must start with the PHP opening tag. We are checking this because + // a Unicode editor may insert a byte order matk (BOM) before it. This is not good as it will + // spit white space before output in some situations such as in PDF reports. + $file = fopen(APP_DIR."/WEB-INF/config.php", "r"); + $line = fgets($file); + if (strcmp("Error: WEB-INF/config.php file does not start with PHP opening tag.
'); + } + fclose($file); } else { echo('Error: WEB-INF/config.php file does not exist.
'); } -- 2.20.1