diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-09-26 13:46:14 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-09-26 13:46:14 +0200 |
commit | 3ff6ffa3341c876b741feb66552cdd110b67872e (patch) | |
tree | 69e11cd0009ddd1346f2dc4cd8c47244368db28e /application/controllers/api/v2/user.php | |
parent | bc2f7f596f727e204e8b8c5b849545745b3cbfaa (diff) | |
parent | 81a4c8c630ef59cffea0c24e64fb6fa7f09bfcf6 (diff) |
Merge CodeIgniter 3 support
Diffstat (limited to 'application/controllers/api/v2/user.php')
-rw-r--r-- | application/controllers/api/v2/user.php | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/application/controllers/api/v2/user.php b/application/controllers/api/v2/user.php index 655dc62f3..677a870c4 100644 --- a/application/controllers/api/v2/user.php +++ b/application/controllers/api/v2/user.php @@ -13,31 +13,31 @@ class user extends \controllers\api\api_controller { { parent::__construct(); - $this->load->model('muser'); + $this->CI->load->model('muser'); } public function apikeys() { - $this->muser->require_access("full"); - return \service\user::apikeys($this->muser->get_userid()); + $this->CI->muser->require_access("full"); + return \service\user::apikeys($this->CI->muser->get_userid()); } public function create_apikey() { - $username = $this->input->post("username"); - $password = $this->input->post("password"); + $username = $this->CI->input->post("username"); + $password = $this->CI->input->post("password"); if ($username && $password) { - if (!$this->muser->login($username, $password)) { + if (!$this->CI->muser->login($username, $password)) { throw new \exceptions\NotAuthenticatedException("user/login-failed", "Login failed"); } } - $this->muser->require_access("full"); + $this->CI->muser->require_access("full"); - $userid = $this->muser->get_userid(); - $comment = $this->input->post("comment"); - $comment = $comment === false ? "" : $comment; - $access_level = $this->input->post("access_level"); + $userid = $this->CI->muser->get_userid(); + $comment = $this->CI->input->post("comment"); + $comment = $comment === null ? "" : $comment; + $access_level = $this->CI->input->post("access_level"); $key = \service\user::create_apikey($userid, $comment, $access_level); @@ -48,16 +48,16 @@ class user extends \controllers\api\api_controller { public function delete_apikey() { - $this->muser->require_access("full"); + $this->CI->muser->require_access("full"); - $userid = $this->muser->get_userid(); - $key = $this->input->post("delete_key"); + $userid = $this->CI->muser->get_userid(); + $key = $this->CI->input->post("delete_key"); - $this->db->where('user', $userid) + $this->CI->db->where('user', $userid) ->where('key', $key) ->delete('apikeys'); - $affected = $this->db->affected_rows(); + $affected = $this->CI->db->affected_rows(); assert($affected >= 0 && $affected <= 1); if ($affected == 1) { |