<? require_once('./templates/overall_header.tpl.php'); ?>
	<div id="content">
	<? if ($this->TPL['topic_info']['forum_locked'] == false && $this->TPL['topic_info']['topic_locked'] == false) { ?>
		<a href="index.php?mode=reply&amp;id=<?= $_GET['id']; ?>">
			<div class="btn">
				Reply
			</div>
		</a>
	<? } else { ?>
			<div class="btn">
				Locked
			</div>
	<? } ?>
		<br />
		
<?php
	for ($i=0; $i<count($this->TPL['posts_list']); $i++)
	{
		echo '
		<div class="forum_table">
			<div class="row">
				<div class="hc1 hcpost">&nbsp;</div>
				<div class="hc2 hcpost">&nbsp;</div>
				<div id="p'.$this->TPL['posts_list'][$i]['post_id'].'" class="hc4 hcpost f_hc4 post_3c">Post <a href="index.php?mode=viewtopic&amp;id='.$_GET['id'].'#p'.$this->TPL['posts_list'][$i]['post_id'].'">#'.($i+1).'</a></div>
			</div>			
			<div class="row">
				<div class="tc1 f_tc2" style="width: 120px">';
				if ($this->TPL['posts_list'][$i]['nick'] != null)
					echo '<a href="index.php?mode=viewprofile&amp;id='.$this->TPL['posts_list'][$i]['user_id'].'">'.$this->colorRank($this->TPL['posts_list'][$i]['nick'], $this->TPL['posts_list'][$i]['user_rank']).'</a>';
				else
					echo 'Anonymous';
				echo '<br>';
				
				if ($this->TPL['posts_list'][$i]['avatar'] != null)
					echo '<img src="'.$this->TPL['posts_list'][$i]['avatar'].'" alt="user avatar">';
				else
					echo '<img src="templates/images/no_av.gif" alt="user avatar">';
				echo '
				</div>
				<div class="tc3 post_content" >';
					
					echo BBCode($this->TPL['posts_list'][$i]['content']);
					
					if ($this->TPL['posts_list'][$i]['signature'] != null)
						echo '
						<br><br>
							<hr>
							<span class="fsmall">'.BBCode($this->TPL['posts_list'][$i]['signature']).'<br><br></span>';
				echo '	
				</div>
				<div class="tc4 post_3c f_tc2">
					<span class="fsmall">Posted: <span style="font-weight: bold">'.$this->TPL['posts_list'][$i]['date'].'</span></span><br>
					<a href="index.php?mode=quote&amp;id='.$_GET['id'].'&amp;q='.$this->TPL['posts_list'][$i]['post_id'].'">
						<div class="btn_small">
							Quote
						</div>
					</a>';
				if ($this->TPL['my_id'] == $this->TPL['posts_list'][$i]['user_id'])
				echo '
					<a href="index.php?mode=editpost&amp;id='.$this->TPL['posts_list'][$i]['post_id'].'">
						<div class="btn_small">
							Edit
						</div>
					</a>';
					
					echo '<br>';
					
					if ($this->TPL['my_rank'] >= RANK_MOD)
					echo '
					<div class="mod_pool">
						<span style="font-weight: bold">Mod options</span><br>
						<a href="index.php?mode=editpost&amp;id='.$this->TPL['posts_list'][$i]['post_id'].'">
							<div class="btn_small">
								Edit
							</div>
						</a>
						<a href="index.php?mode=moderate&amp;submode=deletepost&amp;id='.$this->TPL['posts_list'][$i]['post_id'].'">
							<div class="btn_small" style="width: 35px">
								X
							</div>
						</a>
					</div>';
			echo '
				</div>
			</div>
			
			<div class="row">
				<div class="tc1 post_3c tc2">
					<span class="fsmall">Status: <img src="templates/images/'.(($this->TPL['posts_list'][$i]['user_IP']) ? 'online' : 'offline').'.gif" alt="user status"></span>
				</div>
				<div class="tc1 ut">
					<div class="forum_table" style="box-shadow: none">
						<div class="tc2 ">
							<span class="fsmall">Posts: <span style="font-weight: bold">'.$this->TPL['posts_list'][$i]['user_post_count'].'</span></span>
						</div>
						<div class="tc2 p_uinfo">
							<span class="fsmall">Joined: <span style="font-weight: bold">'.$this->TPL['posts_list'][$i]['regdate'].'</span></span>
						</div>
						<div class="tc3 p_uinfo">
							<span class="fsmall">Last visit: <span style="font-weight: bold">'.(($this->TPL['posts_list'][$i]['lastvisit']!= null) ? $this->TPL['posts_list'][$i]['lastvisit'] : 'Never').'</span></span>
						</div>
					</div>
				</div>
				<div class="tc4 post_3c"><span class="fsmall">Rank: '.$this->getRankLevel($this->TPL['posts_list'][$i]['user_rank']).'</span></div>
			</div>
		</div>
		<br>';
		}
		?>
		
		<? if ($this->TPL['topic_info']['forum_locked'] == false && $this->TPL['topic_info']['topic_locked'] == false) { ?>
		<a href="index.php?mode=reply&amp;id=<?= $_GET['id']; ?>">
			<div class="btn">
				Reply
			</div>
		</a>
	<? } else { ?>
			<div class="btn">
				Locked
			</div>
	<? } ?>
		
		<? if ($this->TPL['my_rank'] >= RANK_MOD) { ?>
		<div class="forum_table topic_mod" style="">
			<div class="row">
				<div class="hc1 hc4 hcpost" style="padding: 0px; text-align: center">Actions</div>
			</div>
			<div class="row">
				<div class="tc1 tc4">
					<a href="index.php?mode=moderate&amp;submode=deletetopic&amp;id=<?= $_GET['id']; ?>">
						<img src="templates/images/delete.gif" alt="delete">
					</a>
					<a href="index.php?mode=moderate&amp;submode=locktopic&amp;id=<?= $_GET['id']; ?>">
						<img src="templates/images/<? if ($this->TPL['topic_info']['topic_locked']) echo 'un'; ?>lock.gif" alt="lock">
					</a>
					<a href="index.php?mode=moderate&amp;submode=movetopic&amp;id=<?= $_GET['id']; ?>">
						<img src="templates/images/move.gif" alt="move">
					</a>
				</div>
			</div>
		</div>
		<? } ?>
		<div style="clear: both">&nbsp;</div>
	</div>
	
<? require_once('./templates/overall_footer.tpl.php'); ?>