1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-22 02:17:26 +00:00

fix preg_match and move up xml line

This commit is contained in:
jkaberg 2014-08-19 11:31:54 +02:00
parent f7d2dfd1c0
commit 3f5f95a633

View File

@ -11,15 +11,14 @@
// We might get two kinds of requests. // We might get two kinds of requests.
$post_body = file_get_contents('php://input'); $post_body = file_get_contents('php://input');
preg_match('/<AcceptableResponseSchema>(.*?)<\/AcceptableResponseSchema>/', $post_body, $match); $match = preg_match('/<AcceptableResponseSchema>(.*?)<\/AcceptableResponseSchema>/', $post_body, $match);
$AcceptableResponseSchema = $match[1]; $AcceptableResponseSchema = $match[1];
if ($AcceptableResponseSchema == "http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006") { if ($AcceptableResponseSchema == "http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006") {
// There is no way to convey the user's login name with this? // There is no way to convey the user's login name with this?
?> ?>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Autodiscover <Autodiscover xmlns:autodiscover="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006">
xmlns:autodiscover="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006">
<autodiscover:Response> <autodiscover:Response>
<autodiscover:Action> <autodiscover:Action>
<autodiscover:Settings> <autodiscover:Settings>
@ -40,7 +39,7 @@ xmlns:autodiscover="http://schemas.microsoft.com/exchange/autodiscover/mobilesyn
// Parse the email address out of the POST request, which // Parse the email address out of the POST request, which
// we pass back as the login name. // we pass back as the login name.
preg_match('/<EMailAddress>(.*?)<\/EMailAddress>/', $post_body, $match); $match = preg_match('/<EMailAddress>(.*?)<\/EMailAddress>/', $post_body, $match);
$LOGIN = $match[1]; $LOGIN = $match[1];
header("Content-type: text/xml"); header("Content-type: text/xml");