Changeset View
Changeset View
Standalone View
Standalone View
lib/AutodiscoverMicrosoft.php
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | protected function mobilesync_response() | ||||
if (!preg_match('/^https?:/i', $this->config['activesync'])) { | if (!preg_match('/^https?:/i', $this->config['activesync'])) { | ||||
$this->config['activesync'] = 'https://' . $this->config['activesync'] . '/Microsoft-Server-ActiveSync'; | $this->config['activesync'] = 'https://' . $this->config['activesync'] . '/Microsoft-Server-ActiveSync'; | ||||
} | } | ||||
$xml = new DOMDocument('1.0', Autodiscover::CHARSET); | $xml = new DOMDocument('1.0', Autodiscover::CHARSET); | ||||
// create main elements (tree) | // create main elements (tree) | ||||
$doc = $xml->createElementNS(self::MOBILESYNC_NS, 'Autodiscover'); | $doc = $xml->createElementNS(self::NS, 'Autodiscover'); | ||||
$doc = $xml->appendChild($doc); | $doc = $xml->appendChild($doc); | ||||
$response = $xml->createElement('Response'); | $response = $xml->createElementNS(self::MOBILESYNC_NS, 'Response'); | ||||
$response = $doc->appendChild($response); | $response = $doc->appendChild($response); | ||||
$user = $xml->createElement('User'); | $user = $xml->createElement('User'); | ||||
$user = $response->appendChild($user); | $user = $response->appendChild($user); | ||||
$action = $xml->createElement('Action'); | $action = $xml->createElement('Action'); | ||||
$action = $response->appendChild($action); | $action = $response->appendChild($action); | ||||
$settings = $xml->createElement('Settings'); | $settings = $xml->createElement('Settings'); | ||||
$settings = $action->appendChild($settings); | $settings = $action->appendChild($settings); | ||||
$server = $xml->createElement('Server'); | $server = $xml->createElement('Server'); | ||||
$server = $settings->appendChild($server); | $server = $settings->appendChild($server); | ||||
// configuration | // configuration | ||||
/* | |||||
$dispname = $xml->createElement('DisplayName'); | $dispname = $xml->createElement('DisplayName'); | ||||
$dispname = $user->appendChild($dispname); | $dispname = $user->appendChild($dispname); | ||||
$dispname->appendChild($xml->createTextNode($this->config['user'])); | $dispname->appendChild($xml->createTextNode($this->config['username'])); | ||||
*/ | |||||
$email = $xml->createElement('EMailAddress'); | $email = $xml->createElement('EMailAddress'); | ||||
$email = $user->appendChild($email); | $email = $user->appendChild($email); | ||||
$email->appendChild($xml->createTextNode($this->config['email'])); | $email->appendChild($xml->createTextNode($this->config['login'] ?: $this->config['email'])); | ||||
$element = $xml->createElement('Type'); | $element = $xml->createElement('Type'); | ||||
$element = $server->appendChild($element); | $element = $server->appendChild($element); | ||||
$element->appendChild($xml->createTextNode('MobileSync')); | $element->appendChild($xml->createTextNode('MobileSync')); | ||||
$element = $xml->createElement('Url'); | $element = $xml->createElement('Url'); | ||||
$element = $server->appendChild($element); | $element = $server->appendChild($element); | ||||
$element->appendChild($xml->createTextNode($this->config['activesync'])); | $element->appendChild($xml->createTextNode($this->config['activesync'])); | ||||
Show All 29 Lines | protected function outlook_response() | ||||
$accountType = $account->appendChild($accountType); | $accountType = $account->appendChild($accountType); | ||||
$accountType->appendChild($xml->createTextNode('email')); | $accountType->appendChild($xml->createTextNode('email')); | ||||
$action = $xml->createElement('Action'); | $action = $xml->createElement('Action'); | ||||
$action = $account->appendChild($action); | $action = $account->appendChild($action); | ||||
$action->appendChild($xml->createTextNode('settings')); | $action->appendChild($xml->createTextNode('settings')); | ||||
// configuration | // configuration | ||||
/* | |||||
$dispname = $xml->createElement('DisplayName'); | $dispname = $xml->createElement('DisplayName'); | ||||
$dispname = $user->appendChild($dispname); | $dispname = $user->appendChild($dispname); | ||||
$dispname->appendChild($xml->createTextNode($this->config['user'])); | $dispname->appendChild($xml->createTextNode($this->config['username'])); | ||||
*/ | |||||
$email = $xml->createElement('AutoDiscoverSMTPAddress'); | $email = $xml->createElement('AutoDiscoverSMTPAddress'); | ||||
$email = $user->appendChild($email); | $email = $user->appendChild($email); | ||||
$email->appendChild($xml->createTextNode($this->config['email'])); | $email->appendChild($xml->createTextNode($this->config['email'])); | ||||
// @TODO: Microsoft supports also DAV protocol here | // @TODO: Microsoft supports also DAV protocol here | ||||
foreach (array('imap', 'pop3', 'smtp') as $type) { | foreach (array('imap', 'pop3', 'smtp') as $type) { | ||||
if (!empty($this->config[$type])) { | if (!empty($this->config[$type])) { | ||||
$protocol = $this->add_protocol_element($xml, $type, $this->config[$type]); | $protocol = $this->add_protocol_element($xml, $type, $this->config[$type]); | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |