本文整理汇总了PHP中MailSo\Base\Utils类的典型用法代码示例。如果您正苦于以下问题:PHP Utils类的具体用法?PHP Utils怎么用?PHP Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Utils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: clearImplementation
/**
* @return bool
*/
protected function clearImplementation()
{
if (\defined('PHP_SAPI') && 'cli' === PHP_SAPI && \MailSo\Base\Utils::FunctionExistsAndEnabled('system')) {
\system('clear');
}
return true;
}
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:10,代码来源:Inline.php
示例2: UseStartTLS
/**
* @param bool $bSupported
* @param int $iSecurityType
* @param bool $bHasSupportedAuth = true
*
* @return bool
*/
public static function UseStartTLS($bSupported, $iSecurityType, $bHasSupportedAuth = true)
{
return ($bSupported &&
(self::STARTTLS === $iSecurityType ||
(self::AUTO_DETECT === $iSecurityType && (!$bHasSupportedAuth || \MailSo\Config::$PreferStartTlsIfAutoDetect))) &&
\defined('STREAM_CRYPTO_METHOD_TLS_CLIENT') && \MailSo\Base\Utils::FunctionExistsAndEnabled('stream_socket_enable_crypto'));
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:14,代码来源:ConnectionSecurityType.php
示例3: ChangePassword
/**
* @param \RainLoop\Model\Account $oHmailAccount
* @param string $sPrevPassword
* @param string $sNewPassword
*
* @return bool
*/
public function ChangePassword(\RainLoop\Account $oHmailAccount, $sPrevPassword, $sNewPassword)
{
if ($this->oLogger) {
$this->oLogger->Write('Try to change password for ' . $oHmailAccount->Email());
}
$bResult = false;
try {
$oHmailApp = new COM("hMailServer.Application");
$oHmailApp->Connect();
if ($oHmailApp->Authenticate($this->sLogin, $this->sPassword)) {
$sEmail = $oHmailAccount->Email();
$sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail);
$oHmailDomain = $oHmailApp->Domains->ItemByName($sDomain);
if ($oHmailDomain) {
$oHmailAccount = $oHmailDomain->Accounts->ItemByAddress($sEmail);
if ($oHmailAccount) {
$oHmailAccount->Password = $sNewPassword;
$oHmailAccount->Save();
$bResult = true;
} else {
$this->oLogger->Write('HMAILSERVER: Unknown account (' . $sEmail . ')', \MailSo\Log\Enumerations\Type::ERROR);
}
} else {
$this->oLogger->Write('HMAILSERVER: Unknown domain (' . $sDomain . ')', \MailSo\Log\Enumerations\Type::ERROR);
}
} else {
$this->oLogger->Write('HMAILSERVER: Auth error', \MailSo\Log\Enumerations\Type::ERROR);
}
} catch (\Exception $oException) {
if ($this->oLogger) {
$this->oLogger->WriteException($oException);
}
}
return $bResult;
}
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:42,代码来源:HmailserverChangePasswordDriver.php
示例4: ChangePassword
/**
* @param \RainLoop\Account $oAccount
* @param string $sPrevPassword
* @param string $sNewPassword
*/
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword)
{
$mResult = false;
if ($this->oDriver instanceof \RainLoop\Providers\ChangePassword\ChangePasswordInterface && $this->PasswordChangePossibility($oAccount)) {
if ($sPrevPassword !== $oAccount->Password()) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CurrentPasswordIncorrect);
}
$sPasswordForCheck = \trim($sNewPassword);
if (6 > \strlen($sPasswordForCheck)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::NewPasswordShort);
}
if (!\MailSo\Base\Utils::PasswordWeaknessCheck($sPasswordForCheck)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::NewPasswordWeak);
}
if (!$this->oDriver->ChangePassword($oAccount, $sPrevPassword, $sNewPassword)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CouldNotSaveNewPassword);
}
$oAccount->SetPassword($sNewPassword);
$this->oActions->SetAuthToken($oAccount);
$mResult = $this->oActions->GetSpecAuthToken();
} else {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CouldNotSaveNewPassword);
}
return $mResult;
}
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:30,代码来源:ChangePassword.php
示例5: __construct
/**
* @param string $sFileName
* @param string $sFileHeader = ''
*
* @return void
*/
public function __construct($sFileName, $sFileHeader = '')
{
$this->sFile = \APP_PRIVATE_DATA . 'configs/' . $sFileName;
$this->sFileHeader = $sFileHeader;
$this->aData = $this->defaultValues();
$this->bUseApcCache = APP_USE_APC_CACHE && \MailSo\Base\Utils::FunctionExistsAndEnabled(array('apc_fetch', 'apc_store'));
}
开发者ID:sunhaolin,项目名称:rainloop,代码行数:13,代码来源:AbstractConfig.php
示例6: Connect
/**
* @return bool
*/
public function Connect()
{
$sHost = $this->bUseSsl ? 'ssl://' . $this->sHost : $this->sHost;
if ($this->IsConnected()) {
CApi::Log('already connected[' . $sHost . ':' . $this->iPort . ']: result = false', ELogLevel::Error);
$this->Disconnect();
return false;
}
$sErrorStr = '';
$iErrorNo = 0;
CApi::Log('start connect to ' . $sHost . ':' . $this->iPort);
$this->rConnect = @fsockopen($sHost, $this->iPort, $iErrorNo, $sErrorStr, $this->iConnectTimeOut);
if (!$this->IsConnected()) {
CApi::Log('connection error[' . $sHost . ':' . $this->iPort . ']: fsockopen = false (' . $iErrorNo . ': ' . $sErrorStr . ')', ELogLevel::Error);
return false;
} else {
CApi::Log('connected');
}
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('stream_set_timeout')) {
@stream_set_timeout($this->rConnect, $this->iSocketTimeOut);
}
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('@stream_set_blocking')) {
@stream_set_blocking($this->rConnect, true);
}
return true;
}
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:29,代码来源:abstract.php
示例7: GC
/**
* @param int $iTimeToClearInHours = 24
*
* @return bool
*/
public function GC($iTimeToClearInHours = 24)
{
if (0 < $iTimeToClearInHours) {
\MailSo\Base\Utils::RecTimeDirRemove($this->sCacheFolder, 60 * 60 * $iTimeToClearInHours, \time());
return true;
}
return false;
}
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:13,代码来源:File.php
示例8: __construct
/**
* @access protected
*
* @param string $sEmailAddresses = ''
*/
protected function __construct($sEmailAddresses = '')
{
parent::__construct();
$sEmailAddresses = \MailSo\Base\Utils::Trim($sEmailAddresses);
if (0 < \strlen($sEmailAddresses)) {
$this->parseEmailAddresses($sEmailAddresses);
}
}
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:13,代码来源:EmailCollection.php
示例9: FilterSmtpCredentials
/**
* This function detects the SMTP Host, and if it is set to "auto", replaces it with the email domain.
*
* @param \RainLoop\Model\Account $oAccount
* @param array $aSmtpCredentials
*/
public function FilterSmtpCredentials($oAccount, &$aSmtpCredentials)
{
if ($oAccount instanceof \RainLoop\Model\Account && \is_array($aSmtpCredentials)) {
// Check for mail.$DOMAIN as entered value in RL settings
if (!empty($aSmtpCredentials['Host']) && 'auto' === $aSmtpCredentials['Host']) {
$aSmtpCredentials['Host'] = \MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email());
}
}
}
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:15,代码来源:index.php
示例10: CreateStream
/**
* @param array $aSubStreams
*
* @return resource|bool
*/
public static function CreateStream($aSubStreams)
{
if (!\in_array(self::STREAM_NAME, \stream_get_wrappers())) {
\stream_wrapper_register(self::STREAM_NAME, '\\MailSo\\Base\\StreamWrappers\\SubStreams');
}
$sHashName = \MailSo\Base\Utils::Md5Rand();
self::$aStreams[$sHashName] = $aSubStreams;
\MailSo\Base\Loader::IncStatistic('CreateStream/SubStreams');
return \fopen(self::STREAM_NAME . '://' . $sHashName, 'rb');
}
开发者ID:sacredwebsite,项目名称:rainloop-webmail,代码行数:15,代码来源:SubStreams.php
示例11: __construct
/**
* @param string $sFileName
* @param string $sFileHeader = ''
* @param string $sAdditionalFileName = ''
*
* @return void
*/
public function __construct($sFileName, $sFileHeader = '', $sAdditionalFileName = '')
{
$this->sFile = \APP_PRIVATE_DATA . 'configs/' . \trim($sFileName);
$sAdditionalFileName = \trim($sAdditionalFileName);
$this->sAdditionalFile = \APP_PRIVATE_DATA . 'configs/' . $sAdditionalFileName;
$this->sAdditionalFile = 0 < \strlen($sAdditionalFileName) && \file_exists($this->sAdditionalFile) ? $this->sAdditionalFile : '';
$this->sFileHeader = $sFileHeader;
$this->aData = $this->defaultValues();
$this->bUseApcCache = APP_USE_APC_CACHE && \MailSo\Base\Utils::FunctionExistsAndEnabled(array('apc_fetch', 'apc_store'));
}
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:17,代码来源:AbstractConfig.php
示例12: convertGoogleJsonContactToResponseContact
/**
* @param array $oItem
* @param array $aPics
*
* @return array|null
*/
private function convertGoogleJsonContactToResponseContact($oItem, &$aPics)
{
$mResult = null;
if (!empty($oItem['gd$email'][0]['address'])) {
$mEmail = \MailSo\Base\Utils::IdnToAscii($oItem['gd$email'][0]['address'], true);
if (\is_array($oItem['gd$email']) && 1 < \count($oItem['gd$email'])) {
$mEmail = array();
foreach ($oItem['gd$email'] as $oEmail) {
if (!empty($oEmail['address'])) {
$mEmail[] = \MailSo\Base\Utils::IdnToAscii($oEmail['address'], true);
}
}
}
$sImg = '';
if (!empty($oItem['link']) && \is_array($oItem['link'])) {
foreach ($oItem['link'] as $oLink) {
if ($oLink && isset($oLink['type'], $oLink['href'], $oLink['rel']) && 'image/*' === $oLink['type'] && '#photo' === \substr($oLink['rel'], -6)) {
$sImg = $oLink['href'];
break;
}
}
}
$mResult = array('email' => $mEmail, 'name' => !empty($oItem['title']['$t']) ? $oItem['title']['$t'] : '');
if (0 < \strlen($sImg)) {
$sHash = \RainLoop\Utils::EncodeKeyValues(array('url' => $sImg, 'type' => 'google_access_token'));
$mData = array();
if (isset($aPics[$sHash])) {
$mData = $aPics[$sHash];
if (!\is_array($mData)) {
$mData = array($mData);
}
}
if (\is_array($mEmail)) {
$mData = \array_merge($mData, $mEmail);
$mData = \array_unique($mData);
} else {
if (0 < \strlen($mEmail)) {
$mData[] = $mEmail;
}
}
if (\is_array($mData)) {
if (1 === \count($mData) && !empty($mData[0])) {
$aPics[$sHash] = $mData[0];
} else {
if (1 < \count($mData)) {
$aPics[$sHash] = $mData;
}
}
}
}
}
return $mResult;
}
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:59,代码来源:Social.php
示例13: PutFile
/**
* @param \CAccount $oAccount
* @param int $iStorageType
* @param string $sKey
* @param resource $rSource
*
* @return bool
*/
public function PutFile(\CAccount $oAccount, $iStorageType, $sKey, $rSource)
{
$bResult = false;
if ($rSource) {
$rOpenOutput = @fopen($this->generateFileName($oAccount, $iStorageType, $sKey, true), 'w+b');
if ($rOpenOutput) {
$bResult = false !== \MailSo\Base\Utils::MultipleStreamWriter($rSource, array($rOpenOutput));
@fclose($rOpenOutput);
}
}
return $bResult;
}
开发者ID:BertLasker,项目名称:Catch-design,代码行数:20,代码来源:Files.php
示例14: GetDomFromText
/**
* @param string $sText
* @param string $sHtmlAttrs = ''
* @param string $sBodyAttrs = ''
*
* @return \DOMDocument|bool
*/
public static function GetDomFromText($sText, $sHtmlAttrs = '', $sBodyAttrs = '')
{
static $bOnce = true;
if ($bOnce) {
$bOnce = false;
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('libxml_use_internal_errors')) {
@\libxml_use_internal_errors(true);
}
}
$oDom = new \DOMDocument('1.0', 'utf-8');
$oDom->encoding = 'UTF-8';
$oDom->formatOutput = false;
@$oDom->loadHTML('<' . '?xml version="1.0" encoding="utf-8"?' . '>' . '<html ' . $sHtmlAttrs . '><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body ' . $sBodyAttrs . '>' . $sText . '</body></html>');
return $oDom;
}
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:22,代码来源:HtmlUtils.php
示例15: Statistic
/**
* @return array|null
*/
public static function Statistic()
{
$aResult = null;
if (self::$StoreStatistic) {
$aResult = array('php' => array('phpversion' => PHP_VERSION, 'ssl' => (int) \function_exists('openssl_open'), 'iconv' => (int) \function_exists('iconv')));
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('memory_get_usage') && \MailSo\Base\Utils::FunctionExistsAndEnabled('memory_get_peak_usage')) {
$aResult['php']['memory_get_usage'] = Utils::FormatFileSize(\memory_get_usage(true), 2);
$aResult['php']['memory_get_peak_usage'] = Utils::FormatFileSize(\memory_get_peak_usage(true), 2);
}
self::SetStatistic('TimeDelta', \microtime(true) - self::GetStatistic('Inited'));
$aResult['statistic'] = self::$aSetStatistic;
$aResult['counts'] = self::$aIncStatistic;
}
return $aResult;
}
开发者ID:pigi72333,项目名称:MailSo,代码行数:18,代码来源:Loader.php
示例16: GetFetchEnvelopeEmailCollection
/**
* @param int $iIndex
* @param string $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1
*
* @return \MailSo\Mime\EmailCollection|null
*/
public function GetFetchEnvelopeEmailCollection($iIndex, $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1)
{
$oResult = null;
$aEmails = $this->GetFetchEnvelopeValue($iIndex, null);
if (is_array($aEmails) && 0 < count($aEmails)) {
$oResult = \MailSo\Mime\EmailCollection::NewInstance();
foreach ($aEmails as $aEmailItem) {
if (is_array($aEmailItem) && 4 === count($aEmailItem)) {
$sDisplayName = \MailSo\Base\Utils::DecodeHeaderValue(self::findEnvelopeIndex($aEmailItem, 0, ''), $sParentCharset);
$sRemark = \MailSo\Base\Utils::DecodeHeaderValue(self::findEnvelopeIndex($aEmailItem, 1, ''), $sParentCharset);
$sLocalPart = self::findEnvelopeIndex($aEmailItem, 2, '');
$sDomainPart = self::findEnvelopeIndex($aEmailItem, 3, '');
if (0 < strlen($sLocalPart) && 0 < strlen($sDomainPart)) {
$oResult->Add(\MailSo\Mime\Email::NewInstance($sLocalPart . '@' . $sDomainPart, $sDisplayName, $sRemark));
}
}
}
}
return $oResult;
}
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:26,代码来源:FetchResponse.php
示例17: ChangePassword
/**
* @param \RainLoop\Account $oAccount
* @param string $sPrevPassword
* @param string $sNewPassword
*
* @return bool
*/
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword)
{
if ($this->oLogger) {
$this->oLogger->Write('DirectAdmin: Try to change password for ' . $oAccount->Email());
}
$bResult = false;
if (!empty($this->sHost) && 0 < $this->iPort && $oAccount) {
$sEmail = \trim(\strtolower($oAccount->Email()));
$sHost = \trim($this->sHost);
$sHost = \str_replace('{user:host-imap}', $oAccount->Domain()->IncHost(), $sHost);
$sHost = \str_replace('{user:host-smtp}', $oAccount->Domain()->OutHost(), $sHost);
$sHost = \str_replace('{user:domain}', \MailSo\Base\Utils::GetDomainFromEmail($sEmail), $sHost);
$sHost = \rtrim($this->sHost, '/\\');
if (!\preg_match('/^http[s]?:\\/\\//i', $sHost)) {
$sHost = 'http://' . $sHost;
}
$sUrl = $sHost . ':' . $this->iPort . '/CMD_CHANGE_EMAIL_PASSWORD';
$iCode = 0;
$oHttp = \MailSo\Base\Http::SingletonInstance();
if ($this->oLogger) {
$this->oLogger->Write('DirectAdmin[Api Request]:' . $sUrl);
}
$mResult = $oHttp->SendPostRequest($sUrl, array('email' => $sEmail, 'oldpassword' => $sPrevPassword, 'password1' => $sNewPassword, 'password2' => $sNewPassword, 'api' => '1'), 'MailSo Http User Agent (v1)', $iCode, $this->oLogger);
if (false !== $mResult && 200 === $iCode) {
$aRes = null;
@\parse_str($mResult, $aRes);
if (is_array($aRes) && (!isset($aRes['error']) || (int) $aRes['error'] !== 1)) {
$bResult = true;
} else {
if ($this->oLogger) {
$this->oLogger->Write('DirectAdmin[Error]: Response: ' . $mResult);
}
}
} else {
if ($this->oLogger) {
$this->oLogger->Write('DirectAdmin[Error]: Empty Response: Code:' . $iCode);
}
}
}
return $bResult;
}
开发者ID:sacredwebsite,项目名称:rainloop-webmail,代码行数:48,代码来源:DirectAdminChangePasswordDriver.php
示例18: folderModify
/**
* @param string $sPrevFolderFullNameRaw
* @param string $sNextFolderNameInUtf
* @param bool $bRenameOrMove
* @param bool $bSubscribeOnModify
*
* @return \MailSo\Mail\MailClient
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
*/
public function folderModify($sPrevFolderFullNameRaw, $sNextFolderNameInUtf, $bRenameOrMove, $bSubscribeOnModify)
{
if (0 === \strlen($sPrevFolderFullNameRaw) || 0 === \strlen($sNextFolderNameInUtf)) {
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
}
$aFolders = $this->oImapClient->FolderList('', $sPrevFolderFullNameRaw);
if (!\is_array($aFolders) || !isset($aFolders[0])) {
// TODO
throw new \MailSo\Mail\Exceptions\RuntimeException('Cannot rename non-existen folder');
}
$sDelimiter = $aFolders[0]->Delimiter();
$iLast = \strrpos($sPrevFolderFullNameRaw, $sDelimiter);
$mSubscribeFolders = null;
if ($bSubscribeOnModify) {
$mSubscribeFolders = $this->oImapClient->FolderSubscribeList($sPrevFolderFullNameRaw, '*');
if (\is_array($mSubscribeFolders) && 0 < count($mSubscribeFolders)) {
foreach ($mSubscribeFolders as $oFolder) {
$this->oImapClient->FolderUnSubscribe($oFolder->FullNameRaw());
}
}
}
$sNewFolderFullNameRaw = \MailSo\Base\Utils::ConvertEncoding($sNextFolderNameInUtf, \MailSo\Base\Enumerations\Charset::UTF_8, \MailSo\Base\Enumerations\Charset::UTF_7_IMAP);
if ($bRenameOrMove) {
if (0 < \strlen($sDelimiter) && false !== \strpos($sNewFolderFullNameRaw, $sDelimiter)) {
// TODO
throw new \MailSo\Mail\Exceptions\RuntimeException('New folder name contain delimiter');
}
$sFolderParentFullNameRaw = false === $iLast ? '' : \substr($sPrevFolderFullNameRaw, 0, $iLast + 1);
$sNewFolderFullNameRaw = $sFolderParentFullNameRaw . $sNewFolderFullNameRaw;
}
$this->oImapClient->FolderRename($sPrevFolderFullNameRaw, $sNewFolderFullNameRaw);
if (\is_array($mSubscribeFolders) && 0 < count($mSubscribeFolders)) {
foreach ($mSubscribeFolders as $oFolder) {
$sFolderFullNameRawForResubscrine = $oFolder->FullNameRaw();
if (0 === \strpos($sFolderFullNameRawForResubscrine, $sPrevFolderFullNameRaw)) {
$sNewFolderFullNameRawForResubscrine = $sNewFolderFullNameRaw . \substr($sFolderFullNameRawForResubscrine, \strlen($sPrevFolderFullNameRaw));
$this->oImapClient->FolderSubscribe($sNewFolderFullNameRawForResubscrine);
}
}
}
return $this;
}
开发者ID:pigi72333,项目名称:MailSo,代码行数:52,代码来源:MailClient.php
示例19: partialResponseLiteralCallbackCallable
/**
* @param string $sParent
* @param string $sLiteralAtomUpperCase
* @param resource $rImapStream
* @param int $iLiteralLen
*
* @return bool
*/
private function partialResponseLiteralCallbackCallable($sParent, $sLiteralAtomUpperCase, $rImapStream, $iLiteralLen)
{
$sLiteralAtomUpperCasePeek = '';
if (0 === \strpos($sLiteralAtomUpperCase, 'BODY')) {
$sLiteralAtomUpperCasePeek = \str_replace('BODY', 'BODY.PEEK', $sLiteralAtomUpperCase);
}
$sFetchKey = '';
if (\is_array($this->aFetchCallbacks)) {
if (0 < \strlen($sLiteralAtomUpperCasePeek) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCasePeek])) {
$sFetchKey = $sLiteralAtomUpperCasePeek;
} else {
if (0 < \strlen($sLiteralAtomUpperCase) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCase])) {
$sFetchKey = $sLiteralAtomUpperCase;
}
}
}
$bResult = false;
if (0 < \strlen($sFetchKey) && '' !== $this->aFetchCallbacks[$sFetchKey] && \is_callable($this->aFetchCallbacks[$sFetchKey])) {
$rImapLiteralStream = \MailSo\Base\StreamWrappers\Literal::CreateStream($rImapStream, $iLiteralLen);
$bResult = true;
$this->writeLog('Start Callback for ' . $sParent . ' / ' . $sLiteralAtomUpperCase . ' - try to read ' . $iLiteralLen . ' bytes.', \MailSo\Log\Enumerations\Type::NOTE);
$this->bRunningCallback = true;
try {
\call_user_func($this->aFetchCallbacks[$sFetchKey], $sParent, $sLiteralAtomUpperCase, $rImapLiteralStream);
} catch (\Exception $oException) {
$this->writeLog('Callback Exception', \MailSo\Log\Enumerations\Type::NOTICE);
$this->writeLogException($oException);
}
if (\is_resource($rImapLiteralStream)) {
$iNotReadLiteralLen = 0;
$bFeof = \feof($rImapLiteralStream);
$this->writeLog('End Callback for ' . $sParent . ' / ' . $sLiteralAtomUpperCase . ' - feof = ' . ($bFeof ? 'good' : 'BAD'), $bFeof ? \MailSo\Log\Enumerations\Type::NOTE : \MailSo\Log\Enumerations\Type::WARNING);
if (!$bFeof) {
while (!@\feof($rImapLiteralStream)) {
$sBuf = @\fread($rImapLiteralStream, 1024 * 1024);
if (false === $sBuf || 0 === \strlen($sBuf) || null === $sBuf) {
break;
}
\MailSo\Base\Utils::ResetTimeLimit();
$iNotReadLiteralLen += \strlen($sBuf);
}
if (\is_resource($rImapLiteralStream) && !@\feof($rImapLiteralStream)) {
@\stream_get_contents($rImapLiteralStream);
}
}
if (\is_resource($rImapLiteralStream)) {
@\fclose($rImapLiteralStream);
}
if ($iNotReadLiteralLen > 0) {
$this->writeLog('Not read literal size is ' . $iNotReadLiteralLen . ' bytes.', \MailSo\Log\Enumerations\Type::WARNING);
}
} else {
$this->writeLog('Literal stream is not resource after callback.', \MailSo\Log\Enumerations\Type::WARNING);
}
\MailSo\Base\Loader::IncStatistic('NetRead', $iLiteralLen);
$this->bRunningCallback = false;
}
return $bResult;
}
开发者ID:sunhaolin,项目名称:rainloop,代码行数:67,代码来源:ImapClient.php
示例20: IdnToAscii
/**
* @param string $sStr
* @param bool $bLowerIfAscii = false
*
* @return string
*/
public static function IdnToAscii($sStr, $bLowerIfAscii = false)
{
$sStr = $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sStr) : $sStr;
$sUser = '';
$sDomain = $sStr;
if (false !== \strpos($sStr, '@')) {
$sUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sStr);
$sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sStr);
}
if (0 < \strlen($sDomain) && \preg_match('/[^\\x20-\\x7E]/', $sDomain)) {
try {
$sDomain = self::idn()->encode($sDomain);
} catch (\Exception $oException) {
}
}
return ('' === $sUser ? '' : $sUser . '@') . $sDomain;
}
开发者ID:sunhaolin,项目名称:rainloop,代码行数:23,代码来源:Utils.php
注:本文中的MailSo\Base\Utils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论