From 2d3be5a92ce009fb4781d66aa24883b12b719592 Mon Sep 17 00:00:00 2001 From: SJ Date: Fri, 12 Apr 2013 22:30:48 +0200 Subject: [PATCH] fixed an imap auth related bug --- webui/model/user/auth.php | 2 +- webui/model/user/user.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webui/model/user/auth.php b/webui/model/user/auth.php index 5dc23f92..b71e4ed8 100644 --- a/webui/model/user/auth.php +++ b/webui/model/user/auth.php @@ -129,7 +129,7 @@ class ModelUserAuth extends Model { $uid = $this->model_user_user->get_uid_by_email($email); if($uid < 1) { - $uid = $this->model_user_user->get_next_uid(); + $uid = $this->model_user_user->get_next_uid(TABLE_EMAIL); $query = $this->db->query("INSERT INTO " . TABLE_EMAIL . " (uid, email) VALUES(?,?)", array($uid, $email)); } diff --git a/webui/model/user/user.php b/webui/model/user/user.php index 01c35778..2dd49960 100644 --- a/webui/model/user/user.php +++ b/webui/model/user/user.php @@ -294,9 +294,9 @@ class ModelUserUser extends Model { } - public function get_next_uid() { + public function get_next_uid($table = TABLE_USER) { - $query = $this->db->query("SELECT MAX(uid) AS last_id FROM " . TABLE_USER); + $query = $this->db->query("SELECT MAX(uid) AS last_id FROM " . $table); if(isset($query->row['last_id']) && $query->row['last_id'] > 0) { return (int)$query->row['last_id'] + 1;