本文整理汇总了PHP中Settings::CreateInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::CreateInstance方法的具体用法?PHP Settings::CreateInstance怎么用?PHP Settings::CreateInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::CreateInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_settings_actions_addons_webmail
function fn_settings_actions_addons_webmail(&$new_value, $old_value)
{
if ($new_value == 'A') {
// Copy data directory to "var"
$dir_data = DIR_ROOT . '/var/webmail';
if (fn_copy(DIR_ADDONS . 'webmail/lib/webmail/data', $dir_data) == false) {
$msg = fn_get_lang_var('text_cannot_write_directory');
fn_set_notification('E', fn_get_lang_var('error'), str_replace('[directory]', $dir_data, $msg));
$new_value = 'D';
return false;
}
$config = Registry::get('config');
$_settings = $dir_data . '/settings/settings.xml';
// 1 step, generate config file
$xml = simplexml_load_file($_settings);
$xml->Common->DBLogin = $config['db_user'];
$xml->Common->DBPassword = $config['db_password'];
$xml->Common->DBName = $config['db_name'];
$xml->Common->DBHost = $config['db_host'];
if (fn_put_contents($_settings, $xml->asXML()) == false) {
$msg = fn_get_lang_var('cannot_write_file');
fn_set_notification('E', fn_get_lang_var('error'), str_replace('[file]', $_settings, $msg));
$new_value = 'D';
return false;
}
include DIR_ADDONS . 'webmail/lib/webmail/web/class_settings.php';
include DIR_ADDONS . 'webmail/lib/webmail/web/class_dbstorage.php';
// Init mailbee core
$null = null;
$settings =& Settings::CreateInstance();
$dbStorage =& DbStorageCreator::CreateDatabaseStorage($null);
$dbStorage->Connect();
$dbStorage->CreateTables($settings->DbPrefix);
}
}
示例2: Connect
/**
* @access private
* @param resource $link
* @param Account $account
* @param CLog $log
* @return bool
*/
function Connect(&$link, &$account, &$log)
{
$setings =& Settings::CreateInstance();
if ($account->MailProtocol == MAILPROTOCOL_WMSERVER) {
} else {
$outHost = strlen($account->MailOutHost) > 0 ? $account->MailOutHost : $account->MailIncHost;
$errno = $errstr = null;
$log->WriteLine('[Connecting to server ' . $outHost . ' on port ' . $account->MailOutPort . ']');
$isSsl = strlen($outHost) > 6 && strtolower(substr($outHost, 0, 6)) == 'ssl://';
if (function_exists('openssl_open') && ($isSsl || $account->MailOutPort == 465)) {
if (!$isSsl) {
$outHost = 'ssl://' . $outHost;
}
} else {
if ($isSsl) {
$outHost = substr($outHost, 6);
}
}
$link = @fsockopen($outHost, $account->MailOutPort, $errno, $errstr, 10);
if (!$link) {
setGlobalError('SMTP Error: ' . $errstr);
$log->WriteLine(getGlobalError());
return false;
} else {
@socket_set_timeout($link, 10);
return CSmtp::IsSuccess($link, $log);
}
}
}
示例3: CalendarUser
function CalendarUser()
{
$wm_settings =& Settings::CreateInstance();
if (!$wm_settings || !$wm_settings->isLoad) {
return false;
}
$this->_settings = new CalSettings($wm_settings);
}
示例4: CommandCreator
/**
* Class Constructor
*
* @return CommandCreator
*/
function CommandCreator($escapeType, $settings = null)
{
if (null === $settings) {
$this->_settings =& Settings::CreateInstance();
} else {
$this->_settings =& $settings;
}
$this->_escapeType = $escapeType;
}
示例5: WMSettings
/**
* @access private
* @return WMSettings
*/
function WMSettings($param = true)
{
if (!is_null($param)) {
die('error: WMSettings::CreateInstance()');
}
$this->Settings =& Settings::CreateInstance();
$this->IsLoad = $this->Settings->isLoad;
$this->Host = $this->Settings->WmServerHost;
$this->IsLoad &= $this->_parse($this->Settings->WmServerRootPath);
}
示例6: CLog
/**
* @access private
* @param bool $param[optional] = true
* @return CLog
*/
function CLog($param = true)
{
if (!is_null($param)) {
die(CANT_CALL_CONSTRUCTOR);
}
$settings =& Settings::CreateInstance();
$this->Enabled = $settings->EnableLogging;
$this->LogFilePath = INI_DIR . '/' . LOG_PATH . '/' . LOG_FILENAME;
if ($this->Enabled && !is_dir(INI_DIR . '/' . LOG_PATH)) {
@mkdir(INI_DIR . '/' . LOG_PATH);
}
}
示例7: CreateDatabaseStorage
function CreateDatabaseStorage()
{
$wm_settings =& Settings::CreateInstance();
$settings = new CalSettings($wm_settings);
static $instance;
if (is_object($instance)) {
return $instance;
}
switch ($settings->DbType) {
default:
case DB_MSSQLSERVER:
$instance = MsSqlStorage($settings->DbHost, $settings->DbLogin, $settings->DbPassword);
break;
case DB_MYSQL:
$instance = MySqlStorage($settings->DbHost, $settings->DbLogin, $settings->DbPassword);
break;
}
return $instance;
}
示例8: InitManager
/**
* @return bool
*/
public function InitManager()
{
require_once WM_ROOTPATH . 'common/class_settings.php';
$settings =& Settings::CreateInstance();
try {
$factory = new DbDriverFactory($settings);
$dbDriver = $factory->GetDriver();
$dbPrefix = $settings->DbPrefix;
$escapeType = $factory->GetEscapeType();
} catch (BaseException $e) {
$this->_registerException($e);
return false;
}
if (isset($this->_defaultCommandeCreatorNames[$settings->DbType])) {
require_once $this->_defaultCommandCreatorPath;
$comandCreator = new $this->_defaultCommandeCreatorNames[$settings->DbType]($dbPrefix, $escapeType);
//TODO the following refactoring is needed:
//add possibility to use multiple models simultaneously
$this->_initModel($dbDriver, $comandCreator);
return $this->IsReady();
}
return false;
}
示例9: switch
/**
* @param Account $account
* @return MySqlStorage
*/
function &CreateDatabaseStorage(&$account, $settings = null)
{
/**
* @var DbStorage
*/
static $instance;
if (is_object($instance)) {
if ($account) {
$instance->Account = $account;
}
return $instance;
}
require_once WM_ROOTPATH . 'common/class_dbstorage.php';
if (null === $settings) {
$settings =& Settings::CreateInstance();
}
switch ($settings->DbType) {
case DB_MSSQLSERVER:
$instance = new MsSqlStorage($account, $settings);
break;
default:
case DB_MYSQL:
$instance = new MySqlStorage($account, $settings);
break;
}
if ($account) {
$instance->Account = $account;
}
return $instance;
}
示例10: CLog
function CLog($settings = null)
{
if (null === $settings) {
$settings =& Settings::CreateInstance();
}
$this->Enabled = $settings->EnableLogging;
$this->LoggingSpecialUsers = $settings->LoggingSpecialUsers;
$this->LoggingSpecialUsers = @file_exists(WM_ROOTPATH . '.LOG');
$this->IsLoggingSpecialUsersOn = isset($_SESSION['awm_logging_on']);
$this->EnabledEventsLog = $settings->EnableEventsLogging;
$this->LogLevel = $settings->LogLevel;
$this->_driver = false ? new CLogDataBaseDriver($settings) : new CLogFileDriver($settings);
}
示例11: CreateAccount
/**
* @param Account $account
* @param short $pop3InboxSyncType optional
* @return bool
*/
function CreateAccount(&$account, $inboxSyncType = FOLDERSYNC_NewEntireMessages)
{
$account->IdUser = $this->Id;
$result = false;
setGlobalError(PROC_ERROR_ACCT_CREATE);
$dbStorage =& DbStorageCreator::CreateDatabaseStorage($account);
if ($dbStorage->Connect()) {
$defaultAccount =& $dbStorage->SelectAccountDataByLogin($account->Email, $account->MailIncLogin, true);
if ($account->DefaultAccount && $defaultAccount != null && $defaultAccount[2] == 1) {
setGlobalError(ACCT_CANT_ADD_DEF_ACCT);
return false;
}
$settings =& Settings::CreateInstance();
//Load or create folder tree here
switch ($account->MailProtocol) {
case MAILPROTOCOL_WMSERVER:
if (!$settings->EnableWmServer) {
setGlobalError(PROC_ERROR_ACCT_CREATE);
return false;
}
$emailArray = ConvertUtils::ParseEmail($account->Email);
if (!$emailArray) {
setGlobalError(JS_LANG_WarningCorrectEmail);
return false;
}
$WMConsole = new CWmServerConsole();
if (!$WMConsole->Connect()) {
setGlobalError(PROC_ERROR_ACCT_CREATE . '<br />' . $WMConsole->GetError());
return false;
}
if ($settings->WmAllowManageXMailAccounts) {
if ($WMConsole->DomainExist($emailArray[1])) {
if (!$WMConsole->UserExist($emailArray[1], $account->MailIncLogin)) {
if (!$WMConsole->AddUser($emailArray[1], EmailAddress::GetAccountNameFromEmail($account->MailIncLogin), $account->MailIncPassword)) {
setGlobalError(PROC_ERROR_ACCT_CREATE . '<br />' . $WMConsole->GetError());
return false;
}
}
if (!$WMConsole->ChangeUserMaxMailBoxSize($emailArray[1], EmailAddress::GetAccountNameFromEmail($account->MailIncLogin), $account->MailboxLimit)) {
setGlobalError(PROC_ERROR_ACCT_CREATE . '<br />' . $WMConsole->GetError());
return false;
}
} else {
setGlobalError(DomainDosntExist . '<br />' . $WMConsole->GetError());
return false;
}
}
$result = $dbStorage->InsertAccountData($account);
$folders =& new FolderCollection();
if ($result) {
$inboxFolder =& new Folder($account->Id, -1, FOLDERNAME_Inbox, FOLDERNAME_Inbox);
if ($settings->AllowDirectMode && $settings->DirectModeIsDefault) {
$inboxSyncType = FOLDERSYNC_DirectMode;
}
$inboxFolder->SyncType = $inboxSyncType;
$folders->Add($inboxFolder);
$folders->Add(new Folder($account->Id, -1, FOLDERNAME_SentItems, FOLDERNAME_SentItems, FOLDERSYNC_DontSync));
$folders->Add(new Folder($account->Id, -1, FOLDERNAME_Drafts, FOLDERNAME_Drafts, FOLDERSYNC_DontSync));
$folders->Add(new Folder($account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync));
}
break;
case MAILPROTOCOL_POP3:
$result = $dbStorage->InsertAccountData($account);
$folders =& new FolderCollection();
if ($result) {
$inboxFolder =& new Folder($account->Id, -1, FOLDERNAME_Inbox, FOLDERNAME_Inbox);
if ($settings->AllowDirectMode && $settings->DirectModeIsDefault) {
$inboxSyncType = FOLDERSYNC_DirectMode;
}
$inboxFolder->SyncType = $inboxSyncType;
$folders->Add($inboxFolder);
$folders->Add(new Folder($account->Id, -1, FOLDERNAME_SentItems, FOLDERNAME_SentItems, FOLDERSYNC_DontSync));
$folders->Add(new Folder($account->Id, -1, FOLDERNAME_Drafts, FOLDERNAME_Drafts, FOLDERSYNC_DontSync));
$folders->Add(new Folder($account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync));
}
break;
case MAILPROTOCOL_IMAP4:
setGlobalError(ACCT_CANT_CREATE_IMAP_ACCT);
$mailStorage =& new ImapStorage($account);
if ($mailStorage->Connect()) {
$result = $dbStorage->InsertAccountData($account);
if (!$result) {
return false;
}
$folders =& $mailStorage->GetFolders();
$folders->SetSyncTypeToAll($inboxSyncType);
if ($folders && $settings->AllowDirectMode && $settings->DirectModeIsDefault) {
$folders->SetSyncTypeToAll(FOLDERSYNC_DirectMode);
}
$result &= $account->Update();
$result &= $folders != null;
$mailStorage->Disconnect();
if (!$result) {
return false;
}
//.........这里部分代码省略.........
示例12: BaseProcessor
/**
* @return BaseProcessor
*/
function BaseProcessor()
{
if (!Session::has(ACCOUNT_ID)) {
$this->SetError(1);
}
$accountId = Session::val(ACCOUNT_ID);
$this->sArray = Session::val(SARRAY, array());
$this->settings =& Settings::CreateInstance();
if (!$this->settings || !$this->settings->isLoad) {
$this->SetError(3);
}
if ($accountId) {
if (Get::has(CHANGE_ACCID)) {
$oldaccount =& Account::LoadFromDb(Session::val(ACCOUNT_ID, -1));
$accountId = Get::val(CHANGE_ACCID);
if (!isset($_SESSION['attachtempdir'])) {
$_SESSION['attachtempdir'] = md5(session_id());
}
$fs =& new FileSystem(INI_DIR . '/temp', $oldaccount->Email, $oldaccount->Id);
$attfolder =& new Folder($oldaccount->Id, -1, $_SESSION['attachtempdir']);
$fs->DeleteDir($attfolder);
unset($fs, $attfolder);
$this->sArray[ACCOUNT_ID] = $accountId;
$this->account =& Account::LoadFromDb($accountId);
if (!$this->account || $this->account->IdUser != $oldaccount->IdUser) {
$this->account = null;
} else {
$_SESSION[ACCOUNT_ID] = $accountId;
unset($_SESSION[SARRAY]);
$this->sArray = array();
}
} else {
$this->sArray[ACCOUNT_ID] = $accountId;
$this->account =& Account::LoadFromDb($accountId);
}
if (!$this->account) {
$this->SetError(2);
}
} else {
$this->SetError(1);
}
if (!isset($this->sArray[ACCOUNT_ID]) || $this->sArray[ACCOUNT_ID] != $accountId) {
$this->sArray[EDIT_ACCOUNT_ID] = $accountId;
}
$this->processor =& new MailProcessor($this->account);
if (!$this->processor->DbStorage || !$this->processor->DbStorage->Connect()) {
$this->SetError(5);
}
$this->db =& $this->processor->DbStorage;
$this->accounts =& $this->GetAccounts();
$skins =& FileSystem::GetSkinsList();
$hasDefSettingsSkin = false;
$normalSkin = false;
foreach ($skins as $skinName) {
if ($skinName == $this->settings->DefaultSkin) {
$hasDefSettingsSkin = true;
}
if ($skinName == $this->account->DefaultSkin) {
$normalSkin = true;
break;
}
}
if (!$normalSkin) {
$this->account->DefaultSkin = $hasDefSettingsSkin ? $this->settings->DefaultSkin : ($this->account->DefaultSkin = $skins[0]);
}
$_SESSION[ATTACH_DIR] = Session::val(ATTACH_DIR, md5(session_id()));
if (isset($this->sArray[SCREEN])) {
$screen = Get::val(SCREEN, $this->sArray[SCREEN]);
$this->sArray[SCREEN] = $screen;
if ($this->account->AllowChangeSettings == false && ($screen == SET_ACCOUNT_PROF || $screen == SET_ACCOUNT_ADDACC)) {
$this->sArray[SCREEN] = SCREEN_MAILBOX;
}
if (!$this->settings->AllowContacts && $screen == SCREEN_CONTACTS) {
$this->sArray[SCREEN] = SCREEN_MAILBOX;
}
} else {
$this->sArray[SCREEN] = Get::val(SCREEN, SCREEN_MAILBOX);
}
if (isset($this->sArray[FOLDER_ID])) {
$this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, $this->sArray[FOLDER_ID]);
} else {
$this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, -1);
}
if (Get::has(FOLDER_ID) || Get::has(SCREEN)) {
if (isset($this->sArray[SEARCH_ARRAY])) {
unset($this->sArray[SEARCH_ARRAY]);
}
}
if (Session::has(GOTOFOLDER)) {
$this->sArray[GOTOFOLDER] = Session::val(GOTOFOLDER, '');
unset($_SESSION[GOTOFOLDER]);
}
if (isset($this->sArray[PAGE])) {
$this->sArray[PAGE] = Get::val(PAGE, $this->sArray[PAGE]);
} else {
$this->sArray[PAGE] = 1;
}
//.........这里部分代码省略.........
示例13: UserLoginByEmail
/**
* @param string $email
* @param string $login
* @param int $startPage
* @param string $password optional
* @return bool
*/
function UserLoginByEmail($email, $login, $startPage = START_PAGE_IS_MAILBOX, $password = null, $toEmail = null, $separated = false)
{
$newAccount = new Account();
$settings =& Settings::CreateInstance();
if (!$settings || !$settings->isLoad) {
$this->SetError(PROC_CANT_GET_SETTINGS);
return false;
}
$url = 'webmail.php?check=1';
switch ($startPage) {
default:
$url .= '&start=' . START_PAGE_IS_MAILBOX;
break;
case START_PAGE_IS_NEW_MESSAGE:
$url .= '&start=' . START_PAGE_IS_NEW_MESSAGE;
if ($toEmail && strlen($toEmail) > 0) {
$url .= '&to=' . $toEmail;
}
break;
case START_PAGE_IS_MAILBOX:
case START_PAGE_IS_SETTINGS:
case START_PAGE_IS_CONTACTS:
$url .= '&start=' . $startPage;
break;
case START_PAGE_IS_CALENDAR:
if ($separated) {
$url = 'calendar.php';
} else {
$url .= '&start=' . $startPage;
}
break;
}
$loginArray =& Account::LoadFromDbByLogin($email, $login);
if ($loginArray != null) {
if ($loginArray[2] == '1') {
if ($password === null) {
$this->SetLoginInfo($loginArray[0], $loginArray[3], null, $separated);
$this->ChangeLocation($url);
return true;
} else {
if ($password == ConvertUtils::DecodePassword($loginArray[1], $newAccount)) {
$this->SetLoginInfo($loginArray[0], $loginArray[3], null, $separated);
$this->ChangeLocation($url);
return true;
} else {
$account =& Account::LoadFromDb($loginArray[0]);
$account->MailIncPassword = $password;
$newprocessor = new MailProcessor($account);
if ($newprocessor->MailStorage->Connect(true)) {
if ($account->Update()) {
$this->SetLoginInfo($account->Id, $account->IdUser, $account->DefaultLanguage, $separated);
$this->ChangeLocation($url);
return true;
} else {
$this->SetError(getGlobalError());
}
} else {
$this->SetError(PROC_WRONG_ACCT_PWD);
}
}
}
} else {
$this->SetError(PROC_CANT_LOG_NONDEF);
}
} else {
$this->SetError(ErrorPOP3IMAP4Auth);
}
return false;
}
示例14: DeleteMessages
/**
* @param Array $messageIdUidSet
* @param Folder $folder optional
* @return bool
*/
function DeleteMessages(&$messageIdUidSet, &$folder, $noMove = false)
{
ConvertUtils::SetLimits();
$messageIdSet = array_keys($messageIdUidSet);
$messageUidSet = array_values($messageIdUidSet);
$settings =& Settings::CreateInstance();
$result = true;
switch ($this->_account->MailProtocol) {
default:
return false;
case MAILPROTOCOL_POP3:
if ($folder->Type == FOLDERTYPE_Trash || $noMove) {
if ($folder->SyncType != FOLDERSYNC_DirectMode) {
if ($this->DbStorage->Connect()) {
$result &= $this->DbStorage->DeleteMessages($messageIdSet, false, $folder);
$result &= $this->DbStorage->UpdateMailboxSize();
}
}
if ($this->_account->MailMode == MAILMODE_DeleteMessageWhenItsRemovedFromTrash || $this->_account->MailMode == MAILMODE_KeepMessagesOnServerAndDeleteMessageWhenItsRemovedFromTrash) {
$result &= $this->MailStorage->Connect() && $this->MailStorage->DeleteMessages($messageUidSet, true, $folder);
}
return $result;
} else {
if ($folder->SyncType == FOLDERSYNC_DirectMode) {
return $result && $this->MailStorage->Connect() && $this->MailStorage->DeleteMessages($messageUidSet, true, $folder);
}
}
$folderList =& $this->GetFolders();
$trashFolder =& $folderList->GetFolderByType(FOLDERTYPE_Trash);
return $noMove ? true : $this->MoveMessages($messageIdUidSet, $folder, $trashFolder);
case MAILPROTOCOL_WMSERVER:
if ($folder->Type == FOLDERTYPE_Trash || $folder->Type == FOLDERTYPE_Spam || $noMove) {
if ($folder->SyncType != FOLDERSYNC_DirectMode) {
if ($this->DbStorage->Connect()) {
$result &= $this->DbStorage->DeleteMessages($messageIdSet, false, $folder);
$result &= $this->DbStorage->UpdateMailboxSize();
}
}
return $result && $this->MailStorage->Connect() && $this->MailStorage->DeleteMessages($messageUidSet, true, $folder);
} else {
if ($folder->SyncType == FOLDERSYNC_DirectMode) {
return $result && $this->MailStorage->Connect() && $this->MailStorage->DeleteMessages($messageUidSet, true, $folder);
}
}
$folderList =& $this->GetFolders();
$trashFolder =& $folderList->GetFolderByType(FOLDERTYPE_Trash);
if (!$trashFolder) {
$trashFolder = new Folder($this->_account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_AllHeadersOnly);
if (!$this->CreateFolder($trashFolder)) {
return false;
}
}
return $noMove ? true : $this->MoveMessages($messageIdUidSet, $folder, $trashFolder);
case MAILPROTOCOL_IMAP4:
//if ($settings->Imap4DeleteLikePop3 && $folder->SyncType != FOLDERSYNC_DirectMode)
if ($settings->Imap4DeleteLikePop3) {
$trashFolder = null;
$folderList =& $this->GetFolders();
if ($folderList) {
$trashFolderType =& $folderList->GetFolderByType(FOLDERTYPE_Trash);
if (!$trashFolderType) {
$trashFolderName =& $folderList->GetFolderByName(FOLDERNAME_Trash);
if ($trashFolderName) {
$trashFolderName->Type = FOLDERTYPE_Trash;
$trashFolder = $trashFolderName;
if (USE_DB && $this->DbStorage->Connect()) {
$result &= $this->DbStorage->UpdateFolder($trashFolderName);
}
} else {
$inboxFolderType =& $folderList->GetFolderByType(FOLDERTYPE_Inbox);
if ($inboxFolderType && $inboxFolderType->SubFolders && $inboxFolderType->SubFolders->Count() > 0) {
$trashFolderName2 =& $inboxFolderType->SubFolders->GetFolderByName(FOLDERNAME_Trash);
if ($trashFolderName2) {
$trashFolderName2->Type = FOLDERTYPE_Trash;
$trashFolder = $trashFolderName2;
if (USE_DB && $this->DbStorage->Connect()) {
$result &= $this->DbStorage->UpdateFolder($trashFolderName2);
}
}
}
if (!$trashFolder) {
$trashFolder = new Folder($this->_account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync);
/*
$trashFolder = new Folder($this->_account->Id, -1,
FOLDERNAME_Trash, FOLDERNAME_Trash, $this->_account->GetDefaultFolderSync($settings));
*/
if (!$this->CreateFolder($trashFolder)) {
$trashFolder = null;
}
}
}
} else {
$trashFolder = $trashFolderType;
}
if ($trashFolder) {
//.........这里部分代码省略.........
示例15: UserLoginByEmail
/**
* @param string $email
* @param string $login
* @param int $startPage
* @param string $password optional
* @return bool
*/
function UserLoginByEmail($email, $login, $startPage = START_PAGE_IS_MAILBOX, $password = null, $toEmail = null)
{
$newAccount = new Account();
$settings =& Settings::CreateInstance();
if (!$settings || !$settings->isLoad) {
$this->SetError(PROC_CANT_GET_SETTINGS);
return false;
}
$getTemp = '';
switch ($startPage) {
default:
$getTemp = '&start=' . START_PAGE_IS_MAILBOX;
break;
case START_PAGE_IS_NEW_MESSAGE:
if ($toEmail && strlen($toEmail) > 0) {
$getTemp = '&start=' . START_PAGE_IS_NEW_MESSAGE . '&to=' . $toEmail;
} else {
$getTemp = '&start=' . START_PAGE_IS_NEW_MESSAGE;
}
break;
case START_PAGE_IS_MAILBOX:
case START_PAGE_IS_SETTINGS:
case START_PAGE_IS_CONTACTS:
case START_PAGE_IS_CALENDAR:
$getTemp = '&start=' . $startPage;
break;
}
$loginArray =& Account::LoadFromDbByLogin($email, $login);
if ($loginArray != null) {
if ($loginArray[2] == '1') {
if ($password == null) {
$_SESSION[ACCOUNT_ID] = $loginArray[0];
$_SESSION[USER_ID] = $loginArray[3];
$this->ChangeLocation($settings, $getTemp);
return true;
} else {
if ($password == ConvertUtils::DecodePassword($loginArray[1], $newAccount)) {
$_SESSION[ACCOUNT_ID] = $loginArray[0];
$_SESSION[USER_ID] = $loginArray[3];
$this->ChangeLocation($settings, $getTemp);
return true;
} else {
$account =& Account::LoadFromDb($loginArray[0]);
$account->MailIncPassword = $password;
$newprocessor =& new MailProcessor($account);
if ($newprocessor->MailStorage->Connect()) {
$_SESSION['id_account'] = $loginArray[0];
$_SESSION[SESSION_LANG] = $account->DefaultLanguage;
if ($account->Update()) {
$this->ChangeLocation($settings, $getTemp);
return true;
} else {
$this->SetError(getGlobalError());
return false;
}
} else {
$this->SetError(PROC_WRONG_ACCT_PWD);
return false;
}
}
}
} else {
$this->SetError(PROC_CANT_LOG_NONDEF);
return false;
}
}
if ($this->_errorMessage == '') {
$this->SetError();
}
return false;
}