-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhost.php
More file actions
53 lines (48 loc) · 1.56 KB
/
Copy pathhost.php
File metadata and controls
53 lines (48 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
$httpsFlag = $_SERVER['HTTPS'] ?? '';
$protocol = ($httpsFlag && $httpsFlag !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'https://getpeer.eu';
$hostName = explode(':', $host)[0]; // Strip port if present.
// Basis-URL des Projekts ermitteln
$scriptName = $_SERVER['SCRIPT_NAME'] ?? '/';
$baseUrl = rtrim(dirname($scriptName), '/');
// Host in Teile zerlegen
$parts = explode('.', $hostName);
// Hauptdomain und Subdomain bestimmen
/*
if (count($parts) > 2) {
$subdomain = implode('.', array_slice($parts, 0, count($parts) - 2));
if ($subdomain == 'frontend') $domain = 'peernetwork.eu';
else if ($subdomain == 'testing') $domain = 'getpeer.eu';
else $domain = $hostName;
} else {
$domain = 'getpeer.eu';
}
*/
$mediaDomain = '';
if (count($parts) > 2) {
$subdomain = implode('.', array_slice($parts, 0, count($parts) - 2));
if (strpos($hostName, 'peerapp.eu') !== false) {
$domain = 'backend.peerapp.eu';
$mediaDomain = 'media.peerapp.eu';
} else if ($subdomain == 'frontend') {
$domain = 'peernetwork.eu';
$mediaDomain = 'media.peernetwork.eu';
} else if ($subdomain == 'testing') {
$domain = 'getpeer.eu';
$mediaDomain = 'media.getpeer.eu';
} else {
$domain = $hostName;
$mediaDomain = 'media.' . $domain;
}
} else {
if (strpos($hostName, 'peerapp.eu') !== false) {
$domain = 'backend.peerapp.eu';
$mediaDomain = 'media.peerapp.eu';
} else {
$domain = 'getpeer.eu';
// $domain = 'backend.peerapp.eu';
$mediaDomain = 'media.getpeer.eu';
// $mediaDomain = 'media.peerapp.eu';
}
}