Exemplo n.º 1
0
 public static function getCsrf($resquestData)
 {
     $metodo = filter_input(INPUT_SERVER, 'REQUEST_METHOD');
     $hash_request = $resquestData['hash'];
     $hash_atual = isset($_SESSION["hash"]) ? $_SESSION["hash"] : null;
     $_SESSION["hash"] = sha1(md5("cli12ente412cohe1241cido21414" + time()));
     if ($hash_atual == null) {
         return $_SESSION["hash"];
     }
     if ($hash_atual != $hash_request && $metodo != "GET") {
         HB_Error_Helper::Erro_404('Operação ilegal. Requisição não veio de um cliente permitido: ');
     }
     return $_SESSION["hash"];
 }
Exemplo n.º 2
0
function hb_error_handler($severity, $message, $filepath, $line)
{
    HB_Error_Helper::setError($severity, $message, $filepath, $line);
}
Exemplo n.º 3
0
 protected function msgErro($msg, $status = 500)
 {
     HB_Error_Helper::Erro($msg, $status);
 }
Exemplo n.º 4
0
 private function preencheObjeto($myClass, array $array, $caminho)
 {
     $pathClass = $caminho . $myClass . '.php';
     if (is_file($pathClass) && !is_dir($pathClass)) {
         require_once $pathClass;
         $object = new $myClass();
         foreach ($array as $key => $value) {
             $key = ucfirst($key);
             if (is_array($value)) {
                 $value = $this->preencheObjeto($key, $value, $caminho);
             }
             $metodoAhSerInvocado = 'set' . $key;
             if (method_exists($object, $metodoAhSerInvocado) || REQUIRED_PROPERTIES_INJECTOR) {
                 $metodoReflexionado = new ReflectionMethod($myClass, $metodoAhSerInvocado);
                 $retorno = $metodoReflexionado->invoke($object, $value);
             }
         }
         return $object;
     } else {
         HB_Error_Helper::Erro_404("<p><strong>Classe não encontrada.</strong><br/>{$pathClass}</p>");
     }
     return NULL;
 }