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.

171 lines
4.5 KiB

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