summaryrefslogtreecommitdiff
path: root/src/lib/Database.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Database.class.php')
-rw-r--r--src/lib/Database.class.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/lib/Database.class.php b/src/lib/Database.class.php
index 13d9559..1e98511 100644
--- a/src/lib/Database.class.php
+++ b/src/lib/Database.class.php
@@ -1,12 +1,19 @@
<?php
+require_once('Singleton.class.php');
+require_once('Hasher.class.php');
-class Database {
+class Database extends Singleton {
+ private static $me = null;
private $conf;
private $mysql;
private $db_prefix;
public function __construct($conf_file) {
$this->conf = $conf_file;
+ self::$me = $this;
+ }
+ public static function getInstance() {
+ return self::$me;
}
// Low-Level SQL functions /////////////////////////////////////////////
@@ -114,9 +121,8 @@ class Database {
if (!is_int($uid)) return false;
$table = $this->mysql_table('auth');
- global $mm;
- $hasher = $mm->hasher();
- @$hash = $hasher->HashPassword($password);
+ $hasher = Hasher::getInstance();
+ @$hash = $hasher->hashPassword($password);
$query =
"UPDATE $table \n".
"SET hash='$hash' \n".
@@ -130,12 +136,10 @@ class Database {
return false;
}
- global $mm;
-
$table = $this->mysql_table('auth');
$user = $this->mysql_escape($username);
- $hasher = $mm->hasher();
- @$hash = $hasher->HashPassword($password);
+ $hasher = Hasher::getInstance();
+ @$hash = $hasher->hashPassword($password);
$status = 0;
$query =
"INSERT INTO $table ( name, hash , status) \n".