Ejemplo n.º 1
0
 /**
  * @return array
  *
  * @throws \MailSo\Base\Exceptions\Exception
  */
 public function DoAccountsCounts()
 {
     $oAccount = $this->getAccountFromToken();
     $bComplete = true;
     $aCounts = array();
     if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS, $oAccount)) {
         $iLimit = 7;
         $mAccounts = $this->GetAccounts($oAccount);
         if (\is_array($mAccounts) && 0 < \count($mAccounts)) {
             if ($iLimit > \count($mAccounts)) {
                 $mAccounts = \array_slice($mAccounts, 0, $iLimit);
             } else {
                 $bComplete = false;
             }
             if (0 < \count($mAccounts)) {
                 foreach ($mAccounts as $sEmail => $sHash) {
                     $aCounts[] = array(\MailSo\Base\Utils::IdnToUtf8($sEmail), $oAccount->Email() === $sEmail ? 0 : $this->getAccountUnredCountFromHash($sHash));
                 }
             }
         }
     } else {
         $aCounts[] = array(\MailSo\Base\Utils::IdnToUtf8($oAccount->Email()), 0);
     }
     return $this->DefaultResponse(__FUNCTION__, array('Complete' => $bComplete, 'Counts' => $aCounts));
 }
 /**
  * @param bool $bAjax = false
  * 
  * @return array
  */
 public function ToSimpleJSON($bAjax = false)
 {
     return array('Id' => $this->Id(), 'Email' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->Email()) : $this->Email(), 'Name' => $this->Name(), 'ReplyTo' => $this->ReplyTo(), 'Bcc' => $this->Bcc());
 }
Ejemplo n.º 3
0
 /**
  * @param bool $bIdn = false
  *
  * @return string
  */
 public function GetEmail($bIdn = false)
 {
     return $bIdn ? \MailSo\Base\Utils::IdnToUtf8($this->sEmail) : $this->sEmail;
 }
Ejemplo n.º 4
0
 /**
  * @param int $iOffset
  * @param int $iLimit = 20
  *
  * @return array
  */
 public function GetList($iOffset, $iLimit = 20)
 {
     $aResult = array();
     $aWildCards = array();
     $aList = \glob($this->sDomainPath . '/*.ini');
     foreach ($aList as $sFile) {
         $sName = \substr(\basename($sFile), 0, -4);
         $sName = $this->codeFileName($sName, true);
         if (false === \strpos($sName, '*')) {
             $aResult[] = $sName;
         } else {
             $aWildCards[] = $sName;
         }
     }
     \sort($aResult, SORT_STRING);
     \rsort($aWildCards, SORT_STRING);
     $aResult = \array_merge($aResult, $aWildCards);
     $iOffset = 0 > $iOffset ? 0 : $iOffset;
     $iLimit = 0 > $iLimit ? 0 : (999 < $iLimit ? 999 : $iLimit);
     $aResult = \array_slice($aResult, $iOffset, $iLimit);
     $aDisabledNames = array();
     if (0 < \count($aResult) && \file_exists($this->sDomainPath . '/disabled')) {
         $sDisabled = @\file_get_contents($this->sDomainPath . '/disabled');
         if (false !== $sDisabled && 0 < strlen($sDisabled)) {
             $aDisabledNames = \explode(',', $sDisabled);
             $aDisabledNames = \array_unique($aDisabledNames);
             foreach ($aDisabledNames as $iIndex => $sValue) {
                 $aDisabledNames[$iIndex] = \MailSo\Base\Utils::IdnToUtf8($sValue, true);
             }
         }
     }
     $aReturn = array();
     foreach ($aResult as $sName) {
         $aReturn[$sName] = !\in_array($sName, $aDisabledNames);
     }
     return $aReturn;
 }
Ejemplo n.º 5
0
 /**
  * @param bool $bAjax = false
  *
  * @return array
  */
 public function ToSimpleJSON($bAjax = false)
 {
     return array('Name' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->Name()) : $this->Name(), 'IncHost' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->IncHost()) : $this->IncHost(), 'IncPort' => $this->IncPort(), 'IncSecure' => $this->IncSecure(), 'IncShortLogin' => $this->IncShortLogin(), 'OutHost' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->OutHost()) : $this->OutHost(), 'OutPort' => $this->OutPort(), 'OutSecure' => $this->OutSecure(), 'OutShortLogin' => $this->OutShortLogin(), 'OutAuth' => $this->OutAuth(), 'WhiteList' => $this->WhiteList());
 }
Ejemplo n.º 6
0
 /**
  * @return array
  *
  * @throws \MailSo\Base\Exceptions\Exception
  */
 public function DoAccountsAndIdentitiesNew()
 {
     $oAccount = $this->getAccountFromToken();
     $mAccounts = false;
     if ($this->Config()->Get('webmail', 'allow_additional_accounts', true)) {
         $mAccounts = $this->GetAccounts($oAccount);
         $mAccounts = \array_keys($mAccounts);
         foreach ($mAccounts as $iIndex => $sName) {
             $mAccounts[$iIndex] = \MailSo\Base\Utils::IdnToUtf8($sName);
         }
     }
     return $this->DefaultResponse(__FUNCTION__, array('Accounts' => $mAccounts, 'Identities' => $this->GetIdentitiesNew($oAccount)));
 }