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.

176 lines
4.5 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file moderate.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/secure.php');
  23. include('./includes/classes/class_mod.php');
  24. include('./includes/classes/class_forum.php');
  25. include('./includes/classes/class_topic.php');
  26. include('./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><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. if ($_SESSION['uid']>0)
  136. {
  137. if(RANK=='2')
  138. {
  139. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  140. }
  141. else
  142. {
  143. $skin['pa_link']='';
  144. }
  145. }
  146. else
  147. {
  148. $skin['pa_link']='';
  149. }
  150. $stop = TimeGeneration();
  151. $skin['queries'] = ShowQueries($start, $stop);
  152. //do it!
  153. include('./skins/'.$default_skin.'/overall_header.tpl');
  154. include('./skins/'.$default_skin.'/move_topic_body.tpl');
  155. include('./skins/'.$default_skin.'/overall_footer.tpl');
  156. }
  157. break;
  158. }
  159. case 'accept':
  160. {
  161. $pid = intval($_GET['id']);
  162. Secure::post_exists($pid);
  163. Mod::AcceptPost($pid);
  164. $stop = TimeGeneration();
  165. $tid = Topic::PostInformation($pid,'t_id');
  166. message_forum($lng['post_accepted'], 'topic.php?t='.$tid);
  167. break;
  168. }
  169. default:
  170. {
  171. $stop = TimeGeneration();
  172. message_forum($lng['invalidmode'],'index.php');
  173. break;
  174. }
  175. }
  176. ?>