Beispiel #1
0
 /**
  * @param	string	$tagName
  * @return	string
  */
 function GetChildValueByTagName($tagName)
 {
     $node =& $this->GetChildNodeByTagName($tagName);
     if ($node != null) {
         return ap_Utils::DecodeSpecialXmlChars($node->Value);
     }
     return '';
 }
Beispiel #2
0
 function UpdateFromSessionArray()
 {
     $sessionArray = isset($_SESSION[WM_SESS_USERMINI]) ? $_SESSION[WM_SESS_USERMINI] : array();
     if (count($sessionArray) > 0) {
         $this->_login = ap_Utils::ArrayValue($sessionArray, '_login', $this->_login);
         $this->ClearSessionArray();
     }
 }
Beispiel #3
0
 /**
  * @return	array | false
  */
 function GetDomainArrayForSelect()
 {
     if ($this->_connector->Execute($this->_commandCreator->GetDomainArray())) {
         $domains = array();
         $domains[0] = ap_Utils::TakePhrase('CM_NOT_DOMAIN_SELECT_NAME');
         while (($row = $this->_connector->GetNextRecord()) != false) {
             $domains[$row->id_domain] = $row->name;
         }
         return $domains;
     }
     return false;
 }
Beispiel #4
0
 function Validate()
 {
     $return = true;
     if (empty($this->Login)) {
         $return = ap_Utils::TakePhrase('CM_REQ_FIELDS_CANNOT_BE_EMPTY');
     } else {
         if (empty($this->Password)) {
             $return = ap_Utils::TakePhrase('CM_REQ_FIELDS_CANNOT_BE_EMPTY');
         } else {
             if (!is_array($this->DomainIds) || count($this->DomainIds) < 1) {
                 $return = ap_Utils::TakePhrase('CM_REQ_FIELDS_CANNOT_BE_EMPTY');
             }
         }
     }
     return $return;
 }
Beispiel #5
0
 /**
  * @return bool
  */
 function Connect()
 {
     if ($this->_imapMail->connection != false) {
         return true;
     }
     if (!$this->_imapMail->open()) {
         $this->SetError(ap_Utils::TakePhrase('WM_ERROR_IMAP4_CONNECT'));
         return false;
     } else {
         register_shutdown_function(array(&$this, 'Disconnect'));
     }
     if (!$this->_imapMail->login($this->_account->MailIncLogin, $this->_account->MailIncPassword)) {
         $this->SetError(ap_Utils::TakePhrase('WM_ERROR_POP3IMAP4AUTH'));
         return false;
     }
     return true;
 }
Beispiel #6
0
 /**
  * @return bool
  */
 function Connect()
 {
     if ($this->_pop3Mail->socket != false) {
         return true;
     }
     if (!$this->_pop3Mail->connect($this->_account->MailIncHost, $this->_account->MailIncPort)) {
         /* $this->SetError($this->_pop3Mail->error); */
         $this->SetError(ap_Utils::TakePhrase('WM_ERROR_POP3_CONNECT'));
         return false;
     } else {
         register_shutdown_function(array(&$this, 'Disconnect'));
     }
     if (!$this->_pop3Mail->login($this->_account->MailIncLogin, $this->_account->MailIncPassword)) {
         /* $this->SetError($this->_pop3Mail->error); */
         $this->SetError(ap_Utils::TakePhrase('WM_ERROR_POP3IMAP4AUTH'));
         return false;
     }
     return true;
 }
Beispiel #7
0
 function get_line()
 {
     $return = false;
     if ($this->connection) {
         $return = @fgets($this->connection, 512);
         if ($this->_bLogEnable) {
             $this->_log('IMAP4 < ' . ap_Utils::ShowCRLF($return));
         }
         if (!$return) {
             $_socket_status = @socket_get_status($this->connection);
             if (isset($_socket_status['timed_out']) && $_socket_status['timed_out']) {
                 $this->error = 'Error : Socket timeout reached during IMAP4 connection.';
             }
         }
     }
     return $return;
 }
Beispiel #8
0
 /**
  * @param	string	$_msg
  */
 function GlobalError($_msg = null)
 {
     $_errorDesc = ap_Utils::TakePhrase('AP_LANG_NOT_CONFIGURED');
     $_errorDesc .= $_msg !== null ? '<br /><br />' . $_msg : '';
     $this->AddCssFile($this->AdminFolder() . '/styles/styles.css');
     define('ERROR_TEML_DESC', $_errorDesc);
     include CAdminPanel::RootPath() . '/templates/error.php';
     exit;
 }
Beispiel #9
0
<?php

/*
 * AfterLogic Admin Panel by AfterLogic Corp. <*****@*****.**>
 *
 * Copyright (C) 2002-2010  AfterLogic Corp. (www.afterlogic.com)
 * Distributed under the terms of the license described in LICENSE.txt
 * 
 */
