diff options
author | Kevin Chabowski <kevin@kch42.de> | 2012-01-21 22:00:33 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2012-01-21 22:00:33 +0100 |
commit | a36e46d44db24622eeed4438342dfdbd98a28727 (patch) | |
tree | 189748224c65613991f9975feafb60b7d543b29e /ratatoeskr/sys | |
parent | eaabdafbcbad712a82878c8a08e0b8b097cae2be (diff) | |
download | ratatoeskr-cms-a36e46d44db24622eeed4438342dfdbd98a28727.tar.gz ratatoeskr-cms-a36e46d44db24622eeed4438342dfdbd98a28727.tar.bz2 ratatoeskr-cms-a36e46d44db24622eeed4438342dfdbd98a28727.zip |
Setup script and clean config file.
Diffstat (limited to 'ratatoeskr/sys')
-rw-r--r-- | ratatoeskr/sys/db.php | 14 | ||||
-rw-r--r-- | ratatoeskr/sys/translation.php | 18 |
2 files changed, 22 insertions, 10 deletions
diff --git a/ratatoeskr/sys/db.php b/ratatoeskr/sys/db.php index 6add093..5ab2688 100644 --- a/ratatoeskr/sys/db.php +++ b/ratatoeskr/sys/db.php @@ -10,7 +10,9 @@ * See "ratatoeskr/licenses/ratatoeskr" for more information. */ -require_once(dirname(__FILE__) . "/../config.php"); +if(!defined("SETUP")) + require_once(dirname(__FILE__) . "/../config.php"); + require_once(dirname(__FILE__) . "/utils.php"); /* @@ -21,16 +23,16 @@ require_once(dirname(__FILE__) . "/utils.php"); function db_connect() { global $config; - $db_connection = mysql_pconnect( + $db_connection = @mysql_pconnect( $config["mysql"]["server"], $config["mysql"]["user"], $config["mysql"]["passwd"]); if(!$db_connection) - die("Could not connect to database server. " . mysql_error()); + throw new MySQLException("Could not connect to database server. " . mysql_error()); + + if(!@mysql_select_db($config["mysql"]["db"], $db_connection)) + throw new MySQLException("Could not open database. " . mysql_error()); - if(!mysql_select_db($config["mysql"]["db"], $db_connection)) - die("Could not open database. " . mysql_error()); - mysql_query("SET NAMES 'utf8'", $db_connection); } diff --git a/ratatoeskr/sys/translation.php b/ratatoeskr/sys/translation.php index ca43c13..6c494db 100644 --- a/ratatoeskr/sys/translation.php +++ b/ratatoeskr/sys/translation.php @@ -9,10 +9,12 @@ * See "ratatoeskr/licenses/ratatoeskr" for more information. */ -require_once(dirname(__FILE__) . "/models.php"); require_once(dirname(__FILE__) . "/utils.php"); require_once(dirname(__FILE__) . "/init_ste.php"); +if(!defined("SETUP")) + require_once(dirname(__FILE__) . "/models.php"); + if(!defined(TRANSLATION_PLUGIN_LOADED)) { $ste->register_tag( @@ -38,9 +40,17 @@ if(!defined(TRANSLATION_PLUGIN_LOADED)) */ function load_language($lang=NULL) { - global $ratatoeskr_settings; - if($lang === NULL) - $lang = $ratatoeskr_settings["default_language"]; + if(!defined("SETUP")) + { + global $ratatoeskr_settings; + if($lang === NULL) + $lang = $ratatoeskr_settings["default_language"]; + } + else + { + if($lang === NULL) + $lang = "en"; + } /* * Because we will include an file defined by the $lang param, we will |