|
@@ -43,20 +43,13 @@ class Session {
|
|
|
static::$session = static::driver()->load($id);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
-
|
|
|
if (is_null($id) or is_null(static::$session) or static::expired(static::$session['last_activity']))
|
|
|
{
|
|
|
static::$session['id'] = Str::random(40);
|
|
|
static::$session['data'] = array();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if ( ! static::has('csrf_token'))
|
|
|
{
|
|
|
static::put('csrf_token', Str::random(16));
|
|
@@ -110,7 +103,7 @@ class Session {
|
|
|
return static::$session['data'][':new:'.$key];
|
|
|
}
|
|
|
|
|
|
- return $default;
|
|
|
+ return is_callable($default) ? call_user_func($default) : $default;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -165,13 +158,6 @@ class Session {
|
|
|
*/
|
|
|
public static function regenerate()
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
static::driver()->delete(static::$session['id']);
|
|
|
|
|
|
static::$session['id'] = Str::random(40);
|
|
@@ -184,21 +170,14 @@ class Session {
|
|
|
*/
|
|
|
public static function close()
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
static::flash('laravel_old_input', Input::get());
|
|
|
|
|
|
static::age_flash();
|
|
|
|
|
|
static::driver()->save(static::$session);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if ( ! headers_sent())
|
|
|
{
|
|
|
$minutes = (Config::get('session.expire_on_close')) ? 0 : Config::get('session.lifetime');
|
|
@@ -206,10 +185,7 @@ class Session {
|
|
|
Cookie::put('laravel_session', static::$session['id'], $minutes, Config::get('session.path'), Config::get('session.domain'), Config::get('session.https'));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if (mt_rand(1, 100) <= 2)
|
|
|
{
|
|
|
static::driver()->sweep(time() - (Config::get('session.lifetime') * 60));
|
|
@@ -223,9 +199,6 @@ class Session {
|
|
|
*/
|
|
|
private static function age_flash()
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
foreach (static::$session['data'] as $key => $value)
|
|
|
{
|
|
|
if (strpos($key, ':old:') === 0)
|
|
@@ -234,10 +207,6 @@ class Session {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
foreach (static::$session['data'] as $key => $value)
|
|
|
{
|
|
|
if (strpos($key, ':new:') === 0)
|