<?php
		if(!preg_match("/^([a-zA-Z0-9_.]{1,60})$/",$di,$m)){
			page($_s['pages_dir'].'/'.$_s['error404']);
		} else {

		if ($post=post_info($di)) {
		$nav = getnext($post['timestamp']);

		if($post['nocomm']) $_s['comments']=0;

		br();
		admenu($post['id']);

		if(!isset($post['name'])) $post['name']=$_s['authorname'];
		if (@sizeof($_s['_prepost'])>0) foreach ($_s['_prepost'] as $f) $f();

		include_once($_s['tpl_dir'].'/'.$_s['tpl_post']);

		if(!$_s['nocmt']) {
		e('<a name=cmt></a>');

		$comment = @file($_s['comm_dir'].'/'.$post['id']);
		for ($i=0; $i < $post['c_count']; $i++)
		{
		$c = explode('¦¦', $comment[$i]);
			$cmnt['i']=$i;
			$cmnt['nick'] = $cmnt['nk']= $c[0];
			$cmnt['url'] = 'http://'.$c[2];
			$cmnt['www'] = @str_replace('www.','',$c[2]);
			$cmnt['mail'] = '';
			$cmnt['amail']=$c[3];
			if(is_admin() && trim($c[3])) $cmnt['mail'] = str_replace('%mail%',$c[3],$_l['mail']);
			$cmnt['ip'] = '';
			$cmnt['bufip'] = $c[4];
			if(is_admin()) $cmnt['ip'] = str_replace('%ip%',$c[4],$_l['ip']);
			$cmnt['date'] = date($_s['datecmt'], $c[5]+$_s['time_offset']);
			$cmnt['text'] = $c[6];
			@$post['name']=$post['author'];

				if (is_admin()) $cmnt['menu'] = '<sup><a href="'.cmtedlink($cmnt['i'],$_v[$_lk['pt']]).'">E</a> '.@$_tpl['mmcm'].' <a href="'.cmtdelink($cmnt['i'],$_v[$_lk['pt']]).'" '.cd().'>X</a> '.@$_tpl['mmcm'].'</sup>';

				@$cmnt['text'] = preg_replace("#\[user:(.*)\]#sU", "<b>\\1</b>", $cmnt['text']);

				if($c[7]==1) include($_s['tpl_dir'].'/'.$_s['tpl_acomment']);
				else include($_s['tpl_dir'].'/'.$_s['tpl_comment']);

				unset($c);
		}
		if ($_s['comments']) include_once($_s['tpl_dir'].'/'.$_s['tpl_commform']);
	}
} else if (is_admin()) { $_v[$_lk['act']]=$_lk['ptnw']; include($_s['core_dir'].'/act/'.$_lk['ptnw']); }
else page($_s['pages_dir'].'/'.$_s['error404']);
}
?>