/**
     * @param Account $account
     * @return string
     */
    function UpdateAccount(&$account)
    {
        $sql = 'UPDATE %sawm_accounts SET
						def_acct = %s, deleted = %s, email = %s, mail_protocol = %s,
						mail_inc_host = %s, mail_inc_login = %s, mail_inc_pass = %s, mail_inc_port = %s,
						mail_out_host = %s, mail_out_login = %s, mail_out_pass = %s, mail_out_port = %s,
						mail_out_auth = %s, friendly_nm = %s, use_friendly_nm = %s, def_order = %s,
						getmail_at_login = %s, mail_mode = %s, mails_on_server_days = %s,
						signature = %s, signature_type = %s, signature_opt = %s, 
						delimiter = %s, mailbox_size = %d
					WHERE id_acct = %d';
        return sprintf($sql, $this->_settings->DbPrefix, $this->Bool2Bool((int) $account->DefaultAccount), $this->Bool2Bool((int) $account->Deleted), $this->_escapeString($account->Email), (int) $account->MailProtocol, $this->_escapeString($account->MailIncHost), $this->_escapeString($account->MailIncLogin), $this->_escapeString(ConvertUtils::EncodePassword($account->MailIncPassword, $account)), (int) $account->MailIncPort, $this->_escapeString($account->MailOutHost), $this->_escapeString($account->MailOutLogin), $this->_escapeString(ConvertUtils::EncodePassword($account->MailOutPassword, $account)), (int) $account->MailOutPort, $this->Bool2Bool((int) $account->MailOutAuthentication), $this->_escapeString($account->FriendlyName), $this->Bool2Bool((int) $account->UseFriendlyName), (int) $account->DefaultOrder, $this->Bool2Bool((int) $account->GetMailAtLogin), (int) $account->MailMode, (int) $account->MailsOnServerDays, $this->_escapeString($account->Signature), (int) $account->SignatureType, (int) $account->SignatureOptions, $this->_escapeString($account->Delimiter), $account->MailboxSize, $account->Id);
    }
Exemple #2
0
 * AfterLogic WebMail Pro PHP by AfterLogic Corp. <*****@*****.**>
 *
 * Copyright (C) 2002-2010  AfterLogic Corp. (www.afterlogic.com)
 * Distributed under the terms of the license described in COPYING
 * 
 */
defined('WM_ROOTPATH') || define('WM_ROOTPATH', dirname(__FILE__) . '/');
require_once WM_ROOTPATH . 'common/inc_top.php';
require_once WM_ROOTPATH . 'common/inc_constants.php';
@ob_start(USE_INDEX_GZIP ? 'obStartGzip' : 'obStartNoGzip');
require WM_ROOTPATH . 'common/class_session.php';
require_once WM_ROOTPATH . 'common/class_account.php';
if (!isset($_SESSION[ACCOUNT_ID])) {
    if (USE_DB && isset($_COOKIE['awm_autologin_data']) && isset($_COOKIE['awm_autologin_id'])) {
        $account =& Account::LoadFromDb($_COOKIE['awm_autologin_id'], false, false);
        if ($account != null && $_COOKIE['awm_autologin_data'] == md5(ConvertUtils::EncodePassword($account->MailIncPassword, $account))) {
            $_SESSION[ACCOUNT_ID] = $account->Id;
            $_SESSION[USER_ID] = $account->IdUser;
            $_SESSION[SESSION_LANG] = $account->DefaultLanguage;
            header('Location: webmail.php?check=1');
            exit;
        }
    }
}
if (!isset($_SESSION[ACCOUNT_ID])) {
    header('Location: index.php?error=1');
    exit;
}
$check = isset($_GET['check']) ? $_GET['check'] : 0;
$start = isset($_GET['start']) ? $_GET['start'] : null;
$start = isset($_POST['start']) ? $_POST['start'] : $start;
Exemple #3
0
 /**
  * @return bool
  */
 function UpdatePasswords()
 {
     if (!USE_DB) {
         Account::SaveInSession($this);
         return true;
     }
     $dbStorage =& DbStorageCreator::CreateDatabaseStorage($this);
     if ($dbStorage->Connect()) {
         return $dbStorage->UpdateAccountPasswords($this->Id, ConvertUtils::EncodePassword($this->MailIncPassword, $this), ConvertUtils::EncodePassword($this->MailOutPassword, $this));
     }
     return false;
 }
