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]
}
 protected function init_cookies()
 {
     if ($this->request()->format() == "xml" || $this->request()->format() == "json") {
         return;
     }
     $forum_posts = ForumPost::where("parent_id IS NULL")->order("updated_at DESC")->limit(10)->take();
     $this->cookies()->current_forum_posts = json_encode(array_map(function ($fp) {
         if (current_user()->is_anonymous()) {
             $updated = false;
         } else {
             $updated = $fp->updated_at > current_user()->last_forum_topic_read_at;
         }
         return [$fp->title, $fp->id, $updated, ceil($fp->response_count / 30.0)];
     }, $forum_posts->members()));
     $this->cookies()->country = current_user()->country;
     if (!current_user()->is_anonymous()) {
         $this->cookies()->user_id = (string) current_user()->id;
         $this->cookies()->user_info = current_user()->user_info_cookie();
         $this->cookies()->has_mail = current_user()->has_mail ? "1" : "0";
         $this->cookies()->forum_updated = current_user()->is_privileged_or_higher() && ForumPost::updated(current_user()) ? "1" : "0";
         $this->cookies()->comments_updated = current_user()->is_privileged_or_higher() && Comment::updated(current_user()) ? "1" : "0";
         if (current_user()->is_janitor_or_higher()) {
             $mod_pending = Post::where("status = 'flagged' OR status = 'pending'")->count();
             $this->cookies()->mod_pending = (string) $mod_pending;
         }
         if (current_user()->is_blocked()) {
             if (current_user()->ban) {
                 $this->cookies()->block_reason = "You have been blocked. Reason: " . current_user()->ban->reason . ". Expires: " . substr(current_user()->ban->expires_at, 0, 10);
             } else {
                 $this->cookies()->block_reason = "You have been blocked.";
             }
         } else {
             $this->cookies()->block_reason = "";
         }
         $this->cookies()->resize_image = current_user()->always_resize_images ? "1" : "0";
         $this->cookies()->show_advanced_editing = current_user()->show_advanced_editing ? "1" : "0";
         $this->cookies()->my_tags = current_user()->my_tags;
         $this->cookies()->blacklisted_tags = json_encode(current_user()->blacklisted_tags_array());
         $this->cookies()->held_post_count = (string) current_user()->held_post_count();
     } else {
         $this->cookies()->delete('user_info');
         $this->cookies()->delete('login');
         $this->cookies()->blacklisted_tags = json_encode(CONFIG()->default_blacklists);
     }
     if ($this->session()->notice) {
         $this->cookies()->notice = $this->session()->notice;
         $this->session()->delete('notice');
     }
 }