summaryrefslogtreecommitdiff
path: root/classes/API.php
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2024-11-17 22:14:08 +0000
committerwn_ <invalid@email.com>2024-11-18 21:59:45 +0000
commit154abc61a0f81bee7757fc57e594f3f4bccc0fdf (patch)
tree19deb331e4204003b11b88cc2f1e98cc2440b402 /classes/API.php
parent394d606fe977a331f733c62e5509469c2eb3ef31 (diff)
Eliminate use of deprecated 'get_pref()' and 'set_pref()'.
Diffstat (limited to 'classes/API.php')
-rw-r--r--classes/API.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/classes/API.php b/classes/API.php
index 826d1f333..ad16f82fe 100644
--- a/classes/API.php
+++ b/classes/API.php
@@ -38,7 +38,7 @@ class API extends Handler {
return false;
}
- if (!empty($_SESSION["uid"]) && $method != "logout" && !get_pref(Prefs::ENABLE_API_ACCESS)) {
+ if (!empty($_SESSION["uid"]) && $method != "logout" && !Prefs::get(Prefs::ENABLE_API_ACCESS, $_SESSION["uid"])) {
$this->_wrap(self::STATUS_ERR, array("error" => self::E_API_DISABLED));
return false;
}
@@ -74,7 +74,7 @@ class API extends Handler {
if (Config::get(Config::SINGLE_USER_MODE)) $login = "admin";
if ($uid = UserHelper::find_user_by_login($login)) {
- if (get_pref(Prefs::ENABLE_API_ACCESS, $uid)) {
+ if (Prefs::get(Prefs::ENABLE_API_ACCESS, $uid)) {
if (UserHelper::authenticate($login, $password, false, Auth_Base::AUTH_SERVICE_API)) {
// needed for _get_config()
@@ -421,7 +421,7 @@ class API extends Handler {
function getPref(): bool {
$pref_name = clean($_REQUEST["pref_name"]);
- return $this->_wrap(self::STATUS_OK, array("value" => get_pref($pref_name)));
+ return $this->_wrap(self::STATUS_OK, array("value" => Prefs::get($pref_name, $_SESSION["uid"], $_SESSION["profile"] ?? null)));
}
function getLabels(): bool {