<?php
if(!defined('DATALIFEENGINE'))
{
  die("Hacking attempt!");
}
	$subaction = $_REQUEST['subaction'];
	
	switch ($subaction)
	{
		case "":
		
		echo_top();
		
		echo_top('1');

		echo_title('Î÷èñòêà æóðíàëà ïîäïèñîê íà òåìû');
		
		echo "<form method=\"post\" action=\"$PHP_SELF?mod=forum&action=service&subaction=subscription\">
		<table border=\"0\" width=\"100%\">
		<tr>
		<td width=\"260\">{$f_lg['titles_uname']}</td>
		<td><input class=\"edit\" type=\"text\" name=\"user_name\" value=\"\" size=\"27\"> {$f_lg['svce_full']}</td></tr>
		<tr><td colspan=\"2\"><div class=\"hr_line\"></div></td></tr>
		<tr>
		<td width=\"260\">&nbsp;</td>
		<td><input type=\"submit\" class=\"buttons\" value=\"{$f_lg['button_start']}\"></td></tr>
		</table></form>";
		
		echo_bottom('1');
		
		echo_top('1');
		
		echo_top('1');
		
		echo_title('Î÷èñòêà æóðíàëà ïðîñìîòðà òåì');
		
		echo "<form method=\"post\" action=\"$PHP_SELF?mod=forum&action=service&subaction=views\">
		Áóäåò î÷èùåí æóðíàë ïðîñìîòðà òåì. Âñå òåìû äî äàííîãî âðåìåíè áóäóò èìåòü ñòàòóñ ïðî÷èòàííûõ.
		<table border=\"0\" width=\"100%\">
		<tr>
		<tr><td colspan=\"2\"><div class=\"hr_line\"></div></td></tr>
		<tr>
		<td width=\"260\">&nbsp;</td>
		<td><input type=\"submit\" class=\"buttons\" value=\"{$f_lg['button_start']}\"></td></tr>
		</table></form>";
		
		echo_bottom('1');
		
		echo_top('1');
		
		echo_title('Î÷èñòêà æóðíàëà ãîëîñîâàíèé');
		
		echo "<form method=\"post\" action=\"$PHP_SELF?mod=forum&action=service&subaction=poll\">
		Ïðè î÷èñòêå æóðíàëà, ïîëüçîâàòåëè ñìîãóò ïîâòîðíî ãîëîñîâàòü.
		<table border=\"0\" width=\"100%\">
		<tr>
		<tr><td colspan=\"2\"><div class=\"hr_line\"></div></td></tr>
		<tr>
		<td width=\"260\">&nbsp;</td>
		<td><input type=\"submit\" class=\"buttons\" value=\"{$f_lg['button_start']}\"></td></tr>
		</table></form>";
		
		echo_bottom('1');
		
		echo_bottom();
		
		break;

// ********************************************************************************
// SUBSCRIPTION
// ********************************************************************************
		case "subscription":
		
		$user_name = $db->safesql($_REQUEST['user_name']);
		
		if ($user_name)
		{
			$row = $db->super_query("SELECT user_id FROM " . PREFIX . "_users WHERE name = '{$user_name}'");
		}
		
		if ($row['user_id'])
		{
			$db->query("DELETE FROM " . PREFIX . "_forum_subscription WHERE user_id = '{$row['user_id']}'");
		}
		
		if (!$user_name)
		{
			$db->query("TRUNCATE TABLE " . PREFIX . "_forum_subscription");
		}
		
		header("Location: ?mod=forum&action=service");
		
		break;

// ********************************************************************************
// VIEWS LOG
// ********************************************************************************
		case "views":
		
		$db->query("TRUNCATE TABLE " . PREFIX . "_forum_views");
		
		$db->query("UPDATE " . PREFIX . "_users SET forum_last = '".time()."', forum_time = '".time()."'");
		
		$_SESSION['member_lasttime'] = time();
		
		header("Location: ?mod=forum&action=service");
		
		break;

// ********************************************************************************
// POLL LOG
// ********************************************************************************
		case "poll":
		
		$db->query("TRUNCATE TABLE " . PREFIX . "_forum_poll_log");
		
		header("Location: ?mod=forum&action=service");
		
		break;
		
	}
	
?>