芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/cloud.pulsehost.co.uk/modules/Mail/Managers/Identities/Manager.php
IdUser = $iUserId; $oIdentity->IdAccount = $iAccountID; $oIdentity->FriendlyName = $sFriendlyName; $oIdentity->Email = $sEmail; $oIdentity->save(); return $oIdentity->Id; } catch (\Aurora\System\Exceptions\BaseException $oException) { $this->setLastException($oException); } return false; } /** * @param int $iId * @param int $iIdAccount * @return Identity */ public function getIdentity($iId, $iIdAccount) { return Identity::where('IdAccount', $iIdAccount)->find($iId); } /** * @param int $iId * @param int $iIdAccount * @param string $sFriendlyName * @param string $sEmail * @param boolean $bDefault * @return boolean */ public function updateIdentity($iId, $iIdAccount, $sFriendlyName, $sEmail, $bDefault) { $bResult = false; try { $oIdentity = Identity::where('IdAccount', $iIdAccount)->findOrFail($iId); if ($oIdentity instanceof Identity) { $oIdentity->FriendlyName = $sFriendlyName; $oIdentity->Email = $sEmail; $oIdentity->Default = $bDefault; $bResult = $oIdentity->save(); } } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $oException) { \Aurora\Api::LogException($oException); } return $bResult; } /** * @param int $iId * @param int $iIdAccount * @param boolean $bUseSignature * @param string $sSignature * @return boolean */ public function updateIdentitySignature($iId, $iIdAccount, $bUseSignature, $sSignature) { $bResult = false; try { $oIdentity = Identity::where('IdAccount', $iIdAccount)->findOrFail($iId); if ($oIdentity instanceof Identity) { $oIdentity->UseSignature = $bUseSignature; $oIdentity->Signature = $sSignature; $bResult = $oIdentity->save(); } } catch (\Aurora\System\Exceptions\BaseException $oException) { $this->setLastException($oException); } return $bResult; } /** * @param int $iId * @param int $iIdAccount * @return boolean */ public function deleteIdentity($iId, $iIdAccount) { $bResult = false; try { $bResult = !!Identity::where('IdAccount', $iIdAccount)->find($iId)->delete(); } catch (\Aurora\System\Exceptions\BaseException $oException) { $this->setLastException($oException); } return $bResult; } /** * @param int $iUserId * @param Builder $oFilters null * @return \Illuminate\Database\Eloquent\Collection */ public function getIdentities($iUserId, Builder $oFilters = null) { $aResult = false; $oQuery = isset($oFilters) ? $oFilters : Identity::query(); $oQuery->where('IdUser', $iUserId); try { $aResult = $oQuery->orderBy('FriendlyName')->get(); } catch (\Aurora\System\Exceptions\BaseException $oException) { $aResult = false; $this->setLastException($oException); } return $aResult; } /** * Deletes identities of the account. * @param int $iAccountId Account identifier. * @return boolean */ public function deleteAccountIdentities($iAccountId) { return Identity::query()->where('IdAccount', $iAccountId)->delete(); } /** * @param int $iUserId * @param int $iAccountId */ public function resetDefaultIdentity($iUserId, $iAccountId) { Identity::where('IdUser', $iUserId)->where('IdAccount', $iAccountId)->where('Default', true)->update(['Default' => false]); } }