Commit da4787b0 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #456 in ZP/z-push from...

Merge pull request #456 in ZP/z-push from feature/ZP-1130-improve-default-autodiscover-config to develop

* commit '62e29924':
  ZP-1130 Log discovered server URL.
  ZP-1130 Improve default autodiscover config.
parents e4f60457 62e29924
...@@ -221,13 +221,16 @@ class ZPushAutodiscover { ...@@ -221,13 +221,16 @@ class ZPushAutodiscover {
*/ */
private function createResponse($email, $userFullname) { private function createResponse($email, $userFullname) {
$xml = file_get_contents('response.xml'); $xml = file_get_contents('response.xml');
$zpushHost = defined('ZPUSH_HOST') ? ZPUSH_HOST : ( $_SERVER['HTTP_HOST'] ? : $_SERVER['SERVER_NAME']);
$serverUrl = "https://" . $zpushHost . "/Microsoft-Server-ActiveSync";
ZLog::Write(LOGLEVEL_INFO, sprintf("ZPushAutodiscover->createResponse(): server URL: '%s'", $serverUrl));
$response = new SimpleXMLElement($xml); $response = new SimpleXMLElement($xml);
$response->Response->User->DisplayName = $userFullname; $response->Response->User->DisplayName = $userFullname;
$response->Response->User->EMailAddress = $email; $response->Response->User->EMailAddress = $email;
$response->Response->Action->Settings->Server->Url = SERVERURL; $response->Response->Action->Settings->Server->Url = $serverUrl;
$response->Response->Action->Settings->Server->Name = SERVERURL; $response->Response->Action->Settings->Server->Name = $serverUrl;
$response = $response->asXML(); $response = $response->asXML();
ZLog::Write(LOGLEVEL_WBXML, sprintf("ZPushAutodiscover->createResponse() XML response:%s%s", PHP_EOL, $response)); ZLog::Write(LOGLEVEL_WBXML, sprintf("ZPushAutodiscover->createResponse(): XML response:%s%s", PHP_EOL, $response));
return $response; return $response;
} }
......
...@@ -26,15 +26,16 @@ ...@@ -26,15 +26,16 @@
/********************************************************************************** /**********************************************************************************
* Default settings * Default settings
*/ */
// Replace zpush.example.com with your z-push's host name and uncomment the line below.
// define('ZPUSH_HOST', 'zpush.example.com');
// Defines the default time zone, change e.g. to "Europe/London" if necessary // Defines the default time zone, change e.g. to "Europe/London" if necessary
define('TIMEZONE', ''); define('TIMEZONE', '');
// Defines the base path on the server // Defines the base path on the server
define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/'); define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/');
// The Z-Push server location for the autodiscover response
define('SERVERURL', 'https://localhost/Microsoft-Server-ActiveSync');
/* /*
* Whether to use the complete email address as a login name * Whether to use the complete email address as a login name
* (e.g. user@company.com) or the username only (user). * (e.g. user@company.com) or the username only (user).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment