Code refactoring

This commit is contained in:
RainLoop Team 2015-02-03 03:58:58 +04:00
parent 79233ad83c
commit 286ab567af
53 changed files with 618 additions and 581 deletions

View file

@ -2527,7 +2527,7 @@ class Actions
$bComplete = true;
$aCounts = array();
if ($this->Config()->Get('webmail', 'allow_additional_accounts', true))
{
$iLimit = 7;
@ -3006,6 +3006,21 @@ class Actions
));
}
/**
* @param string $sDomain
*
* @return string
*/
public function domainPathHelper($sDomain)
{
$sDomain = \strtolower(\trim($sDomain));
$sDomainPrefix = \substr(\preg_replace('/[^a-z0-9]+/', '', $sDomain), 0, 2);
$sDomainPrefix = \str_pad($sDomainPrefix, 2, '_');
return 'domains/'.$sDomainPrefix.'/'.\urlencode($sDomain);
}
/**
* @return string
*/
@ -3062,13 +3077,23 @@ class Actions
$iCode = 0;
$sContentType = '';
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'status/'.\urlencode($sDomain),
$sValue = $oHttp->GetUrlAsString(APP_STATUS_PATH.$this->domainPathHelper($sDomain),
'RainLoop/'.APP_VERSION, $sContentType, $iCode, $this->Logger(), 10,
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
array(), false
);
if (200 !== $iCode)
// $sValue = $oHttp->GetUrlAsString(APP_API_PATH.'status/'.\urlencode($sDomain),
// 'RainLoop/'.APP_VERSION, $sContentType, $iCode, $this->Logger(), 10,
// $this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
// array(), false
// );
if (404 === $iCode)
{
$sValue = 'NO';
}
else if (200 !== $iCode)
{
$sValue = '';
}
@ -3425,34 +3450,41 @@ class Actions
}
}
try
if ($oDomain->UseSieve())
{
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->Logger());
$oSieveClient->SetTimeOuts($iConnectionTimeout);
$iTime = \microtime(true);
$oSieveClient->Connect($oDomain->SieveHost(), $oDomain->SievePort(), $oDomain->SieveSecure(),
!!$this->Config()->Get('ssl', 'verify_certificate', false),
!!$this->Config()->Get('ssl', 'allow_self_signed', true)
);
$iSieveTime = \microtime(true) - $iTime;
$oSieveClient->Disconnect();
$bSieveResult = true;
}
catch (\MailSo\Net\Exceptions\SocketCanNotConnectToHostException $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sSieveErrorDesc = $oException->getSocketMessage();
if (empty($sSieveErrorDesc))
try
{
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->Logger());
$oSieveClient->SetTimeOuts($iConnectionTimeout);
$iTime = \microtime(true);
$oSieveClient->Connect($oDomain->SieveHost(), $oDomain->SievePort(), $oDomain->SieveSecure(),
!!$this->Config()->Get('ssl', 'verify_certificate', false),
!!$this->Config()->Get('ssl', 'allow_self_signed', true)
);
$iSieveTime = \microtime(true) - $iTime;
$oSieveClient->Disconnect();
$bSieveResult = true;
}
catch (\MailSo\Net\Exceptions\SocketCanNotConnectToHostException $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sSieveErrorDesc = $oException->getSocketMessage();
if (empty($sSieveErrorDesc))
{
$sSieveErrorDesc = $oException->getMessage();
}
}
catch (\Exception $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sSieveErrorDesc = $oException->getMessage();
}
}
catch (\Exception $oException)
else
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sSieveErrorDesc = $oException->getMessage();
$bSieveResult = true;
}
}

View file

@ -63,7 +63,7 @@
</p>
</div>
<div data-bind="visible: licensing()">
<div class="alert alert-success span8" style="margin-left: 0; padding-top: 20px" data-bind="visible: licenseValid() && '' === licenseError()">
<div class="alert alert-success span8" style="margin-left: 0; margin-top: 10px; padding-top: 20px" data-bind="visible: licenseValid() && '' === licenseError()">
<h4>
Premium
<span data-bind="visible: licenseIsUnlim()">(Lifetime)</span>
@ -74,7 +74,7 @@
<span data-bind="text: licenseExpiredMomentValue()"></span>
</p>
</div>
<div class="alert alert-error span8" style="margin-left: 0" data-bind="visible: !licenseValid() && '' !== licenseError(), text: licenseError"></div>
<div class="alert alert-error span8" style="margin-left: 0; margin-top: 10px;" data-bind="visible: !licenseValid() && '' !== licenseError(), text: licenseError"></div>
</div>
</div>
</div>

