diff --git a/app/Controllers/apiController.php b/app/Controllers/apiController.php index 52ec53045..7568f9831 100644 --- a/app/Controllers/apiController.php +++ b/app/Controllers/apiController.php @@ -1,4 +1,5 @@ limits; $this->view->cookie_days = (int)round($limits['cookie_duration'] / 86400, 1); - $isPOST = Minz_Request::isPost() && !Minz_Session::param('POST_to_GET'); + $isPOST = Minz_Request::isPost() && !Minz_Session::paramBoolean('POST_to_GET'); Minz_Session::_param('POST_to_GET'); if ($isPOST) { - $nonce = Minz_Session::param('nonce', ''); + $nonce = Minz_Session::paramString('nonce'); $username = Minz_Request::paramString('username'); $challenge = Minz_Request::paramString('challenge'); diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 630399bf4..de6399e27 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -1,4 +1,5 @@ */ + $error_logs = Minz_Session::paramArray('error_logs'); Minz_Session::_params([ 'error_code' => false, 'error_logs' => false, diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index e93ec778f..0158b2f76 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -1,4 +1,5 @@ default_user; @@ -109,7 +110,7 @@ class FreshRSS_Auth { switch (FreshRSS_Context::$system_conf->auth_type) { case 'form': - self::$login_ok = Minz_Session::param('passwordHash') === FreshRSS_Context::$user_conf->passwordHash; + self::$login_ok = Minz_Session::paramString('passwordHash') === FreshRSS_Context::$user_conf->passwordHash; break; case 'http_auth': $current_user = Minz_User::name(); @@ -212,7 +213,7 @@ class FreshRSS_Auth { } public static function csrfToken(): string { - $csrf = Minz_Session::param('csrf'); + $csrf = Minz_Session::paramString('csrf'); if ($csrf == '') { $salt = FreshRSS_Context::$system_conf->salt; $csrf = sha1($salt . uniqid('' . random_int(0, mt_getrandmax()), true)); @@ -222,7 +223,7 @@ class FreshRSS_Auth { } public static function isCsrfOk(?string $token = null): bool { - $csrf = Minz_Session::param('csrf'); + $csrf = Minz_Session::paramString('csrf'); if ($token === null) { $token = $_POST['_csrf'] ?? ''; } diff --git a/app/Models/BooleanSearch.php b/app/Models/BooleanSearch.php index d8c47c878..8a750a713 100644 --- a/app/Models/BooleanSearch.php +++ b/app/Models/BooleanSearch.php @@ -1,4 +1,5 @@ getSearch()) . ')'; + $toS[] = '(' . trim($queries[$name]->getSearch()->getRawInput()) . ')'; } } } @@ -110,7 +111,7 @@ class FreshRSS_BooleanSearch { $id = (int)(trim($matches['search'][$i])) - 1; if (!empty($queries[$id])) { $fromS[] = $matches[0][$i]; - $toS[] = '(' . trim($queries[$id]->getSearch()) . ')'; + $toS[] = '(' . trim($queries[$id]->getSearch()->getRawInput()) . ')'; } } } diff --git a/app/Models/Category.php b/app/Models/Category.php index 370c49709..ab08a5b74 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -1,4 +1,5 @@ hash; } - public function _id(string $value): void { + /** @param int|string $value String is for compatibility with 32-bit platforms */ + public function _id($value): void { + if (is_int($value)) { + $value = (string)$value; + } $this->id = $value; if ($this->date_added == 0) { $this->date_added = $value; @@ -741,11 +746,11 @@ HTML; } $content = ''; - $nodes = $xpath->query(new Gt\CssXPath\Translator($path)); + $nodes = $xpath->query((new Gt\CssXPath\Translator($path))->asXPath()); if ($nodes != false) { foreach ($nodes as $node) { if (!empty($attributes['path_entries_filter'])) { - $filterednodes = $xpath->query(new Gt\CssXPath\Translator($attributes['path_entries_filter']), $node) ?: []; + $filterednodes = $xpath->query((new Gt\CssXPath\Translator($attributes['path_entries_filter']))->asXPath(), $node) ?: []; foreach ($filterednodes as $filterednode) { $filterednode->parentNode->removeChild($filterednode); } diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index f2711d448..403f4e493 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1,4 +1,5 @@ false, 'bd_host' => false, @@ -114,8 +116,8 @@ function saveStep2(): void { 'bd_prefix' => substr($_POST['prefix'], 0, 16), ]); } - if (Minz_Session::param('bd_type') === 'pgsql') { - Minz_Session::_param('bd_base', strtolower(Minz_Session::param('bd_base'))); + if (Minz_Session::paramString('bd_type') === 'pgsql') { + Minz_Session::_param('bd_base', strtolower(Minz_Session::paramString('bd_base'))); } // We use dirname to remove the /i part @@ -125,18 +127,18 @@ function saveStep2(): void { 'base_url' => $base_url, 'default_user' => '_', 'db' => [ - 'type' => Minz_Session::param('bd_type'), - 'host' => Minz_Session::param('bd_host'), - 'user' => Minz_Session::param('bd_user'), - 'password' => Minz_Session::param('bd_password'), - 'base' => Minz_Session::param('bd_base'), - 'prefix' => Minz_Session::param('bd_prefix'), + 'type' => Minz_Session::paramString('bd_type'), + 'host' => Minz_Session::paramString('bd_host'), + 'user' => Minz_Session::paramString('bd_user'), + 'password' => Minz_Session::paramString('bd_password'), + 'base' => Minz_Session::paramString('bd_base'), + 'prefix' => Minz_Session::paramString('bd_prefix'), 'pdo_options' => [], ], 'pubsubhubbub_enabled' => Minz_Request::serverIsPublic($base_url), ]; - if (Minz_Session::param('title') != '') { - $config_array['title'] = Minz_Session::param('title'); + if (Minz_Session::paramString('title') != '') { + $config_array['title'] = Minz_Session::paramString('title'); } $customConfigPath = DATA_PATH . '/config.custom.php'; @@ -177,7 +179,7 @@ function saveStep2(): void { if ($ok) { Minz_Session::_param('bd_error'); header('Location: index.php?step=3'); - } elseif (Minz_Session::param('bd_error') == '') { + } elseif (Minz_Session::paramString('bd_error') == '') { Minz_Session::_param('bd_error', 'Unknown error!'); } } @@ -186,7 +188,7 @@ function saveStep2(): void { function saveStep3(): bool { FreshRSS_Context::initSystem(); - Minz_Translate::init(Minz_Session::param('language')); + Minz_Translate::init(Minz_Session::paramString('language')); if (!empty($_POST)) { if (param('auth_type', 'form') != '') { @@ -220,16 +222,16 @@ function saveStep3(): bool { // Create default user files but first, we delete previous data to // avoid access right problems. - recursive_unlink(USERS_PATH . '/' . Minz_Session::param('default_user')); + recursive_unlink(USERS_PATH . '/' . Minz_Session::paramString('default_user')); $ok = false; try { $ok = FreshRSS_user_Controller::createUser( - Minz_Session::param('default_user'), + Minz_Session::paramString('default_user'), '', //TODO: Add e-mail $password_plain, [ - 'language' => Minz_Session::param('language'), + 'language' => Minz_Session::paramString('language'), 'is_admin' => true, 'enabled' => true, ] @@ -270,8 +272,8 @@ function checkStep(): void { /** @return array */ function checkStep0(): array { $languages = Minz_Translate::availableLanguages(); - $language = Minz_Session::param('language') != '' && in_array(Minz_Session::param('language'), $languages, true); - $sessionWorking = Minz_Session::param('sessionWorking') === 'ok'; + $language = Minz_Session::paramString('language') != '' && in_array(Minz_Session::paramString('language'), $languages, true); + $sessionWorking = Minz_Session::paramString('sessionWorking') === 'ok'; return [ 'language' => $language ? 'ok' : 'ko', @@ -310,8 +312,8 @@ function freshrss_already_installed(): bool { function checkStep2(): array { $conf = is_writable(join_path(DATA_PATH, 'config.php')); - $bd = Minz_Session::param('bd_type') != ''; - $conn = Minz_Session::param('bd_error') == ''; + $bd = Minz_Session::paramString('bd_type') != ''; + $conn = Minz_Session::paramString('bd_error') == ''; return [ 'bd' => $bd ? 'ok' : 'ko', @@ -323,13 +325,13 @@ function checkStep2(): array { /** @return array */ function checkStep3(): array { - $conf = Minz_Session::param('default_user') != ''; + $conf = Minz_Session::paramString('default_user') != ''; - $form = Minz_Session::param('auth_type') != ''; + $form = Minz_Session::paramString('auth_type') != ''; $defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user']; if ($defaultUser === null) { - $defaultUser = Minz_Session::param('default_user') == '' ? '' : Minz_Session::param('default_user'); + $defaultUser = Minz_Session::paramString('default_user') == '' ? '' : Minz_Session::paramString('default_user'); } $data = is_writable(join_path(USERS_PATH, $defaultUser, 'config.php')); diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index ba2d28fd3..1b2f0076e 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -1,16 +1,17 @@ + declare(strict_types=1); + function get_logout_url(): string { + if (($_SERVER['AUTH_TYPE'] ?? '') === 'openid-connect') { + $url_string = urlencode(Minz_Request::guessBaseUrl()); + return './oidc/?logout=' . $url_string . '/'; + # The trailing slash is necessary so that we don’t redirect to http://. + # https://bz.apache.org/bugzilla/show_bug.cgi?id=61355#c13 + } else { + return _url('auth', 'logout') ?: ''; + } + } +?>