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.

110 lines
4.2 KiB

  1. <?php
  2. /**
  3. * @package Dynamic Script Forum
  4. * @file forum.php
  5. * @version 1.0.x, 08-04-2008, 16:53
  6. * @copyright 2008(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/dsf.html
  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/class_db.php');
  15. include('./includes/class_error.php');
  16. //connect to database
  17. DataBase::db_connect();
  18. include('./includes/sessions.php');
  19. include('./includes/class_user.php');
  20. include('./common.php');
  21. include('./includes/class_overall.php');
  22. include('./includes/class_forum.php');
  23. include('./includes/class_topic.php');
  24. include('./includes/classes/secure.php');
  25. $default_lang = Over::DefaultLang();
  26. include('./lngs/'.$default_lang.'/main.php');
  27. $start = Over::TimeGeneration();
  28. $fid = intval($_GET['f']);
  29. sess_del_invalid($_SESSION['uid']);
  30. sess_register($_SESSION['uid']);
  31. sess_delete_old();
  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_associative($skin,Over::generate_header($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.".* 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 = mysql_num_rows($query);
  55. if ($value>0)
  56. {
  57. while($record = mysql_fetch_array($query))
  58. {
  59. $skin = array(
  60. 't_id'=>$record['t_id'],
  61. 'fname'=>($record['sticky']=='1') ? '<b>'.$lng['sticky'].'</b>'.$record['name'] : $record['name'],
  62. 'author'=>Topic::TopicAuthor($record['author']),
  63. 'tposts'=>$count_topic[$record['t_id']],
  64. 'new_post'=>Topic::LastPostImg(),
  65. 'lastpost'=>Topic::LastPostInTopic($record['t_id'])
  66. );
  67. include('./skins/'.$default_skin.'/forum_forum_add.tpl');
  68. }
  69. $skin['noposts']='';
  70. }
  71. else
  72. {
  73. $skin['noposts']='<tr><td width="'.TABLES_WIDTH.'" colspan="8" height="19" class="fitem"><p class="fstandard" align="center">'.$lng['nopost'].'!</p></td></tr>';
  74. }
  75. $skin = array_push_associative($skin, array(
  76. 'option_pages' => Over::AddPages(),
  77. 'lwith' => $lng['with'],
  78. 'lpage' => $lng['page'],
  79. 'lpages' => $count,
  80. 'f_id' => $fid,
  81. 'lang' => $default_lang,
  82. 'ntopic' => ($forum['lock']==1) ? '<img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/lock.gif"
  83. alt="ntopic" border="0">' : '<a href="posting.php?mode=ntopic&amp;f='.$_GET["f"].'">
  84. <img src="skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif"
  85. onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic_active.gif\'"
  86. onMouseOut="this.src=\'skins/'.$default_skin.'/images/lng_'.$default_lang.'/topic.gif\'" border="0" alt="reply"></a>'
  87. ));
  88. include('./skins/'.$default_skin.'/forum_end_body.tpl');
  89. if ($_SESSION['uid']>0)
  90. {
  91. if(RANK=='2')
  92. {
  93. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  94. }
  95. else
  96. {
  97. $skin['pa_link']='';
  98. }
  99. }
  100. else
  101. {
  102. $skin['pa_link']='';
  103. }
  104. $stop = Over::TimeGeneration();
  105. $skin['queries'] = Over::ShowQueries($start, $stop);
  106. include('./skins/'.$default_skin.'/overall_footer.tpl');
  107. ?>