Exemple #4
0
                 }
             }
         }
     }
     if ($sendSettingsList) {
         $dbStorage =& DbStorageCreator::CreateDatabaseStorage($null);
         if (!$dbStorage || !$dbStorage->Connect() || !$dbStorage->UpdateLastLoginAndLoginsCount($account->IdUser)) {
             $sendSettingsList = false;
             printErrorAndExit(getGlobalError(), $xmlRes);
         }
     }
     if ($sendSettingsList) {
         $loginNode =& new XmlDomNode('login');
         if ($xmlObj->GetParamValueByName('sign_me')) {
             $loginNode->AppendAttribute('id_acct', $account->Id);
             $loginNode->AppendChild(new XmlDomNode('hash', md5(ConvertUtils::EncodePassword($account->MailIncPassword, $account)), true));
         }
         $xmlRes->XmlRoot->AppendChild($loginNode);
     }
     printXML($xmlRes);
     break;
 case 'new':
     switch ($xmlObj->GetParamValueByName('request')) {
         case 'account':
             $newAccount =& new Account();
             UpdateAccountFromRequest($xmlObj->XmlRoot, $newAccount);
             $account =& Account::LoadFromDb($accountId);
             if (!$account->AllowChangeSettings || !$settings->AllowUsersAddNewAccounts) {
                 printErrorAndExit(PROC_ERROR_ACCT_CREATE, $xmlRes);
             }
             if (!$account) {
 function DoLogin()
 {
     $_dbStorage = $_settings = $_xmlObj = $_xmlRes = $_accountId = null;
     $this->_initFuncArgs($_dbStorage, $_settings, $_xmlObj, $_xmlRes, $_accountId);
     $jsTimeOffset = $_xmlObj->GetParamValueByName('js_timeoffset');
     if (strlen($jsTimeOffset) > 0) {
         $_SESSION[JS_TIMEOFFSET] = $jsTimeOffset;
     }
     if ($_settings->UseCaptcha) {
         $captcha = $_xmlObj->GetParamValueByName('captcha');
         if (isset($_SESSION['captcha_count']) && (int) $_SESSION['captcha_count'] >= CATCHA_COUNT_LIMIT) {
             if (!isset($_SESSION['captcha_keystring']) || $captcha != $_SESSION['captcha_keystring']) {
                 CXmlProcessing::PrintErrorAndExit(CaptchaError, $_xmlRes);
             }
         }
         $_SESSION['captcha_count'] = isset($_SESSION['captcha_count']) ? (int) $_SESSION['captcha_count'] + 1 : 1;
         if ((int) $_SESSION['captcha_count'] >= CATCHA_COUNT_LIMIT) {
             $_captchaOn = new XmlDomNode('captcha', '1');
             $_xmlRes->XmlRoot->AppendChild($_captchaOn);
         }
     }
     require_once WM_ROOTPATH . 'common/class_login.php';
     $domain = null;
     if ($_settings->UseMultipleDomainsSelection) {
         $domain = trim($_xmlObj->GetParamTagValueByName('domain_name'));
         if ('' == $domain) {
             $domain = null;
         }
     }
     $loginInfo = new CWebMailLoginInfo($_xmlObj->GetParamTagValueByName('email'), $_xmlObj->GetParamTagValueByName('mail_inc_login'), $_xmlObj->GetParamTagValueByName('mail_inc_pass'), $_xmlObj->GetParamTagValueByName('language'), $_xmlObj->GetParamValueByName('advanced_login'), $_xmlObj->GetParamValueByName('mail_protocol'), $_xmlObj->GetParamTagValueByName('mail_inc_host'), $_xmlObj->GetParamValueByName('mail_inc_port'), $_xmlObj->GetParamTagValueByName('mail_out_host'), $_xmlObj->GetParamValueByName('mail_out_port'), $_xmlObj->GetParamValueByName('mail_out_auth'), $domain);
     $errorString = $account = null;
     if (CWebMailLogin::Init($_settings, $_dbStorage, $loginInfo, $account, $errorString, 'NumOLProcessingCallBackFunction')) {
         $_loginNode = new XmlDomNode('login');
         if ($_xmlObj->GetParamValueByName('sign_me') && $account) {
             $_loginNode->AppendAttribute('id_acct', $account->Id);
             $_loginNode->AppendChild(new XmlDomNode('hash', md5(ConvertUtils::EncodePassword($account->MailIncPassword, $account)), true));
         }
         $_xmlRes->XmlRoot->AppendChild($_loginNode);
     } else {
         CXmlProcessing::PrintErrorAndExit($errorString, $_xmlRes);
     }
 }