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.

161 lines
4.2 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file moderate.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/secure.php');
  23. require('./includes/classes/class_mod.php');
  24. require('./includes/classes/class_forum.php');
  25. require('./includes/classes/class_topic.php');
  26. require('./lngs/'.DefaultLang().'/main.php');
  27. $start = TimeGeneration();
  28. SessDelInvalid();
  29. SessRegister();
  30. SessDeleteOld();
  31. if ($_SESSION['uid']>0)
  32. {
  33. if (RANK==0)
  34. {
  35. $stop = TimeGeneration();
  36. message_forum($lng['is_no_mod'],'index.php');
  37. }
  38. }
  39. else
  40. {
  41. message_forum($lng['youarenotlogd'],'login.php?mode=login');
  42. }
  43. switch(trim($_GET['action']))
  44. {
  45. case 'delete':
  46. {
  47. $tid = intval($_GET['id']);
  48. Secure::topic_exists($tid);
  49. $fid = Topic::TopicInformation($tid,'f_id');
  50. Mod::DeleteTopic($tid);
  51. TriggerStats($fid, 1);
  52. $stop = TimeGeneration();
  53. message_forum($lng['tdeleted'], 'forum.php?f='.$fid);
  54. break;
  55. }
  56. case 'lock':
  57. {
  58. $tid = intval($_GET['id']);
  59. Secure::topic_exists($tid);
  60. Mod::LockTopic($tid);
  61. $stop = TimeGeneration();
  62. message_forum($lng['tlocked'], 'topic.php?t='.$tid);
  63. break;
  64. }
  65. case 'unlock':
  66. {
  67. $tid = intval($_GET['id']);
  68. Secure::topic_exists($tid);
  69. Mod::UnlockTopic($tid);
  70. $stop = TimeGeneration();
  71. message_forum($lng['tunlocked'], 'topic.php?t='.$tid);
  72. break;
  73. }
  74. case 'postdelete':
  75. {
  76. $pid = intval($_GET['id']);
  77. Secure::post_exists($pid);
  78. $tid = Topic::PostInformation($pid,'t_id');
  79. $tpid = Topic::PostInformation($pid,'tp_id');
  80. if ($tpid >1)
  81. {
  82. Mod::DeletePost($pid);
  83. TriggerStats($tid, 2);
  84. }
  85. $stop = TimeGeneration();
  86. message_forum($lng['pdeleted'],'topic.php?t='.$tid);
  87. break;
  88. }
  89. case 'stick':
  90. {
  91. $tid = intval($_GET['id']);
  92. Secure::topic_exists($tid);
  93. Mod::StickTopic($tid,'1');
  94. $stop = TimeGeneration();
  95. message_forum($lng['tstuck'], 'topic.php?t='.$tid);
  96. break;
  97. }
  98. case 'unstick':
  99. {
  100. $tid = intval($_GET['id']);
  101. Secure::topic_exists($tid);
  102. Mod::StickTopic($tid,'0');
  103. $stop = TimeGeneration();
  104. message_forum($lng['tunstuck'], 'topic.php?t='.$tid);
  105. break;
  106. }
  107. case 'move':
  108. {
  109. $tid = intval($_GET['id']);
  110. Secure::topic_exists($tid);
  111. if (isset($_POST['forum_id']))
  112. {
  113. $fid = $_POST['forum_id'];
  114. $f_id = Topic::TopicInformation($tid, 'f_id');
  115. Mod::MoveTopic($tid,$fid);
  116. TriggerStats($fid, 1);
  117. TriggerStats($f_id, 1);
  118. message_forum($lng['topic_moved'],'topic.php?t='.$tid);
  119. }
  120. else
  121. {
  122. $start = TimeGeneration();
  123. $default_skin = ViewSkinName();
  124. //add skin variables
  125. $skin = array(
  126. 't' => $tid,
  127. 'L.select_forum' => $lng['select_forum'],
  128. 'L.save' => $lng['save'],
  129. 'L.reset' => $lng['reset'],
  130. 'OPTIONS.select_forum' => Forum::AddForums($tid)
  131. );
  132. $skin = array_push_assoc($skin, GenerateHeader($lng['move_topic'].': '.Topic::TopicInformation($tid,'name'), '<a href="moderate.php?action=move&id='.$tid.'" class="navigator">'
  133. .$lng['move_topic'].': </a><a href="topic.php?t='.$tid.'" class="navigator">'
  134. .Topic::TopicInformation($tid,'name')));
  135. $stop = TimeGeneration();
  136. $skin['queries'] = ShowQueries($start, $stop);
  137. //do it!
  138. require('./skins/'.$default_skin.'/overall_header.tpl');
  139. require('./skins/'.$default_skin.'/move_topic_body.tpl');
  140. require('./skins/'.$default_skin.'/overall_footer.tpl');
  141. }
  142. break;
  143. }
  144. case 'accept':
  145. {
  146. $pid = intval($_GET['id']);
  147. Secure::post_exists($pid);
  148. Mod::AcceptPost($pid);
  149. $stop = TimeGeneration();
  150. $tid = Topic::PostInformation($pid,'t_id');
  151. message_forum($lng['post_accepted'], 'topic.php?t='.$tid);
  152. break;
  153. }
  154. default:
  155. {
  156. $stop = TimeGeneration();
  157. message_forum($lng['invalidmode'],'index.php');
  158. break;
  159. }
  160. }
  161. ?>