function MakeAll() { try { $cronometro = new clsCronometro(); $cronometro->marca('inicio'); $liberado = TRUE; $saida_geral = ''; if ($this->convidado) { @session_start(); $_SESSION['convidado'] = TRUE; $_SESSION['id_pessoa'] = '0'; session_write_close(); } $controlador = new clsControlador(); if ($controlador->Logado() && $liberado || $this->convidado) { $this->Formular(); $this->VerificaPermicao(); $this->CadastraAcesso(); $saida_geral = $this->MakeHeadHtml(); if ($this->renderMenu) { $saida_geral .= $this->MakeBody(); } else { foreach ($this->clsForm as $form) { $saida_geral .= $form->RenderHTML(); } } $saida_geral .= $this->MakeFootHtml(); if ($_GET['suspenso'] == 1 || $_SESSION['suspenso'] == 1 || $_SESSION["tipo_menu"] == 1) { if ($this->renderMenuSuspenso) { $saida_geral = str_replace("<!-- #&MENUSUSPENSO&# -->", $this->makeMenuSuspenso(), $saida_geral); } if ($_GET['suspenso'] == 1) { @session_start(); $_SESSION['suspenso'] = 1; @session_write_close(); } } } elseif (empty($_POST['login']) || empty($_POST['senha']) && $liberado) { $saida_geral .= $this->MakeHeadHtml(); $controlador->Logar(FALSE); $saida_geral .= $this->MakeFootHtml(); } else { $controlador->Logar(TRUE); if ($controlador->Logado() && $liberado) { $this->Formular(); $this->VerificaPermicao(); $this->CadastraAcesso(); $saida_geral = $this->MakeHeadHtml(); $saida_geral .= $this->MakeBody(); $saida_geral .= $this->MakeFootHtml(); } else { $saida_geral = $this->MakeHeadHtml(); $controlador->Logar(false); $saida_geral .= $this->MakeFootHtml(); } } echo $saida_geral; $cronometro->marca('fim'); $tempoTotal = $cronometro->getTempoTotal(); $tempoTotal += 0; $objConfig = new clsConfig(); if ($tempoTotal > $objConfig->arrayConfig["intSegundosProcessaPagina"]) { $conteudo = "<table border=\"1\" width=\"100%\">"; $conteudo .= "<tr><td><b>Data</b>:</td><td>" . date("d/m/Y H:i:s", time()) . "</td></tr>"; $conteudo .= "<tr><td><b>Script</b>:</td><td>{$_SERVER["PHP_SELF"]}</td></tr>"; $conteudo .= "<tr><td><b>Tempo de processamento</b>:</td><td>{$tempoTotal} segundos</td></tr>"; $conteudo .= "<tr><td><b>Tempo max permitido</b>:</td><td>{$objConfig->arrayConfig["intSegundosProcessaPagina"]} segundos</td></tr>"; $conteudo .= "<tr><td><b>URL get</b>:</td><td>{$_SERVER['QUERY_STRING']}</td></tr>"; $conteudo .= "<tr><td><b>Metodo</b>:</td><td>{$_SERVER["REQUEST_METHOD"]}</td></tr>"; if ($_SERVER["REQUEST_METHOD"] == "POST") { $conteudo .= "<tr><td><b>POST vars</b>:</td><td>"; foreach ($_POST as $var => $val) { $conteudo .= "{$var} => {$val}<br>"; } $conteudo .= "</td></tr>"; } elseif ($_SERVER["REQUEST_METHOD"] == "GET") { $conteudo .= "<tr><td><b>GET vars</b>:</td><td>"; foreach ($_GET as $var => $val) { $conteudo .= "{$var} => {$val}<br>"; } $conteudo .= "</td></tr>"; } if ($_SERVER['HTTP_REFERER']) { $conteudo .= "<tr><td><b>Referrer</b>:</td><td>{$_SERVER["HTTP_REFERER"]}</td></tr>"; } $conteudo .= "</table>"; $objMail = new clsEmail($objConfig->arrayConfig['ArrStrEmailsAdministradores'], "[INTRANET - PMI] Desempenho de pagina", $conteudo); $objMail->envia(); } } catch (Exception $e) { $lastError = error_get_last(); @session_start(); $_SESSION['last_error_message'] = $e->getMessage(); $_SESSION['last_php_error_message'] = $lastError['message']; $_SESSION['last_php_error_line'] = $lastError['line']; $_SESSION['last_php_error_file'] = $lastError['file']; @session_write_close(); error_log("Erro inesperado (pego em clsBase): " . $e->getMessage()); NotificationMailer::unexpectedError($e->getMessage()); die("<script>document.location.href = '/module/Error/unexpected';</script>"); } }
public function logInUser() { $controlador = new clsControlador(); // #TODO migrar para Portabilis_Utils_User carregar usuário usando funcionario data mapper // e então nesta classe usar $this->getEntity $user = Portabilis_Utils_User::load($id = $this->getEntity()->ref_cod_pessoa_fj); if ($controlador->canStartLoginSession($user)) { $controlador->startLoginSession($user, '/intranet/index.php'); } $this->messenger()->merge($controlador->messages); }