* @link http://www.pioder.pl/
* @license see LICENSE.txt
**/
define('IN_uF', true);
//include files
include('./config.php');
include('./includes/constants.php');
include('./includes/db.php');
include('./includes/errors.php');
//connect to database
DataBase::db_connect();
include('./includes/sessions.php');
include('./includes/classes/class_user.php');
include('./common.php');
include('./includes/misc_functions.php');
include('./includes/classes/class_forum.php');
include('./includes/classes/class_topic.php');
include('./includes/classes/class_mod.php');
include('./includes/classes/secure.php');
$default_lang = DefaultLang();
include('./lngs/'.$default_lang.'/main.php');
$tid = intval($_GET['t']);
$start = TimeGeneration();
SessDelInvalid();
SessRegister();
SessDeleteOld();
$default_skin = ViewSkinName();
include('./includes/cache/cache_topic.php');
$forum_locked = $forum['lock'];
//add skin variables
$skin = array(
'lreply'=>(($topic['lock']==1) or ($forum_locked==1)) ?
''
:
'
'
);
$skin = array_push_assoc($skin, GenerateHeader($lng['showtopic'].': '.$topic['name'], '> '.$forum['name'].' > '.$topic['name']));
//do it!
include('./skins/'.$default_skin.'/overall_header.tpl');
include('./skins/'.$default_skin.'/topic_body.tpl');
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".*, ".USERS_TABLE.".u_id AS user_id,".SESSIONS_TABLE.".* FROM `".POSTS_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id LEFT JOIN ".SESSIONS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE t_id='$tid' ORDER BY tp_id $limit;";
$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain post information.');
while($item=DataBase::fetch($query))
{
$ua = UserAgent($item['user_agent']);
$warn_pool = ($forum_config['allow_warns'] && $forum_config['warns_in_topic'] ) ? (isset($user_warnlevel[$item['u_id']])) ?
''.$lng['warns'].':
'.($user_warnlevel[$item['u_id']]*10).'%' : ''.$lng['warns'].':
0%' : ' ';
$skin = array(
'tp_id' => $item['tp_id'],
'p_id' => $item['p_id'],
'u_id' => $item['user_id'],
'username' => Topic::UserName($item['nick'], $item['rank']),
'pdate' => GenerateTime($item['ptime']),
'user_gg' => (($item['allow_gg'])&& ($item['gg']!='0')) ?
'
' : '',
'edit' => ($_SESSION['uid']>0) ? (($item['u_id']==$_SESSION['uid']) ||(RANK>0)) ?
'
' : '' : '',
'userrank' => User::UserRank($item['rank']),
'avatar' => ($item['avatar']!='') ? '' : '',
'posttext' => Topic::PostText($item['text'], $item['moderated'], $item['p_id']),
'sig'=>($item['sig']!='') ? '
----------------
'.$item['sig'] : '',
'posts'=>$item['posts'],
'regdate' => date('d-m-Y',$item['regdate']),
'lastvisit' => date('d-m-Y',$item['lastvisit']),
'warns_pool' => $warn_pool,
'lstat'=>$lng['stat'],
'rowspan'=> ($_SESSION['uid']>0) ? ((RANK>0) ? '3' : '2') : '2',
'L.IP' => ($_SESSION['uid']>0) ? ((($forum_config['ip_post_for_mod'] && (RANK>0)) || (RANK==2) ) ? 'IP: '.$item['post_ip'].' (WHOIS)
' : '') : '',
'IP'=>$item['post_ip'],
'admin'=>$lng['admin_mod_administration'],
'mode_p_del' => ($item['tp_id']!='1') ?
'
' : '',
'ban'=> $lng['ban'],
'edit_profile'=>$lng['edit_profile'],
'add_warn'=>$lng['add_warn'],
'online'=>($item['time']!=NULL) ? (($item['time']+1250)>time()) ? 'online.gif' : 'offline.gif' : 'offline.gif',
//labels
'L.warns'=>$lng['warns'],
'lang'=>$default_lang,
'L.date'=>$lng['date'],
'llastvisit'=>$lng['lulastvisit'],
'lregdate'=>$lng['regdate2'],
'lposts'=>$lng['posts'],
'ua_system'=>$ua[0],
'ua_system_desc'=>$lng['system'].' '.$ua[2],
'ua_browser'=>$ua[1],
'ua_browser_desc'=>$lng['browser'].' '.$ua[3],
'L.no'=>$lng['no.'],
'L.p_info'=>$lng['postinfo'],
'lpost'=>$lng['post'],
'C.delete_post'=>$lng['c_delete_post']
);
//do it!
include('./skins/'.$default_skin.'/topic_post_body.tpl');
}
//generate end template variables
$skin = array(
'functions_moderate'=> ($_SESSION['uid']>0) ? (RANK>0) ? './skins/'.$default_skin.'/topic_mod_body.tpl' : './skins/'.$default_skin.'/blank.tpl' : './skins/'.$default_skin.'/blank.tpl',
'lock' => ($topic['lock']==1) ? '' : '',
'stick' => ($topic['sticky']==1) ? '
'
: '',
'lmod' => $lng['lmod'],
'c_delete_topic'=>$lng['c_delete_topic'],
'option_pages'=>ListPages($page, $count),
'lwith'=>$lng['with'],
'lpage'=>$lng['page'],
'lpages'=>$count
);
$skin['lreply']=(($topic['lock']==1) or ($forum_locked==1))
? '' : '
0) and ($topic['lock']==0) and ($forum_locked==0) and ($userdata['allow_qr']=='1'))
{
include './quick_reply.php';
}
if($_SESSION['uid']>0)
{
if(RANK==2)
{
$skin['pa_link']=''.$lng['pa_link'].'';
}
else
{
$skin['pa_link']='';
}
}
else
{
$skin['pa_link']='';
}
$stop = TimeGeneration();
$skin['queries'] = ShowQueries($start, $stop);
include('./skins/'.$default_skin.'/overall_footer.tpl');
?>