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.

142 lines
4.2 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file index.php
  5. * @version $Id$
  6. * @copyright 2009(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/
  8. * @license GNU GPL v3
  9. **/
  10. define('IN_uF', true);
  11. //include files
  12. include('./config.php');
  13. if (!UF_INSTALLED)
  14. {
  15. header('Location: install/');
  16. }
  17. include('./includes/constants.php');
  18. include('./includes/db.php');
  19. include('./includes/errors.php');
  20. //connect to database
  21. DataBase::db_connect();
  22. include('./includes/sessions.php');
  23. include('./includes/classes/class_user.php');
  24. include('./common.php');
  25. include('./includes/misc_functions.php');
  26. include('./includes/classes/class_posting.php');
  27. include('./includes/classes/class_topic.php');
  28. include('./includes/classes/class_forum.php');
  29. include('./lngs/'.DefaultLang().'/main.php');
  30. SessDelInvalid();
  31. SessRegister();
  32. SessDeleteOld();
  33. $start = TimeGeneration();
  34. $default_skin = ViewSkinName();
  35. $visit_count = SetCounter();
  36. include('./includes/cache/cache_index.php');
  37. //add skin variables
  38. $skin = array(
  39. 'lactual_time'=>$lng['lactualtime'],
  40. 'actual_time'=>date('d-m-Y, G:i',time()),
  41. 'loged_as' => User::LogedAs($_SESSION['sessionid'], $_SESSION['uid']),
  42. 'lyoure' => ($_SESSION['uid']>0) ? $lng['you_re'] : '',
  43. 'lpm_msgs' => ($_SESSION['uid']>0) ? $lng['pm_messages'] : '',
  44. 'amsgs' => ($_SESSION['uid']>0) ? User::UserMsgs() : ''
  45. );
  46. $skin = array_push_associative($skin, GenerateHeader($lng['mainpage'], '</a>&gt; <a href="index.php" class="navigator">'.$lng['mainpage']));
  47. //do it!
  48. include('./skins/'.$default_skin.'/overall_header.tpl');
  49. include('./skins/'.$default_skin.'/index_body.tpl');
  50. //
  51. //add forums and categories-----------------------------------------------------
  52. //
  53. $isset_forum = array();
  54. $sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`";
  55. $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.');
  56. while($result = @mysql_fetch_array($query))
  57. {
  58. $skin = array(
  59. 'category' => $result['name'],
  60. 'lforumname' => $lng['forumname'],
  61. 'lposts'=>$lng['posts'],
  62. 'llastposts'=>$lng['lastpost']);
  63. include('./skins/'.$default_skin.'/index_category_add.tpl');
  64. for ($i=1; $i<=count($forum); $i++)
  65. {
  66. if ($forum[$i]['c_id']==$result['c_id'])
  67. {
  68. if(!@in_array($forum[$i]['f_id'],$isset_forum))
  69. {
  70. array_push($isset_forum, $forum[$i]['f_id']);
  71. $postsinforum = (isset($count_forum[$forum[$i]['f_id']])) ? $count_forum[$forum[$i]['f_id']] : '0';
  72. $skin = array(
  73. 'new_post' => Forum::LastPostImg($postsinforum),
  74. 'forum_name' => $forum[$i]['name'],
  75. 'forum_id' => $forum[$i]['f_id'],
  76. 'description' => $forum[$i]['desc'],
  77. 'posts' => $postsinforum,
  78. 'lastpost' =>Forum::LastPost($postsinforum, $forum[$i]['f_id']),
  79. );
  80. include('./skins/'.$default_skin.'/index_forum_add.tpl');
  81. }
  82. }
  83. }
  84. echo '</table>';
  85. }
  86. $sess = SessView();
  87. //add skin variables
  88. $skin =array(
  89. 'registered_users' => str_replace('%x%', $count_users ,$lng['reg_users']),
  90. 'last_user' => $lng['last_user'] . ': <b>' . User::LastUser() . '</b>',
  91. 'stat' => $lng['statistics'],
  92. 'showlastposts'=>$lng['showlastposts'],
  93. 'total_posts'=> str_replace('%x%', $post_count ,$lng['total_posts']),
  94. 'lforum_counter'=> str_replace('%x%',$visit_count, $lng['forum_counter']),
  95. 'logged_users' => str_replace('%x%', $sess[1] , $lng['logged_users']),
  96. 'group_users' => $lng['users_groups'],
  97. 'logged_users_list' => $sess[0],
  98. //shoutbox pool
  99. 'linsert_msg' => $lng['insert_msg'],
  100. 'lsave'=> $lng['save'],
  101. 'lsort_desc'=>$lng['sort_desc'],
  102. 'lsort_normal'=>$lng['sort_normal']
  103. );
  104. //ShoutBox pool :)
  105. // do it!
  106. include('./skins/'.$default_skin.'/index_body_end.tpl');
  107. if ($_SESSION['uid']>0)
  108. {
  109. if (($forum_config['view_shoutbox']) && ($userdata['view_shoutbox']==1))
  110. {
  111. include ('./shoutbox.php');
  112. }
  113. }
  114. else
  115. {
  116. if($forum_config['view_shoutbox'])
  117. {
  118. include ('./shoutbox.php');
  119. }
  120. }
  121. if ($_SESSION['uid']>0)
  122. {
  123. if(RANK=='2')
  124. {
  125. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  126. }
  127. else
  128. {
  129. $skin['pa_link']='';
  130. }
  131. }
  132. else
  133. {
  134. $skin['pa_link']='';
  135. }
  136. $stop = TimeGeneration();
  137. $skin['queries'] = ShowQueries($start, $stop);
  138. include('./skins/'.$default_skin.'/overall_footer.tpl');
  139. ?>