$db =& DbStorageCreator::CreateDatabaseStorage($this->_settings);
$prefix = $this->_settings->DbPrefix;
if ($db->_settings->DbType != AP_DB_MYSQL && $db->_settings->DbType != AP_DB_MSSQLSERVER) {
    exit('Warning: Incorrect database type.	Tables can be created in MySql or MSSql database only!');
}
if (!$db->Connect()) {
    exit('Connect Error: ' . ap_Utils::TakePhrase('WM_INFO_CONNECTUNSUCCESSFUL') . ' ' . $db->GetError());
}
$bodyText = '';
if ($db->AdminAllTableCreate($bodyText)) {
    $bodyText = nl2br($bodyText);
} else {
    $bodyText = '<font color="red"><b>Warning!</b></font><br />' . nl2br($bodyText);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<html>
<head>
	<?php 
echo AP_META_CONTENT_TYPE;
?>
	<title>WebMail</title>
Beispiel #10
0
 /**
  * @param string $strDate
  * @return int
  */
 function GetTimeFromString($strDate)
 {
     $matches = array();
     $datePattern = '/^(([a-z]*),[\\s]*){0,1}(\\d{1,2}).([a-z]*).(\\d{2,4})[\\s]*(\\d{1,2}).(\\d{1,2}).(\\d{1,2})([\\s]+([+-]?\\d{1,4}))?([\\s]*(\\(?(\\w+)\\)?))?/i';
     if (preg_match($datePattern, $strDate, $matches)) {
         $year = $matches[5];
         $month = ap_Utils::GetMonthIndex(strtolower($matches[4]));
         if ($month == -1) {
             $month = 1;
         }
         $day = $matches[3];
         $hour = $matches[6];
         $minute = $matches[7];
         $second = $matches[8];
         $_dt = ap_Utils::GmtMkTime($hour, $minute, $second, $month, $day, $year);
         $zone = null;
         if (isset($matches[13])) {
             $zone = strtolower($matches[13]);
         }
         $off = null;
         if (isset($matches[10])) {
             $off = strtolower($matches[10]);
         }
         return ap_Utils::ApplyOffsetForDate($_dt, $off, $zone);
     }
     return time();
 }
Beispiel #11
0
 /**
  * @param string $name
  */
 function PrintJsValue($sName)
 {
     echo ap_Utils::ReBuildStringToJavaScript($this->GetValueAsString($sName), '"');
 }
Beispiel #12
0
 /**
  * @return void
  */
 protected static function initDataPath()
 {
     $dataPath = 'data';
     if (!defined('AP_DATA_FOLDER') && @file_exists(self::GetWebMailPath() . 'inc_settings_path.php')) {
         include self::GetWebMailPath() . 'inc_settings_path.php';
     }
     if (!defined('AP_DATA_FOLDER') && null !== $dataPath) {
         define('AP_DATA_FOLDER', ap_Utils::GetFullPath($dataPath, self::GetWebMailPath()));
     }
 }
Beispiel #13
0
 public function DomainsMainEdit(ap_Table_Screen &$oScreen)
 {
     $sDomainSkin = $sDomainLang = $sDomainZone = '';
     /* @var $oDomain CDomain */
     $oDomain =& $this->oAdminPanel->GetMainObject('domain_edit');
     if ($oDomain) {
         $oScreen->Data->SetValue('hiddenDomainId', $oDomain->IdDomain);
         $oScreen->Data->SetValue('classHideDefault', $oDomain->IsDefaultDomain ? 'wm_hide' : '');
         $oScreen->Data->SetValue('classHideNotDefault', $oDomain->IsDefaultDomain ? '' : 'wm_hide');
         $oScreen->Data->SetValue('classHideOverrideSettings', 0 < $oDomain->IdTenant ? 'wm_hide' : '');
         $oScreen->Data->SetValue('classHideSsl', $this->oModule->HasSslSupport() ? '' : 'wm_hide');
         $oScreen->Data->SetValue('chOverrideSettings', $oDomain->OverrideSettings);
         $sDomainSkin = $oDomain->DefaultSkin;
         $sDomainLang = $oDomain->DefaultLanguage;
         $sDomainZone = $oDomain->DefaultTimeZone;
         $sDefaultTab = $oDomain->DefaultTab;
         $oScreen->Data->SetValue('txtSiteName', $oDomain->SiteName);
         $oScreen->Data->SetValue('radioTimeFormat12', ETimeFormat::F12 === $oDomain->DefaultTimeFormat);
         $oScreen->Data->SetValue('radioTimeFormat24', ETimeFormat::F24 === $oDomain->DefaultTimeFormat);
         $oScreen->Data->SetValue('optDateFormatDDMonthYYYY', EDateFormat::DD_MONTH_YYYY === $oDomain->DefaultDateFormat);
         $oScreen->Data->SetValue('optDateFormatMMDDYY', EDateFormat::MMDDYY === $oDomain->DefaultDateFormat);
         $oScreen->Data->SetValue('optDateFormatDDMMYY', EDateFormat::DDMMYY === $oDomain->DefaultDateFormat);
         $oScreen->Data->SetValue('optDateFormatMMDDYYYY', EDateFormat::MMDDYYYY === $oDomain->DefaultDateFormat);
         $oScreen->Data->SetValue('optDateFormatDDMMYYYY', EDateFormat::DDMMYYYY === $oDomain->DefaultDateFormat);
     }
     $sSkinsOptions = '';
     $aSkins = $this->oModule->GetSkinList();
     if (is_array($aSkins)) {
         foreach ($aSkins as $sSkin) {
             $sSelected = $sSkin === $sDomainSkin ? ' selected="selected"' : '';
             $sSkinsOptions .= '<option value="' . ap_Utils::AttributeQuote($sSkin) . '"' . $sSelected . '>' . ap_Utils::EncodeSpecialXmlChars($sSkin) . '</option>';
         }
         $oScreen->Data->SetValue('selSkinsOptions', $sSkinsOptions);
     }
     $sTabsOptions = '';
     $aTabs = $this->oModule->GetTabList($oDomain);
     if (is_array($aTabs)) {
         foreach ($aTabs as $sKeyTab => $sValueTab) {
             $sSelected = $sKeyTab === $sDefaultTab ? ' selected="selected"' : '';
             $sTabsOptions .= '<option value="' . ap_Utils::AttributeQuote($sKeyTab) . '"' . $sSelected . '>' . ap_Utils::EncodeSpecialXmlChars($sValueTab) . '</option>';
         }
         $oScreen->Data->SetValue('selTabsOptions', $sTabsOptions);
     }
     $sLanguageOptions = '';
     $aLangs = $this->oModule->GetLangsList();
     if (is_array($aLangs)) {
         foreach ($aLangs as $sLang) {
             $sSelected = $sLang === $sDomainLang ? ' selected="selected"' : '';
             $sLanguageOptions .= '<option value="' . ap_Utils::AttributeQuote($sLang) . '"' . $sSelected . '>' . ap_Utils::EncodeSpecialXmlChars($sLang) . '</option>';
         }
         $oScreen->Data->SetValue('selLanguageOptions', $sLanguageOptions);
     }
     $sTimeZoneOptions = '';
     $aTimeZones = $this->oModule->GetTimeZoneList();
     if (is_array($aTimeZones)) {
         foreach ($aTimeZones as $iIndex => $aTimeZone) {
             $sSelected = (int) $sDomainZone === (int) $iIndex ? ' selected="selected"' : '';
             $sTimeZoneOptions .= '<option value="' . ap_Utils::AttributeQuote($iIndex) . '"' . $sSelected . '>' . ap_Utils::EncodeSpecialXmlChars($aTimeZone) . '</option>';
         }
         $oScreen->Data->SetValue('selTimeZone', $sTimeZoneOptions);
     }
 }
Beispiel #14
0
 /**
  * @static
  * @param string $str
  * @return CDateTime
  */
 function &CreateFromStr($str)
 {
     $return = new CDateTime(ap_Utils::GetTimeFromString($str));
     return $return;
 }
Beispiel #15
0
?>
</head>
<body style="background-color: #e5e5e5" onload="var login=document.getElementById('loginId'); if (login) {login.focus();};" >
	<div align="center" class="wm_content">
		<div id="login_screen" class="wm_login">
			<form action="<?php 
echo AP_INDEX_FILE;
?>
?login" method="post">
				<div align="center" class="<?php 
echo $this->ContentClass();
?>
">
					<div class="wm_logo" id="logo"></div>
					<?php 
echo ap_Utils::TakePhrase('LOGIN_FORM_ERROR_MESS');
?>
					<div class="wm_login">
						<div class="a top"></div>
						<div class="b top"></div>
						<div class="login_table" style="margin: 0px;">
							<div class="wm_login_header">Administration Login</div>
							<div class="wm_login_content">
								<table id="login_table" border="0" cellspacing="0" cellpadding="10">
								<tr>
									<td class="wm_title" style="font-size: 12px; width: 70px">Login:</td>
									<td>
										<input class="wm_input" size="20" type="text" id="loginId" name="AdmloginInput"
											style="width: 99%; font-size: 16px;"
											onfocus="this.style.background = '#FFF9B2';"
											onblur="this.style.background = 'white';"
Beispiel #16
0
 /**
  * @return bool
  */
 function SaveToXml()
 {
     $xmlDocument = new XmlDocument();
     $xmlDocument->CreateElement('Settings');
     $xmlDocument->XmlRoot->AppendAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
     $xmlDocument->XmlRoot->AppendAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $common = new XmlDomNode('Common');
     $this->AddNode($common, 'SiteName', $this->WindowTitle);
     $this->AddNode($common, 'LicenseKey', $this->LicenseKey);
     $this->AddNode($common, 'AdminPassword', $this->AdminPassword);
     $this->AddNode($common, 'DBType', (int) $this->DbType);
     $this->AddNode($common, 'DBLogin', $this->DbLogin);
     $this->AddNode($common, 'DBPassword', $this->DbPassword);
     $this->AddNode($common, 'DBName', $this->DbName);
     $this->AddNode($common, 'UseDsn', (int) $this->UseDsn);
     $this->AddNode($common, 'DBDSN', $this->DbDsn);
     $this->AddNode($common, 'DBHost', $this->DbHost);
     $this->AddNode($common, 'UseCustomConnectionString', (int) $this->UseCustomConnectionString);
     $this->AddNode($common, 'DBCustomConnectionString', $this->DbCustomConnectionString);
     $this->AddNode($common, 'DBPrefix', ap_Utils::ClearPrefix($this->DbPrefix));
     $this->AddNode($common, 'DefaultSkin', $this->DefaultSkin);
     $this->AddNode($common, 'AllowUsersChangeSkin', (int) $this->AllowUsersChangeSkin);
     $this->AddNode($common, 'DefaultLanguage', $this->DefaultLanguage);
     $this->AddNode($common, 'AllowUsersChangeLanguage', (int) $this->AllowUsersChangeLanguage);
     $this->AddNode($common, 'EnableMobileSync', (bool) $this->EnableMobileSync);
     $this->AddNode($common, 'MobileSyncUrl', $this->MobileSyncUrl);
     $this->AddNode($common, 'MobileSyncContactDataBase', $this->MobileSyncContactDataBase);
     $this->AddNode($common, 'MobileSyncCalendarDataBase', $this->MobileSyncCalendarDataBase);
     $xmlDocument->XmlRoot->AppendChild($common);
     $webmail = new XmlDomNode('WebMail');
     $this->AddNode($webmail, 'IncomingMailProtocol', (int) $this->IncomingMailProtocol);
     $this->AddNode($webmail, 'IncomingMailServer', $this->IncomingMailServer);
     $this->AddNode($webmail, 'IncomingMailPort', (int) $this->IncomingMailPort);
     $this->AddNode($webmail, 'OutgoingMailServer', $this->OutgoingMailServer);
     $this->AddNode($webmail, 'OutgoingMailPort', (int) $this->OutgoingMailPort);
     $this->AddNode($webmail, 'ReqSmtpAuth', (int) $this->ReqSmtpAuth);
     $this->AddNode($webmail, 'AllowAdvancedLogin', (int) $this->AllowAdvancedLogin);
     $this->AddNode($webmail, 'HideLoginMode', (int) $this->HideLoginMode);
     $this->AddNode($webmail, 'DefaultDomainOptional', $this->DefaultDomainOptional);
     $this->AddNode($webmail, 'UseMultipleDomainsSelection', (int) $this->UseMultipleDomainsSelection);
     $this->AddNode($webmail, 'UseCaptcha', (int) $this->UseCaptcha);
     $this->AddNode($webmail, 'ShowTextLabels', (int) $this->ShowTextLabels);
     $this->AddNode($webmail, 'AutomaticCorrectLoginSettings', (int) $this->AutomaticCorrectLoginSettings);
     $EnableLogging = (int) $this->EnableLogging;
     if ($this->LoggingSpecialUsers) {
         $EnableLogging++;
     }
     $this->AddNode($webmail, 'EnableLogging', (int) $EnableLogging);
     $this->AddNode($webmail, 'LogLevel', (int) $this->LogLevel);
     $this->AddNode($webmail, 'EnableEventsLogging', (int) $this->EnableEventsLogging);
     $this->AddNode($webmail, 'DisableErrorHandling', (int) $this->DisableErrorHandling);
     $this->AddNode($webmail, 'AllowAjax', (int) $this->AllowAjax);
     $this->AddNode($webmail, 'MailsPerPage', (int) $this->MailsPerPage);
     $this->AddNode($webmail, 'EnableAttachmentSizeLimit', (int) $this->EnableAttachmentSizeLimit);
     $this->AddNode($webmail, 'AttachmentSizeLimit', GetGoodBigInt($this->AttachmentSizeLimit));
     $this->AddNode($webmail, 'EnableMailboxSizeLimit', (int) $this->EnableMailboxSizeLimit);
     $this->AddNode($webmail, 'MailboxSizeLimit', GetGoodBigInt($this->MailboxSizeLimit));
     $this->AddNode($webmail, 'TakeImapQuota', (int) $this->TakeImapQuota);
     $this->AddNode($webmail, 'DefaultTimeZone', $this->DefaultTimeZone);
     $this->AddNode($webmail, 'AllowUsersChangeTimeZone', (int) $this->AllowUsersChangeTimeZone);
     $this->AddNode($webmail, 'DefaultUserCharset', (int) CWebMail_Plugin::GetCodePageNumber($this->DefaultUserCharset));
     $this->AddNode($webmail, 'AllowUsersChangeCharset', (int) $this->AllowUsersChangeCharset);
     $this->AddNode($webmail, 'AllowDHTMLEditor', (int) $this->AllowDhtmlEditor);
     $this->AddNode($webmail, 'AllowUsersChangeEmailSettings', (int) $this->AllowUsersChangeEmailSettings);
     $this->AddNode($webmail, 'AllowDirectMode', (int) $this->AllowDirectMode);
     $this->AddNode($webmail, 'DirectModeIsDefault', (int) $this->DirectModeIsDefault);
     $this->AddNode($webmail, 'AllowNewUsersRegister', (int) $this->AllowNewUsersRegister);
     $this->AddNode($webmail, 'AllowUsersAddNewAccounts', (int) $this->AllowUsersAddNewAccounts);
     $this->AddNode($webmail, 'AllowUsersChangeAccountsDef', (int) $this->AllowUsersChangeAccountsDef);
     $this->AddNode($webmail, 'StoreMailsInDb', (int) $this->StoreMailsInDb);
     $this->AddNode($webmail, 'AllowContacts', (int) $this->AllowContacts);
     $this->AddNode($webmail, 'AllowCalendar', (int) $this->AllowCalendar);
     $this->AddNode($webmail, 'AllowLanguageOnLogin', (int) $this->AllowLanguageOnLogin);
     $this->AddNode($webmail, 'Imap4DeleteLikePop3', (int) $this->Imap4DeleteLikePop3);
     $this->AddNode($webmail, 'AllowInsertImage', (int) $this->AllowInsertImage);
     $this->AddNode($webmail, 'AllowBodySize', (int) $this->AllowBodySize);
     $this->AddNode($webmail, 'MaxBodySize', (int) $this->MaxBodySize);
     $this->AddNode($webmail, 'MaxSubjectSize', (int) $this->MaxSubjectSize);
     $this->AddNode($webmail, 'EnableWmServer', (int) $this->EnableWmServer);
     $this->AddNode($webmail, 'WmServerRootPath', $this->WmServerRootPath);
     $this->AddNode($webmail, 'WmServerHost', $this->WmServerHost);
     $this->AddNode($webmail, 'WmAllowManageXMailAccounts', (int) $this->WmAllowManageXMailAccounts);
     $this->AddNode($webmail, 'IdleSessionTimeout', (int) $this->IdleSessionTimeout);
     $this->AddNode($webmail, 'AllowRegistration', (int) $this->AllowRegistration);
     $this->AddNode($webmail, 'AllowPasswordReset', (int) $this->AllowPasswordReset);
     $this->AddNode($webmail, 'GlobalAddressBook', $this->GlobalAddressBook);
     $this->AddNode($webmail, 'FlagsLangSelect', (int) $this->FlagsLangSelect);
     $this->AddNode($webmail, 'ViewMode', (int) $this->ViewMode);
     $this->AddNode($webmail, 'SaveInSent', (int) $this->SaveInSent);
     $xmlDocument->XmlRoot->AppendChild($webmail);
     $calendar = new XmlDomNode('Calendar');
     $this->AddNode($calendar, 'DefaultTimeFormat', (int) $this->Cal_DefaultTimeFormat);
     $this->AddNode($calendar, 'DefaultDateFormat', (int) $this->Cal_DefaultDateFormat);
     $this->AddNode($calendar, 'ShowWeekends', (int) $this->Cal_ShowWeekends);
     $this->AddNode($calendar, 'WorkdayStarts', (int) $this->Cal_WorkdayStarts);
     $this->AddNode($calendar, 'WorkdayEnds', (int) $this->Cal_WorkdayEnds);
     $this->AddNode($calendar, 'ShowWorkDay', (int) $this->Cal_ShowWorkDay);
     $this->AddNode($calendar, 'WeekStartsOn', (int) $this->Cal_WeekStartsOn);
     $this->AddNode($calendar, 'DefaultTab', (int) $this->Cal_DefaultTab);
     $this->AddNode($calendar, 'DefaultCountry', $this->Cal_DefaultCountry);
     $this->AddNode($calendar, 'DefaultTimeZone', (int) $this->Cal_DefaultTimeZone);
     $this->AddNode($calendar, 'AllTimeZones', (int) $this->Cal_AllTimeZones);
     $this->AddNode($calendar, 'AllowReminders', (int) $this->Cal_AllowReminders);
     $this->AddNode($calendar, 'AutoAddInvitation', (int) $this->Cal_AutoAddInvitation);
     $xmlDocument->XmlRoot->AppendChild($calendar);
     if (strlen($this->Dev) > 0) {
         $xmlDocument->XmlRoot->AppendChild(new XmlDomNode('Dev', ap_Utils::EncodeSpecialXmlChars($this->Dev)));
     }
     if (AP_USE_XML_CACHE) {
         $out = array();
         foreach ($this as $key => $value) {
             if (strlen($key) > 0) {
                 if ($key[0] === '_' || $key === 'isLoad') {
                     continue;
                 }
                 if (is_int($value)) {
                     $out[] = '\'' . $key . '\'=>' . $value;
                 } else {
                     $out[] = '\'' . $key . '\'=>\'' . ap_Utils::ClearStringValue(ap_Utils::EncodeSpecialXmlChars($value), '\'') . '\'';
                 }
             }
         }
         file_put_contents($this->_path . '/settings/settings.xml.cache', '<?php return array(' . implode(",\r\n", $out) . ');');
     }
     return $xmlDocument->SaveToFile($this->_path . '/settings/settings.xml');
 }
Beispiel #17
0
	<title><?php 
$this->Title();
?>
</title>
	<script type="text/javascript" src="./js/browser.js<?php 
echo '?' . $this->ClearAdminVersion();
?>
"></script>
	<script type="text/javascript">
		var Browser = new CBrowser();
		var _apPath = "<?php 
echo ap_Utils::ReBuildStringToJavaScript($this->AdminFolder(), '"');
?>
";
		var _langSaving = "<?php 
echo ap_Utils::ReBuildStringToJavaScript(AP_LANG_SAVING, '"');
?>
";
		function ResizeElements(mode) { return true; }
		function GlobalInit() { return true; }
	</script>
<?php 
$this->TopJS();
$this->TopStyles();
?>
</head>
<body onresize="ResizeElements('All');" onload="GlobalInit();">
	<div class="<?php 
$this->ContentClass();
?>
" align="center">
Beispiel #18
0
 function _initTable(&$_screen)
 {
     $_ap =& $_screen->GetAp();
     $_apTab = $_ap->Tab();
     if ($_apTab == 'admins') {
         $_screen->SetNullPhrase(ap_Utils::TakePhrase('CM_LANG_NOADMINS'));
         $_screen->InitTable();
         $_screen->ClearHeaders();
         $_screen->AddHeader('Login', 60);
         $_screen->AddHeader('Description', 120, true);
         $this->_initAdminsData($_screen);
     }
 }
Beispiel #19
0
	<tr>
		<td><div class="wm_inbox_page_switcher_left"></div></td>
		<td class="wm_inbox_page_switcher_pages" id="ps_pages"></td>
		<td><div class="wm_inbox_page_switcher_right"></div></td>
	</tr>
</table>
-->
<script type="text/javascript">
<?php 
$screen->WriteTableJS();
?>
var List = new CList();
var Selection;
Init_list("list");
ResizeElements("all");

<?php 
if (isset($_GET['uid'])) {
    echo 'Selection.CheckLine("' . ap_Utils::ReBuildStringToJavaScript(urlencode($_GET['uid']), '"') . '");';
}
?>

function ViewAddressRecord(id) {
	document.location = "<?php 
echo AP_INDEX_FILE;
?>
?mode=edit&uid=" + id;
}
</script>
<?php 
$screen->WriteInitJS();
Beispiel #20
0
    /**
     * @param Account $account
     * @return string
     */
    function UpdateSettings(&$account)
    {
        $sql = '
UPDATE %sawm_settings SET
	msgs_per_page = %d, white_listing = %d, x_spam = %d,
	def_skin = %s, def_lang = %s, def_charset_inc = %d,
	def_charset_out = %d, def_timezone = %d, def_date_fmt = %s,
	hide_folders = %d, mailbox_limit = %d, allow_change_settings = %d,
	allow_dhtml_editor = %d, allow_direct_mode = %d, hide_contacts = %d,
	db_charset = %d, horiz_resizer = %d, vert_resizer = %d, mark = %d,
	reply = %d, contacts_per_page = %d, view_mode = %d
WHERE id_user = %d';
        return sprintf($sql, $this->_prefix, $account->MailsPerPage > 0 ? $account->MailsPerPage : 20, $account->WhiteListing, $account->XSpam, $this->_escapeString($account->DefaultSkin), $this->_escapeString($account->DefaultLanguage), ap_Utils::GetCodePageNumber($account->DefaultIncCharset), ap_Utils::GetCodePageNumber($account->DefaultOutCharset), $account->DefaultTimeZone, $this->_escapeString(CDateTime::GetDbDateFormat($account->DefaultDateFormat, $account->DefaultTimeFormat)), $account->HideFolders, $account->MailboxLimit, $account->AllowChangeSettings, $account->AllowDhtmlEditor, $account->AllowDirectMode, $account->HideContacts, ap_Utils::GetCodePageNumber($account->DbCharset), $account->HorizResizer, $account->VertResizer, $account->Mark, $account->Reply, $account->ContactsPerPage > 0 ? $account->ContactsPerPage : 20, $account->ViewMode, $account->IdUser);
    }
Beispiel #21
0
 /**
  * @return string/boot
  */
 function ValidateData()
 {
     if (!ap_Utils::CheckFileName($this->Email)) {
         return 'You should specify a correct e-mail.';
     } elseif (empty($this->Email)) {
         return 'You cannot leave Email field blank';
     } elseif (!ap_Utils::checkEmail($this->Email)) {
         return 'You should specify a correct e-mail.';
     } elseif (empty($this->MailIncLogin)) {
         return 'You cannot leave Login field blank.';
     } elseif (empty($this->MailIncPassword)) {
         return 'You cannot leave Password field blank.';
     } elseif (empty($this->MailIncHost)) {
         return 'You cannot leave POP3(IMAP4) Server field blank.';
     } elseif (!ap_Utils::checkServerName($this->MailIncHost)) {
         return 'You should specify a correct POP3(IMAP) server address.';
     } elseif (empty($this->MailIncPort)) {
         return 'You cannot leave POP3(IMAP4) Server Port field blank.';
     } elseif (!ap_Utils::checkPort($this->MailIncPort)) {
         return 'You should specify a positive number in POP3(IMAP4) port field. Default POP3(IMAP4) port number is 110(143).';
     } elseif (empty($this->MailOutHost)) {
         return 'You should specify a correct SMTP server address.';
     } elseif (!ap_Utils::checkServerName($this->MailOutHost)) {
         return 'You should specify a correct SMTP server address.';
     } elseif (empty($this->MailOutPort)) {
         return 'You cannot leave SMTP Server Port field blank.';
     } elseif (!ap_Utils::checkPort($this->MailOutPort)) {
         return 'You should specify a positive number in SMTP port field. Default SMTP port number is 25.';
     }
     return true;
 }
Beispiel #22
0
 function UpdateFromSessionArray()
 {
     $sessionArray = isset($_SESSION[WM_SESS_DOMAIN]) ? $_SESSION[WM_SESS_DOMAIN] : array();
     if (count($sessionArray) > 0) {
         $this->_id = ap_Utils::ArrayValue($sessionArray, '_id', $this->_id);
         $this->_name = ap_Utils::ArrayValue($sessionArray, '_name', $this->_name);
         $this->_mailProtocol = ap_Utils::ArrayValue($sessionArray, '_mailProtocol', $this->_mailProtocol);
         $this->_mailIncomingHost = ap_Utils::ArrayValue($sessionArray, '_mailIncomingHost', $this->_mailIncomingHost);
         $this->_mailIncomingPort = ap_Utils::ArrayValue($sessionArray, '_mailIncomingPort', $this->_mailIncomingPort);
         $this->_mailSmtpHost = ap_Utils::ArrayValue($sessionArray, '_mailSmtpHost', $this->_mailSmtpHost);
         $this->_mailSmtpPort = ap_Utils::ArrayValue($sessionArray, '_mailSmtpPort', $this->_mailSmtpPort);
         $this->_mailSmtpAuth = ap_Utils::ArrayValue($sessionArray, '_mailSmtpAuth', $this->_mailSmtpAuth);
         $this->_isInternal = ap_Utils::ArrayValue($sessionArray, '_isInternal', $this->_isInternal);
         $this->_globalAddrBook = ap_Utils::ArrayValue($sessionArray, '_globalAddrBook', $this->_globalAddrBook);
         $this->_ldapAuth = ap_Utils::ArrayValue($sessionArray, '_ldapAuth', $this->_ldapAuth);
         $this->ClearSessionArray();
     }
 }
Beispiel #23
0
    /**
     * @return void
     */
    public function WriteMenu()
    {
        $sCurrentMode = $this->GetCurrentMode();
        echo '<div style="width:215px; height:1px; overflow:hidden; padding: 0px"></div>';
        foreach ($this->aMenu as $sMode => $aItems) {
            $sClass = 'wm_settings_item';
            if ($sCurrentMode === $sMode) {
                $sClass = 'wm_selected_settings_item';
                foreach ($aItems as $oAddItem) {
                    $aToolTips = $oAddItem->ToolTips();
                    if (is_array($aToolTips) && 0 < count($aToolTips)) {
                        foreach ($aToolTips as $sId => $sToolTip) {
                            $this->JsAddInitText('JAddToolTip("' . ap_Utils::ReBuildStringToJavaScript($sId, '"') . '", "' . ap_Utils::ReBuildStringToJavaScript($sToolTip, '"') . '");');
                        }
                    }
                }
            }
            $oItem = isset($aItems[0]) ? $aItems[0] : null;
            if ($oItem) {
                echo '
<div class="' . $sClass . '" id="' . $oItem->Mode() . '_div"><a href="' . AP_INDEX_FILE . '?mode=' . $oItem->Mode() . '">' . $oItem->Name() . '</a></div>';
            }
        }
    }
Beispiel #24
0
    /**
     * @return void
     */
    public function Write()
    {
        $sActiv = '';
        $sOptions = '';
        $iC = 0;
        $iLimit = 999;
        $bHide = false;
        foreach ($this->aList as $mIndex => $aValue) {
            if (1 < count($aValue)) {
                $sActiv = $iC === 0 ? '<a class="l1" title="' . ap_Utils::AttributeQuote($aValue[0]) . '" href="javascript:void(0);"><div class="link ' . $aValue[1] . '"><div>' . $aValue[0] . '</div></div>' : $sActiv;
                $addClass = empty($this->sSelectedItem) && $iC === 0 || $mIndex == $this->sSelectedItem ? ' SelectedDomain' : '';
                $iC++;
                $sActiv = $mIndex == $this->sSelectedItem ? '<a class="l1" title="' . ap_Utils::AttributeQuote($aValue[0]) . '" href="javascript:void(0);"><div class="link ' . $aValue[1] . '"><div>' . $aValue[0] . '</div></div>' : $sActiv;
                if (!$bHide) {
                    $mHref = AP_INDEX_FILE . '?tab=' . ap_Utils::AttributeQuote($this->sTag) . '&filter=' . ap_Utils::AttributeQuote($mIndex);
                    $sOptions .= '<a class="l2" title="' . ap_Utils::AttributeQuote($aValue[0]) . '" href="' . $mHref . '"><div class="' . $aValue[1] . $addClass . '">' . $aValue[0] . '</div></a>';
                }
                if ($iLimit === $iC) {
                    $sOptions .= '<div style="text-align: center; margin: 2px;">...</div>';
                    $bHide = true;
                }
            }
        }
        echo 0 === count($this->aList) ? '' : '
<div style="float: left; height: 16px; padding: 4px;"><span>' . $this->sName . ':</span></div>
<div class="menu_select">
' . $sActiv . '<!--[if gte IE 7]><!--></a><!--<![endif]-->
	<div class="dd">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td>
					' . $sOptions . '
				</td>
			</tr>
		</table>
	</div>
	<!--[if lte IE 6]></a><![endif]-->
</div>';
    }
Beispiel #25
0
 /**
  * @param ap_Screen_Data $data
  * @param Account $account
  */
 function ScreenDataFromAccount(&$_data, &$_account, $_isNewAccount = false)
 {
     $_data->SetValue('txtIncomingLogin', $_account->MailIncLogin);
     if (!$_isNewAccount) {
         if (strlen($_account->MailIncPassword) > 0) {
             $_data->SetValue('txtIncomingPassword', AP_DUMMYPASSWORD);
         }
         if (strlen($_account->MailOutPassword) > 0) {
             $_data->SetValue('txtSmtpPassword', AP_DUMMYPASSWORD);
         }
     }
     $_data->SetValue('selectMailProtocolPop3', $_account->MailProtocol == WM_MAILPROTOCOL_POP3);
     $_data->SetValue('selectMailProtocolImap4', $_account->MailProtocol == WM_MAILPROTOCOL_IMAP4);
     $_data->SetValue('txtIncomingMail', $_account->MailIncHost);
     $_data->SetValue('txtSmtpServer', $_account->MailOutHost);
     $_data->SetValue('intIncomingPort', (int) $_account->MailIncPort);
     $_data->SetValue('intSmtpPort', (int) $_account->MailOutPort);
     $_data->SetValue('intLimitMailbox', (int) ceil($_account->MailboxLimit / 1024));
     $_data->SetValue('txtFriendlyName', $_account->FriendlyName);
     $_data->SetValue('txtEmail', $_account->Email);
     $_quotaJs = '';
     if ($this->_settings->TakeImapQuota) {
         $_quotaJs .= ' var TakeImapQuota = true; ';
         $_data->SetValue('intTakeImapQuota', (int) ($_account->ImapQuota === 1));
     } else {
         $_quotaJs .= ' var TakeImapQuota = false; ';
         $_data->SetValue('classTakeImapQuota', 'wm_hide');
     }
     if ($_account->ImapQuota === -1) {
         $_data->SetValue('infoTakeImapQuotaText', '<br />(IMAP quota is not supported by the server.)');
         $_quotaJs .= ' SetDisabled(document.getElementById("intTakeImapQuota"), true, true); ';
     }
     if (strlen($_quotaJs) > 0) {
         $_data->SetValue('infoTakeImapQuotaJs', '<script> ' . $_quotaJs . ' </script>');
     }
     $_data->SetValue('txtSmtpLogin', $_account->MailOutLogin);
     $_data->SetValue('txtKeepMsgsDays', $_account->MailsOnServerDays);
     $_data->SetValue('chkUseSmtpAuth', $_account->MailOutAuthentication);
     $_data->SetValue('chkUseFriendlyName', $_account->UseFriendlyName);
     $_data->SetValue('chkGetMailAtLogin', $_account->GetMailAtLogin);
     $_data->SetValue('chkAllowDM', $_account->AllowDirectMode);
     $_data->SetValue('chkAllowChangeEmail', $_account->AllowChangeSettings);
     $_data->SetValue('chkUserEnabled', !$_account->Deleted);
     switch ($_account->MailMode) {
         case WM_MAILMODE_DeleteMessagesFromServer:
             $_data->SetValue('radioDelRecvMsgs', true);
             break;
         case WM_MAILMODE_LeaveMessagesOnServer:
             $_data->SetValue('radioLeaveMsgs', true);
             break;
         case WM_MAILMODE_KeepMessagesOnServer:
             $_data->SetValue('radioLeaveMsgs', true);
             $_data->SetValue('chkKeepMsgs', true);
             break;
         case WM_MAILMODE_DeleteMessageWhenItsRemovedFromTrash:
             $_data->SetValue('radioLeaveMsgs', true);
             $_data->SetValue('chkDelMsgsSrv', true);
             break;
         case WM_MAILMODE_KeepMessagesOnServerAndDeleteMessageWhenItsRemovedFromTrash:
             $_data->SetValue('radioLeaveMsgs', true);
             $_data->SetValue('chkKeepMsgs', true);
             $_data->SetValue('chkDelMsgsSrv', true);
             break;
     }
     $_folderSyncType = $_data->GetValueAsInt('folderSyncType');
     if ($_folderSyncType == WM_FOLDERSYNC_NewHeadersOnly || $_folderSyncType == WM_FOLDERSYNC_AllHeadersOnly) {
         $_data->SetValue('synchronizeSelect1', true);
     } else {
         if ($_folderSyncType == WM_FOLDERSYNC_DirectMode) {
             $_data->SetValue('synchronizeSelect5', true);
         } else {
             $_data->SetValue('synchronizeSelect3', true);
         }
     }
     if ($_folderSyncType == WM_FOLDERSYNC_AllHeadersOnly || $_folderSyncType == WM_FOLDERSYNC_AllEntireMessages) {
         $_data->SetValue('chkDelMsgsDB', true);
     }
     // Advanced
     $_data->SetValue('txtMessagesPerPage', $_account->MailsPerPage);
     $_data->SetValue('txtContactsPerPage', $_account->ContactsPerPage);
     $_data->SetValue('intDisableRichEditor', !$_account->AllowDhtmlEditor);
     $_data->SetValue('intMessageListWithPreviewPane', $_account->ViewMode == WM_VIEW_MODE_PREVIEW_PANE || $_account->ViewMode == WM_VIEW_MODE_PREVIEW_PANE_NO_IMG);
     $_data->SetValue('intAlwaysShowPictures', $_account->ViewMode == WM_VIEW_MODE_PREVIEW_PANE || $_account->ViewMode == WM_VIEW_MODE_WITHOUT_PREVIEW_PANE);
     $_skins =& $this->GetSkinsList();
     $_skinsString = '';
     foreach ($_skins as $_skin) {
         $_selected = $_skin == $_account->DefaultSkin ? ' selected="selected"' : '';
         $_skinsString .= '<option value="' . ap_Utils::AttributeQuote($_skin) . '"' . $_selected . '>' . ap_Utils::EncodeSpecialXmlChars($_skin) . '</option>' . AP_CRLF;
     }
     $_data->SetValue('txtDefaultSkin', $_skinsString);
     $_charsets =& $this->GetCharsetsList();
     $_charsetsString = '';
     foreach ($_charsets as $_charset) {
         $_selected = $_charset[0] == $_account->DefaultIncCharset ? ' selected="selected"' : '';
         $_charsetsString .= '<option value="' . ap_Utils::AttributeQuote($_charset[0]) . '"' . $_selected . '>' . ap_Utils::EncodeSpecialXmlChars($_charset[1]) . '</option>' . AP_CRLF;
     }
     $_data->SetValue('txtDefaultUserCharset', $_charsetsString);
     $_timezones =& $this->GetTimeZoneList();
     $_timezonesString = '';
     foreach ($_timezones as $_timezoneKey => $_timezoneValue) {
         $_selected = $_timezoneKey == $_account->DefaultTimeZone ? ' selected="selected"' : '';
         $_timezonesString .= '<option value="' . ap_Utils::AttributeQuote($_timezoneKey) . '"' . $_selected . '>' . ap_Utils::EncodeSpecialXmlChars($_timezoneValue) . '</option>' . AP_CRLF;
     }
     $_data->SetValue('txtDefaultTimeZone', $_timezonesString);
     $_langs =& $this->GetLangsList();
     $_langsString = '';
     foreach ($_langs as $_lang) {
         $_selected = $_lang == $_account->DefaultLanguage ? ' selected="selected"' : '';
         $_langsString .= '<option value="' . ap_Utils::AttributeQuote($_lang) . '"' . $_selected . '>' . ap_Utils::EncodeSpecialXmlChars($_lang) . '</option>' . AP_CRLF;
     }
     $_data->SetValue('txtDefaultLanguage', $_langsString);
     if ($_account->Aliases && count($_account->Aliases) > 0) {
         $text = '';
         foreach ($_account->Aliases as $value) {
             $text .= '<option value="' . ap_Utils::AttributeQuote($value) . '">' . ap_Utils::EncodeSpecialXmlChars($value) . '</option>';
         }
         if (strlen($text) > 0) {
             $_data->SetValue('AliasesListDDL', $text);
             $text = '';
         }
     }
     if ($_account->Forwards && count($_account->Forwards) > 0) {
         $text = '';
         foreach ($_account->Forwards as $value) {
             $text .= '<option value="' . ap_Utils::AttributeQuote($value) . '">' . ap_Utils::EncodeSpecialXmlChars($value) . '</option>';
         }
         if (strlen($text) > 0) {
             $_data->SetValue('ForwardsListDDL', $text);
             $text = '';
         }
     }
 }
Beispiel #26
0
 /**
  * @param string $sLogin
  * @param string $sPassword
  * @return bool
  */
 public function AuthLogin($sLogin, $sPassword)
 {
     $oSettings = null;
     $oSettings =& CApi::GetSettings();
     $sDemoLogin = CApi::GetConf('demo.adminpanel.login', '');
     $sLogin = trim($sLogin);
     $sPassword = trim($sPassword);
     if (empty($sLogin) || empty($sPassword)) {
         return false;
     }
     if ($oSettings->GetConf('Common/AdminLogin') === $sLogin && $this->oWebmailApi->validateAdminPassword($sPassword)) {
         $this->setAdminAccessType(AP_SESS_AUTH_TYPE_SUPER_ADMIN);
         return true;
     } else {
         if (CApi::GetConf('demo.adminpanel.enable', false) && 0 < strlen($sDemoLogin) && $sDemoLogin === CPost::get('AdmloginInput')) {
             $this->setAdminAccessType(AP_SESS_AUTH_TYPE_SUPER_ADMIN_ONLYREAD);
             return true;
         } else {
             if ($this->oAdminPanel->PType() && $this->oAdminPanel->RType()) {
                 $iTenantId = $this->oAdminPanel->CallModuleFunction('CProModule', 'GetTenantIdByLoginPassword', array($sLogin, $sPassword));
                 if (0 < $iTenantId) {
                     $oTenant = $this->oAdminPanel->CallModuleFunction('CProModule', 'getTenantById', array($iTenantId));
                     if ($oTenant) {
                         /* @var $oTenant CTenant */
                         if (0 < $oTenant->Expared && $oTenant->Expared < \time()) {
                             $sDesc = '<div style="display: block; margin: 0px auto; font: 11pt Verdana,sans-serif; width: 340px; padding: 20px; color: #777;">';
                             $sDesc .= '<h2 style="color: #D35A5A; font-weight: normal; font-size: 16pt;">' . CAPi::I18N('ADMIN_PANEL/YOUR_SUBSCRIPTION_IS_EXPIRED') . '</h2>';
                             if (0 < strlen($oTenant->PayUrl)) {
                                 $sDesc .= '<p>' . CAPi::I18N('ADMIN_PANEL/TO_RENEW_FOLLOW_LINK') . ' <a target="_blank" href="' . ap_Utils::AttributeQuote($oTenant->PayUrl) . '">' . $oTenant->PayUrl . '</a></p>';
                             }
                             $sDesc .= '</div>';
                             CSession::Set('SESSION_LOGIN_WARNING', $sDesc);
                             return true;
                         }
                         $this->setAdminAccessType(AP_SESS_AUTH_TYPE_TENANT);
                         $this->setTenantAccessId($iTenantId);
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
Beispiel #27
0
 /**
  * @access private
  * @param string $string
  * @return bool
  */
 function _putline($string)
 {
     CAdminPanel::Log('POP3 > ' . ap_Utils::ShowCRLF($string));
     $line = $string . "\r\n";
     if (!@fwrite($this->socket, $line, strlen($line))) {
         $this->error = 'POP3 _putline() - Error while send "' . $string . '". -- Connection closed.';
         $this->setGlobalErrorAndWriteLog();
         $this->_cleanup();
         return false;
     }
     return true;
 }
Beispiel #28
0
 /**
  * @param int $id
  * @return Account
  */
 function &SelectAccountData($id)
 {
     $null = null;
     if (!$this->_connector->Execute($this->_commandCreator->SelectAccountData($id))) {
         return $null;
     }
     $account = new Account($this->_settings);
     $row = $this->_connector->GetNextRecord();
     if ($row) {
         $account->Id = (int) $row->id_acct;
         $account->IdUser = (int) $row->id_user;
         $account->DefaultAccount = (bool) abs($row->def_acct);
         $account->Deleted = (bool) abs($row->deleted);
         $account->Email = $row->email;
         $account->MailProtocol = (int) $row->mail_protocol;
         $account->MailIncHost = $row->mail_inc_host;
         $account->MailIncLogin = $row->mail_inc_login;
         $account->MailIncPort = (int) $row->mail_inc_port;
         $account->MailOutHost = $row->mail_out_host;
         $account->MailOutLogin = $row->mail_out_login;
         $account->MailOutPort = (int) $row->mail_out_port;
         $account->MailOutAuthentication = (int) $row->mail_out_auth;
         $account->FriendlyName = $row->friendly_nm;
         $account->UseFriendlyName = (bool) abs($row->use_friendly_nm);
         $account->DefaultOrder = (int) $row->def_order;
         $account->GetMailAtLogin = (bool) abs($row->getmail_at_login);
         $account->MailMode = (int) $row->mail_mode;
         $account->MailsOnServerDays = (int) $row->mails_on_server_days;
         $account->SignatureType = (int) $row->signature_type;
         $account->SignatureOptions = (int) $row->signature_opt;
         $account->HideContacts = (bool) abs($row->hide_contacts);
         $account->MailsPerPage = (int) $row->msgs_per_page > 0 ? (int) $row->msgs_per_page : 20;
         $account->Delimiter = $row->delimiter;
         $account->NameSpace = $row->personal_namespace;
         $account->DomainId = (int) $row->id_domain;
         $account->WhiteListing = (bool) abs($row->white_listing);
         $account->XSpam = (bool) abs($row->x_spam);
         $account->LastLogin = (int) $row->last_login;
         $account->LoginsCount = (int) $row->logins_count;
         $account->DefaultSkin = $row->def_skin;
         $account->DefaultLanguage = $row->def_lang;
         $account->DefaultIncCharset = ap_Utils::GetCodePageName((int) $row->def_charset_inc);
         $account->DefaultOutCharset = ap_Utils::GetCodePageName((int) $row->def_charset_out);
         $account->DefaultTimeZone = (int) $row->def_timezone;
         $account->DefaultDateFormat = CDateTime::GetDateFormatFromBd($row->def_date_fmt);
         $account->DefaultTimeFormat = CDateTime::GetTimeFormatFromBd($row->def_date_fmt);
         $account->HideFolders = (bool) abs($row->hide_folders);
         $account->MailboxLimit = GetGoodBigInt($row->mailbox_limit);
         $account->MailboxSize = GetGoodBigInt($row->mailbox_size);
         $account->AllowChangeSettings = (bool) abs($row->allow_change_settings);
         $account->AllowDhtmlEditor = (bool) abs($row->allow_dhtml_editor);
         $account->AllowDirectMode = (bool) abs($row->allow_direct_mode);
         $account->DbCharset = ap_Utils::GetCodePageName((int) $row->db_charset);
         $account->HorizResizer = (int) $row->horiz_resizer;
         $account->VertResizer = (int) $row->vert_resizer;
         $account->Mark = (int) $row->mark;
         $account->Reply = (int) $row->reply;
         $account->ContactsPerPage = (int) $row->contacts_per_page > 0 ? (int) $row->contacts_per_page : 20;
         $account->ViewMode = (int) $row->view_mode;
         $account->MailIncPassword = ap_Utils::DecodePassword($row->mail_inc_pass);
         $account->MailOutPassword = ap_Utils::DecodePassword($row->mail_out_pass);
         $account->IsMailList = (bool) $row->mailing_list;
         $account->ImapQuota = (int) $row->imap_quota;
         $this->_connector->FreeResult();
     } else {
         $account = $null;
     }
     if ($account && !$account->IsMailList) {
         if (!is_object($account) || !$this->_connector->Execute($this->_commandCreator->SelectSignature($account->Id))) {
             return $null;
         }
         $row = $this->_connector->GetNextRecord();
         if ($row) {
             $account->Signature = $row->signature;
             $this->_connector->FreeResult();
         }
         if (!is_object($account) || !$this->_connector->Execute($this->_commandCreator->SelectAccountColumnsData($account->IdUser))) {
             return $null;
         }
         while (($row = $this->_connector->GetNextRecord()) != false) {
             $account->Columns[(int) $row->id_column] = $row->column_value;
         }
         if ($account->DomainId > 0 && $this->_connector->Execute($this->_commandCreator->SelectAccountAliases($account->Id))) {
             while (($row = $this->_connector->GetNextRecord()) != false) {
                 $account->Aliases[] = $row->alias_name;
             }
         }
         if ($account->DomainId > 0 && $this->_connector->Execute($this->_commandCreator->SelectAccountForwards($account->Id))) {
             while (($row = $this->_connector->GetNextRecord()) != false) {
                 $account->Forwards[] = $row->forward_to;
             }
         }
     } else {
         if ($account && $account->IsMailList) {
             if ($this->_connector->Execute($this->_commandCreator->SelectMailListAccountUsers($account->Id))) {
                 while (($row = $this->_connector->GetNextRecord()) != false) {
                     $account->MailingList[] = $row->list_to;
                 }
             }
         }
     }
     return $account;
 }
Beispiel #29
0
    function _getListHtml()
    {
        $return = '';
        if (count($this->_headers) > 0) {
            $nobrArray = array('Email', 'Last Login');
            $cnt = count($this->_list);
            if ($cnt > 0 && $cnt <= $this->_linePerPage) {
                foreach ($this->_list as $href => $value) {
                    $return .= '
	<tr id="' . ap_Utils::AttributeQuote(urlencode($href)) . '" class="wm_inbox_read_item">
		<td id="none" class="wm_inbox_none">
			<input name="chCollection[]" type="checkbox" value="' . ap_Utils::AttributeQuote($href) . '" class="wm_checkbox" />
		</td>';
                    $headerKeys = array_keys($this->_headers);
                    foreach ($headerKeys as $name) {
                        if (isset($value[$name])) {
                            $nobrStr0 = $nobrStr1 = '';
                            if (in_array($name, $nobrArray)) {
                                $nobrStr0 = '<nobr>';
                                $nobrStr1 = '</nobr>';
                            }
                            $pretext = $name == 'Email' ? '' : '';
                            $return .= '
		<td></td>
		<td class="wm_inbox_from_subject" style="overflow:hidden;">
			' . $nobrStr0 . $pretext . $this->_lightStr($name, $value[$name], $this->_light) . $nobrStr1 . '
		</td>							
	';
                        } else {
                            $return .= '
		<td></td>
		<td class="wm_inbox_from_subject" style="padding-left: 4px;">
		</td>
		';
                        }
                    }
                    $return .= '
	</tr>';
                }
            } else {
                if ($cnt == 0) {
                    $return .= '<tr><td colspan="' . (count($this->_headers) * 2 + 1) . '"><div class="wm_inbox_info_message">' . $this->_null_message . '</div></td></tr>';
                } else {
                    $return .= '<tr><td colspan="' . (count($this->_headers) * 2 + 1) . '"><div class="wm_inbox_info_message">ERROR</div></td></tr>';
                }
            }
        }
        return $return;
    }
 /**
  * @param	Account	$account
  * @param	int		$sync[optional] = null
  * @return	bool
  */
 function UpdateAccount($account, $sync = null)
 {
     $result = true;
     if ($this->DbStorage->Connect()) {
         if ($account->DefaultAccount) {
             $defaultAccountArray = $this->DbStorage->SelectAccountDataByLogin($account->Email, $account->MailIncLogin, true, $account->Id);
             if (is_array($defaultAccountArray) && count($defaultAccountArray) > 0) {
                 $this->SetError(ap_Utils::TakePhrase('WM_CANT_ADD_DEF_ACCT'));
                 $result = false;
             }
         }
         if ($result && $account->MailProtocol == WM_MAILPROTOCOL_POP3 && $sync != null) {
             $folders =& $this->DbStorage->GetFolders($account);
             if ($folders) {
                 $inboxFolder =& $folders->GetFolderByType(WM_FOLDERTYPE_Inbox);
                 if ($inboxFolder) {
                     $inboxFolder->SyncType = $sync;
                     $result &= $this->DbStorage->UpdateFolder($inboxFolder);
                 }
             }
         }
         if ($result && $account->MailProtocol == WM_MAILPROTOCOL_IMAP4 && $this->_account->_settings->TakeImapQuota) {
             if ($this->_account->ImapQuota === 1) {
                 $mbl = $this->GetQuota();
                 if (false !== $mbl && $mbl >= 0) {
                     $account->MailboxLimit = GetGoodBigInt($mbl);
                 }
             } else {
                 if ($this->_account->ImapQuota === -1 && $this->IsQuotaSupport()) {
                     $this->_account->ImapQuota = 0;
                 }
             }
             $result = $this->DbStorage->UpdateAccountImapQuota($account);
         }
         if ($result) {
             $result = $this->DbStorage->UpdateAccountData($account);
         }
         if ($result && $account->IsInternal) {
             $result &= $this->DbStorage->SaveMailAliases($account);
             $result &= $this->DbStorage->SaveMailForwards($account);
         }
     }
     return $result;
 }