From 4f1b81ff4bfd044e226f8803f590dda2d27df90a Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Tue, 4 Dec 2018 19:48:23 -0700 Subject: [PATCH] Deprecate is_empty() --- app.php | 4 ++-- index.php | 2 +- mobile/index.php | 2 +- required.php | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app.php b/app.php index 12ece2f..b74d422 100644 --- a/app.php +++ b/app.php @@ -13,7 +13,7 @@ if ($_SESSION['loggedin'] != true) { require_once __DIR__ . "/pages.php"; $pageid = "home"; -if (isset($_GET['page']) && !is_empty($_GET['page'])) { +if (!empty($_GET['page'])) { $pg = strtolower($_GET['page']); $pg = preg_replace('/[^0-9a-z_]/', "", $pg); if (array_key_exists($pg, PAGES) && file_exists(__DIR__ . "/pages/" . $pg . ".php")) { @@ -68,7 +68,7 @@ header("Link: ; rel=preload; as=script", fals if (!empty($_GET['msg'])) { if (array_key_exists($_GET['msg'], MESSAGES)) { // optional string generation argument - if (!isset($_GET['arg']) || is_empty($_GET['arg'])) { + if (empty($_GET['arg'])) { $alertmsg = $Strings->get(MESSAGES[$_GET['msg']]['string'], false); } else { $alertmsg = $Strings->build(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false); diff --git a/index.php b/index.php index 3c992b3..1f8f76f 100644 --- a/index.php +++ b/index.php @@ -47,7 +47,7 @@ if (Login::checkLoginServer()) { $username_ok = true; break; default: - if (!is_empty($error)) { + if (!empty($error)) { $alert = $error; } else { $alert = $Strings->get("login error", false); diff --git a/mobile/index.php b/mobile/index.php index 5cc4575..de36d52 100644 --- a/mobile/index.php +++ b/mobile/index.php @@ -75,7 +75,7 @@ if (mobile_enabled() !== TRUE) { } // Make sure we have a username and access key -if (is_empty($VARS['username']) || is_empty($VARS['key'])) { +if (empty($VARS['username']) || empty($VARS['key'])) { http_response_code(401); die(json_encode(["status" => "ERROR", "msg" => "Missing username and/or access key."])); } diff --git a/required.php b/required.php index c296dcb..c67229f 100644 --- a/required.php +++ b/required.php @@ -133,6 +133,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } /** + * @deprecated * Checks if a string or whatever is empty. * @param $str The thingy to check * @return boolean True if it's empty or whatever.