<?php

if (!defined('IN_AJAX')) die(basename(__FILE__));

global $userdata;
	$user_id = (int) $userdata['user_id'];
	$rules_id = (int) $this->request['rules_id'];
	if(IS_GUEST) $this->ajax_die('Вы должны авторизоваться на трекере');
	$unserialize = !empty($userdata['user_showsrules']) ? $userdata['user_showsrules'] : 'a:1:{i:0;s:1:"0";}';
	if(in_array($rules_id, safe_unserialize($unserialize)))$this->ajax_die('Новость уже была скрыта');
	$sql = "SELECT id FROM ".BB_RULES." WHERE id=$rules_id LIMIT 1";

	if(DB()->fetch_row($sql))
	{
		$show_start = safe_unserialize($unserialize);
		array_push($show_start, "".$rules_id."");
		$user_decode = might_serialize($show_start);
		DB()->query("UPDATE ".BB_USERS." SET user_showsrules = '{$user_decode}' WHERE user_id = ".$user_id);
		cache_rm_user_sessions($userdata['user_id']);
		
	}else{
		$this->ajax_die('Нет такой новостяки');
	}
	$this->response['show'] = true;
	$this->response['rules_id'] = $rules_id;
