cvs: phpweb /include site.inc

From: Date: Tue, 03 Feb 2009 17:01:57 +0000
Subject: cvs: phpweb /include site.inc
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-3741@lists.php.net to get a copy of this message
bjori Tue Feb 3 17:01:57 2009 UTC Modified files: /phpweb/include site.inc Log: Make it possible to run on different ports then 80 (patch by zoe@) http://cvs.php.net/viewvc.cgi/phpweb/include/site.inc?r1=1.262&r2=1.263&diff_format=u Index: phpweb/include/site.inc diff -u phpweb/include/site.inc:1.262 phpweb/include/site.inc:1.263 --- phpweb/include/site.inc:1.262 Sun Jun 8 19:46:14 2008 +++ phpweb/include/site.inc Tue Feb 3 17:01:57 2009 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: site.inc,v 1.262 2008/06/08 19:46:14 bjori Exp $ +// $Id: site.inc,v 1.263 2009/02/03 17:01:57 bjori Exp $ // Define $MIRRORS array, and some constants include $_SERVER['DOCUMENT_ROOT'] . '/include/mirrors.inc'; @@ -308,7 +308,13 @@ // This should be the main name of the mirror (in case // it works under more then one name). SERVER_NAME is // the name of the Apache vhost. -$MYSITE = 'http://' . $_SERVER["SERVER_NAME"] . '/'; + + +if($_SERVER["SERVER_PORT"] != '80') { + $MYSITE = 'http://' . $_SERVER["SERVER_NAME"] . ':' . (int)$_SERVER["SERVER_PORT"] . '/'; +} else { + $MYSITE = 'http://' . $_SERVER["SERVER_NAME"] . '/'; +} // If this site does not exist if (!isset($MIRRORS[$MYSITE])) { @@ -316,8 +322,12 @@ // Try the hostname [without www]. In case the main name above is // not found, we try to find the mirror with the name provided by // the browser (in the Host HTTP header). - $MYSITE = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . '/'; - + + if($_SERVER["SERVER_PORT"] != '80') { + $MYSITE = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . ':' . (int)$_SERVER["SERVER_PORT"] . '/'; + } else { + $MYSITE = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . '/'; + } // 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])) {

« previous php.webmaster (#3741) next »