Page MenuHomeDevCentral

D1168.diff
No OneTemporary

D1168.diff

diff --git a/includes/core.php b/includes/core.php
--- a/includes/core.php
+++ b/includes/core.php
@@ -255,15 +255,22 @@
* @return string the server URL
*/
function get_server_url () {
- switch ($port = $_SERVER['SERVER_PORT']) {
+ if (isset($_SERVER['HTTP_HOST'])) {
+ list($name, $port) = explode(':', $_SERVER['HTTP_HOST'], 2);
+ } else {
+ $port = $_SERVER['SERVER_PORT'];
+ $name = $_SERVER['SERVER_NAME'];
+ }
+
+ switch ($port) {
case '80':
- return "http://$_SERVER[SERVER_NAME]";
+ return "http://$name";
case '443':
- return "https://$_SERVER[SERVER_NAME]";
+ return "https://$name";
default:
- return "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]";
+ return "http://$name:$port";
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 12:22 (21 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250647
Default Alt Text
D1168.diff (848 B)

Event Timeline