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

  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_assoc($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 = DataBase::fetch($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. $lastpost = explode(':',$forum[$i]['lastpost']);
  72. $postsinforum = (isset($count_forum[$forum[$i]['f_id']])) ? $count_forum[$forum[$i]['f_id']] : '0';
  73. $skin = array(
  74. 'new_post' => Forum::LastPostImg($postsinforum),
  75. 'forum_name' => $forum[$i]['name'],
  76. 'forum_id' => $forum[$i]['f_id'],
  77. 'description' => $forum[$i]['desc'],
  78. 'posts' => $postsinforum,
  79. 'lastpost' =>Forum::LastPost($postsinforum, $forum[$i]['f_id']),
  80. );
  81. include('./skins/'.$default_skin.'/index_forum_add.tpl');
  82. }
  83. }
  84. }
  85. echo '</table>';
  86. }
  87. $sess = SessView();
  88. //add skin variables
  89. $skin =array(
  90. 'registered_users' => str_replace('%x%', $count_users ,$lng['reg_users']),
  91. 'last_user' => $lng['last_user'] . ': <b>' . User::LastUser() . '</b>',
  92. 'stat' => $lng['statistics'],
  93. 'showlastposts'=>$lng['showlastposts'],
  94. 'total_posts'=> str_replace('%x%', $forum_config['posts'] ,$lng['total_posts']),
  95. 'lforum_counter'=> str_replace('%x%',$visit_count, $lng['forum_counter']),
  96. 'logged_users' => str_replace('%x%', $sess[1] , $lng['logged_users']),
  97. 'group_users' => $lng['users_groups'],
  98. 'logged_users_list' => $sess[0],
  99. //shoutbox pool
  100. 'linsert_msg' => $lng['insert_msg'],
  101. 'lsave'=> $lng['save'],
  102. 'lsort_desc'=>$lng['sort_desc'],
  103. 'lsort_normal'=>$lng['sort_normal']
  104. );
  105. //ShoutBox pool :)
  106. // do it!
  107. include('./skins/'.$default_skin.'/index_body_end.tpl');
  108. if ($_SESSION['uid']>0)
  109. {
  110. if (($forum_config['view_shoutbox']) && ($userdata['view_shoutbox']==1))
  111. {
  112. include ('./shoutbox.php');
  113. }
  114. }
  115. else
  116. {
  117. if($forum_config['view_shoutbox'])
  118. {
  119. include ('./shoutbox.php');
  120. }
  121. }
  122. $stop = TimeGeneration();
  123. $skin['queries'] = ShowQueries($start, $stop);
  124. include('./skins/'.$default_skin.'/overall_footer.tpl');
  125. ?>