Esempio n. 1
0
 /**
  * Obtiene los datos del usuario desde la variable de sesion
  * @return mixed Devuelve el usuario o false
  */
 public static function getUser()
 {
     $data = \Supernova\Session::read('AuthUser');
     if ($data) {
         $User = \Supernova\Crypt::decrypt($data);
         return $User;
     }
     return false;
 }
Esempio n. 2
0
 /**
  * Genera cache del modelo
  * @param  string $model Nombre del modelo
  * @return null
  */
 public static function generate($model)
 {
     $dirName = ROOT . DS . 'Cache';
     if (!file_exists($dirName)) {
         mkdir($dirName, 0777, true);
     }
     chdir($dirName);
     $table = \Supernova\Inflector::camelToUnder(\Supernova\Inflector::pluralize($model));
     $fields = \Supernova\Sql::getFields($table);
     file_put_contents($model, \Supernova\Crypt::encrypt(http_build_query($fields)));
     chmod($model, 0777);
 }
Esempio n. 3
0
 /**
  * Muestra cuadro de Error
  * @param  integer $type    Numero de error
  * @param  string $message Mensaje de error
  * @param  string $file    Archivo de error
  * @param  string $line    Linea de error
  * @param  string $str     Depurado de error
  */
 public static function renderError($type, $message = "", $file = "", $line = "", $str = "")
 {
     $fullfile = $file;
     $file = str_replace(ROOT . DS, '', $file);
     if (ob_get_contents()) {
         ob_end_clean();
     }
     if (!defined("ENVIRONMENT") || ENVIRONMENT == "dev") {
         $errorColor = in_array($type, array(E_ERROR, E_CORE_ERROR, E_USER_ERROR)) ? "#F6D8CE" : "#FFFFCC";
         echo self::style($errorColor);
         echo self::drawDebugBox($type, $line, $file, $message);
     }
     echo self::showLines(self::getLines($fullfile, $line), $line);
     $br = "\n";
     $text = $type . $br . $line . $br . $file . $br . $message . $br . implode($br, self::getLines($fullfile, $line));
     $encodedError = \Supernova\Crypt::encrypt($text);
     //$encodedError = \Supernova\Crypt::decrypt($encodedError);
     \Supernova\View::callError(500, $encodedError);
 }