From ca9c610460d9538a65ddf77c77fc89c50cf8cc40 Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 2 Jan 2019 21:28:22 +0100 Subject: [PATCH] [Web] Apple mobileconfig enhancements by @feldsam --- data/web/inc/functions.inc.php | 13 ++ data/web/mobileconfig.php | 281 +++++++++++++++++---------------- 2 files changed, 156 insertions(+), 138 deletions(-) diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 89ccd037..312b87f7 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -1452,4 +1452,17 @@ function get_logs($application, $lines = false) { } return false; } +function getGUID() { + if (function_exists('com_create_guid')) { + return com_create_guid(); + } + mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up. + $charid = strtoupper(md5(uniqid(rand(), true))); + $hyphen = chr(45);// "-" + return substr($charid, 0, 8).$hyphen + .substr($charid, 8, 4).$hyphen + .substr($charid,12, 4).$hyphen + .substr($charid,16, 4).$hyphen + .substr($charid,20,12); +} ?> diff --git a/data/web/mobileconfig.php b/data/web/mobileconfig.php index d6cfc743..ade4f606 100644 --- a/data/web/mobileconfig.php +++ b/data/web/mobileconfig.php @@ -1,5 +1,5 @@ prepare("SELECT `name` FROM `mailbox` WHERE `username`= :username"); $stmt->execute(array(':username' => $email)); $MailboxData = $stmt->fetch(PDO::FETCH_ASSOC); + $displayname = empty($MailboxData['name']) ? $email : $MailboxData['name']; } catch(PDOException $e) { - die("Failed to determine name from SQL"); -} -if (!empty($MailboxData['name'])) { - $displayname = $MailboxData['name']; -} -else { $displayname = $email; } +if (isset($_GET['only_email'])) { + $onlyEmailAccount = true; + $description = 'IMAP'; +} else { + $onlyEmailAccount = false; + $description = 'IMAP, CalDAV, CardDAV'; +} + echo '' . "\n"; ?> - - PayloadContent - - - CalDAVAccountDescription - - CalDAVHostName - - CalDAVPort - - CalDAVPrincipalURL - /SOGo/dav/ - CalDAVUseSSL - - CalDAVUsername - - PayloadDescription - Configures CalDAV account. - PayloadDisplayName - CalDAV () - PayloadIdentifier - .CalDAV - PayloadOrganization - - PayloadType - com.apple.caldav.account - PayloadUUID - FC898573-EBA8-48AF-93BD-BFA0C9778FA7 - PayloadVersion - 1 - - - EmailAccountDescription - - EmailAccountType - EmailTypeIMAP - EmailAccountName - - EmailAddress - - IncomingMailServerAuthentication - EmailAuthPassword - IncomingMailServerHostName - - IncomingMailServerPortNumber - - IncomingMailServerUseSSL - - IncomingMailServerUsername - - OutgoingMailServerAuthentication - EmailAuthPassword - OutgoingMailServerHostName - - OutgoingMailServerPortNumber - - OutgoingMailServerUseSSL - - OutgoingMailServerUsername - - OutgoingPasswordSameAsIncomingPassword - - PayloadDescription - Configures email account. - PayloadDisplayName - IMAP Account () - PayloadIdentifier - .email - PayloadOrganization - - PayloadType - com.apple.mail.managed - PayloadUUID - 00294FBB-1016-413E-87B9-652D856D6875 - PayloadVersion - 1 - PreventAppSheet - - PreventMove - - SMIMEEnabled - - - - CardDAVAccountDescription - - CardDAVHostName - - CardDAVPort - - CardDAVPrincipalURL - /SOGo/dav/ - CardDAVUseSSL - - CardDAVUsername - - PayloadDescription - Configures CardDAV accounts - PayloadDisplayName - CardDAV () - PayloadIdentifier - .carddav - PayloadOrganization - - PayloadType - com.apple.carddav.account - PayloadUUID - 0797EF2B-B1F1-4BC7-ABCD-4580862252B4 - PayloadVersion - 1 - - - PayloadDescription - IMAP, CalDAV, CardDAV - PayloadDisplayName - Mailcow - PayloadIdentifier - - PayloadOrganization - - PayloadRemovalDisallowed - - PayloadType - Configuration - PayloadUUID - 5EE248C5-ACCB-42D8-9199-8F8ED08D5624 - PayloadVersion - 1 - + + PayloadContent + + + EmailAccountDescription + + EmailAccountType + EmailTypeIMAP + EmailAccountName + + EmailAddress + + IncomingMailServerAuthentication + EmailAuthPassword + IncomingMailServerHostName + + IncomingMailServerPortNumber + + IncomingMailServerUseSSL + + IncomingMailServerUsername + + OutgoingMailServerAuthentication + EmailAuthPassword + OutgoingMailServerHostName + + OutgoingMailServerPortNumber + + OutgoingMailServerUseSSL + + OutgoingMailServerUsername + + OutgoingPasswordSameAsIncomingPassword + + PayloadDescription + Configures email account. + PayloadDisplayName + IMAP Account () + PayloadIdentifier + .email + PayloadOrganization + + PayloadType + com.apple.mail.managed + PayloadUUID + + PayloadVersion + 1 + PreventAppSheet + + PreventMove + + SMIMEEnabled + + + + + CalDAVAccountDescription + + CalDAVHostName + + CalDAVPort + + CalDAVPrincipalURL + /SOGo/dav/ + CalDAVUseSSL + + CalDAVUsername + + PayloadDescription + Configures CalDAV account. + PayloadDisplayName + CalDAV () + PayloadIdentifier + .CalDAV + PayloadOrganization + + PayloadType + com.apple.caldav.account + PayloadUUID + + PayloadVersion + 1 + + + CardDAVAccountDescription + + CardDAVHostName + + CardDAVPort + + CardDAVPrincipalURL + /SOGo/dav/ + CardDAVUseSSL + + CardDAVUsername + + PayloadDescription + Configures CardDAV accounts + PayloadDisplayName + CardDAV () + PayloadIdentifier + .carddav + PayloadOrganization + + PayloadType + com.apple.carddav.account + PayloadUUID + + PayloadVersion + 1 + + + + PayloadDescription + + PayloadDisplayName + + PayloadIdentifier + + PayloadOrganization + + PayloadRemovalDisallowed + + PayloadType + Configuration + PayloadUUID + + PayloadVersion + 1 +