|
<?php
|
|
/**
|
|
* @package uForum
|
|
* @file index.php
|
|
* @version $Id$
|
|
* @copyright 2007-2010 (c) PioDer <[email protected]>
|
|
* @link http://www.pioder.pl/
|
|
* @license see LICENSE.txt
|
|
**/
|
|
define('IN_uF', true);
|
|
//include files
|
|
require('./config.php');
|
|
if (!UF_INSTALLED)
|
|
{
|
|
header('Location: install/');
|
|
}
|
|
require('./includes/constants.php');
|
|
require('./includes/db.php');
|
|
require('./includes/errors.php');
|
|
//connect to database
|
|
DataBase::db_connect();
|
|
require('./includes/sessions.php');
|
|
require('./includes/classes/class_user.php');
|
|
require('./common.php');
|
|
require('./includes/misc_functions.php');
|
|
require('./includes/classes/class_posting.php');
|
|
require('./includes/classes/class_topic.php');
|
|
require('./includes/classes/class_forum.php');
|
|
require('./lngs/'.DefaultLang().'/main.php');
|
|
|
|
SessDelInvalid();
|
|
SessRegister();
|
|
SessDeleteOld();
|
|
$start = TimeGeneration();
|
|
$default_skin = ViewSkinName();
|
|
$visit_count = SetCounter();
|
|
require('./includes/cache/cache_index.php');
|
|
|
|
//add skin variables
|
|
$skin = array(
|
|
|
|
);
|
|
$skin = array_push_assoc($skin, GenerateHeader($lng['mainpage'], '<a href="index.php" class="navigator">'.$lng['mainpage']));
|
|
//do it!
|
|
require('./skins/'.$default_skin.'/overall_header.tpl');
|
|
require('./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']);
|
|
require('./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']),
|
|
);
|
|
require('./skins/'.$default_skin.'/index_forum_add.tpl');
|
|
}
|
|
}
|
|
}
|
|
echo '</table></div>';
|
|
}
|
|
$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!
|
|
require('./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);
|
|
require('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
?>
|