A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

111 lines
4.2 KiB

<?php
/**
* @package uForum
* @file forum.php
* @version $Id$
* @copyright 2009(c) PioDer <[email protected]>
* @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/secure.php');
$default_lang = DefaultLang();
include('./lngs/'.$default_lang.'/main.php');
$start = TimeGeneration();
$fid = intval($_GET['f']);
SessDelInvalid();
SessRegister();
SessDeleteOld();
include('./includes/cache/cache_forums.php');
//add skin variables
$skin = array(
'ntopic' => ($forum['lock']==1) ? '<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/lock.gif"
alt="ntopic" border="0"/>' : '<a href="posting.php?mode=ntopic&amp;f='.$_GET["f"].'">
<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic_active.gif\'"�
onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif\'" border="0" alt="reply"></a>',
'lposts'=>$lng['posts'],
'llastposts'=>$lng['lastpost'],
'lposts'=>$lng['posts'],
'lauthor'=>$lng['author'],
'llastpost'=>$lng['lastpost'],
'ltopicname'=>$lng['ltopicname'],
'f_id' => $fid,
'lang'=> $default_lang
);
$skin = array_push_assoc($skin,GenerateHeader($lng['showforum'].': '.$forum['name'], '</a>&gt; <a href="forum.php?f='.$_GET['f'].'" class="navigator">'.$forum['name']));
//do it!
include('./skins/'.$default_skin.'/overall_header.tpl');
include('./skins/'.$default_skin.'/forum_body.tpl');
$sql = "SELECT ".TOPICS_TABLE.".*, ".USERS_TABLE.".*, ".TOPICS_TABLE.".posts AS `postcount`, ".TOPICS_TABLE.".lastpost AS `topic_lastpost` FROM ".TOPICS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".TOPICS_TABLE.".author = ".USERS_TABLE.".u_id WHERE f_id='$fid' ORDER BY `sticky` DESC, `lastpost_time` DESC $limit;";
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topics information');
$value = DataBase::num_rows($query);
if ($value>0)
{
while($record = DataBase::fetch($query))
{
$last_post = explode(':', $record['topic_lastpost']);
$skin = array(
't_id'=>$record['t_id'],
'fname'=>($record['sticky']=='1') ? '<b>'.$lng['sticky'].'</b>'.$record['name'] : $record['name'],
'author'=>Topic::TopicAuthor($record['author']),
'tposts'=>$record['postcount'],
'new_post'=>Topic::LastPostImg(),
'lastpost'=>Topic::LastPostInTopic($record['t_id'])
);
include('./skins/'.$default_skin.'/forum_forum_add.tpl');
}
$skin['noposts']='';
}
else
{
$skin['noposts']='<tr><td width="'.TABLES_WIDTH.'" colspan="8" height="19" class="fitem"><p class="fstandard" align="center">'.$lng['nopost'].'!</p></td></tr>';
}
$skin = array_push_assoc($skin, array(
'option_pages' => AddPages(),
'lwith' => $lng['with'],
'lpage' => $lng['page'],
'lpages' => $count,
'f_id' => $fid,
'lang' => $default_lang,
'ntopic' => ($forum['lock']==1) ? '<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/lock.gif"
alt="ntopic" border="0">' : '<a href="posting.php?mode=ntopic&amp;f='.$_GET["f"].'">
<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif"
onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic_active.gif\'"�
onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif\'" border="0" alt="reply"></a>'
));
include('./skins/'.$default_skin.'/forum_end_body.tpl');
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');
?>