Exemple #1
0
 public static function mailserviceGet($arParams)
 {
     IncludeModuleLangFile(__FILE__);
     if (empty($arParams['ID'])) {
         throw new Exception(GetMessage('MAIL_MAILSERVICE_EMPTY_ID'));
     }
     $result = Bitrix\Mail\MailServicesTable::getList(array('filter' => array('=ID' => $arParams['ID'], '=SITE_ID' => SITE_ID)));
     if ($data = $result->fetch()) {
         unset($data['SERVICE_TYPE'], $data['TOKEN'], $data['FLAGS']);
         $data['ICON'] = Bitrix\Mail\MailServicesTable::getIconSrc($data['NAME'], $data['ICON']);
     }
     if (empty($data)) {
         throw new Exception(GetMessage('MAIL_MAILSERVICE_EMPTY'));
     }
     return $data;
 }
Exemple #2
0
}
global $USER, $APPLICATION;
$APPLICATION->SetTitle(GetMessage('NTR_MAIL_PAGE_TITLE'));
if (!CModule::IncludeModule('mail')) {
    ShowError(GetMessage('MAIL_MODULE_NOT_INSTALLED'));
    return;
}
if (!is_object($USER) || !$USER->IsAuthorized()) {
    $APPLICATION->AuthForm('');
    return;
}
$arParams['OPTIONS'] = array('link', 'server', 'port', 'encryption', 'login', 'password');
$result = Bitrix\Mail\MailServicesTable::getList(array('filter' => array('ACTIVE' => 'Y', '=SITE_ID' => SITE_ID), 'order' => array('SORT' => 'ASC', 'NAME' => 'ASC')));
$arParams['SERVICES'] = array();
while (($service = $result->fetch()) !== false) {
    $arParams['SERVICES'][$service['ID']] = array('name' => $service['NAME'], 'link' => $service['LINK'], 'icon' => Bitrix\Mail\MailServicesTable::getIconSrc($service['NAME'], $service['ICON']), 'server' => $service['SERVER'], 'port' => $service['PORT'], 'encryption' => $service['ENCRYPTION']);
}
if (empty($arParams['SERVICES'])) {
    ShowError(GetMessage('MAIL_SERVICES_NOT_FOUND'));
    return;
}
function CheckOption($option, $value, &$error)
{
    if (!in_array($option, array('encryption')) && empty($value)) {
        $error = GetMessage('INTR_MAIL_INP_' . strtoupper($option) . '_EMPTY');
    }
    if (empty($error)) {
        switch ($option) {
            case 'server':
                $regExp = '`(?:(?:http|https|ssl|tls|imap)://)?((?:[a-z0-9](?:-*[a-z0-9])*\\.?)+)`';
                if (preg_match($regExp, strtolower($value), $matches) && strlen($matches[1]) > 0) {
if ($str_ACTIVE == "Y") {
    ?>
 checked="checked"<?php 
}
?>
></td>
	</tr>
	<tr>
		<td valign="top"><?php 
echo GetMessage('MAIL_MSERVICE_EDT_ICON');
?>
</td>
		<td>
			<input type="file" name="ICON">
			<?php 
if ($icon = Bitrix\Mail\MailServicesTable::getIconSrc($str_NAME, $str_ICON)) {
    ?>
			<br><br><img src="<?php 
    echo $icon;
    ?>
" alt="<?php 
    echo $str_NAME;
    ?>
"><br>
			<?php 
    if ($str_ICON) {
        ?>
			<input type="checkbox" name="remove_icon" value="Y" id="remove_icon" >
			<label for="remove_icon"><?php 
        echo GetMessage("MAIL_MSERVICE_EDT_ICON_REMOVE");
        ?>