示例#1
0
 public function getModel($name)
 {
     // If during the session class definitions has changed, this will throw an exception.
     try {
         return unserialize($this->get($name));
     } catch (Exception $e) {
         Dump::warn('Model definition changed during cookie period');
         return false;
     }
 }
示例#2
0
文件: Json.php 项目: nabble/ajde-core
 public function getBody()
 {
     $body = json_encode($this->get('body'));
     if (Config::get('debug')) {
         if (Dump::getAll()) {
             foreach (Dump::getAll() as $source => $var) {
                 //if ($var[1] === true) { $expand = true; }
                 $body .= "<pre class='xdebug-var-dump'>" . var_export($var[0], true) . "</pre>";
             }
         }
     }
     return $body;
 }
示例#3
0
文件: User.php 项目: nabble/ajde-core
 public function createHash($password)
 {
     // @see http://net.tutsplus.com/tutorials/php/understanding-hash-functions-and-keeping-passwords-safe/
     if (CRYPT_BLOWFISH !== 1) {
         Dump::warn('BLOWFISH algorithm not available for hashing, using MD5 instead');
         // Use MD5
         $algo = '$1';
         $cost = '';
         $unique_salt = $this->generateSecret(12);
     } else {
         // Use BLOWFISH
         $algo = '$2a';
         $cost = '$10';
         $unique_salt = $this->generateSecret(22);
     }
     $hash = crypt($password, $algo . $cost . '$' . $unique_salt);
     if (empty($hash)) {
         // TODO:
         throw new Exception('crypt() algorithm failed');
     }
     return $hash;
 }