/** * @param Settings $settings * @param Account $account * @param WebMailMessage $message * @param string $from * @param string $to * @return bool */ function SendMail(&$settings, &$account, &$message, $from, $to) { if ($account->IsDemo) { $allRcpt = $message->GetAllRecipients(); for ($i = 0, $c = $allRcpt->Count(); $i < $c; $i++) { $rcpt =& $allRcpt->Get($i); if (strtolower($rcpt->GetDomain()) != 'afterlogic.com') { setGlobalError('For security reasons, sending e-mail from this account to external addresses is disabled. Please send to livedemo@afterlogic.com or relogin in Advanced Login mode using your mail account on another mail server.'); return false; } } } $log =& CLog::CreateInstance(); if ($from === null) { $fromAddr = $message->GetFrom(); $from = $fromAddr->Email; } if ($to === null) { $to = $message->GetAllRecipientsEmailsAsString(); } $link = null; $result = CSmtp::Connect($link, $account, $log); if ($result) { $result = CSmtp::Send($link, $account, $message, $from, $to, $log); if ($result) { $result = CSmtp::Disconnect($link, $log); } } else { setGlobalError(ErrorSMTPConnect); } return $result; }
/** * @param Account $oAccount * @return CSieveStorage */ public function __construct(Account $oAccount) { $this->_oLog =& CLog::CreateInstance(); $this->_sLogin = $oAccount->MailIncLogin; $this->_sPassword = $oAccount->MailIncPassword; $this->_oSieve = null; }
/** * @param string $customConnectionString * @return DbOdbc */ function DbOdbc($customConnectionString, $dbType, $user = '', $pass = '') { $this->_dbCustomConnectionString = $customConnectionString; $this->_dbType = $dbType; $this->_user = $user; $this->_pass = $pass; $this->_log =& CLog::CreateInstance(); }
/** * @param string $host * @param string $user * @param string $password * @param string $dbName * @return DbMySql */ function DbMySql($host, $user, $password, $dbName) { $this->_host = $host; $this->_user = $user; $this->_password = $password; $this->_dbName = $dbName; $this->_log =& CLog::CreateInstance(); }
/** * @access public * @param Account $account * @return XmailStorage */ function WMserverStorage(&$account) { MailServerStorage::MailServerStorage($account); $email = $account->Email; $basePath = $this->_settings->WmServerRootPath; $this->_wmserver = new WMserverFS($basePath, $email); $this->_wmadmin = new CWmServerConsole(); $this->_log =& CLog::CreateInstance(); }
/** * @access public * @param string $basePath * @param string $email * @return WMserverFS */ function WMserverFS($basePath, $email) { $parsedEmail = ConvertUtils::ParseEmail($email); $this->userName = trim($parsedEmail[0]); $this->domain = trim($parsedEmail[1]); $this->basePath = rtrim($basePath, '/\\'); $this->path = $this->basePath . '/domains/' . $this->domain . '/' . $this->userName . '/Maildir/'; $this->_log =& CLog::CreateInstance(); }
public function __construct() { $this->account = null; $this->userId = null; $this->responseStatus = X_WMP_RESPONSE_STATUS_OK; $this->response = ''; $this->log = null; $this->log =& CLog::CreateInstance(); }
function execute($query) { $log =& CLog::CreateInstance(); $log->WriteLine('calendar MYSQL: ' . $query); $res = mysql_query($query); if ($res === false) { die(mysql_error()); } return $res; }
function execute($query) { $log =& CLog::CreateInstance(); $log->WriteLine('calendar MSSQL: ' . $query); $res = mssql_query($query); if ($res === false) { die(mssql_get_last_message()); } return $res; }
/** * @param Account $account * @return MailStorage */ function MailStorage(&$account, $settings = null) { if (null === $settings) { $this->_settings =& Settings::CreateInstance(); } else { $this->_settings =& $settings; } $this->_log =& CLog::CreateInstance($this->_settings); $this->Account =& $account; }
/** * @access public * @param string $host[optional] = null * @return CWmServerConsole */ function CWmServerConsole($host = null) { $this->Settings =& WMSettings::CreateInstance(); $this->_admHost = $host !== null ? $host : $this->Settings->Settings->WmServerHost; $this->_admPort = $this->Settings->AdminPort; $this->_admLogin = $this->Settings->AdminLogin; $this->_admPassword = $this->Settings->AdminPassword; $this->_log =& CLog::CreateInstance(); if (!$this->Settings->IsLoad) { $this->_setError(str_replace('\\', '/', getGlobalError())); } }
function IMAPMAIL() { $this->host = null; $this->port = 143; $this->user = ''; $this->password = ''; $this->state = 'DISCONNECTED'; $this->connection = null; $this->error = ''; $this->must_update = false; $this->tag = uniqid('HKC'); $this->_log =& CLog::CreateInstance(); }
private function _importIcal() { $icsText = implode('', file('php://input')); if (class_exists('CLog')) { $log =& CLog::CreateInstance(); $log->WriteLine('Sync: Import Calendar[Body] / LENGTH = ' . strlen($icsText)); $log->WriteLine('Sync: Import Calendar[Body] / RAW = ' . "\r\n" . $icsText); } $tmpfname = tempnam('/tmp', ''); file_put_contents($tmpfname, $icsText); $result = $this->manager->ImportIcs($tmpfname); unlink($tmpfname); $this->responseStatus = $result ? X_WMP_RESPONSE_STATUS_OK : X_WMP_RESPONSE_STATUS_ERROR_DB_FAULT; $this->response = $result; }
private static function ExecCmd($file, $cmd, $functionName) { $log =& CLog::CreateInstance(); $log->WriteLine('Exim: ' . $functionName . ' / exec(\'' . $file . ' ' . $cmd . '\');'); if (@file_exists($file)) { $output = array(); @exec($file . ' ' . $cmd, $output); if (is_array($output) && count($output) > 0) { $log->WriteLine('Exim: ' . $functionName . ' / $output = ' . print_r($output, true)); } } else { $log->WriteLine('Exim [error]: ' . $file . ' not exist!'); return false; } return true; }
function IMAPMAIL() { $this->host = null; $this->port = 143; $this->user = ''; $this->password = ''; $this->state = 'DISCONNECTED'; $this->lastSelect = ''; $this->proxyuser = null; $this->error = ''; $this->must_update = false; $this->UpdateTag(); $this->_oLog =& CLog::CreateInstance(); if ($this->_oLog && $this->_oLog->Enabled) { $this->_bLogEnable = true; } }
/** * @access public * @param string $basePath * @param string $email * @return WMserverFS */ function WMserverFS($basePath, $email) { $parsedEmail = ConvertUtils::ParseEmail($email); $this->userName = trim($parsedEmail[0]); $this->domain = trim($parsedEmail[1]); $this->basePath = rtrim($basePath, '/\\'); if (is_dir($this->basePath . '/domains/' . $this->domain . '/' . $this->userName . '/mailbox/')) { $this->path = $this->basePath . '/domains/' . $this->domain . '/' . $this->userName . '/mailbox/'; $this->isUnix = false; } else { $this->path = $this->basePath . '/domains/' . $this->domain . '/' . $this->userName . '/Maildir/'; $this->pathnew = $this->path . 'new/'; $this->pathcur = $this->path . 'cur/'; $this->isUnix = true; } $this->_log =& CLog::CreateInstance(); }
/** * @param Account $account * @param WebMailMessage $message * @param string $from * @param string $to * @return bool */ function SendMail(&$account, &$message, $from, $to) { $link = null; $log =& CLog::CreateInstance(); $result = CSmtp::Connect($link, $account, $log); if ($result) { if ($from == null) { $fromAddr = $message->GetFrom(); $from = $fromAddr->Email; } if ($to == null) { $to = $message->GetAllRecipientsEmailsAsString(); } $result = CSmtp::Send($link, $account, $message, $from, $to, $log); if ($result) { $result = CSmtp::Disconnect($link, $log); } } else { setGlobalError(ErrorSMTPConnect); } return $result; }
protected function _ProcessParsedContact($IdUser, ContactContainerWithSingleGroup $contactContainer) { $ll =& CLog::CreateInstance(); $contactContainer->SetValue('IdUser', $IdUser, 'int'); $contactStrId = $contactContainer->GetValue('StrId'); $groupStrId = $contactContainer->GetValue('GroupStrId'); $groupName = $contactContainer->GetValue('GroupName'); $contact = new ContactContainer($contactContainer); $contact->SetValue('IdUser', $IdUser, 'int'); $ContactId = $this->_GetContactIdByStrId($IdUser, $contactStrId); if (0 < $ContactId) { $contact->SetValue('IdAddress', $ContactId, 'int'); } if (!empty($groupName)) { $groupContainer = $this->_GetGroupByStrId($IdUser, $groupStrId); if ($groupContainer) { $groupId = $groupContainer->GetValue('GroupId'); $groupContainer->MassSetValue($contactContainer->GetContainer()); $groupContainer->SetValue('GroupId', $groupId, 'int'); $groupContainer->SetValue('IdUser', $IdUser, 'int'); $this->_UpdateGroup($groupContainer); } else { $groupContainer = new GroupContainer($contactContainer); $groupContainer->SetValue('IdUser', $IdUser, 'int'); $this->_CreateGroup($groupContainer); } $contact->SetValue('Groups', array($groupContainer)); } if (0 < $contact->GetValue('IdAddress', 'int')) { $this->_UpdateVCardContact($contact); } else { $this->_CreateContact($contact); } }
@ob_start(); header('Content-type: text/javascript; charset=utf-8'); header('Pragma: cache'); header('Cache-control: public'); header('Expires: ' . gmdate("r", time() + 31536000)); if (!defined('WM_ROOTPATH')) { define('WM_ROOTPATH', dirname(__FILE__) . '/'); } require_once WM_ROOTPATH . 'class_settings.php'; require_once WM_ROOTPATH . 'common/inc_constants.php'; $lang = isset($_GET['lang']) ? $_GET['lang'] : ''; $settings =& Settings::CreateInstance(); if (!$settings || !$settings->isLoad || !$settings->IncludeLang($lang)) { require_once WM_ROOTPATH . 'common/class_log.php'; $log =& CLog::CreateInstance(); $log->WriteLine('::: JS Lang file Error :::'); exit; } /** * @param string $str * @return string */ function quot($str) { return str_replace('\'', '\\\'', str_replace('\\', '\\\\', $str)); } ?> Lang = { TitleLogin: '<?php echo quot(JS_LANG_TitleLogin);
/** * @access public * @param bool $apop_detect[optional] = false * @return CPOP3 */ function CPOP3($apop_detect = false) { $this->apop_detect = $apop_detect; $this->_log =& CLog::CreateInstance(); }
/** * @access private * @param InputDataBase $inputDataObject * @param DbGeneralSql $dbDriverObject */ function BaseController($inputDataObject = null, $dbDriverObject = null) { $this->setInputData($inputDataObject); $this->setDataBaseDriver($dbDriverObject); $this->_logger =& CLog::CreateInstance(); }
/** * @param XmlDocument $_xmlObj */ function PrintXML(&$_xmlObj, $_startTime = null) { global $BackgroundXmlParam; if ($_xmlObj) { if (isset($_SESSION[ISINFOERROR], $_SESSION[INFORMATION]) && $_SESSION[ISINFOERROR]) { $_xmlNode = new XmlDomNode('error', $_SESSION[INFORMATION], true); $_xmlObj->XmlRoot->AppendChild($_xmlNode); unset($_SESSION[ISINFOERROR], $_SESSION[INFORMATION]); } if ($BackgroundXmlParam === 1) { $_xmlObj->XmlRoot->AppendAttribute('background', 1); } echo $_xmlObj->ToString(); if (null !== $_startTime) { $_log =& CLog::CreateInstance(); $_log->WriteLine('XML Time: ' . (getmicrotime() - $_startTime)); } exit; } exit; }
/** * @param string $messageIndex * @param bool $indexAsUid * @return WebMailMessage */ function &LoadMessage($messageIndex, $indexAsUid) { $message = null; $idx = $messageIndex; $uid = $messageIndex; if ($indexAsUid) { $uids =& $this->_getPop3Uids(); $idx = $this->_getMessageIndexFromUid($uids, $messageIndex); if ($idx != -1) { $uid = $uids[$idx]; } } if ($idx < 0) { setGlobalError(PROC_MSG_HAS_DELETED); return $message; } $log =& CLog::CreateInstance(); $msgText = $this->_pop3Mail->get_mail($idx); if (!$msgText) { return $message; } $message = new WebMailMessage(); $message->LoadMessageFromRawBody($msgText, true); $message->Uid = $uid; $message->Size = strlen($msgText); /* $size = &$this->_getPop3Sizes(); $message->Size = $size[$idx]; */ return $message; }
/** * @param string $newAccountName * @return bool */ function MoveFolders($newAccountName) { $log =& CLog::CreateInstance(); $oldFolderPath = rtrim($this->_createFolderFullPath(''), '/'); if (!is_dir($oldFolderPath)) { return true; } $fs =& new FileSystem($this->RootFolder, $newAccountName, $this->_accountId); $newFolderPath = rtrim($fs->_createFolderFullPath(''), '/'); $rootFolder = substr($newFolderPath, 0, strrpos($newFolderPath, '/')); if (!is_dir($rootFolder)) { $this->_createRecursiveFolderPath($rootFolder); } if (!@rename($oldFolderPath, $newFolderPath)) { $log->WriteLine('Error Move Folder: ' . $oldFolderPath . ' => ' . $newFolderPath); return false; } return true; }
/** * @param Array $messageIndexSet * @param bool $indexAsUid * @param Folder $folder * @return WebMailMessageCollection */ function LoadMessages(&$messageIndexSet, $indexAsUid, &$folder, $imapUids = null, $imapUidFlags = null, $imapUidSizes = null) { $messageCollection = null; if ($this->_imapMail->examine_mailbox($folder->FullName)) { $_imapUids = array(); $_imapUidFlags = array(); $_imapUidSizes = array(); if ($imapUids == null) { //Get uid, flags and size from imap Server $paramsMessages = $this->_imapMail->getParamsMessages(); if (!is_array($paramsMessages)) { return $messageCollection; } foreach ($paramsMessages as $key => $value) { $_imapUids[$key] = $value["uid"]; $_imapUidFlags[$value["uid"]] = $value["flag"]; $_imapUidSizes[$value["uid"]] = $value["size"]; } } $messageCollection =& new WebMailMessageCollection(); foreach ($messageIndexSet as $idx) { if ($this->DownloadedMessagesHandler != null) { ShowDownloadedMessageNumber(); } $response = $this->_imapMail->get_message($idx, $indexAsUid); if ($response) { $log =& CLog::CreateInstance(); $log->WriteLine('::::MSG:::: ' . $response); $msg =& new WebMailMessage(); $msg->LoadMessageFromRawBody($response, true); if ($indexAsUid) { $msg->Uid = $idx; } else { if ($imapUids == null) { $imapUids = $_imapUids; } $msg->Uid = $imapUids[$idx]; } if ($imapUidSizes == null) { $imapUidSizes = $_imapUidSizes; } $msg->Size = $imapUidSizes[$msg->Uid]; if ($imapUidFlags == null) { $imapUidFlags = $_imapUidSizes; } $this->_setMessageFlags($msg, $imapUidFlags[$idx]); $messageCollection->Add($msg); } } if ($messageCollection->Count() > 0) { return $messageCollection; } } return $messageCollection; }
if (count($langs) > 0) { $_langDiv .= ' <span class="wm_language_place"> <a id="langs_selected" href="#" class="wm_reg" onclick="return false;" style="padding-right: 0px;"><span>' . GetNameByLang(defaultLanguage) . '</span><font> </font><span class="wm_login_lang_switcher"> </span></a> <input type="hidden" value="' . (isset($_GET['lang']) ? defaultLanguage : '') . '" id="language" name="language"> <br /> <div id="langs_collection">'; foreach ($langs as $langName) { $_langDiv .= '<a href="#" name="lng_' . ConvertUtils::AttributeQuote($langName) . '" onclick="ChangeLang(this); return false;">' . GetNameByLang($langName) . '</a>'; } $_langDiv .= ' </div> </span>'; } } $_log =& CLog::CreateInstance($settings); $_rtl = in_array(defaultLanguage, explode('|', RTL_ARRAY)); $_style = $_rtl ? '<link rel="stylesheet" href="skins/' . ConvertUtils::AttributeQuote($settings->DefaultSkin) . '/styles-rtl.css" type="text/css">' : ''; $_js_rtl = $_rtl ? 'var RTL = true;' : ''; $_isGdSupport = @function_exists('imagecreatefrompng'); define('JS_VERS', ConvertUtils::GetJsVersion()); if (!$isconfig) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Pragma" content="cache" /> <meta http-equiv="Cache-Control" content="public" /> <link rel="shortcut icon" href="favicon.ico" />
/** * @param int $id * @return bool */ function AccountAccess($id) { if ($id == $_SESSION[ACCOUNT_ID]) { return true; } $result = false; if (isset($_SESSION[ACCOUNT_IDS]) && is_array($_SESSION[ACCOUNT_IDS])) { $result = in_array($id, $_SESSION[ACCOUNT_IDS]); } else { if (isset($_SESSION[ACCOUNT_ID])) { $_account = null; if (!isset($_SESSION[USER_ID])) { $_account =& Account::LoadFromDb($_SESSION[ACCOUNT_ID], false, false); if ($_account) { $_SESSION[USER_ID] = $_account->IdUser; } } if (isset($_SESSION[USER_ID])) { $_dbStorage =& DbStorageCreator::CreateDatabaseStorage($_account); if ($_dbStorage->Connect()) { $_SESSION[ACCOUNT_IDS] = $_dbStorage->GetAccountListByUserId($_SESSION[USER_ID]); $result = in_array($id, $_SESSION[ACCOUNT_IDS]); } } } } if (!$result) { $_log =& CLog::CreateInstance(); $_log->WriteLine('Access Error: Unauthorized access ' . $id . ' && ' . $_SESSION[ACCOUNT_ID], LOG_LEVEL_WARNING); } return $result; }
/** * @param Settings $_settings * @param MySqlStorage $_dbStorage * @param CWebMailLoginInfo $loginInfo * @param Account $refAccount * @param string $errorString */ function Init(&$_settings, &$_dbStorage, &$loginInfo, &$refAccount, &$errorString) { $accountCustomValues = array(); $_log =& CLog::CreateInstance(); $_isNoLoginField = false; $_sendSettingsList = false; /* custom class */ wm_Custom::StaticUseMethod('ChangeLoginInfoBeforeInit', array(&$loginInfo)); $_infoEmail = trim($loginInfo->getEmail()); $_infoLogin = trim($loginInfo->getLogin()); $_infoPassword = $loginInfo->getPassword(); $_infoAdvancedLogin = $loginInfo->getAdvancedLogin(); $_infoLang = trim($loginInfo->getLanguage()); $_domain = $loginInfo->getDomainsSelectValue(); $_email = $_login = $_optLogin = ''; if ($_infoAdvancedLogin && $_settings->AllowAdvancedLogin) { $_email = $_infoEmail; $_login = $_infoLogin; } else { switch ($_settings->HideLoginMode) { case 0: $_email = $_infoEmail; $_login = $_infoLogin; break; case 10: $_email = $_infoEmail; $_isNoLoginField = true; $_emailAddress = new EmailAddress(); $_emailAddress->SetAsString($_email); $_optLogin = $_emailAddress->GetAccountName(); break; case 11: $_email = $_infoEmail; $_isNoLoginField = true; $_optLogin = $_email; break; case 20: case 21: $_login = $_infoLogin; $loginArray = ConvertUtils::ParseEmail($_login); if (20 == $_settings->HideLoginMode) { if (is_array($loginArray) && 2 === count($loginArray)) { $_email = $_login; } else { $_email = $_login . '@'; $_email .= $_domain && $_settings->UseMultipleDomainsSelection ? $_domain : $_settings->DefaultDomainOptional; } } else { $_email = is_array($loginArray) && 2 === count($loginArray) ? $loginArray[0] . '@' : $_login . '@'; $_email .= $_domain && $_settings->UseMultipleDomainsSelection ? $_domain : $_settings->DefaultDomainOptional; } break; case 22: case 23: $loginArray = ConvertUtils::ParseEmail($_infoLogin); $_login = is_array($loginArray) && isset($loginArray[0]) ? $loginArray[0] . '@' : $_infoLogin . '@'; $_login .= $_domain && $_settings->UseMultipleDomainsSelection ? $_domain : $_settings->DefaultDomainOptional; $_email = $_login; } } /* custom class */ wm_Custom::StaticUseMethod('ChangeLoginDuringInit', array(&$_login, &$_email)); $bReturn = true; wm_Custom::StaticUseMethod('LdapCustomLoginFunction', array(&$_login, &$_email, &$_infoPassword, &$accountCustomValues, &$errorString, &$bReturn)); if (!$bReturn) { return false; } $_loginArray = null; if (USE_DB) { if ($_isNoLoginField) { $_loginArray =& Account::LoadFromDbOnlyByEmail($_email); if (is_array($_loginArray) && count($_loginArray) > 3) { $_eAccount =& Account::LoadFromDb((int) $_loginArray[0]); if ($_eAccount) { if ($_loginArray[5]) { $errorString = 'Your account is inactive, please contact the system administrator on this.'; return false; } $_login = ConvertUtils::DecodePassword($_loginArray[1], $_eAccount) == $_infoPassword ? $_loginArray[4] : $_optLogin; } else { $_login = $_optLogin; } } else { $_login = $_optLogin; } /* custom class */ wm_Custom::StaticUseMethod('ChangeLoginInfoAfterInit', array(&$_login, &$_email)); } else { /* custom class */ wm_Custom::StaticUseMethod('ChangeLoginInfoAfterInit', array(&$_login, &$_email)); $_loginArray =& Account::LoadFromDbByLogin($_email, $_login); if ($_loginArray[4]) { $errorString = 'Your account is inactive, please contact the system administrator on this.'; return false; } } } if (!$_dbStorage || !$_dbStorage->Connect()) { $_sendSettingsList = false; $errorString = getGlobalError(); return false; } if ($_loginArray === false) { $errorString = getGlobalError(); return false; } else { if ($_loginArray === null) { if ($_settings->AllowNewUsersRegister) { if (!NumOLCallBackFunction($_settings, $_dbStorage, $errorString)) { return false; } $_account = new Account(); $_account->DefaultAccount = true; $_account->Email = $_email; $_account->MailIncLogin = $_login; $_account->MailIncPassword = $_infoPassword; if (strlen($_infoLang) > 0) { $_account->DefaultLanguage = $_infoLang; } $_account->CustomValues = $accountCustomValues; if ($_infoAdvancedLogin && $_settings->AllowAdvancedLogin) { $_account->MailProtocol = $loginInfo->getMailProtocol(); $_account->MailIncPort = $loginInfo->getMailIncPort(); $_account->MailOutPort = $loginInfo->getMailOutPort(); $_account->MailOutAuthentication = $loginInfo->getMailOutAuth(); $_account->MailIncHost = $loginInfo->getMailIncHost(); $_account->MailOutHost = $loginInfo->getMailOutHost(); } else { $_account->MailProtocol = (int) $_settings->IncomingMailProtocol; $_account->MailIncPort = (int) $_settings->IncomingMailPort; $_account->MailOutPort = (int) $_settings->OutgoingMailPort; $_account->MailOutAuthentication = (bool) $_settings->ReqSmtpAuth; $_account->MailIncHost = $_settings->IncomingMailServer; $_account->MailOutHost = $_settings->OutgoingMailServer; } if (DEMOACCOUNTALLOW && $_email == DEMOACCOUNTEMAIL) { $_account->MailIncPassword = DEMOACCOUNTPASS; } /* custom class */ wm_Custom::StaticUseMethod('InitLdapSettingsAccountOnLogin', array(&$_account)); if (0 < strlen($_infoLang)) { $_account->DefaultLanguage = $_infoLang; } /* custom class */ wm_Custom::StaticUseMethod('ChangeAccountBeforeCreateOnLogin', array(&$_account)); if (USE_DB) { $_domain =& $_dbStorage->SelectDomainByName(EmailAddress::GetDomainFromEmail($_account->Email)); if (null !== $_domain) { $_domain->UpdateAccount($_account, $_settings); } } $_validate = $_account->ValidateData(); if ($_validate !== true) { $errorString = $_validate; return false; } else { if ($_account->IsInternal) { $errorString = ErrorPOP3IMAP4Auth; $_log->WriteLine('LOGIN Error: IsInternal = true', LOG_LEVEL_WARNING); return false; } $_processor = new MailProcessor($_account); if ($_processor->MailStorage->Connect(true)) { $_user =& User::CreateUser($_account); if ($_user && $_account) { if (!USE_DB) { $_account->Id = 1; } $_account->IdUser = $_user->Id; } $_inboxSyncType = $_account->GetDefaultFolderSync($_settings); if ($_user != null && $_user->CreateAccount($_account, $_inboxSyncType, false, $_processor->MailStorage)) { if ($_settings->EnableMobileSync && function_exists('mcrypt_encrypt')) { // create Funambol user for loginable user require_once WM_ROOTPATH . 'common/class_funambol_sync_users.php'; $fnSyncUsers = new FunambolSyncUsers($_account); $fnSyncUsers->PerformSync(); } $_SESSION[ACCOUNT_ID] = $_account->Id; $_SESSION[USER_ID] = $_account->IdUser; $_SESSION[SESSION_LANG] = $_account->DefaultLanguage; $_sendSettingsList = true; if (!USE_DB) { Account::SaveInSession($_account); } $_log->WriteEvent('User login', $_account); self::AfterLoginAction($_account, $_processor, $_settings); } else { if ($_user) { User::DeleteUserSettings($_user->Id); } $_error = getGlobalError(); $_error = strlen($_error) > 0 ? $_error : CantCreateUser; $errorString = $_error; return false; } } else { $errorString = getGlobalError(); return false; } } } else { $_log->WriteLine('LOGIN Error: AllowNewUsersRegister = false', LOG_LEVEL_WARNING); $errorString = ErrorPOP3IMAP4Auth; return false; } } else { if ($_loginArray[2] == 0) { $errorString = PROC_CANT_LOG_NONDEF; return false; } else { if (USE_DB) { $_newAccount =& Account::LoadFromDb($_loginArray[0]); if (!$_newAccount) { $errorString = getGlobalError(); return false; } else { $_deleted = $_dbStorage->GetAUserDeleted($_newAccount->IdUser); if (false === $_deleted) { $errorString = getGlobalError(); return false; } else { if (1 === $_deleted) { $errorString = ErrorMaximumUsersLicenseIsExceeded; return false; } } $_mailIncPass = $_infoPassword; if (DEMOACCOUNTALLOW && $_email == DEMOACCOUNTEMAIL) { $_mailIncPass = DEMOACCOUNTPASS; } $_useLangUpdate = false; if (strlen($_infoLang) > 0 && $_newAccount->DefaultLanguage != $_infoLang) { $_newAccount->DefaultLanguage = $_infoLang; $_useLangUpdate = true; } $_account = null; $bIsPasswordCorrect = ConvertUtils::DecodePassword($_loginArray[1], $_newAccount) == $_mailIncPass; $_account =& $_newAccount; $_account->MailIncPassword = $_mailIncPass; $_newprocessor = new MailProcessor($_account); if ($_newprocessor->MailStorage->Connect(true)) { if (!$bIsPasswordCorrect && !$_account->Update()) { return ErrorPOP3IMAP4Auth; } $_SESSION[ACCOUNT_ID] = $_account->Id; $_SESSION[USER_ID] = $_account->IdUser; $_SESSION[SESSION_LANG] = $_account->DefaultLanguage; $tempFiles =& CTempFiles::CreateInstance($_account); $tempFiles->ClearAccount(); unset($tempFiles); $_sendSettingsList = true; $_log->WriteEvent('User login', $_account); if ($_account->MailProtocol == MAILPROTOCOL_IMAP4 && $_account->ImapQuota === 1) { $quota = $_newprocessor->GetQuota(); if ($quota !== false && $quota !== $_account->MailboxLimit) { $_account->MailboxLimit = GetGoodBigInt($quota); $_account->UpdateMailBoxLimit(); } } self::AfterLoginAction($_account, $_newprocessor, $_settings); } else { $errorString = ErrorPOP3IMAP4Auth; return false; } } } } } } if ($_sendSettingsList && USE_DB) { if (!$_dbStorage->UpdateLastLoginAndLoginsCount($_account->IdUser)) { $_sendSettingsList = false; $errorString = getGlobalError(); return false; } } if (isset($_account)) { $refAccount = $_account; } return true; }
/** * @param array $filesArray * @param string[optional] $subfolder * @return bool */ function DeleteTempFilesByArray($filesArray, $subfolder = '') { $log =& CLog::CreateInstance(); if (!is_array($filesArray) || count($filesArray) < 1) { return true; } $path = $this->_createFolderFullPath($subfolder); if (@is_dir($path)) { $dh = @opendir($path); if ($dh) { while (($file = @readdir($dh)) !== false) { if ($file != '.' && $file != '..') { if (@is_dir($path . '/' . $file)) { $this->DeleteTempFilesByArray($filesArray, $file); } else { if (in_array($file, $filesArray)) { $log->WriteLine('FS: Delete temp - ' . $path . '/' . $file); @unlink($path . '/' . $file); } } } } @closedir($dh); } } return true; }
public function __construct() { $this->log =& CLog::CreateInstance(); parent::__construct(); }