/** * @param Account $account * @return bool */ function SaveMailForwards($account) { if ($account && $account->IsInternal) { if ($this->_connector->Execute($this->_commandCreator->ClearMailForwards($account->Id))) { $forwardName = $forwardDomain = ''; $return = true; list($forwardName, $forwardDomain) = explode('@', $account->MailIncLogin, 2); if (strlen($forwardName) > 0 && strlen($forwardDomain) > 0 && is_array($account->Forwards) && count($account->Forwards) > 0) { $forwards = array_unique($account->Forwards); if (count($forwards) > 0) { foreach ($forwards as $forwardTo) { $return &= $this->_connector->Execute($this->_commandCreator->InsertMailForward($account->Id, $forwardName, $forwardDomain, $forwardTo)); } } } return $return; } return false; } return true; }