Changeset View
Changeset View
Standalone View
Standalone View
lib/AutodiscoverMicrosoft.php
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | public function handle_response() | ||||
Log::debug('Response [microsoft]: ' . $response); | Log::debug('Response [microsoft]: ' . $response); | ||||
header('Content-type: text/xml; charset=' . Autodiscover::CHARSET); | header('Content-type: text/xml; charset=' . Autodiscover::CHARSET); | ||||
echo $response; | echo $response; | ||||
exit; | exit; | ||||
} | } | ||||
/** | /** | ||||
* Send error to the client and exit | |||||
*/ | |||||
protected function error($msg) | |||||
{ | |||||
$xml = new DOMDocument('1.0', Autodiscover::CHARSET); | |||||
$doc = $xml->createElementNS(self::NS, 'Autodiscover'); | |||||
$doc = $xml->appendChild($doc); | |||||
$response = $xml->createElement('Response'); | |||||
$response = $doc->appendChild($response); | |||||
$error = $xml->createElement('Error'); | |||||
list($usec, $sec) = explode(' ', microtime()); | |||||
$error->setAttribute('Time',date('H:i:s',$sec).".".substr($usec, 2, 6)); | |||||
$error->setAttribute('Id',sprintf("%u",crc32($_SERVER['HTTP_HOST']))); | |||||
$response->appendChild($error); | |||||
$code = $xml->createElement('ErrorCode'); | |||||
$code->appendChild($xml->createTextNode(600)); | |||||
$error->appendChild($code); | |||||
$message = $xml->createElement('Message'); | |||||
$message->appendChild($xml->createTextNode($msg)); | |||||
$error->appendChild($message); | |||||
$response->appendChild($xml->createElement('DebugData')); | |||||
$xml->formatOutput = true; | |||||
Log::debug('Error [microsoft]: ' . $msg); | |||||
header('Content-type: text/xml; charset=' . Autodiscover::CHARSET); | |||||
echo $xml->saveXML(); | |||||
exit; | |||||
} | |||||
/** | |||||
* Generates XML response for Activesync | * Generates XML response for Activesync | ||||
*/ | */ | ||||
protected function mobilesync_response() | protected function mobilesync_response() | ||||
{ | { | ||||
if (empty($this->config['activesync'])) { | if (empty($this->config['activesync'])) { | ||||
$this->error("Activesync not supported"); | $this->error("Activesync not supported"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |