From 19f5f2a7a4eb6227c07a1c855cb101e917e683dc Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Fri, 19 Dec 2014 09:49:33 +0100 Subject: [PATCH] remove static copyright-year in templates; fix possible undefined theme-variable in phpErrHandler by specifying a fallback-default Signed-off-by: Michael Kaufmann (d00p) --- install/lib/class.FroxlorInstall.php | 1 + lib/classes/database/class.Database.php | 1 + lib/functions/froxlor/function.phpErrHandler.php | 5 +++++ lib/init.php | 3 +++ templates/Sparkle/misc/alreadyinstalledhint.tpl | 2 +- templates/Sparkle/misc/configurehint.tpl | 2 +- templates/Sparkle/misc/dberrornice.tpl | 2 +- templates/Sparkle/misc/ownershiphint.tpl | 2 +- 8 files changed, 14 insertions(+), 4 deletions(-) diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index 305017d3..10ff8cec 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -982,6 +982,7 @@ class FroxlorInstall { ) { // use sparkle theme for the notice $installed_hint = file_get_contents($this->_basepath.'/templates/Sparkle/misc/alreadyinstalledhint.tpl'); + $installed_hint = str_replace("", date('Y', time()), $installed_hint); die($installed_hint); } } diff --git a/lib/classes/database/class.Database.php b/lib/classes/database/class.Database.php index 7fbbf0aa..474c8474 100644 --- a/lib/classes/database/class.Database.php +++ b/lib/classes/database/class.Database.php @@ -364,6 +364,7 @@ class Database { // replace values $err_hint = str_replace("", $error_message, $err_hint); $err_hint = str_replace("", $error_trace, $err_hint); + $err_hint = str_replace("", date('Y', time()), $err_hint); $err_report_html = ''; if (is_array($userinfo) && ( diff --git a/lib/functions/froxlor/function.phpErrHandler.php b/lib/functions/froxlor/function.phpErrHandler.php index f5c3d584..f237accd 100644 --- a/lib/functions/froxlor/function.phpErrHandler.php +++ b/lib/functions/froxlor/function.phpErrHandler.php @@ -20,6 +20,11 @@ function phpErrHandler($errno, $errstr, $errfile, $errline, array $errcontext) { if (!isset($_SERVER['SHELL']) || (isset($_SERVER['SHELL']) && $_SERVER['SHELL'] == '')) { global $theme; + + // fallback + if (empty($theme)) { + $theme = "Sparkle"; + } // if we're not on the shell, output a nicer error-message $err_hint = file_get_contents(FROXLOR_INSTALL_DIR.'/templates/'.$theme.'/misc/phperrornice.tpl'); // replace values diff --git a/lib/init.php b/lib/init.php index 1026d1ed..d91022cf 100644 --- a/lib/init.php +++ b/lib/init.php @@ -78,6 +78,7 @@ define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__))); // check whether the userdata file exists if (!file_exists(FROXLOR_INSTALL_DIR.'/lib/userdata.inc.php')) { $config_hint = file_get_contents(FROXLOR_INSTALL_DIR.'/templates/'.$_deftheme.'/misc/configurehint.tpl'); + $config_hint = str_replace("", date('Y', time()), $config_hint); die($config_hint); } @@ -92,6 +93,7 @@ if (!is_readable(FROXLOR_INSTALL_DIR.'/lib/userdata.inc.php')) { $owner_hint = str_replace("", $posixusername['name'], $owner_hint); $owner_hint = str_replace("", $posixgroup['name'], $owner_hint); $owner_hint = str_replace("", FROXLOR_INSTALL_DIR, $owner_hint); + $owner_hint = str_replace("", date('Y', time()), $owner_hint); // show die($owner_hint); } @@ -105,6 +107,7 @@ if (!isset($sql) || !is_array($sql) ) { $config_hint = file_get_contents(FROXLOR_INSTALL_DIR.'/templates/'.$_deftheme.'/misc/configurehint.tpl'); + $config_hint = str_replace("", date('Y', time()), $config_hint); die($config_hint); } diff --git a/templates/Sparkle/misc/alreadyinstalledhint.tpl b/templates/Sparkle/misc/alreadyinstalledhint.tpl index c7138eaa..928c0743 100644 --- a/templates/Sparkle/misc/alreadyinstalledhint.tpl +++ b/templates/Sparkle/misc/alreadyinstalledhint.tpl @@ -39,7 +39,7 @@ diff --git a/templates/Sparkle/misc/configurehint.tpl b/templates/Sparkle/misc/configurehint.tpl index 40552fbd..4c465aef 100644 --- a/templates/Sparkle/misc/configurehint.tpl +++ b/templates/Sparkle/misc/configurehint.tpl @@ -37,7 +37,7 @@ diff --git a/templates/Sparkle/misc/dberrornice.tpl b/templates/Sparkle/misc/dberrornice.tpl index e1f0557e..eb1d5f8d 100644 --- a/templates/Sparkle/misc/dberrornice.tpl +++ b/templates/Sparkle/misc/dberrornice.tpl @@ -50,7 +50,7 @@ diff --git a/templates/Sparkle/misc/ownershiphint.tpl b/templates/Sparkle/misc/ownershiphint.tpl index 454e5bd1..74a98275 100644 --- a/templates/Sparkle/misc/ownershiphint.tpl +++ b/templates/Sparkle/misc/ownershiphint.tpl @@ -45,7 +45,7 @@