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.
 
 
 
 
 
 

128 lines
4.1 KiB

<?php
/**
* @package uForum
* @file index.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');
if (!UF_INSTALLED)
{
header('Location: install/');
}
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_posting.php');
include('./includes/classes/class_topic.php');
include('./includes/classes/class_forum.php');
include('./lngs/'.DefaultLang().'/main.php');
SessDelInvalid();
SessRegister();
SessDeleteOld();
$start = TimeGeneration();
$default_skin = ViewSkinName();
$visit_count = SetCounter();
include('./includes/cache/cache_index.php');
//add skin variables
$skin = array(
'lactual_time'=>$lng['lactualtime'],
'actual_time'=>date('d-m-Y, G:i',time()),
'loged_as' => User::LogedAs($_SESSION['sessionid'], $_SESSION['uid']),
'lyoure' => ($_SESSION['uid']>0) ? $lng['you_re'] : '',
'lpm_msgs' => ($_SESSION['uid']>0) ? $lng['pm_messages'] : '',
'amsgs' => ($_SESSION['uid']>0) ? User::UserMsgs() : ''
);
$skin = array_push_assoc($skin, GenerateHeader($lng['mainpage'], '</a>&gt; <a href="index.php" class="navigator">'.$lng['mainpage']));
//do it!
include('./skins/'.$default_skin.'/overall_header.tpl');
include('./skins/'.$default_skin.'/index_body.tpl');
//
//add forums and categories-----------------------------------------------------
//
$isset_forum = array();
$sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain categories information.');
while($result = DataBase::fetch($query))
{
$skin = array(
'category' => $result['name'],
'lforumname' => $lng['forumname'],
'lposts'=>$lng['posts'],
'llastposts'=>$lng['lastpost']);
include('./skins/'.$default_skin.'/index_category_add.tpl');
for ($i=1; $i<=count($forum); $i++)
{
if ($forum[$i]['c_id']==$result['c_id'])
{
if(!@in_array($forum[$i]['f_id'],$isset_forum))
{
array_push($isset_forum, $forum[$i]['f_id']);
$lastpost = explode(':',$forum[$i]['lastpost']);
$postsinforum = (isset($count_forum[$forum[$i]['f_id']])) ? $count_forum[$forum[$i]['f_id']] : '0';
$skin = array(
'new_post' => Forum::LastPostImg($postsinforum),
'forum_name' => $forum[$i]['name'],
'forum_id' => $forum[$i]['f_id'],
'description' => $forum[$i]['desc'],
'posts' => $postsinforum,
'lastpost' =>Forum::LastPost($postsinforum, $forum[$i]['f_id']),
);
include('./skins/'.$default_skin.'/index_forum_add.tpl');
}
}
}
echo '</table>';
}
$sess = SessView();
//add skin variables
$skin =array(
'registered_users' => str_replace('%x%', $count_users ,$lng['reg_users']),
'last_user' => $lng['last_user'] . ': <b>' . User::LastUser() . '</b>',
'stat' => $lng['statistics'],
'showlastposts'=>$lng['showlastposts'],
'total_posts'=> str_replace('%x%', $forum_config['posts'] ,$lng['total_posts']),
'lforum_counter'=> str_replace('%x%',$visit_count, $lng['forum_counter']),
'logged_users' => str_replace('%x%', $sess[1] , $lng['logged_users']),
'group_users' => $lng['users_groups'],
'logged_users_list' => $sess[0],
//shoutbox pool
'linsert_msg' => $lng['insert_msg'],
'lsave'=> $lng['save'],
'lsort_desc'=>$lng['sort_desc'],
'lsort_normal'=>$lng['sort_normal']
);
//ShoutBox pool :)
// do it!
include('./skins/'.$default_skin.'/index_body_end.tpl');
if ($_SESSION['uid']>0)
{
if (($forum_config['view_shoutbox']) && ($userdata['view_shoutbox']==1))
{
include ('./shoutbox.php');
}
}
else
{
if($forum_config['view_shoutbox'])
{
include ('./shoutbox.php');
}
}
$stop = TimeGeneration();
$skin['queries'] = ShowQueries($start, $stop);
include('./skins/'.$default_skin.'/overall_footer.tpl');
?>