From e4107ac9520ca404d4ab49ef79ca74430e8fd772 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 22 Feb 2021 21:47:48 +0300 Subject: wip: initial for config object --- include/sessions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/sessions.php') diff --git a/include/sessions.php b/include/sessions.php index 5b372612b..d2fbc6a41 100644 --- a/include/sessions.php +++ b/include/sessions.php @@ -5,10 +5,11 @@ require_once "config.php"; require_once "autoload.php"; + require_once "functions.php"; require_once "errorhandler.php"; require_once "lib/gettext/gettext.inc.php"; - $session_expire = min(2147483647 - time() - 1, max(SESSION_COOKIE_LIFETIME, 86400)); + $session_expire = min(2147483647 - time() - 1, max(\Config::get(\Config::SESSION_COOKIE_LIFETIME), 86400)); $session_name = (!defined('TTRSS_SESSION_NAME')) ? "ttrss_sid" : TTRSS_SESSION_NAME; if (is_server_https()) { @@ -37,7 +38,7 @@ } function validate_session() { - if (SINGLE_USER_MODE) return true; + if (\Config::get(\Config::SINGLE_USER_MODE)) return true; if (isset($_SESSION["ref_schema_version"]) && $_SESSION["ref_schema_version"] != session_get_schema_version()) { $_SESSION["login_error_msg"] = @@ -144,7 +145,7 @@ return true; } - if (!SINGLE_USER_MODE /* && DB_TYPE == "pgsql" */) { + if (!\Config::get(\Config::SINGLE_USER_MODE)) { session_set_save_handler('\Sessions\ttrss_open', '\Sessions\ttrss_close', '\Sessions\ttrss_read', '\Sessions\ttrss_write', '\Sessions\ttrss_destroy', -- cgit v1.2.3-54-g00ecf From 12bcf826e4f2672afbda85264a970fb4735d97f1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 22 Feb 2021 22:39:20 +0300 Subject: don't include config.php everywhere --- api/index.php | 2 -- backend.php | 1 - include/functions.php | 1 - include/sessions.php | 1 - index.php | 7 ------- prefs.php | 7 ------- public.php | 1 - update.php | 1 - update_daemon2.php | 1 - 9 files changed, 22 deletions(-) (limited to 'include/sessions.php') diff --git a/api/index.php b/api/index.php index 6b0071141..333c64830 100644 --- a/api/index.php +++ b/api/index.php @@ -1,8 +1,6 @@ Fatal Error: You forgot to copy - config.php-dist to config.php and edit it.\n"; - exit; - } - // we need a separate check here because functions.php might get parsed // incorrectly before 5.3 because of :: syntax. if (version_compare(PHP_VERSION, '7.0.0', '<')) { @@ -20,7 +14,6 @@ require_once "sessions.php"; require_once "functions.php"; require_once "sanity_check.php"; - require_once "config.php"; require_once "db-prefs.php"; if (!init_plugins()) return; diff --git a/prefs.php b/prefs.php index b6026eb23..141118534 100644 --- a/prefs.php +++ b/prefs.php @@ -2,17 +2,10 @@ set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); - if (!file_exists("config.php")) { - print "Fatal Error: You forgot to copy - config.php-dist to config.php and edit it.\n"; - exit; - } - require_once "autoload.php"; require_once "sessions.php"; require_once "functions.php"; require_once "sanity_check.php"; - require_once "config.php"; require_once "db-prefs.php"; if (!init_plugins()) return; diff --git a/public.php b/public.php index 48fe675f8..8a02387cf 100644 --- a/public.php +++ b/public.php @@ -6,7 +6,6 @@ require_once "sessions.php"; require_once "functions.php"; require_once "sanity_check.php"; - require_once "config.php"; require_once "db-prefs.php"; startup_gettext(); diff --git a/update.php b/update.php index 92a087a2e..af541f517 100755 --- a/update.php +++ b/update.php @@ -9,7 +9,6 @@ require_once "autoload.php"; require_once "functions.php"; - require_once "config.php"; require_once "sanity_check.php"; require_once "db-prefs.php"; diff --git a/update_daemon2.php b/update_daemon2.php index b0314f3e9..2743a0fa2 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -10,7 +10,6 @@ require_once "autoload.php"; require_once "functions.php"; - require_once "config.php"; require_once "sanity_check.php"; require_once "db-prefs.php"; -- cgit v1.2.3-54-g00ecf