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.

111 lines
4.2 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file forum.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. include('./includes/constants.php');
  14. include('./includes/db.php');
  15. include('./includes/errors.php');
  16. //connect to database
  17. DataBase::db_connect();
  18. include('./includes/sessions.php');
  19. include('./includes/classes/class_user.php');
  20. include('./common.php');
  21. include('./includes/misc_functions.php');
  22. include('./includes/classes/class_forum.php');
  23. include('./includes/classes/class_topic.php');
  24. include('./includes/classes/secure.php');
  25. $default_lang = DefaultLang();
  26. include('./lngs/'.$default_lang.'/main.php');
  27. $start = TimeGeneration();
  28. $fid = intval($_GET['f']);
  29. SessDelInvalid();
  30. SessRegister();
  31. SessDeleteOld();
  32. include('./includes/cache/cache_forums.php');
  33. //add skin variables
  34. $skin = array(
  35. 'ntopic' => ($forum['lock']==1) ? '<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/lock.gif"
  36. alt="ntopic" border="0"/>' : '<a href="posting.php?mode=ntopic&amp;f='.$_GET["f"].'">
  37. <img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic_active.gif\'"
  38. onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif\'" border="0" alt="reply"></a>',
  39. 'lposts'=>$lng['posts'],
  40. 'llastposts'=>$lng['lastpost'],
  41. 'lposts'=>$lng['posts'],
  42. 'lauthor'=>$lng['author'],
  43. 'llastpost'=>$lng['lastpost'],
  44. 'ltopicname'=>$lng['ltopicname'],
  45. 'f_id' => $fid,
  46. 'lang'=> $default_lang
  47. );
  48. $skin = array_push_assoc($skin,GenerateHeader($lng['showforum'].': '.$forum['name'], '</a>&gt; <a href="forum.php?f='.$_GET['f'].'" class="navigator">'.$forum['name']));
  49. //do it!
  50. include('./skins/'.$default_skin.'/overall_header.tpl');
  51. include('./skins/'.$default_skin.'/forum_body.tpl');
  52. $sql = "SELECT ".TOPICS_TABLE.".*, ".USERS_TABLE.".*, ".TOPICS_TABLE.".posts AS `postcount`, ".TOPICS_TABLE.".lastpost AS `topic_lastpost` FROM ".TOPICS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".TOPICS_TABLE.".author = ".USERS_TABLE.".u_id WHERE f_id='$fid' ORDER BY `sticky` DESC, `lastpost_time` DESC $limit;";
  53. $query = DataBase::sql_query($sql,GENERAL,'Could not obtain topics information');
  54. $value = DataBase::num_rows($query);
  55. if ($value>0)
  56. {
  57. while($record = DataBase::fetch($query))
  58. {
  59. $last_post = explode(':', $record['topic_lastpost']);
  60. $skin = array(
  61. 't_id'=>$record['t_id'],
  62. 'fname'=>($record['sticky']=='1') ? '<b>'.$lng['sticky'].'</b>'.$record['name'] : $record['name'],
  63. 'author'=>Topic::TopicAuthor($record['author']),
  64. 'tposts'=>$record['postcount'],
  65. 'new_post'=>Topic::LastPostImg(),
  66. 'lastpost'=>Topic::LastPostInTopic($record['t_id'])
  67. );
  68. include('./skins/'.$default_skin.'/forum_forum_add.tpl');
  69. }
  70. $skin['noposts']='';
  71. }
  72. else
  73. {
  74. $skin['noposts']='<tr><td width="'.TABLES_WIDTH.'" colspan="8" height="19" class="fitem"><p class="fstandard" align="center">'.$lng['nopost'].'!</p></td></tr>';
  75. }
  76. $skin = array_push_assoc($skin, array(
  77. 'option_pages' => AddPages(),
  78. 'lwith' => $lng['with'],
  79. 'lpage' => $lng['page'],
  80. 'lpages' => $count,
  81. 'f_id' => $fid,
  82. 'lang' => $default_lang,
  83. 'ntopic' => ($forum['lock']==1) ? '<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/lock.gif"
  84. alt="ntopic" border="0">' : '<a href="posting.php?mode=ntopic&amp;f='.$_GET["f"].'">
  85. <img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif"
  86. onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic_active.gif\'"
  87. onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif\'" border="0" alt="reply"></a>'
  88. ));
  89. include('./skins/'.$default_skin.'/forum_end_body.tpl');
  90. if ($_SESSION['uid']>0)
  91. {
  92. if(RANK=='2')
  93. {
  94. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  95. }
  96. else
  97. {
  98. $skin['pa_link']='';
  99. }
  100. }
  101. else
  102. {
  103. $skin['pa_link']='';
  104. }
  105. $stop = TimeGeneration();
  106. $skin['queries'] = ShowQueries($start, $stop);
  107. include('./skins/'.$default_skin.'/overall_footer.tpl');
  108. ?>