diff options
author | Robin Appelman <robin@icewind.nl> | 2023-04-21 13:48:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-21 13:48:12 +0200 |
commit | ccab101df85e8c5878361e7a9fa19480a3d54a96 (patch) | |
tree | f7183efe2acc724de4528ee79df0434c56d5e4fa /lib/private/AppFramework/Http/Request.php | |
parent | c08026a92ab020ac327aa7b8d379fc26cfe447bd (diff) | |
parent | b294edad804f40618a96116845615831302d0357 (diff) | |
download | nextcloud-server-ccab101df85e8c5878361e7a9fa19480a3d54a96.tar.gz nextcloud-server-ccab101df85e8c5878361e7a9fa19480a3d54a96.zip |
Merge pull request #37596 from nextcloud/enh/type-iconfig-getter-calls
Use typed version of IConfig::getSystemValue as much as possible
Diffstat (limited to 'lib/private/AppFramework/Http/Request.php')
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 1f32d6c5461..52abb909b60 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -624,7 +624,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @return bool */ private function isOverwriteCondition(string $type = ''): bool { - $regex = '/' . $this->config->getSystemValue('overwritecondaddr', '') . '/'; + $regex = '/' . $this->config->getSystemValueString('overwritecondaddr', '') . '/'; $remoteAddr = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : ''; return $regex === '//' || preg_match($regex, $remoteAddr) === 1 || $type !== 'protocol'; @@ -636,9 +636,9 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @return string Server protocol (http or https) */ public function getServerProtocol(): string { - if ($this->config->getSystemValue('overwriteprotocol') !== '' + if ($this->config->getSystemValueString('overwriteprotocol') !== '' && $this->isOverwriteCondition('protocol')) { - return $this->config->getSystemValue('overwriteprotocol'); + return $this->config->getSystemValueString('overwriteprotocol'); } if ($this->fromTrustedProxy() && isset($this->server['HTTP_X_FORWARDED_PROTO'])) { @@ -696,7 +696,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { */ public function getRequestUri(): string { $uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : ''; - if ($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) { + if ($this->config->getSystemValueString('overwritewebroot') !== '' && $this->isOverwriteCondition()) { $uri = $this->getScriptName() . substr($uri, \strlen($this->server['SCRIPT_NAME'])); } return $uri; @@ -764,7 +764,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { */ public function getScriptName(): string { $name = $this->server['SCRIPT_NAME']; - $overwriteWebRoot = $this->config->getSystemValue('overwritewebroot'); + $overwriteWebRoot = $this->config->getSystemValueString('overwritewebroot'); if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) { // FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous $serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -\strlen('lib/private/appframework/http/'))); @@ -859,8 +859,8 @@ class Request implements \ArrayAccess, \Countable, IRequest { * isn't met */ private function getOverwriteHost() { - if ($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) { - return $this->config->getSystemValue('overwritehost'); + if ($this->config->getSystemValueString('overwritehost') !== '' && $this->isOverwriteCondition()) { + return $this->config->getSystemValueString('overwritehost'); } return null; } |