ReportedPosts.template.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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']) && !empty($txt['report_action_'. $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. <div class="pagesection">
  31. <div class="pagelinks">', $context['page_index'], '</div>
  32. </div>';
  33. // Make the buttons.
  34. $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"');
  35. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  36. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  37. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  38. $ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
  39. $delete_button = create_button('delete.png', 'mc_reportedp_delete', 'mc_reportedp_delete', 'class="centericon"');
  40. foreach ($context['reports'] as $report)
  41. {
  42. echo '
  43. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  44. <div class="content">
  45. <h5>
  46. <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>
  47. </h5>
  48. <div class="smalltext">
  49. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  50. // Prepare the comments...
  51. $comments = array();
  52. foreach ($report['comments'] as $comment)
  53. $comments[$comment['member']['id']] = $comment['member']['link'];
  54. echo '
  55. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  56. </div>
  57. <hr>
  58. ', $report['body'], '
  59. <br>
  60. <ul class="quickbuttons">
  61. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  62. <li><a href="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$report['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
  63. <li><a href="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';close=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a></li>';
  64. // Delete message button.
  65. if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
  66. echo '
  67. <li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'] ,'.0;msg=', $report['topic']['id_msg'] ,';modcenter;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'' , $txt['mc_reportedp_delete_confirm'] , '\');">', $delete_button, '</a></li>';
  68. // Ban this user button.
  69. if (!$report['closed'] && !empty($context['report_manage_bans']))
  70. echo '
  71. <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>';
  72. echo '
  73. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check">' : '', '</li>
  74. </ul>
  75. </div>
  76. </div>';
  77. }
  78. // Were none found?
  79. if (empty($context['reports']))
  80. echo '
  81. <div class="windowbg2">
  82. <div class="content">
  83. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  84. </div>
  85. </div>';
  86. echo '
  87. <div class="pagesection">
  88. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  89. <div class="floatright">
  90. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit">' : '', '
  91. </div>
  92. </div>
  93. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  94. </form>';
  95. }
  96. // A block to show the current top reported posts.
  97. function template_reported_posts_block()
  98. {
  99. global $context, $txt, $scripturl;
  100. echo '
  101. <div class="cat_bar">
  102. <h3 class="catbg">
  103. <span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  104. <a href="', $scripturl, '?action=moderate;area=reports" id="reported_posts_link">', $txt['mc_recent_reports'], '</a>
  105. </h3>
  106. </div>
  107. <div class="windowbg" id="reported_posts_panel">
  108. <div class="content modbox">
  109. <ul class="reset">';
  110. foreach ($context['reported_posts'] as $report)
  111. echo '
  112. <li class="smalltext">
  113. <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
  114. </li>';
  115. // Don't have any watched users right now?
  116. if (empty($context['reported_posts']))
  117. echo '
  118. <li>
  119. <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
  120. </li>';
  121. echo '
  122. </ul>
  123. </div>
  124. </div>
  125. <script><!-- // --><![CDATA[
  126. var oReportedPostsPanelToggle = new smc_Toggle({
  127. bToggleEnabled: true,
  128. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ',
  129. aSwappableContainers: [
  130. \'reported_posts_panel\'
  131. ],
  132. aSwapImages: [
  133. {
  134. sId: \'reported_posts_toggle\',
  135. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  136. altCollapsed: ', JavaScriptEscape($txt['show']), '
  137. }
  138. ],
  139. aSwapLinks: [
  140. {
  141. sId: \'reported_posts_link\',
  142. msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ',
  143. msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), '
  144. }
  145. ],
  146. oThemeOptions: {
  147. bUseThemeSettings: true,
  148. sOptionName: \'admin_preferences\',
  149. sSessionVar: smf_session_var,
  150. sSessionId: smf_session_id,
  151. sThemeId: \'1\',
  152. sAdditionalVars: \';admin_key=mcrp\'
  153. }
  154. });
  155. // ]]></script>';
  156. }
  157. function template_viewmodreport()
  158. {
  159. global $context, $scripturl, $txt;
  160. echo '
  161. <div id="modcenter">
  162. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  163. <div class="cat_bar">
  164. <h3 class="catbg">
  165. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  166. </h3>
  167. </div>
  168. <div class="title_bar">
  169. <h3 class="titlebg">
  170. <span class="floatleft">
  171. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  172. </span>
  173. <span class="floatright">';
  174. // Make the buttons.
  175. $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"');
  176. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  177. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  178. echo '
  179. <a href="', $scripturl, '?action=moderate;area=reports;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$context['report']['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
  180. <a href="', $scripturl, '?action=moderate;area=reports;close=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a>
  181. </span>
  182. </h3>
  183. </div>
  184. <div class="windowbg2">
  185. <div class="content">
  186. ', $context['report']['body'], '
  187. </div>
  188. </div>
  189. <br>
  190. <div class="cat_bar">
  191. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  192. </div>';
  193. foreach ($context['report']['comments'] as $comment)
  194. echo '
  195. <div class="windowbg">
  196. <div class="content">
  197. <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>
  198. <p>', $comment['message'], '</p>
  199. </div>
  200. </div>';
  201. echo '
  202. <br>
  203. <div class="cat_bar">
  204. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  205. </div>
  206. <div class="windowbg2">
  207. <div class="content">';
  208. if (empty($context['report']['mod_comments']))
  209. echo '
  210. <div class="information">
  211. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  212. </div>';
  213. foreach ($context['report']['mod_comments'] as $comment)
  214. echo
  215. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '><span class="floatright"><a href="' . $scripturl . '?moderate;area=reports;report='. $context['report']['id'] .';mid='. $comment['id'] .';sa=edit">'. $txt['mc_reportedp_comment_edit'] .'</a> | <a href="' . $scripturl . '?moderate;area=reports;report='. $context['report']['id'] .';mid='. $comment['id'] .';sa=delete">'. $txt['mc_reportedp_comment_delete'] .'</a></span>' : '') ,'</p>';
  216. echo '
  217. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  218. <div>
  219. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
  220. </div>
  221. </div>
  222. </div>
  223. <br>';
  224. $alt = false;
  225. template_show_list('moderation_actions_list');
  226. echo '
  227. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  228. </form>
  229. </div>';
  230. }
  231. ?>