2013-12-09 05:32:19 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace RainLoop;
|
|
|
|
|
|
|
|
class Notifications
|
|
|
|
{
|
|
|
|
const InvalidToken = 101;
|
|
|
|
const AuthError = 102;
|
|
|
|
const AccessError = 103;
|
|
|
|
const ConnectionError = 104;
|
|
|
|
const CaptchaError = 105;
|
|
|
|
const SocialFacebookLoginAccessDisable = 106;
|
|
|
|
const SocialTwitterLoginAccessDisable = 107;
|
|
|
|
const SocialGoogleLoginAccessDisable = 108;
|
|
|
|
const DomainNotAllowed = 109;
|
|
|
|
const AccountNotAllowed = 110;
|
2014-03-29 00:02:39 +08:00
|
|
|
|
|
|
|
const AccountTwoFactorAuthRequired = 120;
|
|
|
|
const AccountTwoFactorAuthError = 121;
|
2013-12-09 05:32:19 +08:00
|
|
|
|
2014-04-19 07:41:10 +08:00
|
|
|
const CouldNotSaveNewPassword = 130;
|
|
|
|
const CurrentPasswordIncorrect = 131;
|
|
|
|
const NewPasswordShort = 132;
|
|
|
|
const NewPasswordWeak = 133;
|
|
|
|
const NewPasswordForbidden = 134;
|
|
|
|
|
2014-04-26 05:50:17 +08:00
|
|
|
const ContactsSyncError = 140;
|
|
|
|
|
2013-12-09 05:32:19 +08:00
|
|
|
const CantGetMessageList = 201;
|
|
|
|
const CantGetMessage = 202;
|
|
|
|
const CantDeleteMessage = 203;
|
|
|
|
const CantMoveMessage = 204;
|
|
|
|
const CantCopyMessage = 205;
|
|
|
|
|
|
|
|
const CantSaveMessage = 301;
|
|
|
|
const CantSendMessage = 302;
|
|
|
|
const InvalidRecipients = 303;
|
|
|
|
|
|
|
|
const CantCreateFolder = 400;
|
|
|
|
const CantRenameFolder = 401;
|
|
|
|
const CantDeleteFolder = 402;
|
|
|
|
const CantSubscribeFolder = 403;
|
|
|
|
const CantUnsubscribeFolder = 404;
|
|
|
|
const CantDeleteNonEmptyFolder = 405;
|
|
|
|
|
|
|
|
const CantSaveSettings = 501;
|
|
|
|
const CantSavePluginSettings = 502;
|
|
|
|
|
|
|
|
const DomainAlreadyExists = 601;
|
|
|
|
|
|
|
|
const CantInstallPackage = 701;
|
|
|
|
const CantDeletePackage = 702;
|
|
|
|
const InvalidPluginPackage = 703;
|
|
|
|
const UnsupportedPluginPackage = 704;
|
|
|
|
|
|
|
|
const LicensingServerIsUnavailable = 710;
|
|
|
|
const LicensingExpired = 711;
|
|
|
|
const LicensingBanned = 712;
|
|
|
|
|
|
|
|
const DemoSendMessageError = 750;
|
|
|
|
|
|
|
|
const AccountAlreadyExists = 801;
|
|
|
|
|
|
|
|
const MailServerError = 901;
|
2014-01-08 05:49:23 +08:00
|
|
|
const ClientViewError = 902;
|
2013-12-09 05:32:19 +08:00
|
|
|
const UnknownNotification = 998;
|
|
|
|
const UnknownError = 999;
|
|
|
|
|
2014-01-08 05:49:23 +08:00
|
|
|
/**
|
|
|
|
* @staticvar array $aMap
|
|
|
|
*
|
|
|
|
* @param int $iCode
|
|
|
|
* @param \Exception|null $oPrevious
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
static public function GetNotificationsMessage($iCode, $oPrevious = null)
|
2013-12-09 05:32:19 +08:00
|
|
|
{
|
|
|
|
static $aMap = array(
|
|
|
|
self::InvalidToken => 'InvalidToken',
|
|
|
|
self::AuthError => 'AuthError',
|
|
|
|
self::AccessError => 'AccessError',
|
|
|
|
self::ConnectionError => 'ConnectionError',
|
|
|
|
self::CaptchaError => 'CaptchaError',
|
|
|
|
self::SocialFacebookLoginAccessDisable => 'SocialFacebookLoginAccessDisable',
|
|
|
|
self::SocialTwitterLoginAccessDisable => 'SocialTwitterLoginAccessDisable',
|
|
|
|
self::SocialGoogleLoginAccessDisable => 'SocialGoogleLoginAccessDisable',
|
|
|
|
self::DomainNotAllowed => 'DomainNotAllowed',
|
|
|
|
self::AccountNotAllowed => 'AccountNotAllowed',
|
2014-04-06 03:48:22 +08:00
|
|
|
self::AccountTwoFactorAuthRequired => 'AccountTwoFactorAuthRequired',
|
|
|
|
self::AccountTwoFactorAuthError => 'AccountTwoFactorAuthError',
|
2014-04-19 07:41:10 +08:00
|
|
|
|
|
|
|
self::CouldNotSaveNewPassword => 'CouldNotSaveNewPassword',
|
|
|
|
self::CurrentPasswordIncorrect => 'CurrentPasswordIncorrect',
|
|
|
|
self::NewPasswordShort => 'NewPasswordShort',
|
|
|
|
self::NewPasswordWeak => 'NewPasswordWeak',
|
|
|
|
self::NewPasswordForbidden => 'NewPasswordForbidden',
|
2014-04-26 05:50:17 +08:00
|
|
|
|
|
|
|
self::ContactsSyncError => 'ContactsSyncError',
|
2014-04-19 07:41:10 +08:00
|
|
|
|
2013-12-09 05:32:19 +08:00
|
|
|
self::CantGetMessageList => 'CantGetMessageList',
|
|
|
|
self::CantGetMessage => 'CantGetMessage',
|
|
|
|
self::CantDeleteMessage => 'CantDeleteMessage',
|
|
|
|
self::CantMoveMessage => 'CantMoveMessage',
|
|
|
|
self::CantSaveMessage => 'CantSaveMessage',
|
|
|
|
self::CantSendMessage => 'CantSendMessage',
|
|
|
|
self::InvalidRecipients => 'InvalidRecipients',
|
|
|
|
self::CantCreateFolder => 'CantCreateFolder',
|
|
|
|
self::CantRenameFolder => 'CantRenameFolder',
|
|
|
|
self::CantDeleteFolder => 'CantDeleteFolder',
|
|
|
|
self::CantSubscribeFolder => 'CantSubscribeFolder',
|
|
|
|
self::CantUnsubscribeFolder => 'CantUnsubscribeFolder',
|
|
|
|
self::CantDeleteNonEmptyFolder => 'CantDeleteNonEmptyFolder',
|
|
|
|
self::CantSaveSettings => 'CantSaveSettings',
|
|
|
|
self::CantSavePluginSettings => 'CantSavePluginSettings',
|
|
|
|
self::DomainAlreadyExists => 'DomainAlreadyExists',
|
|
|
|
self::CantInstallPackage => 'CantInstallPackage',
|
|
|
|
self::CantDeletePackage => 'CantDeletePackage',
|
|
|
|
self::InvalidPluginPackage => 'InvalidPluginPackage',
|
|
|
|
self::UnsupportedPluginPackage => 'UnsupportedPluginPackage',
|
|
|
|
self::LicensingServerIsUnavailable => 'LicensingServerIsUnavailable',
|
|
|
|
self::LicensingExpired => 'LicensingExpired',
|
|
|
|
self::LicensingBanned => 'LicensingBanned',
|
|
|
|
self::DemoSendMessageError => 'DemoSendMessageError',
|
|
|
|
self::AccountAlreadyExists => 'AccountAlreadyExists',
|
|
|
|
self::MailServerError => 'MailServerError',
|
2014-01-08 05:49:23 +08:00
|
|
|
self::ClientViewError => 'ClientViewError',
|
2013-12-09 05:32:19 +08:00
|
|
|
self::UnknownNotification => 'UnknownNotification',
|
|
|
|
self::UnknownError => 'UnknownError'
|
|
|
|
);
|
|
|
|
|
2014-01-08 05:49:23 +08:00
|
|
|
if (self::ClientViewError === $iCode && $oPrevious instanceof \Exception)
|
|
|
|
{
|
|
|
|
return $oPrevious->getMessage();
|
|
|
|
}
|
|
|
|
|
2013-12-09 05:32:19 +08:00
|
|
|
return isset($aMap[$iCode]) ? $aMap[$iCode].'['.$iCode.']' : 'UnknownNotification['.$iCode.']';
|
|
|
|
}
|
2013-09-25 03:04:44 +08:00
|
|
|
}
|