/** * session * * @param string $key * @param mixed $value * @return mixed */ function session($key = null, $value = null) { if ($key === null && $value === null) { return Session::toArray(); } if (Session::has($key)) { return Session::get($key); } if ($key !== null && $value !== null) { return Session::add($key, $value); } return null; }
/** * Vérifie si token csrf est valide * * @param string $token le token a vérifié * @param bool $strict le niveau de vérification * * @return boolean */ public static function verifyCsrfToken($token, $strict = false) { $status = false; if (Session::has('bow.csrf')) { if ($token === Session::has('bow.csrf')->token) { $status = true; if ($strict) { $status = $status && static::tokenCsrfTimeIsExpirate(time()); } } } return $status; }