summaryrefslogtreecommitdiffstats
path: root/application/models/muser.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-10-19 23:04:20 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-10-19 23:04:41 +0200
commitc8d9d70f60ccc8d77180627852810453375c91fd (patch)
tree72cdbe776fce9dccefb13610913ff24dcd3d92e4 /application/models/muser.php
parent111c356f7833d1619f0da75d019c390a424d6445 (diff)
parent1abe7372404a9d65f3b59eda2d83e628267b366d (diff)
Merge postgresql support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models/muser.php')
-rw-r--r--application/models/muser.php41
1 files changed, 18 insertions, 23 deletions
diff --git a/application/models/muser.php b/application/models/muser.php
index a1d8f18e5..ffcc5f6b3 100644
--- a/application/models/muser.php
+++ b/application/models/muser.php
@@ -97,17 +97,16 @@ class Muser extends CI_Model {
// get rid of spaces and newlines
$apikey = trim($apikey);
- $query = $this->db->query("
- SELECT a.user userid, a.access_level
- FROM apikeys a
- WHERE a.key = ?
- ", array($apikey))->row_array();
+ $query = $this->db->select('user, access_level')
+ ->from('apikeys')
+ ->where('key', $apikey)
+ ->get()->row_array();
- if (isset($query["userid"])) {
+ if (isset($query["user"])) {
$this->session->set_userdata(array(
'logged_in' => true,
'username' => '',
- 'userid' => $query["userid"],
+ 'userid' => $query["user"],
'access_level' => $query["access_level"],
));
return true;
@@ -205,12 +204,10 @@ class Muser extends CI_Model {
function get_action($action, $key)
{
- $query = $this->db->query("
- SELECT *
- FROM actions
- WHERE `key` = ?
- AND `action` = ?
- ", array($key, $action))->row_array();
+ $query = $this->db->from('actions')
+ ->where('key', $key)
+ ->where('action', $action)
+ ->get()->row_array();
if (!isset($query["key"]) || $key != $query["key"]) {
show_error("Invalid action key");
@@ -228,11 +225,10 @@ class Muser extends CI_Model {
"upload_id_limits" => $this->default_upload_id_limits,
);
- $query = $this->db->query("
- SELECT ".implode(", ", array_keys($fields))."
- FROM `profiles`
- WHERE user = ?
- ", array($userid))->row_array();
+ $query = $this->db->select(implode(', ', array_keys($fields)))
+ ->from('profiles')
+ ->where('user', $userid)
+ ->get()->row_array();
$extra_fields = array(
"username" => $this->get_username(),
@@ -262,11 +258,10 @@ class Muser extends CI_Model {
{
$userid = $this->get_userid();
- $query = $this->db->query("
- SELECT upload_id_limits
- FROM `profiles`
- WHERE user = ?
- ", array($userid))->row_array();
+ $query = $this->db->select('upload_id_limits')
+ ->from('profiles')
+ ->where('user', $userid)
+ ->get()->row_array();
if (empty($query)) {
return explode("-", $this->default_upload_id_limits);