/** * @param \RainLoop\Domain $oDomain * * @return bool */ public function Save(\RainLoop\Domain $oDomain) { $sRealFileName = $this->codeFileName($oDomain->Name()); if ($this->oCacher) { $this->oCacher->Delete($this->wildcardDomainsCacheKey()); } $mResult = \file_put_contents($this->sDomainPath . '/' . $sRealFileName . '.ini', $oDomain->ToIniString()); return \is_int($mResult) && 0 < $mResult; }
/** * @return \RainLoop\Domain */ public function Hash() { return md5(APP_SALT . $this->Email() . APP_SALT . $this->oDomain->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email())) . APP_SALT . $this->oDomain->IncPort() . APP_SALT . $this->Password() . APP_SALT . '0' . APP_SALT . $this->ParentEmail() . APP_SALT); }
/** * @param \RainLoop\Actions $oActions * @param string $sNameForTest = '' * * @return \RainLoop\Domain | null */ public function LoadOrCreateNewFromAction(\RainLoop\Actions $oActions, $sNameForTest = '') { $oDomain = null; if ($this->bAdmin) { $bCreate = '1' === (string) $oActions->GetActionParam('Create', '0'); $sName = (string) $oActions->GetActionParam('Name', ''); $sIncHost = (string) $oActions->GetActionParam('IncHost', ''); $iIncPort = (int) $oActions->GetActionParam('IncPort', 143); $iIncSecure = (int) $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); $bIncShortLogin = '******' === (string) $oActions->GetActionParam('IncShortLogin', '0'); $sOutHost = (string) $oActions->GetActionParam('OutHost', ''); $iOutPort = (int) $oActions->GetActionParam('OutPort', 25); $iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); $bOutShortLogin = '******' === (string) $oActions->GetActionParam('OutShortLogin', '0'); $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); $sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); if (0 < \strlen($sName) && 0 < strlen($sNameForTest) && false === \strpos($sName, '*')) { $sNameForTest = ''; } if (0 < strlen($sName) || 0 < strlen($sNameForTest)) { $oDomain = 0 < strlen($sNameForTest) ? null : $this->Load($sName); if ($oDomain instanceof \RainLoop\Domain) { if ($bCreate) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists); } else { $oDomain->UpdateInstance($sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList); } } else { $oDomain = \RainLoop\Domain::NewInstance(0 < strlen($sNameForTest) ? $sNameForTest : $sName, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList); } } } return $oDomain; }