Revert "add a self url path hack to strip request path directories (needed for /api/index.php)"

This reverts commit 9826d2f075.
This commit is contained in:
Andrew Dolgov 2023-10-23 23:39:28 +03:00
parent 994f376f42
commit 1e3b7f7a43
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
2 changed files with 0 additions and 11 deletions

View File

@ -14,8 +14,6 @@
require_once "functions.php"; require_once "functions.php";
require_once "sessions.php"; require_once "sessions.php";
Config::strip_self_url_path_dirs(1);
ini_set('session.use_cookies', "0"); ini_set('session.use_cookies', "0");
ini_set("session.gc_maxlifetime", "86400"); ini_set("session.gc_maxlifetime", "86400");

View File

@ -268,8 +268,6 @@ class Config {
/** @var Db_Migrations|null $migrations */ /** @var Db_Migrations|null $migrations */
private $migrations; private $migrations;
private static $self_url_path_strip_dirs = 0;
public static function get_instance() : Config { public static function get_instance() : Config {
if (self::$instance == null) if (self::$instance == null)
self::$instance = new self(); self::$instance = new self();
@ -478,10 +476,6 @@ class Config {
(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'); (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https');
} }
static function strip_self_url_path_dirs($amount) {
self::$self_url_path_strip_dirs = $amount;
}
/** returns fully-qualified external URL to tt-rss (no trailing slash) /** returns fully-qualified external URL to tt-rss (no trailing slash)
* SELF_URL_PATH configuration variable is used as a fallback for the CLI SAPI * SELF_URL_PATH configuration variable is used as a fallback for the CLI SAPI
* */ * */
@ -494,9 +488,6 @@ class Config {
$self_url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); $self_url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$self_url_path = preg_replace("/\w+\.php(\?.*$)?$/", "", $self_url_path); $self_url_path = preg_replace("/\w+\.php(\?.*$)?$/", "", $self_url_path);
for ($i = 0; $i < self::$self_url_path_strip_dirs; $i++)
$self_url_path = dirname($self_url_path);
if (substr($self_url_path, -1) === "/") { if (substr($self_url_path, -1) === "/") {
return substr($self_url_path, 0, -1); return substr($self_url_path, 0, -1);
} else { } else {