/** * Computes salted password hash. * @param string * @return string */ public static function calculateHash($password, $salt = null) { if ($salt === null) { $salt = '$2a$07$' . Nette\Utils\Strings::random(32) . '$'; } return crypt($password, $salt); }
/** * @return void */ public function __destruct() { if (self::$fixIE && isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE ') !== FALSE && in_array($this->code, array(400, 403, 404, 405, 406, 408, 409, 410, 500, 501, 505), TRUE) && preg_match('#^text/html(?:;|$)#', $this->getHeader('Content-Type', 'text/html'))) { echo Nette\Utils\Strings::random(2000.0, " \t\r\n"); // sends invisible garbage for IE self::$fixIE = FALSE; } }