Beispiel #1
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);
 }
Beispiel #2
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);
 }
Beispiel #3
0
 /**
  * Crea una variable de sesion "AuthUser" con los datos encriptados del usuario
  * @param array $data Datos del usuario
  */
 public static function setUser($data)
 {
     \Supernova\Session::create('AuthUser', \Supernova\Crypt::encrypt($data));
 }