/** * @param Zend_Controller_Request_Abstract $req * @param array $acl */ private function check($req, $acl) { $controller = $req->getControllerName(); $action = $req->getActionName(); $divert = ''; if (USER_AUTH) { if (isset($acl['public'][$controller]) && in_array($action, $acl['public'][$controller])) { $divert = 'default'; } else { if (isset($acl['private'][$controller]) && in_array($action, $acl['private'][$controller])) { if (true) { // se usuário não tem autorização $divert = 'default'; Ao_Alert::warning('<b>Acesso Negado!</b> Sua conta não está habilitada a acessar este recurso.'); } } } } else { if (isset($acl['protected'][$controller]) && in_array($action, $acl['protected'][$controller])) { $divert = 'account'; } else { if (isset($acl['private'][$controller]) && in_array($action, $acl['private'][$controller])) { $divert = 'account'; } } if ($divert) { $sq = filter_input(INPUT_SERVER, 'QUERY_STRING'); $uri = filter_input(INPUT_SERVER, 'REQUEST_URI'); if (strlen($sq) > 1) { $_SESSION['Ao_Login_Redirect'] = $uri; } else { //Ao_Alert::danger('<b>Apenas usuários autenticados</b> podem usar este recurso!'); } } } empty($divert) ? null : $req->setModuleName($divert)->setControllerName('index')->setActionName('index'); }
public function destroyAction() { $this->_helper->layout->disableLayout(); $id = $this->getRequest()->getParam('id'); if (empty($id)) { Ao_Alert::danger('<b>Requisição recusada</b> por não fornecer os parâmetros corretamente.'); } else { $m = $this->model; try { $m::build()->destroy($id); Ao_Alert::success('<b>Exclusão realizada</b> com sucesso!'); } catch (Exception $e) { Ao_Alert::danger($e->getMessage()); } } $this->_redirect($this->path); }
public function send($transport = null) { try { return parent::send($transport); } catch (Exception $e) { Ao_Alert::warning('<b>Falha inesperada</b> ao tentar enviar o e-mail.'); } return false; }