summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Database.class.php4
-rw-r--r--src/lib/Login.class.php2
-rw-r--r--src/lib/Model.class.php2
-rw-r--r--src/lib/Singleton.class.php10
4 files changed, 9 insertions, 9 deletions
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 @@
<?php
abstract class Singleton {
- private static $obj;
+ private static $instances = array();
public static function getInstance() {
- if (!isset(self::$obj)) {
- $class = get_called_class();
- self::$obj = new $class;
+ $class = get_called_class();
+ if (!isset(self::$instances[$class])) {
+ self::$instances[$class] = new $class;
}
- return self::$obj;
+ return self::$instances[$class];
}
}