Handle it if the webserver doesn't set SERVER_NAME

This commit is contained in:
Andrew McMillan 2009-03-29 22:19:09 +13:00
parent fadaee0b27
commit 2706174b8d

View File

@ -16,7 +16,7 @@ unset($session); unset($request); unset($dbconn);
$c->sysabbr = 'davical';
$c->admin_email = 'admin@davical.example.com';
$c->system_name = "DAViCal CalDAV Server";
$c->domain_name = $_SERVER['SERVER_NAME'];
$c->domain_name = (isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:$_SERVER['SERVER_ADDR']);
$c->save_time_zone_defs = true;
$c->collections_always_exist = false;
$c->allow_get_email_visibility = false;
@ -43,6 +43,11 @@ $c->dbg = array();
// Utilities
require_once("AWLUtilities.php");
/** We actually discovered this and worked around it earlier, but we can't log it until the utilties are loaded */
if ( !isset($_SERVER['SERVER_NAME']) ) {
@dbg_error_log( "WARN", "Your webserver is not setting the SERVER_NAME parameter. You may need to set \$c->domain_name in your configuration. Using IP address meanhwhile..." );
}
/**
* Calculate the simplest form of reference to this page, excluding the PATH_INFO following the script name.
*/