ModerationCenter.template.php 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  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_moderation_center()
  13. {
  14. global $settings, $context, $txt, $scripturl;
  15. // Show moderators notes.
  16. template_notes();
  17. // Show a welcome message to the user.
  18. echo '
  19. <div id="modcenter">';
  20. $alternate = true;
  21. // Show all the blocks they want to see.
  22. foreach ($context['mod_blocks'] as $block)
  23. {
  24. $block_function = 'template_' . $block;
  25. echo '
  26. <div class="modblock_', $alternate ? 'left' : 'right', '">', function_exists($block_function) ? $block_function() : '', '</div>';
  27. if (!$alternate)
  28. echo '
  29. <br class="clear">';
  30. $alternate = !$alternate;
  31. }
  32. echo '
  33. </div>
  34. <br class="clear">';
  35. }
  36. // Show all the group requests the user can see.
  37. function template_group_requests_block()
  38. {
  39. global $context, $txt, $scripturl;
  40. echo '
  41. <div class="cat_bar">
  42. <h3 class="catbg">
  43. <span id="group_requests_toggle" class="', !empty($context['admin_prefs']['mcgr']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  44. <a href="', $scripturl, '?action=groups;sa=requests" id="group_requests_link">', $txt['mc_group_requests'], '</a>
  45. </h3>
  46. </div>
  47. <div class="windowbg" id="group_requests_panel">
  48. <div class="content modbox">
  49. <ul class="reset">';
  50. foreach ($context['group_requests'] as $request)
  51. echo '
  52. <li class="smalltext">
  53. <a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
  54. </li>';
  55. // Don't have any watched users right now?
  56. if (empty($context['group_requests']))
  57. echo '
  58. <li>
  59. <strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
  60. </li>';
  61. echo '
  62. </ul>
  63. </div>
  64. </div>
  65. <script><!-- // --><![CDATA[
  66. var oGroupRequestsPanelToggle = new smc_Toggle({
  67. bToggleEnabled: true,
  68. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcgr']) ? 'true' : 'false', ',
  69. aSwappableContainers: [
  70. \'group_requests_panel\'
  71. ],
  72. aSwapImages: [
  73. {
  74. sId: \'group_requests_toggle\',
  75. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  76. altCollapsed: ', JavaScriptEscape($txt['show']), '
  77. }
  78. ],
  79. aSwapLinks: [
  80. {
  81. sId: \'group_requests_link\',
  82. msgExpanded: ', JavaScriptEscape($txt['mc_group_requests']), ',
  83. msgCollapsed: ', JavaScriptEscape($txt['mc_group_requests']), '
  84. }
  85. ],
  86. oThemeOptions: {
  87. bUseThemeSettings: true,
  88. sOptionName: \'admin_preferences\',
  89. sSessionVar: smf_session_var,
  90. sSessionId: smf_session_id,
  91. sThemeId: \'1\',
  92. sAdditionalVars: \';admin_key=mcgr\'
  93. }
  94. });
  95. // ]]></script>';
  96. }
  97. // A block to show the current top reported posts.
  98. function template_reported_posts_block()
  99. {
  100. global $context, $txt, $scripturl;
  101. echo '
  102. <div class="cat_bar">
  103. <h3 class="catbg">
  104. <span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  105. <a href="', $scripturl, '?action=moderate;area=reports" id="reported_posts_link">', $txt['mc_recent_reports'], '</a>
  106. </h3>
  107. </div>
  108. <div class="windowbg" id="reported_posts_panel">
  109. <div class="content modbox">
  110. <ul class="reset">';
  111. foreach ($context['reported_posts'] as $report)
  112. echo '
  113. <li class="smalltext">
  114. <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
  115. </li>';
  116. // Don't have any watched users right now?
  117. if (empty($context['reported_posts']))
  118. echo '
  119. <li>
  120. <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
  121. </li>';
  122. echo '
  123. </ul>
  124. </div>
  125. </div>
  126. <script><!-- // --><![CDATA[
  127. var oReportedPostsPanelToggle = new smc_Toggle({
  128. bToggleEnabled: true,
  129. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ',
  130. aSwappableContainers: [
  131. \'reported_posts_panel\'
  132. ],
  133. aSwapImages: [
  134. {
  135. sId: \'reported_posts_toggle\',
  136. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  137. altCollapsed: ', JavaScriptEscape($txt['show']), '
  138. }
  139. ],
  140. aSwapLinks: [
  141. {
  142. sId: \'reported_posts_link\',
  143. msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ',
  144. msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), '
  145. }
  146. ],
  147. oThemeOptions: {
  148. bUseThemeSettings: true,
  149. sOptionName: \'admin_preferences\',
  150. sSessionVar: smf_session_var,
  151. sSessionId: smf_session_id,
  152. sThemeId: \'1\',
  153. sAdditionalVars: \';admin_key=mcrp\'
  154. }
  155. });
  156. // ]]></script>';
  157. }
  158. function template_watched_users()
  159. {
  160. global $context, $txt, $scripturl;
  161. echo '
  162. <div class="cat_bar">
  163. <h3 class="catbg">
  164. <span id="watched_users_toggle" class="', !empty($context['admin_prefs']['mcwu']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  165. <a href="', $scripturl, '?action=moderate;area=userwatch" id="watched_users_link">', $txt['mc_watched_users'], '</a>
  166. </h3>
  167. </div>
  168. <div class="windowbg" id="watched_users_panel">
  169. <div class="content modbox">
  170. <ul class="reset">';
  171. foreach ($context['watched_users'] as $user)
  172. echo '
  173. <li>
  174. <span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
  175. </li>';
  176. // Don't have any watched users right now?
  177. if (empty($context['watched_users']))
  178. echo '
  179. <li>
  180. <strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
  181. </li>';
  182. echo '
  183. </ul>
  184. </div>
  185. </div>
  186. <script><!-- // --><![CDATA[
  187. var oWatchedUsersToggle = new smc_Toggle({
  188. bToggleEnabled: true,
  189. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcwu']) ? 'true' : 'false', ',
  190. aSwappableContainers: [
  191. \'watched_users_panel\'
  192. ],
  193. aSwapImages: [
  194. {
  195. sId: \'watched_users_toggle\',
  196. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  197. altCollapsed: ', JavaScriptEscape($txt['show']), '
  198. }
  199. ],
  200. aSwapLinks: [
  201. {
  202. sId: \'watched_users_link\',
  203. msgExpanded: ', JavaScriptEscape($txt['mc_watched_users']), ',
  204. msgCollapsed: ', JavaScriptEscape($txt['mc_watched_users']), '
  205. }
  206. ],
  207. oThemeOptions: {
  208. bUseThemeSettings: true,
  209. sOptionName: \'admin_preferences\',
  210. sSessionVar: smf_session_var,
  211. sSessionId: smf_session_id,
  212. sThemeId: \'1\',
  213. sAdditionalVars: \';admin_key=mcwu\'
  214. }
  215. });
  216. // ]]></script>';
  217. }
  218. // Little section for making... notes.
  219. function template_notes()
  220. {
  221. global $context, $txt, $scripturl;
  222. echo '
  223. <div class="modnotes">
  224. <form action="', $scripturl, '?action=moderate;area=index;modnote" method="post">
  225. <div class="cat_bar">
  226. <h3 class="catbg">', $txt['mc_notes'], '</h3>
  227. </div>
  228. <div class="windowbg">
  229. <div class="content modbox">';
  230. if (!empty($context['notes']))
  231. {
  232. echo '
  233. <ul class="reset moderation_notes">';
  234. // Cycle through the notes.
  235. foreach ($context['notes'] as $note)
  236. echo '
  237. <li class="smalltext"><a href="', $note['delete_href'], '"><span class="generic_icons del_small"></span></a>', $note['time'] ,' <strong>', $note['author']['link'], ':</strong> ', $note['text'], '</li>';
  238. echo '
  239. </ul>
  240. <div class="pagesection notes">
  241. <span class="smalltext">', $context['page_index'], '</span>
  242. </div>';
  243. }
  244. echo '
  245. <div class="floatleft post_note">
  246. <input type="text" name="new_note" value="', $txt['mc_click_add_note'], '" style="width: 95%;" onclick="if (this.value == \'', $txt['mc_click_add_note'], '\') this.value = \'\';" class="input_text">
  247. </div>
  248. <input type="submit" name="makenote" value="', $txt['mc_add_note'], '" class="button_submit">
  249. </div>
  250. </div>
  251. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  252. </form>
  253. </div>';
  254. }
  255. function template_reported_posts()
  256. {
  257. global $context, $txt, $scripturl;
  258. // Let them know the action was a success.
  259. if (!empty($context['report_post_action']) && !empty($txt['report_action_'. $context['report_post_action']]))
  260. {
  261. echo '
  262. <div class="infobox">
  263. ', $txt['report_action_'. $context['report_post_action']], '
  264. </div>';
  265. }
  266. echo '
  267. <form id="reported_posts" action="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  268. <div class="cat_bar">
  269. <h3 class="catbg">
  270. ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
  271. </h3>
  272. </div>
  273. <div class="pagesection">
  274. <div class="pagelinks">', $context['page_index'], '</div>
  275. </div>';
  276. // Make the buttons.
  277. $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"');
  278. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  279. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  280. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  281. $ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
  282. $delete_button = create_button('delete.png', 'mc_reportedp_delete', 'mc_reportedp_delete', 'class="centericon"');
  283. foreach ($context['reports'] as $report)
  284. {
  285. echo '
  286. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  287. <div class="content">
  288. <h5>
  289. <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>
  290. </h5>
  291. <div class="smalltext">
  292. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  293. // Prepare the comments...
  294. $comments = array();
  295. foreach ($report['comments'] as $comment)
  296. $comments[$comment['member']['id']] = $comment['member']['link'];
  297. echo '
  298. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  299. </div>
  300. <hr>
  301. ', $report['body'], '
  302. <br>
  303. <ul class="quickbuttons">
  304. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  305. <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>
  306. <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>';
  307. // Delete message button.
  308. if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
  309. echo '
  310. <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>';
  311. // Ban this user button.
  312. if (!$report['closed'] && !empty($context['report_manage_bans']))
  313. echo '
  314. <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>';
  315. echo '
  316. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check">' : '', '</li>
  317. </ul>
  318. </div>
  319. </div>';
  320. }
  321. // Were none found?
  322. if (empty($context['reports']))
  323. echo '
  324. <div class="windowbg2">
  325. <div class="content">
  326. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  327. </div>
  328. </div>';
  329. echo '
  330. <div class="pagesection">
  331. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  332. <div class="floatright">
  333. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit">' : '', '
  334. </div>
  335. </div>
  336. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  337. </form>';
  338. }
  339. // Show a list of all the unapproved posts
  340. function template_unapproved_posts()
  341. {
  342. global $options, $context, $txt, $scripturl;
  343. // Just a big table of it all really...
  344. echo '
  345. <div id="modcenter">
  346. <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="', $context['character_set'], '">
  347. <div class="cat_bar">
  348. <h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3>
  349. </div>';
  350. // Make up some buttons
  351. $approve_button = create_button('approve.png', 'approve', 'approve', 'class="centericon"');
  352. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  353. // No posts?
  354. if (empty($context['unapproved_items']))
  355. echo '
  356. <div class="windowbg2">
  357. <div class="content">
  358. <p class="centertext">', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '</p>
  359. </div>
  360. </div>';
  361. else
  362. echo '
  363. <div class="pagesection floatleft">
  364. ', $context['page_index'], '
  365. </div>';
  366. foreach ($context['unapproved_items'] as $item)
  367. {
  368. echo '
  369. <div class="topic clear">
  370. <div class="', $item['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  371. <div class="content">
  372. <div class="counter">', $item['counter'], '</div>
  373. <div class="topic_details">
  374. <h5><strong>', $item['category']['link'], ' / ', $item['board']['link'], ' / ', $item['link'], '</strong></h5>
  375. <span class="smalltext"><strong>', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ':</strong> ', $item['time'], '</span>
  376. </div>
  377. <div class="list_posts">
  378. <div class="post">', $item['body'], '</div>
  379. </div>
  380. <span class="floatright">
  381. <a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';approve=', $item['id'], '">', $approve_button, '</a>';
  382. if ($item['can_delete'])
  383. echo '
  384. ', $context['menu_separator'], '
  385. <a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';delete=', $item['id'], '">', $remove_button, '</a>';
  386. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  387. echo '
  388. <input type="checkbox" name="item[]" value="', $item['id'], '" checked class="input_check"> ';
  389. echo '
  390. </span>
  391. </div>
  392. </div>
  393. </div>';
  394. }
  395. echo '
  396. <div class="pagesection">';
  397. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  398. echo '
  399. <div class="floatright">
  400. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  401. <option value="0">', $txt['with_selected'], ':</option>
  402. <option value="0">-------------------</option>
  403. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  404. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  405. </select>
  406. <noscript><input type="submit" name="mc_go" value="', $txt['go'], '" class="button_submit"></noscript>
  407. </div>';
  408. if (!empty($context['unapproved_items']))
  409. echo '
  410. <div class="floatleft">
  411. <div class="pagelinks">', $context['page_index'], '</div>
  412. </div>';
  413. echo '
  414. </div>
  415. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  416. </form>
  417. </div>';
  418. }
  419. function template_viewmodreport()
  420. {
  421. global $context, $scripturl, $txt;
  422. echo '
  423. <div id="modcenter">
  424. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  425. <div class="cat_bar">
  426. <h3 class="catbg">
  427. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  428. </h3>
  429. </div>
  430. <div class="title_bar">
  431. <h3 class="titlebg">
  432. <span class="floatleft">
  433. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  434. </span>
  435. <span class="floatright">';
  436. // Make the buttons.
  437. $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"');
  438. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  439. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  440. echo '
  441. <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>
  442. <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>
  443. </span>
  444. </h3>
  445. </div>
  446. <div class="windowbg2">
  447. <div class="content">
  448. ', $context['report']['body'], '
  449. </div>
  450. </div>
  451. <br>
  452. <div class="cat_bar">
  453. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  454. </div>';
  455. foreach ($context['report']['comments'] as $comment)
  456. echo '
  457. <div class="windowbg">
  458. <div class="content">
  459. <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>
  460. <p>', $comment['message'], '</p>
  461. </div>
  462. </div>';
  463. echo '
  464. <br>
  465. <div class="cat_bar">
  466. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  467. </div>';
  468. if (empty($context['report']['mod_comments']))
  469. echo '
  470. <div class="description">
  471. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  472. </div>';
  473. echo '
  474. <div class="windowbg2">
  475. <div class="content">';
  476. foreach ($context['report']['mod_comments'] as $comment)
  477. echo
  478. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  479. echo '
  480. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  481. <div>
  482. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
  483. </div>
  484. </div>
  485. </div>
  486. <br>';
  487. $alt = false;
  488. template_show_list('moderation_actions_list');
  489. echo '
  490. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  491. </form>
  492. </div>';
  493. }
  494. function template_viewmemberreport()
  495. {
  496. global $context, $scripturl, $txt;
  497. echo '
  498. <div id="modcenter">
  499. <form action="', $scripturl, '?action=moderate;area=memberreports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  500. <div class="cat_bar">
  501. <h3 class="catbg">
  502. ', sprintf($txt['mc_viewmemberreport'], $context['report']['user']['link']), '
  503. </h3>
  504. </div>
  505. <div class="title_bar">
  506. <h3 class="titlebg">
  507. <span class="floatleft">
  508. ', sprintf($txt['mc_memberreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  509. </span>
  510. <span class="floatright">';
  511. // Make the buttons.
  512. $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"');
  513. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  514. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  515. echo '
  516. <a href="', $scripturl, '?action=moderate;area=memberreports;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>
  517. <a href="', $scripturl, '?action=moderate;area=memberreports;close=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a>
  518. </span>
  519. </h3>
  520. </div>
  521. <br>
  522. <div class="cat_bar">
  523. <h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
  524. </div>';
  525. foreach ($context['report']['comments'] as $comment)
  526. echo '
  527. <div class="windowbg">
  528. <div class="content">
  529. <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>
  530. <p>', $comment['message'], '</p>
  531. </div>
  532. </div>';
  533. echo '
  534. <br>
  535. <div class="cat_bar">
  536. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  537. </div>';
  538. if (empty($context['report']['mod_comments']))
  539. echo '
  540. <div class="description">
  541. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  542. </div>';
  543. echo '
  544. <div class="windowbg2">
  545. <div class="content">';
  546. foreach ($context['report']['mod_comments'] as $comment)
  547. echo
  548. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  549. echo '
  550. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  551. <div>
  552. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
  553. </div>
  554. </div>
  555. </div>
  556. <br>';
  557. $alt = false;
  558. template_show_list('memreport_actions_list');
  559. echo '
  560. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  561. </form>
  562. </div>';
  563. }
  564. // Callback function for showing a watched users post in the table.
  565. function template_user_watch_post_callback($post)
  566. {
  567. global $scripturl, $context, $txt, $delete_button;
  568. // We'll have a delete please bob.
  569. if (empty($delete_button))
  570. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  571. $output_html = '
  572. <div>
  573. <div class="floatleft">
  574. <strong><a href="' . $scripturl . '?topic=' . $post['id_topic'] . '.' . $post['id'] . '#msg' . $post['id'] . '">' . $post['subject'] . '</a></strong> ' . $txt['mc_reportedp_by'] . ' <strong>' . $post['author_link'] . '</strong>
  575. </div>
  576. <div class="floatright">';
  577. if ($post['can_delete'])
  578. $output_html .= '
  579. <a href="' . $scripturl . '?action=moderate;area=userwatch;sa=post;delete=' . $post['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mc_watched_users_delete_post'] . '\');">' . $delete_button . '</a>
  580. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check">';
  581. $output_html .= '
  582. </div>
  583. </div><br>
  584. <div class="smalltext">
  585. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  586. </div>
  587. <hr>
  588. ' . $post['body'];
  589. return $output_html;
  590. }
  591. // Moderation settings
  592. function template_moderation_settings()
  593. {
  594. global $context, $txt, $scripturl;
  595. echo '
  596. <div id="modcenter">
  597. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  598. <div class="windowbg2">
  599. <div class="content">
  600. <dl class="settings">';
  601. if ($context['can_moderate_approvals'])
  602. {
  603. echo '
  604. <dt>
  605. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  606. </dt>
  607. <dd>
  608. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval"', $context['mod_settings']['notify_approval'] ? ' checked' : '', ' class="input_check">
  609. </dd>';
  610. }
  611. echo '
  612. </dl>
  613. <hr class="hrcolor">
  614. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  615. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '">
  616. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit">
  617. </div>
  618. </div>
  619. </form>
  620. </div>';
  621. }
  622. // Show a notice sent to a user.
  623. function template_show_notice()
  624. {
  625. global $txt, $settings, $context;
  626. // We do all the HTML for this one!
  627. echo '<!DOCTYPE html>
  628. <html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  629. <head>
  630. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '">
  631. <title>', $context['page_title'], '</title>
  632. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21">
  633. </head>
  634. <body>
  635. <div class="cat_bar">
  636. <h3 class="catbg">', $txt['show_notice'], '</h3>
  637. </div>
  638. <div class="cat_bar">
  639. <h3 class="catbg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  640. </div>
  641. <div class="windowbg">
  642. <div class="content">
  643. <dl>
  644. <dt>
  645. <strong>', $txt['show_notice_text'], ':</strong>
  646. </dt>
  647. <dd>
  648. ', $context['notice_body'], '
  649. </dd>
  650. </dl>
  651. </div>
  652. </div>
  653. </body>
  654. </html>';
  655. }
  656. // Add or edit a warning template.
  657. function template_warn_template()
  658. {
  659. global $context, $txt, $scripturl;
  660. echo '
  661. <div id="modcenter">
  662. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  663. <div class="cat_bar">
  664. <h3 class="catbg">', $context['page_title'], '</h3>
  665. </div>
  666. <div class="information">
  667. ', $txt['mc_warning_template_desc'], '
  668. </div>
  669. <div class="windowbg">
  670. <div class="content">
  671. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  672. <dl>
  673. <dt>
  674. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  675. </dt>
  676. <dd class="error" id="error_list">
  677. ', empty($context['warning_errors']) ? '' : implode('<br>', $context['warning_errors']), '
  678. </dd>
  679. </dl>
  680. </div>
  681. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  682. <dl class="settings">
  683. <dt>
  684. <strong>', $txt['preview'] , '</strong>
  685. </dt>
  686. <dd id="template_preview">
  687. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  688. </dd>
  689. </dl>
  690. </div>
  691. <dl class="settings">
  692. <dt>
  693. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  694. </dt>
  695. <dd>
  696. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text">
  697. </dd>
  698. <dt>
  699. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br>
  700. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  701. </dt>
  702. <dd>
  703. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  704. </dd>
  705. </dl>';
  706. if ($context['template_data']['can_edit_personal'])
  707. echo '
  708. <input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', ' class="input_check">
  709. <label for="make_personal">
  710. <strong>', $txt['mc_warning_template_personal'], '</strong>
  711. </label>
  712. <br>
  713. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  714. <br>';
  715. echo '
  716. <hr class="hrcolor">
  717. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit">
  718. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit">
  719. </div>
  720. </div>
  721. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  722. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '">
  723. </form>
  724. </div>
  725. <script><!-- // --><![CDATA[
  726. $(document).ready(function() {
  727. $("#preview_button").click(function() {
  728. return ajax_getTemplatePreview();
  729. });
  730. });
  731. function ajax_getTemplatePreview ()
  732. {
  733. $.ajax({
  734. type: "POST",
  735. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  736. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  737. context: document.body,
  738. success: function(request){
  739. $("#box_preview").css({display:""});
  740. $("#template_preview").html($(request).find(\'body\').text());
  741. if ($(request).find("error").text() != \'\')
  742. {
  743. $("#errors").css({display:""});
  744. var errors_html = \'\';
  745. var errors = $(request).find(\'error\').each(function() {
  746. errors_html += $(this).text() + \'<br>\';
  747. });
  748. $(document).find("#error_list").html(errors_html);
  749. }
  750. else
  751. {
  752. $("#errors").css({display:"none"});
  753. $("#error_list").html(\'\');
  754. }
  755. return false;
  756. },
  757. });
  758. return false;
  759. }
  760. // ]]></script>';
  761. }
  762. // A block to show the current top reported member profiles.
  763. function template_reported_members_block()
  764. {
  765. global $context, $txt, $scripturl;
  766. echo '
  767. <div class="cat_bar">
  768. <h3 class="catbg">
  769. <span id="reported_members_toggle" class="', !empty($context['admin_prefs']['mcru']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  770. <a href="', $scripturl, '?action=moderate;area=memberreports" id="reported_members_link">', $txt['mc_recent_member_reports'], '</a>
  771. </h3>
  772. </div>
  773. <div class="windowbg" id="reported_users_panel">
  774. <div class="content modbox">
  775. <ul class="reset">';
  776. foreach ($context['reported_members'] as $report)
  777. echo '
  778. <li class="smalltext">
  779. <a href="', $report['report_href'], '">', $report['user_name'], '</a>
  780. </li>';
  781. // Don't have any reported members right now?
  782. if (empty($context['reported_members']))
  783. echo '
  784. <li>
  785. <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
  786. </li>';
  787. echo '
  788. </ul>
  789. </div>
  790. </div>
  791. <script><!-- // --><![CDATA[
  792. var oReportedPostsPanelToggle = new smc_Toggle({
  793. bToggleEnabled: true,
  794. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrm']) ? 'true' : 'false', ',
  795. aSwappableContainers: [
  796. \'reported_posts_panel\'
  797. ],
  798. aSwapImages: [
  799. {
  800. sId: \'reported_members_toggle\',
  801. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  802. altCollapsed: ', JavaScriptEscape($txt['show']), '
  803. }
  804. ],
  805. aSwapLinks: [
  806. {
  807. sId: \'reported_members_link\',
  808. msgExpanded: ', JavaScriptEscape($txt['mc_recent_member_reports']), ',
  809. msgCollapsed: ', JavaScriptEscape($txt['mc_recent_member_reports']), '
  810. }
  811. ],
  812. oThemeOptions: {
  813. bUseThemeSettings: true,
  814. sOptionName: \'admin_preferences\',
  815. sSessionVar: smf_session_var,
  816. sSessionId: smf_session_id,
  817. sThemeId: \'1\',
  818. sAdditionalVars: \';admin_key=mcrm\'
  819. }
  820. });
  821. // ]]></script>';
  822. }
  823. function template_reported_members()
  824. {
  825. global $context, $txt, $scripturl;
  826. // Let them know the action was a success.
  827. if (!empty($context['report_post_action']) && !empty($txt['report_action_'. $context['report_post_action']]))
  828. {
  829. echo '
  830. <div class="infobox">
  831. ', $txt['report_action_'. $context['report_post_action']], '
  832. </div>';
  833. }
  834. echo '
  835. <form id="reported_members" action="', $scripturl, '?action=moderate;area=memberreports', $context['view_closed'] ? ';sa=closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  836. <div class="cat_bar">
  837. <h3 class="catbg">
  838. ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
  839. </h3>
  840. </div>
  841. <div class="pagesection">
  842. <div class="pagelinks">', $context['page_index'], '</div>
  843. </div>';
  844. // Make the buttons.
  845. $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"');
  846. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  847. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  848. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  849. $ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
  850. foreach ($context['reports'] as $report)
  851. {
  852. echo '
  853. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  854. <div class="content">
  855. <h5>
  856. <strong><a href="', $report['user']['href'], '">', $report['user']['name'], '</a></strong>
  857. </h5>
  858. <div class="smalltext">
  859. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  860. // Prepare the comments...
  861. $comments = array();
  862. foreach ($report['comments'] as $comment)
  863. $comments[$comment['member']['id']] = $comment['member']['link'];
  864. echo '
  865. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  866. </div>
  867. <hr>
  868. <ul class="quickbuttons">
  869. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  870. <li><a href="', $scripturl, '?action=moderate;area=memberreports', $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>
  871. <li><a href="', $scripturl, '?action=moderate;area=memberreports', $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>';
  872. // Ban this user button.
  873. if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id']))
  874. echo '
  875. <li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'] ,';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
  876. echo '
  877. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check">' : '', '</li>
  878. </ul>
  879. </div>
  880. </div>';
  881. }
  882. // Were none found?
  883. if (empty($context['reports']))
  884. echo '
  885. <div class="windowbg2">
  886. <div class="content">
  887. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  888. </div>
  889. </div>';
  890. echo '
  891. <div class="pagesection">
  892. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  893. <div class="floatright">
  894. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit">' : '', '
  895. </div>
  896. </div>
  897. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  898. </form>';
  899. }
  900. ?>