View file

@ -104,7 +104,7 @@
<div class="e-languages thm-languages" data-bind="visible: allowLanguagesOnLogin() && socialLoginEnabled()">
<label class="flag-selector">
<i data-bind="css: langRequest() ? 'icon-spinner animated' : 'icon-world'"></i>
&nbsp;
&nbsp;&nbsp;
<span class="flag-name" data-bind="text: languageFullName, click: selectLanguage"></span>
</label>
</div>

View file

@ -90,7 +90,7 @@
}
}"></div>
<br />
<div data-bind="visible: threading, component: {
<div data-bind="visible: threadsAllowed, component: {
name: 'Checkbox',
params: {
label: 'SETTINGS_GENERAL/LABEL_USE_THREADS',

View file

@ -22,17 +22,6 @@
<strong><span data-bind="text: viewUser"></span></strong>
</div>
</div>
<!--
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n-text="SETTINGS_SECURITY/LABEL_TWO_FACTOR_STATUS"></span>
</label>
<div class="controls" style="padding-top: 5px;">
<strong data-bind="visible: !processing()"><span data-bind="text: viewTwoFactorStatus"></span></strong>
<strong data-bind="visible: processing()">...</strong>
</div>
</div>
-->
<div class="control-group">
<div class="controls">
<a class="btn" data-bind="click: clearTwoFactor, visible: twoFactorStatus">
@ -75,7 +64,7 @@
<p class="muted i18n" style="width: 550px" data-i18n-text="SETTINGS_SECURITY/TWO_FACTOR_SECRET_DESC"></p>
</blockquote>
<!-- ko if: '' !== viewUrl() -->
<img style="margin-left: -7px;" src="javascript:void();" data-bind="attr: {'src': viewUrl}" />
<img style="margin-left: -7px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=" data-bind="attr: {'src': viewUrl}" />
<!-- /ko -->
</div>
</div>

View file

@ -6,9 +6,9 @@
<i data-bind="css: {'icon-user': !accounts.loading(), 'icon-spinner animated': accounts.loading()}"
></i>
&nbsp;
<b data-bind="text: accountsUnreadCount, visible: 100 > accountsUnreadCount() && 0 < accountsUnreadCount()"></b>
<!-- <b data-bind="text: accountsUnreadCount, visible: 100 > accountsUnreadCount() && 0 < accountsUnreadCount()"></b>
<b data-bind="visible: 99 < accountsUnreadCount()">99+</b>
&nbsp;
&nbsp;-->
<span class="caret"></span>
</a>
<ul class="dropdown-menu g-ui-menu" tabindex="-1" role="menu" aria-labelledby="top-system-dropdown-id">
@ -18,10 +18,10 @@
<li class="e-item" role="presentation">
<a class="e-link menuitem account-item" href="#" data-bind="click: $root.accountClick,
attr: {'href': changeAccountLink()}, css: {current: $root.accountEmail() === email}">
<b class="pull-right counter" data-bind="visible: 0 < count()">
<!-- <b class="pull-right counter" data-bind="visible: 0 < count()">
<span data-bind="text: count, visible: 100 > count()"></span>
<span data-bind="visible: 99 < count()">99+</span>
</b>
</b>-->
<i class="icon-ok"></i>
<i class="icon-user"></i>
&nbsp;&nbsp;

View file

@ -57,6 +57,7 @@ Options -Indexes
define('APP_API_PATH', 'http://api.rainloop.net/');
define('APP_REP_PATH', 'http://repository.rainloop.net/v1/');
define('APP_REPO_CORE_FILE', 'http://repository.rainloop.net/v2/core.{{channel}}.json');
define('APP_STATUS_PATH', 'http://status.rainloop.net/');
define('APP_WEB_PATH', 'rainloop/v/'.APP_VERSION.'/');
define('APP_WEB_STATIC_PATH', APP_WEB_PATH.'static/');
define('APP_DATA_FOLDER_PATH_UNIX', str_replace('\\', '/', APP_DATA_FOLDER_PATH));

View file

@ -16,8 +16,8 @@
@login-box-shadow: 0px 2px 10px rgba(0,0,0,0.2);
@login-border: none;
@login-border-radius: 7px;
@powered-color: #ddd;
@languages-color: #ddd;
@powered-color: #fff;
@languages-color: #fff;
// MENU
@dropdown-menu-color: #333;