|
<?php
|
|
/**
|
|
* @package Dynamic Script Forum
|
|
* @file index.php
|
|
* @version $Id$
|
|
* @copyright 2008(c) PioDer <[email protected]>
|
|
* @link http://pioder.gim2przemysl.int.pl/dsf.html
|
|
* @license GNU GPL v3
|
|
**/
|
|
define('IN_uF', true);
|
|
//include files
|
|
include('./config.php');
|
|
if (!DSF_INSTALLED)
|
|
{
|
|
header('Location: install/');
|
|
}
|
|
include('./includes/constants.php');
|
|
include('./includes/class_db.php');
|
|
include('./includes/class_error.php');
|
|
//connect to database
|
|
DataBase::db_connect();
|
|
include('./includes/sessions.php');
|
|
include('./includes/class_user.php');
|
|
include('./common.php');
|
|
include('./includes/class_overall.php');
|
|
include('./includes/class_posting.php');
|
|
include('./includes/class_topic.php');
|
|
include('./includes/class_forum.php');
|
|
include('./lngs/'.Over::DefaultLang().'/main.php');
|
|
|
|
sess_del_invalid($_SESSION['uid']);
|
|
sess_register($_SESSION['uid']);
|
|
sess_delete_old();
|
|
$start = Over::TimeGeneration();
|
|
$default_skin = Over::ViewSkinName();
|
|
$visit_count = Over::set_counter();
|
|
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_associative($skin, Over::generate_header($lng['mainpage'], '</a>> <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 = @mysql_fetch_array($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']);
|
|
$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 = sess_view();
|
|
//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%', $post_count ,$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');
|
|
}
|
|
}
|
|
|
|
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 = Over::TimeGeneration();
|
|
$skin['queries'] = Over::ShowQueries($start, $stop);
|
|
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
?>
|