summaryrefslogtreecommitdiff
path: root/classes/db
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-05 23:41:32 +0300
committerAndrew Dolgov <[email protected]>2021-02-05 23:41:32 +0300
commit403dca154c6b539de221f9e16174a0fdd0a1e896 (patch)
tree8187096f0e04ecb60440c8551514d990d0e85b2d /classes/db
parentb4cbc792cc5fbbd5356f91038bf6cf5e67a19e42 (diff)
initial WIP for php8; bump php version requirement to 7.0
Diffstat (limited to 'classes/db')
-rw-r--r--classes/db/prefs.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/classes/db/prefs.php b/classes/db/prefs.php
index fbe7e0eea..24153b19a 100644
--- a/classes/db/prefs.php
+++ b/classes/db/prefs.php
@@ -8,7 +8,7 @@ class Db_Prefs {
$this->pdo = Db::pdo();
$this->cache = array();
- if ($_SESSION["uid"]) $this->cache();
+ if (!empty($_SESSION["uid"])) $this->cache();
}
private function __clone() {
@@ -24,7 +24,7 @@ class Db_Prefs {
function cache() {
$user_id = $_SESSION["uid"];
- @$profile = $_SESSION["profile"];
+ $profile = $_SESSION["profile"] ?? false;
if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
@@ -55,12 +55,12 @@ class Db_Prefs {
if (!$user_id) {
$user_id = $_SESSION["uid"];
- @$profile = $_SESSION["profile"];
+ $profile = $_SESSION["profile"] ?? false;
} else {
$profile = false;
}
- if ($user_id == $_SESSION['uid'] && isset($this->cache[$pref_name])) {
+ if ($user_id == ($_SESSION['uid'] ?? false) && isset($this->cache[$pref_name])) {
$tuple = $this->cache[$pref_name];
return $this->convert($tuple["value"], $tuple["type"]);
}
@@ -83,7 +83,7 @@ class Db_Prefs {
$value = $row["value"];
$type_name = $row["type_name"];
- if ($user_id == $_SESSION["uid"]) {
+ if ($user_id == ($_SESSION["uid"] ?? false)) {
$this->cache[$pref_name]["type"] = $type_name;
$this->cache[$pref_name]["value"] = $value;
}
@@ -113,7 +113,7 @@ class Db_Prefs {
if (!$user_id) {
$user_id = $_SESSION["uid"];
- @$profile = $_SESSION["profile"];
+ @$profile = $_SESSION["profile"] ?? false;
} else {
$profile = null;
}