includes/functions.php
changeset 1223 7dca925b0209
parent 1219 2b13cd6b4f95
child 1226 de56132c008d
equal deleted inserted replaced
1222:d1ded7b4c775 1223:7dca925b0209
   219  * @return string
   219  * @return string
   220  */
   220  */
   221 
   221 
   222 function get_server_url()
   222 function get_server_url()
   223 {
   223 {
   224   return 'http' . ( $GLOBALS['is_https'] ) . '://' . $_SERVER['HTTP_HOST'];
   224   $server_name = false;
       
   225   if ( isset($_SERVER['HTTP_HOST']) )
       
   226   	$server_name = $_SERVER['HTTP_HOST'];
       
   227   else if ( isset($_SERVER['SERVER_NAME']) )
       
   228   	$server_name = $_SERVER['SERVER_NAME'];
       
   229   else
       
   230     $server_name = 'localhost';
       
   231   
       
   232   return 'http' . ( $GLOBALS['is_https'] ) . '://' . $server_name;
   225 }
   233 }
   226 
   234 
   227 /**
   235 /**
   228  * Returns the full page ID string of the main page.
   236  * Returns the full page ID string of the main page.
   229  * @return string
   237  * @return string