Ejemplo n.º 1
0
 public function migrate($destroy = false, $lifetime = 86400)
 {
     parent::migrate($destroy, null);
     $session_id = $this->getId();
     cookie_remove('chestnut_session');
     cookie('chestnut_session', $session_id, $lifetime);
 }
Ejemplo n.º 2
0
 public function check($token = null)
 {
     if (is_null($token)) {
         return false;
     }
     if ($token = $this->decodeJsonWebToken($token)) {
         if (time() > $token->expire) {
             cookie_remove('jwt');
             return false;
         }
         if ($token->aud !== $this->app->config->get('app.domain')) {
             return false;
         }
         return $this->boot($token->iss);
     } else {
         return false;
     }
 }
function init_cookies()
{
    if (Request::$format != 'html' || Request::$format == 'json') {
        return;
    }
    // $forum_posts = ForumPost::find('all', array('order' => "updated_at DESC", 'limit' => 10, 'conditions' => "parent_id IS NULL"));
    // foreach($forum_posts as $fp) {
    // $updated = User::$current->is_anonymous ? false : $fp->updated_at > User::$current->last_forum_topic_read_at;
    // $fp_cookies[] = array($fp->updated_at, $fp->id, $updated, ceil($fp->response_count/30));
    // }
    // Cookies::$list["current_forum_posts"] = to_json($fp_cookies);
    // Cookies::$list["country"] = $current_user_country;
    // vde(User::$current->is_anonymous);
    if (!User::$current->is_anonymous) {
        cookie_put("user_id", (string) User::$current->id);
        cookie_put("user_info", User::$current->user_info_cookie());
        // Cookies::$list["has_mail"] = User::$current->has_mail() ? "1" : "0";
        cookie_put("forum_updated", User::$current->is(">=30") && ForumPost::updated(User::$current) ? "1" : "0");
        // Cookies::$list["comments_updated"] = User::$current->is(">=30") && Comment::updated(User::$current) ? "1" : "0";
        // if(User::$current->is(">=35")) {
        // $mod_pending = Post::count(array('conditions' => array("status = 'flagged' OR status = 'pending'")));
        // cookies["mod_pending"] = $mod_pending;
        // }
        // if(User::$current->is_blocked()) {
        // if(User::$current->ban)
        // Cookies::$list["block_reason"] = "You have been blocked. Reason: ".User::$current->ban->reason.". Expires: ".substr(User::$current->ban->expires_at, 0, 10);
        // else
        // Cookies::$list["block_reason"] = "You have been blocked.";
        // } else
        // Cookies::$list["block_reason"] = "";
        cookie_put("resize_image", User::$current->always_resize_images ? "1" : "0");
        cookie_put('show_advanced_editing', User::$current->show_advanced_editing ? "1" : "0");
        // Cookies::$list["my_tags"] = User::$current->my_tags;
        // $a = explode("\r\n", User::$current->blacklisted_tags());
        // vde($a);
        cookie_rawput('blacklisted_tags', str_replace('%0D%0A', '&', urlencode(User::$current->blacklisted_tags())));
        // ["blacklisted_tags"] = User::$current->blacklisted_tags_array;
        cookie_put("held_post_count", User::$current->held_post_count());
    } else {
        cookie_remove('user_info');
        cookie_remove('login');
        // Cookies::$list["blacklisted_tags"] = str_replace('%0D%0A', '&', urlencode(implode("\r\n", CONFIG::$default_blacklists)));
        // Cookies::rawput
        cookie_rawput('blacklisted_tags', str_replace('%0D%0A', '&', urlencode(implode("\r\n", CONFIG::$default_blacklists))));
    }
    // if flash[:notice] then
    // cookies["notice"] = flash[:notice]
}
Ejemplo n.º 4
0
//  / ___/__  ___  / /________  / / / _ \___ ____  ___ / /
// / /__/ _ \/ _ \/ __/ __/ _ \/ / / ___/ _ `/ _ \/ -_) / 
// \___/\___/_//_/\__/_/  \___/_/ /_/   \_,_/_//_/\__/_/ 
// =========================================================================
// Copyright (c) Stargames Control Panel - Licensed under GNU GPL.
// See LICENSE File
// =========================================================================
// Project Lead by: Mysterious
// =========================================================================
-->
<?php 
if (!$SERVER['system_safe']) {
    exit;
}
if ($CONFIG_save_type == 1) {
    cookie_remove(1);
    session_start();
    session_register("loginname");
    session_register("loginpass");
    session_register("userlang");
    session_register("usertheme");
}
getglobalvar(2);
if (empty($STORED_userlang)) {
    $STORED['LANG'] = $CONFIG_language;
} else {
    $dir = "lang/" . $STORED_userlang . ".php";
    if (is_file($dir)) {
        $STORED['LANG'] = $STORED_userlang;
    } else {
        if ($CONFIG_save_type == 1) {
Ejemplo n.º 5
0
<?php

set_title('Logout');
session_regenerate_id();
session_destroy();
$_SESSION = array();
session_start();
cookie_remove('login');
cookie_remove('pass_hash');
$dest = isset(Request::$params->from) ? Request::$params->from : '#home';
respond_to_success("You are now logged out", $dest);
Ejemplo n.º 6
0
 function logout()
 {
     cookie_remove("login");
     cookie_remove("pass_hash");
     cookie_remove("user_info");
     cookie_remove("held_post_count");
     cookie_remove("show_advanced_editing");
     session_unset();
 }
Ejemplo n.º 7
0
 public function boot()
 {
     $this->callMiddleware();
     $this->dispatch();
     if (!$this->request->isAjax()) {
         $xsrf_token = time() . $this->auth->getAccount();
         session('xsrf_token', $xsrf_token);
         cookie_remove('chestnut_xsrf_token');
         cookie('chestnut_xsrf_token', $xsrf_token);
     }
     $this->response->send();
 }