<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
	$mod_template="post.tpl";

	$posts=Db::i()->select("SELECT fp.user_id, fp.post_id, IF (u.user_id>0, login, fp.user_name) as user_name, fp.msg, IF (u.user_id>0,u.email, fp.email) as email, UNIX_TIMESTAMP(putdate) as putdate, INET_NTOA(fp.ip) as ip, avatar 
						FROM ?_forum_posts fp 
						LEFT JOIN ?_users u ON fp.user_id=u.user_id
						WHERE fp.post_id=?
						", $forum_info['theme_id']);
	
	$post=$forum_info;
	
	$post['access_edit']=(($forum_info['user_id']==User::i()->id && access("edit")) || access("moderator")) ? 1 : 0;
	$post['access_delete']=0;
	
	$post['msg_html']=getbb($post['msg']);

	Tpl::i()->assign('post', $post); 
