Page MenuHomeDevCentral

D1168.id2984.diff
No OneTemporary

D1168.id2984.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, 14:44 (20 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250775
Default Alt Text
D1168.id2984.diff (849 B)

Event Timeline