Beispiel #1
0
 public static function getMailServices()
 {
     static $services;
     if (is_null($services)) {
         $dbServices = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('ACTIVE' => 'Y', '=SITE_ID' => SITE_ID), 'order' => array('SORT' => 'ASC', 'NAME' => 'ASC')));
         $services = array();
         while (($service = $dbServices->fetch()) !== false) {
             $services[$service['ID']] = array('id' => $service['ID'], 'type' => $service['SERVICE_TYPE'], 'name' => $service['NAME'], 'link' => $service['LINK'], 'icon' => \Bitrix\Mail\MailServicesTable::getIconSrc($service['NAME'], $service['ICON']), 'server' => $service['SERVER'], 'port' => $service['PORT'], 'encryption' => $service['ENCRYPTION'], 'token' => $service['TOKEN'], 'flags' => $service['FLAGS'], 'sort' => $service['SORT']);
         }
     }
     return $services;
 }
Beispiel #2
0
} else {
    $SITE_ID = CSite::GetDefSite();
    $rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => $SITE_ID));
    $arSite = $rsSite->GetNext();
    $SITE_DIR = $arSite["DIR"];
    $ID_INVITED = $ID_ADDED = 0;
    $arMailServices = array();
    $bDomainUsersExist = false;
    $bCreateDomainsExist = false;
    $bConnectDomainsExist = false;
    $bMailInstalled = false;
    if (CModule::IncludeModule("mail")) {
        $bMailInstalled = true;
        $dbService = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('ACTIVE' => 'Y', '=SITE_ID' => $SITE_ID), 'order' => array('SORT' => 'ASC', 'NAME' => 'ASC')));
        while ($arService = $dbService->fetch()) {
            $arMailServices[$arService['ID']] = array('id' => $arService['ID'], 'type' => $arService['SERVICE_TYPE'], 'name' => $arService['NAME'], 'link' => $arService['LINK'], 'icon' => \Bitrix\Mail\MailServicesTable::getIconSrc($arService['NAME'], $arService['ICON']), 'server' => $arService['SERVER'], 'port' => $arService['PORT'], 'encryption' => $arService['ENCRYPTION'], 'token' => $arService['TOKEN']);
            if ($arService['SERVICE_TYPE'] == 'controller') {
                $crDomains = CControllerClient::ExecuteEvent('OnMailControllerGetDomains', array());
                if (!empty($crDomains['result']) && is_array($crDomains['result'])) {
                    $arMailServices[$arService['ID']]['domains'] = $crDomains['result'];
                    $bCreateDomainsExist = true;
                }
                $arMailServices[$arService['ID']]['users'] = array();
                $crUsers = CControllerClient::ExecuteEvent('OnMailControllerGetUsers', array());
                if (!empty($crUsers['result']) && is_array($crUsers['result'])) {
                    foreach ($crUsers['result'] as $email) {
                        list($login, $domain) = explode('@', $email, 2);
                        if (empty($arMailServices[$arService['ID']]['users'][$domain])) {
                            $arMailServices[$arService['ID']]['users'][$domain] = array();
                        }
                        $arMailServices[$arService['ID']]['users'][$domain][] = $login;