From b6a1709abebd7db5d97dd5e7aa0db3f95d6a60de Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Tue, 28 Dec 2010 11:42:50 +0000 Subject: [PATCH] Do not overwrite $MYSITE unless the new version actually exists --- include/site.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/site.inc b/include/site.inc index d465730dc..6cc0911b5 100644 --- a/include/site.inc +++ b/include/site.inc @@ -375,10 +375,16 @@ if (!isset($MIRRORS[$MYSITE])) { // the browser (in the Host HTTP header). if($_SERVER["SERVER_PORT"] != '80') { - $MYSITE = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . ':' . (int)$_SERVER["SERVER_PORT"] . '/'; + $tmp = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . ':' . (int)$_SERVER["SERVER_PORT"] . '/'; } else { - $MYSITE = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . '/'; + $tmp = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . '/'; } + + // If the name without www. exists, use it + if (isset($MIRRORS[$tmp])) { + $MYSITE = $tmp; + } + // If the mirror is not registered with this name, provide defaults // (no country code, no search, no stats, English default language ...) if (!isset($MIRRORS[$MYSITE])) {