summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-02 12:22:48 +0300
committerAndrew Dolgov <[email protected]>2021-03-02 12:22:48 +0300
commit30b94fb19467c023cf299a2c37f5063e85c4bb18 (patch)
tree9078e7c97f61ffb6ccd42833d2690da554a28cca /classes
parent1a7f724bfa0594988b42c66741673de60112c786 (diff)
store widescreen mode setting in preferences instead of a cookie
Diffstat (limited to 'classes')
-rw-r--r--classes/prefs.php2
-rwxr-xr-xclasses/rpc.php10
2 files changed, 6 insertions, 6 deletions
diff --git a/classes/prefs.php b/classes/prefs.php
index e736ff7c8..24f0f7a80 100644
--- a/classes/prefs.php
+++ b/classes/prefs.php
@@ -59,6 +59,7 @@ class Prefs {
const HEADLINES_NO_DISTINCT = "HEADLINES_NO_DISTINCT";
const DEBUG_HEADLINE_IDS = "DEBUG_HEADLINE_IDS";
const DISABLE_CONDITIONAL_COUNTERS = "DISABLE_CONDITIONAL_COUNTERS";
+ const WIDESCREEN_MODE = "WIDESCREEN_MODE";
private const _DEFAULTS = [
Prefs::PURGE_OLD_DAYS => [ 60, Config::T_INT ],
@@ -118,6 +119,7 @@ class Prefs {
Prefs::HEADLINES_NO_DISTINCT => [ false, Config::T_BOOL ],
Prefs::DEBUG_HEADLINE_IDS => [ false, Config::T_BOOL ],
Prefs::DISABLE_CONDITIONAL_COUNTERS => [ false, Config::T_BOOL ],
+ Prefs::WIDESCREEN_MODE => [ false, Config::T_BOOL ],
];
const _PROFILE_BLACKLIST = [
diff --git a/classes/rpc.php b/classes/rpc.php
index c158f0cf6..ebe29e5cb 100755
--- a/classes/rpc.php
+++ b/classes/rpc.php
@@ -235,14 +235,12 @@ class RPC extends Handler_Protected {
//print json_encode(array("message" => "UPDATE_COUNTERS"));
}
- function setpanelmode() {
+ function setWidescreen() {
$wide = (int) clean($_REQUEST["wide"]);
- // FIXME should this use SESSION_COOKIE_LIFETIME and be renewed periodically?
- setcookie("ttrss_widescreen", (string)$wide,
- time() + 86400*365);
+ set_pref(Prefs::WIDESCREEN_MODE, $wide);
- print json_encode(array("wide" => $wide));
+ print json_encode(["wide" => $wide]);
}
static function updaterandomfeed_real() {
@@ -471,7 +469,7 @@ class RPC extends Handler_Protected {
$params["max_feed_id"] = (int) $max_feed_id;
$params["num_feeds"] = (int) $num_feeds;
$params["hotkeys"] = $this->get_hotkeys_map();
- $params["widescreen"] = (int) ($_COOKIE["ttrss_widescreen"] ?? 0);
+ $params["widescreen"] = (int) get_pref(Prefs::WIDESCREEN_MODE);
$params['simple_update'] = Config::get(Config::SIMPLE_UPDATE_MODE);
$params["icon_indicator_white"] = $this->image_to_base64("images/indicator_white.gif");
$params["labels"] = Labels::get_all($_SESSION["uid"]);