Added resources folder (Code refactoring)

This commit is contained in:
RainLoop Team 2014-08-15 19:18:40 +04:00
parent 25624c280d
commit 79a5c11556
60 changed files with 246 additions and 349 deletions

View file

@ -528,6 +528,11 @@ class Http
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array())
{
if (null === $sCustomUserAgent)
{
$sCustomUserAgent = 'MailSo Http User Agent (v1)';
}
if (!is_resource($rFile))
{
if ($oLogger)

View file

@ -5478,22 +5478,6 @@ class Actions
return $this->DefaultResponse(__FUNCTION__, $aResult);
}
/**
* @return array
*/
public function DoServicesPics()
{
$aData = \RainLoop\Utils::ServicesPics();
$aResult = array();
foreach ($aData as $sDomain => $sPic)
{
$aResult[$sDomain] = APP_WEB_STATIC_PATH.'services/'.$sPic;
}
return $this->DefaultResponse(__FUNCTION__, $aResult);
}
/**
* @return array
*/
@ -6492,6 +6476,60 @@ class Actions
{
return $this->rawSmart(false);
}
/**
* @return bool
*/
public function RawAvatar()
{
$sData = '';
$sRawKey = (string) $this->GetActionParam('RawKey', '');
$sRawKey = \urldecode($sRawKey);
$this->verifyCacheByKey($sRawKey);
if (0 < \strlen($sRawKey) && \preg_match('/^[^@]+@([^@]+)$/', $sRawKey))
{
$sEmail = \MailSo\Base\Utils::IdnToAscii($sRawKey, true);
$iCode = 0;
$sContentType = '';
$sData = $this->Http()->GetUrlAsString('http://gravatar.com/avatar/'.\md5($sEmail).'.jpg?s=80&d=404',
null, $sContentType, $iCode, $this->Logger(), 5,
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''));
$sContentType = \strtolower(\trim($sContentType));
if (200 !== $iCode || empty($sData) ||
!\in_array($sContentType, array('image/jpeg', 'image/jpg', 'image/png')))
{
$sData = '';
$aMatch = array();
if (\preg_match('/^[^@]+@([a-z0-9\-\.]+)$/', $sEmail, $aMatch) && !empty($aMatch[1]))
{
$sDomain = $aMatch[1];
if (\file_exists(APP_VERSION_ROOT_PATH.'app/resources/images/services/'.$sDomain.'.png'))
{
$sContentType = 'image/png';
$sData = \file_get_contents(APP_VERSION_ROOT_PATH.'app/resources/images/services/'.$sDomain.'.png');
}
}
}
}
if (empty($sData) || empty($sContentType))
{
$sContentType = 'image/png';
$sData = \file_get_contents(APP_VERSION_ROOT_PATH.'app/resources/images/empty-contact.png');
}
$this->cacheByKey($sRawKey);
\header('Content-Type: '.$sContentType);
echo $sData;
return true;
}
/**
* @return bool

View file

@ -305,66 +305,6 @@ class Utils
@\setcookie($sName, '', \time() - 3600 * 24 * 30, '/');
}
/**
* @return array
*/
public static function ServicesPics()
{
return array(
'ebay.com' => 'ebay.jpg',
'reply.ebay.com' => 'ebay.jpg',
'reply1.ebay.com' => 'ebay.jpg',
'reply2.ebay.com' => 'ebay.jpg',
'reply3.ebay.com' => 'ebay.jpg',
'facebook.com' => 'facebook.png',
'facebookmail.com' => 'facebook.png',
'cnet.online.com' => 'cnet.jpg',
'github.com' => 'github.png',
'steampowered.com' => 'steam.png',
'myspace.com' => 'myspace.png',
'new.myspace.com' => 'myspace.png',
'youtube.com' => 'youtube.gif',
'amazon.com' => 'amazon.png',
'ted.com' => 'ted.png',
'google.com' => 'google.png',
'plus.google.com' => 'google-plus.png',
'email.microsoft.com' => 'microsoft.jpg',
'microsoftonline.com' => 'microsoft.jpg',
'microsoft.com' => 'microsoft.jpg',
'paypal.com' => 'paypal.jpg',
'intl.paypal.com' => 'paypal.jpg',
'e.paypal.com' => 'paypal.jpg',
'ea.com' => 'ea.png',
'em.ea.com' => 'ea.png',
'battlefieldheroes.com' => 'ea.png',
'battle.net' => 'battle.net.png',
'blizzard.com' => 'battle.net.png',
'email.blizzard.com' => 'battle.net.png',
'battlefieldheroes.com' => 'battle.net.png',
'twitter.com' => 'twitter.jpg',
'postmaster.twitter.com' => 'twitter.jpg',
'skype.com' => 'skype.png',
'email.skype.com' => 'skype.png',
'apple.com' => 'apple.jpg',
'id.apple.com' => 'apple.jpg',
'onlive.com' => 'onlive.png',
'news.onlive.com' => 'onlive.png',
'asana.com' => 'asana.png',
'connect.asana.com' => 'asana.png',
);
}
public static function CustomBaseConvert($sNumberInput, $sFromBaseInput = '0123456789', $sToBaseInput = '0123456789')
{
if ($sFromBaseInput === $sToBaseInput)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB