Added a check for config.php file to start with PHP opening tag.
authorNik Okuntseff <support@anuko.com>
Wed, 31 Aug 2016 18:09:41 +0000 (18:09 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 31 Aug 2016 18:09:41 +0000 (18:09 +0000)
WEB-INF/templates/footer.tpl
dbinstall.php

index a91075b..793494d 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.9.30.3528 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.30.3529 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 49d61f1..46fc0fc 100755 (executable)
@@ -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.<br>');
+
+    // 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("<?php\n", $line) !== 0) {
+      echo('<font color="red">Error: WEB-INF/config.php file does not start with PHP opening tag.</font><br>');
+    }
+    fclose($file);
   } else {
     echo('<font color="red">Error: WEB-INF/config.php file does not exist.</font><br>');
   }