Просмотр файла modules/user/notify.php

Размер файла: 1.37Kb
<?php
if(!isset($user)) { header('location: /'); exit; }
$locate = 'in_cabinet';
$title	= $lang->word('notify');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('notify'));
$notify_r = $db->query("SELECT * FROM `notify` WHERE `user_id` = '". $user['id'] ."' AND `read` = '0'")->rowCount();
$pages = new Paginator($notify_r, $ames);
if($notify_r == 0)
	{
		$tpl->div('menu', $lang->word('notify_no'));
	}
else
	{
		$notify_q = $db->query("SELECT * FROM `notify` WHERE `user_id` = '". $user['id'] ."' AND `read` = '0' ORDER BY time DESC LIMIT $start, $ames");
		while($notify = $notify_q->fetch())
			{
				$db->query("UPDATE `notify` SET `read` = '1' WHERE `id` = '". $notify['id'] ."' AND `type` != 'notify_topic_reply'");
				echo '<div class="menu">
						'.rtime($notify['time']).'<br/>
						'.$lang->word('user').' <a href="/user/'.$notify['from_id'].'?">'. tnick($notify['from_id']) .'</a> '.$lang->word($notify['type']).' <br/>
						'.($notify['type'] == 'notify_topic_reply' ? '[<a href="/forum/topic'.$notify['request_id'].'?page=end">'. $lang->word('read') .'</a>]' : NULL).'
					</div>';
			}
		$pages->view('/user/notify?');
	}
echo '<div class="block">
		'. NAV .' <a href="/user/panel">'. $lang->word('user_panel') .'</a><br/>
		'. HICO .' <a href="/">'. $lang->word('home') .'</a><br/>
	</div>';
require_once(SYS.'/view/footer.php');
?>