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.

96 lines
4.0 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file forum.php
  5. * @version $Id$
  6. * @copyright 2007-2010 (c) PioDer <pioder@wp.pl>
  7. * @link http://www.pioder.pl/
  8. * @license see LICENSE.txt
  9. **/
  10. define('IN_uF', true);
  11. //include files
  12. require('./config.php');
  13. require('./includes/constants.php');
  14. require('./includes/db.php');
  15. require('./includes/errors.php');
  16. //connect to database
  17. DataBase::db_connect();
  18. require('./includes/sessions.php');
  19. require('./includes/classes/class_user.php');
  20. require('./common.php');
  21. require('./includes/misc_functions.php');
  22. require('./includes/classes/class_forum.php');
  23. require('./includes/classes/class_topic.php');
  24. require('./includes/classes/secure.php');
  25. $default_lang = DefaultLang();
  26. require('./lngs/'.$default_lang.'/main.php');
  27. $start = TimeGeneration();
  28. $fid = intval($_GET['f']);
  29. SessDelInvalid();
  30. SessRegister();
  31. SessDeleteOld();
  32. require('./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 href="forum.php?f='.$_GET['f'].'" class="navigator">'.$forum['name']));
  49. //do it!
  50. require('./skins/'.$default_skin.'/overall_header.tpl');
  51. require('./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. require('./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' => ListPages($page, $count),
  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. require('./skins/'.$default_skin.'/forum_end_body.tpl');
  90. $stop = TimeGeneration();
  91. $skin['queries'] = ShowQueries($start, $stop);
  92. require('./skins/'.$default_skin.'/overall_footer.tpl');
  93. ?>