diff options
author | canyonknight <canyonknight@gmail.com> | 2013-02-03 16:26:28 +0000 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2013-02-10 12:10:37 +0100 |
commit | 8e03e68d687015b5cd8c9d3857e1a1d007252afa (patch) | |
tree | 26cd5d7aa6cfac4f6fddfa1f76fdc59d2cbd4a0f /web/lib/translator.inc.php | |
parent | b3a2b6c4a59a2cd90b020120b64f16797af1b6fb (diff) |
Add database wrapper class and new connection method
Uses the Singleton pattern to ensure all queries use the same
database connection that is released upon script completion.
All database connections should now be called with DB::connect() and
not db_connect().
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/translator.inc.php')
-rw-r--r-- | web/lib/translator.inc.php | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/web/lib/translator.inc.php b/web/lib/translator.inc.php index 1477b17..67693e0 100644 --- a/web/lib/translator.inc.php +++ b/web/lib/translator.inc.php @@ -12,6 +12,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR # print __("This is a %smajor%s problem!", "<strong>", "</strong>"); include_once('config.inc.php'); +include_once('DB.class.php'); include_once('gettext.php'); include_once('streams.php'); @@ -69,7 +70,7 @@ function __() { # set up the visitor's language # -function set_lang($dbh=NULL) { +function set_lang() { global $LANG; global $SUPPORTED_LANGS; global $PERSISTENT_COOKIE_TIMEOUT; @@ -90,9 +91,7 @@ function set_lang($dbh=NULL) { } elseif (isset($_COOKIE["AURSID"])) { # No language but a session; use default lang preference # - if(!$dbh) { - $dbh = db_connect(); - } + $dbh = DB::connect(); $q = "SELECT LangPreference FROM Users, Sessions "; $q.= "WHERE Users.ID = Sessions.UsersID "; $q.= "AND Sessions.SessionID = '"; |