Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsgiehl <stefan@matomo.org>2020-07-24 14:11:05 +0300
committersgiehl <stefan@matomo.org>2020-07-24 15:28:48 +0300
commit679e73f1236969db0c2d767655cb84456a727d24 (patch)
tree648722fa79cb524f8819857e79163e0c1cf16d59 /core/Nonce.php
parent6b5f8138180716d5088d764f0b41d5787159b28a (diff)
parent3e1234a887f56a1cf853e29ba89370b234af5127 (diff)
Merge branch '3.x-dev' into 4.x-dev
Diffstat (limited to 'core/Nonce.php')
-rw-r--r--core/Nonce.php39
1 files changed, 23 insertions, 16 deletions
diff --git a/core/Nonce.php b/core/Nonce.php
index 9f5a9091bc..ef0b09bf21 100644
--- a/core/Nonce.php
+++ b/core/Nonce.php
@@ -127,28 +127,35 @@ class Nonce
public static function getAcceptableOrigins()
{
$host = Url::getCurrentHost(null);
- $port = '';
-
- // parse host:port
- if (preg_match('/^([^:]+):([0-9]+)$/D', $host, $matches)) {
- $host = $matches[1];
- $port = $matches[2];
- }
if (empty($host)) {
return array();
}
- // standard ports
- $origins = array(
- 'http://' . $host,
- 'https://' . $host,
- );
-
- // non-standard ports
- if (!empty($port) && $port != 80 && $port != 443) {
- $origins[] = 'http://' . $host . ':' . $port;
+ // parse host:port
+ if (preg_match('/^([^:]+):([0-9]+)$/D', $host, $matches)) {
+ $host = $matches[1];
+ $port = $matches[2];
+ $origins = array(
+ 'http://' . $host,
+ 'https://' . $host,
+ );
+ if ($port != 443) {
+ $origins[] = 'http://' . $host .':' . $port;
+ }
$origins[] = 'https://' . $host . ':' . $port;
+ } elseif (Config::getInstance()->General['force_ssl']) {
+ $origins = array(
+ 'https://' . $host,
+ 'https://' . $host . ':443',
+ );
+ } else {
+ $origins = array(
+ 'http://' . $host,
+ 'https://' . $host,
+ 'http://' . $host . ':80',
+ 'https://' . $host . ':443',
+ );
}
return $origins;