- <?php
- /**
- * @package uForum
- * @file index.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');
- 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>> <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');
- }
- }
-
- 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');
- ?>
|