<?php /** * @package uForum * @file topic.php * @version $Id$ * @copyright 2009(c) PioDer <pioder@wp.pl> * @link http://pioder.gim2przemysl.int.pl/ * @license GNU GPL v3 **/ 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)) ? '<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/lock.gif" border="0" alt="reply">' : '<a href="posting.php?mode=rpost&id='.$_GET['t'].'"> <img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/reply.gif" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/reply_active.gif\';" onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/reply.gif\'" border="0" alt="reply"></a>' ); $skin = array_push_associative($skin, GenerateHeader($lng['showtopic'].': '.$topic['name'], '</a>> <a href="forum.php?f='.$fid.'" class="navigator">'.$forum['name'].'</a> > <a href="'.$_SERVER['REQUEST_URI'].'" class="navigator">'.$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']])) ? '<a href="warns.php?mode=view&id='.$item['u_id'].'" class="fsmall">'.$lng['warns'].'</a>: <font color="red"><b>'.($user_warnlevel[$item['u_id']]*10).'%</b></span>' : '<a href="warns.php?mode=view&id='.$item['u_id'].'" class="fsmall">'.$lng['warns'].'</a>: <font color="green"><b>0%</b></span>' : ' '; $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')) ? '<a href="gg:'.$item['gg'].'"><img border="0" src="skins/'.$default_skin.'/images/gg_small.gif" alt="gg" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/gg_small_active.gif\'" onMouseOut="this.src=\'skins/'.$default_skin.'/images/gg_small.gif\'"></a><br>' : '', 'edit' => ($_SESSION['uid']>0) ? (($item['u_id']==$_SESSION['uid']) ||(RANK>0)) ? '<a href="posting.php?mode=edit&id='.$item['p_id'].'"> <img border="0" src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/edit_small.gif" alt="edit" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/edit_small_active.gif\'" onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/edit_small.gif\'"></a><br>' : '' : '', 'userrank' => User::UserRank($item['rank']), 'avatar' => ($item['avatar']!='') ? '<img src="'.$item['avatar'].'" alt="av">' : '<br><br><br><br>', 'posttext' => Topic::PostText($item['text'], $item['moderated'], $item['p_id']), 'sig'=>($item['sig']!='') ? '<br><br>----------------<br>'.$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'].'<br>' : '') : '', 'IP'=>$item['post_ip'], 'admin'=>$lng['admin_mod_administration'], 'mode_p_del' => ($item['tp_id']!='1') ? '<a href="javascript:confirm_action(\''.$lng['c_delete_post'].'\',\'moderate.php?action=postdelete&id='.$item['p_id'].'\')"> <img border="0" src="skins/'.$default_skin.'/images/delete_small.gif" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/delete_small_active.gif\'" onMouseOut="this.src=\'skins/'.$default_skin.'/images/delete_small.gif\'" alt="pdelete"></a><br>' : '', '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 'lwarns'=>$lng['warns'], 'lang'=>$default_lang, 'ldate'=>$lng['date'], 'lrank'=>$lng['lurank2'], '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], 'lno'=>$lng['no.'], 'lpinfo'=>$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) ? '<a href="moderate.php?action=unlock&id='.$tid.'"><img border="0" src="skins/'.$default_skin.'/images/unlock.gif" alt="unlock"></a>' : '<a href="moderate.php?action=lock&id='.$tid.'"><img border="0" src="skins/'.$default_skin.'/images/lock.gif" alt="lock"></a>', 'stick' => ($topic['sticky']==1) ? '<a href="moderate.php?action=unstick&id='.$tid.'"> <img border="0" src="skins/'.$default_skin.'/images/unstick.gif" alt="unstick"></a>' : '<a href="moderate.php?action=stick&id='.$tid.'"><img border="0" src="skins/'.$default_skin.'/images/stick.gif" alt="stick"></a>', 'lmod' => $lng['lmod'], 'c_delete_topic'=>$lng['c_delete_topic'], 'option_pages'=>AddPages(), 'lwith'=>$lng['with'], 'lpage'=>$lng['page'], 'lpages'=>$count ); $skin['lreply']=(($topic['lock']==1) or ($forum_locked==1)) ? '<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/lock.gif" border="0" alt="reply">' : '<a href="posting.php?mode=rpost&id='.$_GET['t'].'"> <img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/reply.gif" border="0" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/reply_active.gif\'" onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/reply.gif\'" border="0" alt="reply"></a'; include('./skins/'.$default_skin.'/topic_end_body.tpl'); if (($_SESSION['uid']>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']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>'; } else { $skin['pa_link']=''; } } else { $skin['pa_link']=''; } $stop = TimeGeneration(); $skin['queries'] = ShowQueries($start, $stop); include('./skins/'.$default_skin.'/overall_footer.tpl'); ?>