ReportedPosts.template.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2014 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. function template_reported_posts()
  13. {
  14. global $context, $txt, $scripturl;
  15. // Let them know the action was a success.
  16. if (!empty($context['report_post_action']))
  17. {
  18. echo '
  19. <div class="infobox">
  20. ', $txt['report_action_'. $context['report_post_action']], '
  21. </div>';
  22. }
  23. echo '
  24. <form id="reported_posts" action="', $scripturl, '?action=moderate;area=reports;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  25. <div class="cat_bar">
  26. <h3 class="catbg">
  27. ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
  28. </h3>
  29. </div>';
  30. // Make the buttons.
  31. $close_button = create_button('close.png', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', 'class="centericon"');
  32. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  33. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  34. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  35. $ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
  36. $delete_button = create_button('delete.png', 'mc_reportedp_delete', 'mc_reportedp_delete', 'class="centericon"');
  37. foreach ($context['reports'] as $report)
  38. {
  39. echo '
  40. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  41. <div class="content">
  42. <h5>
  43. <strong>', !empty($report['topic']['board_name']) ? '<a href="' . $scripturl . '?board=' . $report['topic']['id_board'] . '.0">' . $report['topic']['board_name'] . '</a>' : '??', ' / <a href="', $report['topic']['href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</strong>
  44. </h5>
  45. <div class="smalltext">
  46. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  47. // Prepare the comments...
  48. $comments = array();
  49. foreach ($report['comments'] as $comment)
  50. $comments[$comment['member']['id']] = $comment['member']['link'];
  51. echo '
  52. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  53. </div>
  54. <hr>
  55. ', $report['body'], '
  56. <br>
  57. <ul class="quickbuttons">
  58. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  59. <li><a href="', $scripturl, '?action=moderate;area=reports;sa=handle;ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', (int) !$report['ignore'], '">', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
  60. <li><a href="', $scripturl, '?action=moderate;area=reports;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
  61. // Delete message button.
  62. if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
  63. echo '
  64. <li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'] ,'.0;msg=', $report['topic']['id_msg'] ,';modcenter;', $context['session_var'], '=', $context['session_id'], '" class="delete_message">', $delete_button, '</a></li>';
  65. // Ban this user button.
  66. if (!$report['closed'] && !empty($context['report_manage_bans']))
  67. echo '
  68. <li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u='. $report['author']['id'] : ';msg='. $report['topic']['id_msg']) ,';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
  69. echo '
  70. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check">' : '', '</li>
  71. </ul>
  72. </div>
  73. </div>';
  74. }
  75. // Were none found?
  76. if (empty($context['reports']))
  77. echo '
  78. <div class="windowbg2">
  79. <div class="content">
  80. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  81. </div>
  82. </div>';
  83. echo '
  84. <div class="pagesection">
  85. ', !empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many'] ? '<div class="pagelinks floatleft">'. $context['page_index']. '</div>' : '' ,'
  86. <div class="floatright">', !$context['view_closed'] ? '
  87. <input type="hidden" name="'. $context['mod-report-close-all_token_var'] .'" value="'. $context['mod-report-close-all_token'] .'">
  88. <input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit">' : '', '
  89. </div>
  90. </div>
  91. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  92. </form>';
  93. }
  94. // A block to show the current top reported posts.
  95. function template_reported_posts_block()
  96. {
  97. global $context, $txt, $scripturl;
  98. echo '
  99. <div class="cat_bar">
  100. <h3 class="catbg">
  101. <span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  102. <a href="', $scripturl, '?action=moderate;area=reports" id="reported_posts_link">', $txt['mc_recent_reports'], '</a>
  103. </h3>
  104. </div>
  105. <div class="windowbg" id="reported_posts_panel">
  106. <div class="content modbox">
  107. <ul class="reset">';
  108. foreach ($context['reported_posts'] as $report)
  109. echo '
  110. <li class="smalltext">
  111. <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
  112. </li>';
  113. // Don't have any watched users right now?
  114. if (empty($context['reported_posts']))
  115. echo '
  116. <li>
  117. <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
  118. </li>';
  119. echo '
  120. </ul>
  121. </div>
  122. </div>
  123. <script><!-- // --><![CDATA[
  124. var oReportedPostsPanelToggle = new smc_Toggle({
  125. bToggleEnabled: true,
  126. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ',
  127. aSwappableContainers: [
  128. \'reported_posts_panel\'
  129. ],
  130. aSwapImages: [
  131. {
  132. sId: \'reported_posts_toggle\',
  133. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  134. altCollapsed: ', JavaScriptEscape($txt['show']), '
  135. }
  136. ],
  137. aSwapLinks: [
  138. {
  139. sId: \'reported_posts_link\',
  140. msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ',
  141. msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), '
  142. }
  143. ],
  144. oThemeOptions: {
  145. bUseThemeSettings: true,
  146. sOptionName: \'admin_preferences\',
  147. sSessionVar: smf_session_var,
  148. sSessionId: smf_session_id,
  149. sThemeId: \'1\',
  150. sAdditionalVars: \';admin_key=mcrp\'
  151. }
  152. });
  153. // ]]></script>';
  154. }
  155. function template_viewmodreport()
  156. {
  157. global $context, $scripturl, $txt;
  158. // Let them know the action was a success.
  159. if (!empty($context['report_post_action']))
  160. {
  161. echo '
  162. <div class="infobox">
  163. ', $txt['report_action_'. $context['report_post_action']], '
  164. </div>';
  165. }
  166. echo '
  167. <div id="modcenter">
  168. <form action="', $scripturl, '?action=moderate;area=reports;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  169. <div class="cat_bar">
  170. <h3 class="catbg">
  171. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  172. </h3>
  173. </div>
  174. <div class="title_bar">
  175. <h3 class="titlebg">
  176. <span class="floatleft">
  177. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  178. </span>
  179. <span class="floatright">';
  180. // Make the buttons.
  181. $close_button = create_button('close.png', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', 'class="centericon"');
  182. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  183. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  184. echo '
  185. <a href="', $scripturl, '?action=moderate;area=reports;sa=handle;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', !$context['report']['ignore'] ,'">', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
  186. <a href="', $scripturl, '?action=moderate;area=reports;sa=handle;closed=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a>
  187. </span>
  188. </h3>
  189. </div>
  190. <div class="windowbg2">
  191. <div class="content">
  192. ', $context['report']['body'], '
  193. </div>
  194. </div>
  195. <br>
  196. <div class="cat_bar">
  197. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  198. </div>';
  199. foreach ($context['report']['comments'] as $comment)
  200. echo '
  201. <div class="windowbg">
  202. <div class="content">
  203. <p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
  204. <p>', $comment['message'], '</p>
  205. </div>
  206. </div>';
  207. echo '
  208. <br>
  209. <div class="cat_bar">
  210. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  211. </div>
  212. <div>';
  213. if (empty($context['report']['mod_comments']))
  214. echo '
  215. <div class="information">
  216. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  217. </div>';
  218. foreach ($context['report']['mod_comments'] as $comment)
  219. {
  220. echo
  221. '<div class="cat_bar">
  222. <h4 class="catbg">', $comment['member']['link'], ': <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '<span class="floatright"><a href="' . $scripturl . '?action=moderate;area=reports;sa=editcomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';'. $context['session_var'] .'='. $context['session_id'] .'">'. $txt['mc_reportedp_comment_edit'] .'</a> | <a href="' . $scripturl . '?action=moderate;area=reports;sa=handlecomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';delete;'. $context['session_var'] .'='. $context['session_id']. ';'. $context['mod-reportC-delete_token_var'] .'='. $context['mod-reportC-delete_token'] .'" class="deleteModComment">'. $txt['mc_reportedp_comment_delete'] .'</a></span>' : '') ,'
  223. </div></h4>';
  224. echo '
  225. <div class="windowbg">
  226. <p class="content">', $comment['message'], '</p>
  227. </div>';
  228. }
  229. echo '
  230. <div class="title_bar">
  231. <h3 class="titlebg">
  232. <span class="floatleft">
  233. ', $txt['mc_reportedp_new_comment'], '
  234. </span>
  235. </h3>
  236. </div>
  237. <div class="content">
  238. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  239. <div class="padding">
  240. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
  241. <input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
  242. </div>
  243. </div>
  244. </div>
  245. <br>';
  246. template_show_list('moderation_actions_list');
  247. echo '
  248. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  249. </form>
  250. </div>';
  251. }
  252. function template_edit_comment()
  253. {
  254. global $context, $scripturl, $txt;
  255. echo '
  256. <div id="modcenter">
  257. <form action="', $scripturl, '?action=moderate;area=reports;sa=editcomment;mid=', $context['comment_id'], ';rid=', $context['report_id'] ,';save" method="post" accept-charset="', $context['character_set'], '">';
  258. echo '
  259. <br>
  260. <div class="cat_bar">
  261. <h3 class="catbg">', $txt['mc_modreport_edit_mod_comment'] ,'</h3>
  262. </div>
  263. <div class="windowbg2">
  264. <div class="content">';
  265. echo '
  266. <textarea rows="6" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment">', $context['comment']['body'] ,'</textarea>
  267. <div>
  268. <input type="submit" name="edit_comment" value="', $txt['mc_modreport_edit_mod_comment'], '" class="button_submit">
  269. </div>
  270. </div>
  271. </div>
  272. <br>';
  273. echo '
  274. <input type="hidden" name="', $context['mod-reportC-edit_token_var'], '" value="', $context['mod-reportC-edit_token'], '">
  275. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  276. </form>
  277. </div>';
  278. }
  279. ?>