/** * logout() * * Força o Logout * * @return bool */ public function logout($redir = true) { unset($_SESSION["Sys"]["Auth"]); unset($_SESSION["Sys"]["FormHelper"]["statusMessage"]); $this->checkLogin(); if ($redir) { if (!empty($this->logoutRedirectTo)) { redirect(translateUrl($this->logoutRedirectTo)); } else { redirect(translateUrl($this->loginPage())); } return false; } else { return true; } }
/** * favicon() * * @param string $url Endereço da imagem * @param array $options * @return string HTML */ public function favicon($url, array $options = array()) { /* * OPÇÕES RESERVADAS */ $reservedWords = array(""); if (!empty($url)) { $conteudo = ""; $inlineProperties = ""; if (is_array($options)) { foreach ($options as $chave => $valor) { /* * Somente palavras não reservadas */ if (!in_array($chave, $reservedWords)) { $inlineProperties .= " " . $chave . '="' . $valor . '"'; } } } //<link rel="icon" type="image/gif" href="../../view/public/images/layout/animated_favicon1.gif" > $conteudo .= '<link rel="shortcut icon" href="' . translateUrl(APP_IMAGES_DIR . $url, true) . '" ' . $inlineProperties . ' />'; return $conteudo; } else { /* * @todo - retornar erro */ showError("Não foi especificado o endereço da imagem para HtmlHelper::favicon()"); } }
/** * form() * * Faz com que <form> seja enviado via Ajax, se fazer reload da página. * * @param string $modelName Nome do Model principal * @param array $options Opções Javascript para amostragem * @return string Tag de formulário */ function form($modelName, $options) { /* * Prepara para que o Ajax saiba que esta requisição é por um <form> */ $options['form'] = true; /* * Opcional, caso o usuário digite a opções 'method' em vez de 'type' */ if (!empty($options["method"])) { $options["type"] = $options["method"]; } /* * */ $uid = isset($options['id']) ? $options['id'] : $this->randomizeId(); $idString = 'id="' . $uid . '"'; $options['url'] = translateUrl($options['url']); $conteudo = '<form action="' . $options['url'] . '" ' . $idString . ' onsubmit=\'' . $this->remoteFunction($options) . '; return false;\' method="' . (isset($options['type']) ? $options['type'] : 'GET') . '" class="formHelper">'; if (!empty($this->_loadedHelpers["Form"])) { $this->_loadedHelpers["Form"]->create($modelName, array(), true); } return $conteudo; }
/** * Redireciona o cliente para o endereço $url indicado. * * Se $url é uma array, trata-a para um endereço válido * * @param string $url Endereço Url válido a ser aberto * @return boolean Retorna falso se não conseguir redirecionar */ function redirect($url, $autoExit = true) { /** * Segurança: se $url for array */ $url = translateUrl($url); /** * Redireciona */ if (!empty($url)) { header("Status: 200"); //if needed for IE6 header("Cache-Control: no-cache"); header("Expires: -1"); $host = $_SERVER['HTTP_HOST']; $url = "http://" . $host . $url; header("Location: " . $url); if ($autoExit) { exit; } return false; } else { return false; } }