From 29a3ffb99435827d5a7ea6886ac22bd2ee18d593 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 27 Oct 2011 19:44:10 -0400 Subject: I think this fixes everything, but it now depends on PHP 5.3+ The introduction of the dependency on PHP 5.3 is that lib/Singleton.class uses `get_called_class()' --- index.php | 2 ++ src/lib/Database.class.php | 4 ++-- src/lib/Login.class.php | 2 +- src/lib/Model.class.php | 2 +- src/lib/Singleton.class.php | 10 +++++----- src/models/Auth.class.php | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 231b4d6..6c17d47 100644 --- a/index.php +++ b/index.php @@ -52,7 +52,9 @@ require_once('View.class.php'); require_once('Controller.class.php'); // Check if we have a database configuration /////////////////////////////////// +$conf_file = BASEPATH.'/conf.php'; if (file_exists($conf_file)) { + require_once('Database.class.php'); new Database($conf_file); session_start(); } else { diff --git a/src/lib/Database.class.php b/src/lib/Database.class.php index 1e98511..a76d891 100644 --- a/src/lib/Database.class.php +++ b/src/lib/Database.class.php @@ -122,7 +122,7 @@ class Database extends Singleton { $table = $this->mysql_table('auth'); $hasher = Hasher::getInstance(); - @$hash = $hasher->hashPassword($password); + @$hash = $hasher->hash($password); $query = "UPDATE $table \n". "SET hash='$hash' \n". @@ -139,7 +139,7 @@ class Database extends Singleton { $table = $this->mysql_table('auth'); $user = $this->mysql_escape($username); $hasher = Hasher::getInstance(); - @$hash = $hasher->hashPassword($password); + @$hash = $hasher->hash($password); $status = 0; $query = "INSERT INTO $table ( name, hash , status) \n". diff --git a/src/lib/Login.class.php b/src/lib/Login.class.php index a470176..bb21928 100644 --- a/src/lib/Login.class.php +++ b/src/lib/Login.class.php @@ -19,7 +19,7 @@ class Login { return 2; } $hash = $db->getPasswordHash($uid); - if ($hasher->CheckPassword($password, $hash)) { + if ($hasher->check($password, $hash)) { // success $_SESSION['uid'] = $uid; return 0; diff --git a/src/lib/Model.class.php b/src/lib/Model.class.php index 14f59d4..0cce525 100644 --- a/src/lib/Model.class.php +++ b/src/lib/Model.class.php @@ -4,6 +4,6 @@ require_once('Database.class.php'); abstract class Model { protected $db; public function __construct() { - $db = Database::getInstance(); + $this->db = Database::getInstance(); } } diff --git a/src/lib/Singleton.class.php b/src/lib/Singleton.class.php index 4eb3bb3..2f8c74f 100644 --- a/src/lib/Singleton.class.php +++ b/src/lib/Singleton.class.php @@ -1,12 +1,12 @@ getStatus($uid)<3; + $type = Database::getInstance()->getStatus($uid); switch ($type) { case 0: // unactivated user case 1: // user -- cgit v1.1-4-g5e80