From 4388f9080ded6d4e4db9a333e94a005ba072a8cd Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 18 Sep 2017 12:45:31 +0200 Subject: Migrate return code checks for CI3 Signed-off-by: Florian Pritz --- application/controllers/Main.php | 2 +- application/controllers/User.php | 16 ++++++++-------- application/controllers/api/v2/user.php | 2 +- application/controllers/file/Multipaste.php | 6 +++--- application/core/MY_Controller.php | 2 +- application/models/Muser.php | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/application/controllers/Main.php b/application/controllers/Main.php index 2422d96bf..e7775d6d2 100644 --- a/application/controllers/Main.php +++ b/application/controllers/Main.php @@ -566,7 +566,7 @@ class Main extends MY_Controller { private function _append_multipaste_queue() { $ids = $this->input->post_array("ids"); - if ($ids === false) { + if ($ids === null) { $ids = []; } diff --git a/application/controllers/User.php b/application/controllers/User.php index d87b544c7..15eab1b2f 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -55,7 +55,7 @@ class User extends MY_Controller { $this->data['redirect_uri'] = $redirect_uri; - if ($this->input->post('process') !== false) { + if ($this->input->post('process') !== null) { $username = $this->input->post('username'); $password = $this->input->post('password'); @@ -82,10 +82,10 @@ class User extends MY_Controller { $userid = $this->muser->get_userid(); $comment = $this->input->post("comment"); - $comment = $comment === false ? "" : $comment; + $comment = $comment === null ? "" : $comment; $access_level = $this->input->post("access_level"); - if ($access_level === false) { + if ($access_level === null) { $access_level = "apikey"; } @@ -188,7 +188,7 @@ class User extends MY_Controller { $this->data['redirect_uri'] = "/"; - if ($process !== false) { + if ($process !== null) { $username = $this->input->post("username"); $email = $this->input->post("email"); $password = $this->input->post("password"); @@ -381,7 +381,7 @@ class User extends MY_Controller { $userid = $query["user"]; - if ($process !== false) { + if ($process !== null) { $password = $this->input->post("password"); $password_confirm = $this->input->post("password_confirm"); @@ -462,7 +462,7 @@ class User extends MY_Controller { { $this->muser->require_access(); - if ($this->input->post("process") !== false) { + if ($this->input->post("process") !== null) { $this->_save_profile(); } @@ -584,7 +584,7 @@ class User extends MY_Controller { foreach (array_keys($value_processor) as $field) { $value = $this->input->post($field); - if ($value !== false) { + if ($value !== null) { $new_value = $value_processor[$field]($value); if ($new_value !== null) { $data[$field] = $new_value; @@ -619,7 +619,7 @@ class User extends MY_Controller { $this->data["hash"] = false; $this->data["password"] = $password; - if ($process !== false) { + if ($process !== null) { if (!$password || $password !== $password_confirm) { $error[]= "No password or passwords don't match."; } else { diff --git a/application/controllers/api/v2/user.php b/application/controllers/api/v2/user.php index 3c2eafad0..677a870c4 100644 --- a/application/controllers/api/v2/user.php +++ b/application/controllers/api/v2/user.php @@ -36,7 +36,7 @@ class user extends \controllers\api\api_controller { $userid = $this->CI->muser->get_userid(); $comment = $this->CI->input->post("comment"); - $comment = $comment === false ? "" : $comment; + $comment = $comment === null ? "" : $comment; $access_level = $this->CI->input->post("access_level"); $key = \service\user::create_apikey($userid, $comment, $access_level); diff --git a/application/controllers/file/Multipaste.php b/application/controllers/file/Multipaste.php index 50367697c..cc8ab8819 100644 --- a/application/controllers/file/Multipaste.php +++ b/application/controllers/file/Multipaste.php @@ -20,7 +20,7 @@ class Multipaste extends MY_Controller { $this->muser->require_access("basic"); $ids = $this->input->post_array("ids"); - if ($ids === false) { + if ($ids === null) { $ids = []; } @@ -58,7 +58,7 @@ class Multipaste extends MY_Controller { $ids = $this->input->post_array('ids'); $process = $this->input->post('process'); - if ($ids === false) { + if ($ids === null) { $ids = []; } @@ -89,7 +89,7 @@ class Multipaste extends MY_Controller { $this->muser->require_access("basic"); $ids = $this->input->post_array('ids'); - if ($ids === false) { + if ($ids === null) { $ids = []; } diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 47dd6a899..63db6c8a5 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -79,7 +79,7 @@ class MY_Controller extends CI_Controller { private function _check_csrf_protection_required() { - if ($this->input->post("apikey") !== false || is_api_client()) { + if ($this->input->post("apikey") !== null || is_api_client()) { /* This relies on the authentication code always verifying the supplied * apikey. If the key is not verified/logged in an attacker could simply * add an empty "apikey" field to the CSRF form to circumvent the diff --git a/application/models/Muser.php b/application/models/Muser.php index 1ee6c259a..00d14b7b9 100644 --- a/application/models/Muser.php +++ b/application/models/Muser.php @@ -276,7 +276,7 @@ class Muser extends CI_Model { function require_access($wanted_level = "full") { - if ($this->input->post("apikey") !== false) { + if ($this->input->post("apikey") !== null) { $this->apilogin($this->input->post("apikey")); } -- cgit v1.2.3-24-g4f1b