diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/vauth/auth.lib.php | 2 | ||||
-rw-r--r-- | modules/vauth/dbh.lib.php | 64 | ||||
-rw-r--r-- | modules/vauth/init.php | 3 | ||||
-rw-r--r-- | modules/vauth/session.lib.php | 14 |
4 files changed, 9 insertions, 74 deletions
diff --git a/modules/vauth/auth.lib.php b/modules/vauth/auth.lib.php index 336b370d..5440bdb2 100644 --- a/modules/vauth/auth.lib.php +++ b/modules/vauth/auth.lib.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2006 Karl Vollmer + Copyright (c) 2006 - 2007 Karl Vollmer All rights reserved. This program is free software; you can redistribute it and/or diff --git a/modules/vauth/dbh.lib.php b/modules/vauth/dbh.lib.php deleted file mode 100644 index eb3575d0..00000000 --- a/modules/vauth/dbh.lib.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/* - - Copyright (c) 2006 Karl Vollmer - All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/** - * Database Handler File - * This file contains functions for handling the database connection - * Yup! - */ - - -/** - * vauth_dbh - * Init's the dbh yea - */ -function vauth_dbh($handle='vauth_dbh') { - - $dbh = vauth_conf($handle); - - /* If we don't have a db connection yet */ - if (!is_resource($dbh)) { - - $hostname = vauth_conf('mysql_hostname'); - $username = vauth_conf('mysql_username'); - $password = vauth_conf('mysql_password'); - $database = vauth_conf('mysql_db'); - - $dbh = mysql_pconnect($hostname, $username, $password); - $select_db = mysql_select_db($database, $dbh); - - /* If either one of these fails */ - if (!is_resource($dbh) || !$select_db) { - vauth_error('Database Connection Failed' . mysql_error()); - return false; - } - - vauth_conf(array($handle => $dbh),1); - - } // if no db connection - - return $dbh; - -} // vauth_dbh - - -?> diff --git a/modules/vauth/init.php b/modules/vauth/init.php index 60928e00..ecd0ee25 100644 --- a/modules/vauth/init.php +++ b/modules/vauth/init.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2006 Karl Vollmer + Copyright (c) 2007 Karl Vollmer All rights reserved. This program is free software; you can redistribute it and/or @@ -119,7 +119,6 @@ function vauth_init($data) { if (isset($error_status)) { return false; } /* Load the additional libraries that we may or may not need... */ - require_once 'dbh.lib.php'; require_once 'session.lib.php'; require_once 'auth.lib.php'; diff --git a/modules/vauth/session.lib.php b/modules/vauth/session.lib.php index 6d71bf9c..ddb99d1c 100644 --- a/modules/vauth/session.lib.php +++ b/modules/vauth/session.lib.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2006 Karl Vollmer + Copyright (c) 2006 - 2007 Karl Vollmer All rights reserved. This program is free software; you can redistribute it and/or @@ -42,7 +42,7 @@ session_set_save_handler( */ function vauth_sess_open($save_path,$session_name) { - if (!is_resource(vauth_dbh())) { + if (!is_resource(Dba::dbh())) { vauth_error('Session open failed, no database handle'); return false; } @@ -95,7 +95,7 @@ function vauth_sess_write($key,$value) { $sql = "UPDATE session SET value='$value', expire='$expire'" . " WHERE id='$key'"; - $db_results = mysql_query($sql, vauth_dbh()); + $db_results = Dba::query($sql); return $db_results; @@ -110,8 +110,8 @@ function vauth_sess_destory($key) { $key = Dba::escape($key); /* Remove any database entries */ - $sql = "DELETE FROM session WHERE id='$key'"; - $db_results = mysql_query($sql, vauth_dbh()); + $sql = "DELETE FROM `session` WHERE `id`='$key'"; + $db_results = Dba::query($sql); /* Destory the Cookie */ setcookie (vauth_conf('session_name'),'',time() - 86400); @@ -155,7 +155,7 @@ function vauth_get_session($key) { $sql = "SELECT * FROM `session` WHERE `id`='$key' AND `expire` > '" . time() . "'"; $db_results = Dba::query($sql); - $results = mysql_fetch_assoc($db_results); + $results = Dba::fetch_assoc($db_results); if (!count($results)) { vauth_error("Query: $sql failed to return results " . mysql_error()); @@ -215,7 +215,7 @@ function vauth_session_create($data) { /* Insert the row */ $sql = "INSERT INTO session (`id`,`username`,`type`,`value`,`expire`) " . " VALUES ('$key','$username','$type','$value','$expire')"; - $db_results = mysql_query($sql, vauth_dbh()); + $db_results = Dba::query($sql); if (!$db_results) { vauth_error("Session Creation Failed with Query: $sql and " . mysql_error()); |