mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Small fixes
This commit is contained in:
parent
cdf812ae9a
commit
1d309979b8
3 changed files with 15 additions and 11 deletions
|
|
@ -848,16 +848,14 @@
|
||||||
Utils.createCommand = function (oContext, fExecute, fCanExecute)
|
Utils.createCommand = function (oContext, fExecute, fCanExecute)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
fResult = fExecute ? function () {
|
fNonEmpty = function () {
|
||||||
|
|
||||||
if (fResult && fResult.canExecute && fResult.canExecute())
|
if (fResult && fResult.canExecute && fResult.canExecute())
|
||||||
{
|
{
|
||||||
fExecute.apply(oContext, Array.prototype.slice.call(arguments));
|
fExecute.apply(oContext, Array.prototype.slice.call(arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
} : function () {}
|
fResult = fExecute ? fNonEmpty : Utils.emptyFunction;
|
||||||
;
|
;
|
||||||
|
|
||||||
fResult.enabled = ko.observable(true);
|
fResult.enabled = ko.observable(true);
|
||||||
|
|
|
||||||
|
|
@ -522,11 +522,12 @@ class Http
|
||||||
* @param string $sProxy = ''
|
* @param string $sProxy = ''
|
||||||
* @param string $sProxyAuth = ''
|
* @param string $sProxyAuth = ''
|
||||||
* @param array $aHttpHeaders = array()
|
* @param array $aHttpHeaders = array()
|
||||||
|
* @param bool $bFollowLocation = true
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
|
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
|
||||||
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array())
|
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array(), $bFollowLocation = true)
|
||||||
{
|
{
|
||||||
if (null === $sCustomUserAgent)
|
if (null === $sCustomUserAgent)
|
||||||
{
|
{
|
||||||
|
|
@ -549,7 +550,7 @@ class Http
|
||||||
CURLOPT_FAILONERROR => true,
|
CURLOPT_FAILONERROR => true,
|
||||||
CURLOPT_SSL_VERIFYPEER => false,
|
CURLOPT_SSL_VERIFYPEER => false,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_FOLLOWLOCATION => true,
|
CURLOPT_FOLLOWLOCATION => !!$bFollowLocation,
|
||||||
CURLOPT_MAXREDIRS => 7,
|
CURLOPT_MAXREDIRS => 7,
|
||||||
CURLOPT_FILE => $rFile,
|
CURLOPT_FILE => $rFile,
|
||||||
CURLOPT_TIMEOUT => (int) $iTimeout
|
CURLOPT_TIMEOUT => (int) $iTimeout
|
||||||
|
|
@ -620,14 +621,15 @@ class Http
|
||||||
* @param string $sProxy = ''
|
* @param string $sProxy = ''
|
||||||
* @param string $sProxyAuth = ''
|
* @param string $sProxyAuth = ''
|
||||||
* @param array $aHttpHeaders = array()
|
* @param array $aHttpHeaders = array()
|
||||||
|
* @param bool $bFollowLocation = true
|
||||||
*
|
*
|
||||||
* @return string|bool
|
* @return string|bool
|
||||||
*/
|
*/
|
||||||
public function GetUrlAsString($sUrl, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
|
public function GetUrlAsString($sUrl, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
|
||||||
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array())
|
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array(), $bFollowLocation = true)
|
||||||
{
|
{
|
||||||
$rMemFile = \MailSo\Base\ResourceRegistry::CreateMemoryResource();
|
$rMemFile = \MailSo\Base\ResourceRegistry::CreateMemoryResource();
|
||||||
if ($this->SaveUrlToFile($sUrl, $rMemFile, $sCustomUserAgent, $sContentType, $iCode, $oLogger, $iTimeout, $sProxy, $sProxyAuth, $aHttpHeaders) && \is_resource($rMemFile))
|
if ($this->SaveUrlToFile($sUrl, $rMemFile, $sCustomUserAgent, $sContentType, $iCode, $oLogger, $iTimeout, $sProxy, $sProxyAuth, $aHttpHeaders, $bFollowLocation) && \is_resource($rMemFile))
|
||||||
{
|
{
|
||||||
\rewind($rMemFile);
|
\rewind($rMemFile);
|
||||||
return \stream_get_contents($rMemFile);
|
return \stream_get_contents($rMemFile);
|
||||||
|
|
|
||||||
|
|
@ -2529,7 +2529,9 @@ class Actions
|
||||||
|
|
||||||
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'status/'.\urlencode($sDomain),
|
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'status/'.\urlencode($sDomain),
|
||||||
'RainLoop', $sContentType, $iCode, $this->Logger(), 10,
|
'RainLoop', $sContentType, $iCode, $this->Logger(), 10,
|
||||||
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''));
|
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
|
||||||
|
array(), false
|
||||||
|
);
|
||||||
|
|
||||||
if (200 !== $iCode)
|
if (200 !== $iCode)
|
||||||
{
|
{
|
||||||
|
|
@ -2599,7 +2601,9 @@ class Actions
|
||||||
\sleep(1);
|
\sleep(1);
|
||||||
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'activate/'.\urlencode($sDomain).'/'.\urlencode($sKey),
|
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'activate/'.\urlencode($sDomain).'/'.\urlencode($sKey),
|
||||||
'RainLoop', $sContentType, $iCode, $this->Logger(), 10,
|
'RainLoop', $sContentType, $iCode, $this->Logger(), 10,
|
||||||
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''));
|
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
|
||||||
|
array(), false
|
||||||
|
);
|
||||||
|
|
||||||
if (200 !== $iCode)
|
if (200 !== $iCode)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue