ModerationCenter.template.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  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. // Callback function for showing a watched users post in the table.
  495. function template_user_watch_post_callback($post)
  496. {
  497. global $scripturl, $context, $txt, $delete_button;
  498. // We'll have a delete please bob.
  499. if (empty($delete_button))
  500. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  501. $output_html = '
  502. <div>
  503. <div class="floatleft">
  504. <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>
  505. </div>
  506. <div class="floatright">';
  507. if ($post['can_delete'])
  508. $output_html .= '
  509. <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>
  510. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check">';
  511. $output_html .= '
  512. </div>
  513. </div><br>
  514. <div class="smalltext">
  515. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  516. </div>
  517. <hr>
  518. ' . $post['body'];
  519. return $output_html;
  520. }
  521. // Moderation settings
  522. function template_moderation_settings()
  523. {
  524. global $context, $txt, $scripturl;
  525. echo '
  526. <div id="modcenter">
  527. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  528. <div class="windowbg2">
  529. <div class="content">
  530. <dl class="settings">';
  531. if ($context['can_moderate_approvals'])
  532. {
  533. echo '
  534. <dt>
  535. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  536. </dt>
  537. <dd>
  538. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval"', $context['mod_settings']['notify_approval'] ? ' checked' : '', ' class="input_check">
  539. </dd>';
  540. }
  541. echo '
  542. </dl>
  543. <hr class="hrcolor">
  544. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  545. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '">
  546. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit">
  547. </div>
  548. </div>
  549. </form>
  550. </div>';
  551. }
  552. // Show a notice sent to a user.
  553. function template_show_notice()
  554. {
  555. global $txt, $settings, $context, $modSettings;
  556. // We do all the HTML for this one!
  557. echo '<!DOCTYPE html>
  558. <html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  559. <head>
  560. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '">
  561. <title>', $context['page_title'], '</title>
  562. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'">
  563. </head>
  564. <body>
  565. <div class="cat_bar">
  566. <h3 class="catbg">', $txt['show_notice'], '</h3>
  567. </div>
  568. <div class="cat_bar">
  569. <h3 class="catbg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  570. </div>
  571. <div class="windowbg">
  572. <div class="content">
  573. <dl>
  574. <dt>
  575. <strong>', $txt['show_notice_text'], ':</strong>
  576. </dt>
  577. <dd>
  578. ', $context['notice_body'], '
  579. </dd>
  580. </dl>
  581. </div>
  582. </div>
  583. </body>
  584. </html>';
  585. }
  586. // Add or edit a warning template.
  587. function template_warn_template()
  588. {
  589. global $context, $txt, $scripturl;
  590. echo '
  591. <div id="modcenter">
  592. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  593. <div class="cat_bar">
  594. <h3 class="catbg">', $context['page_title'], '</h3>
  595. </div>
  596. <div class="information">
  597. ', $txt['mc_warning_template_desc'], '
  598. </div>
  599. <div class="windowbg">
  600. <div class="content">
  601. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  602. <dl>
  603. <dt>
  604. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  605. </dt>
  606. <dd class="error" id="error_list">
  607. ', empty($context['warning_errors']) ? '' : implode('<br>', $context['warning_errors']), '
  608. </dd>
  609. </dl>
  610. </div>
  611. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  612. <dl class="settings">
  613. <dt>
  614. <strong>', $txt['preview'] , '</strong>
  615. </dt>
  616. <dd id="template_preview">
  617. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  618. </dd>
  619. </dl>
  620. </div>
  621. <dl class="settings">
  622. <dt>
  623. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  624. </dt>
  625. <dd>
  626. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text">
  627. </dd>
  628. <dt>
  629. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br>
  630. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  631. </dt>
  632. <dd>
  633. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  634. </dd>
  635. </dl>';
  636. if ($context['template_data']['can_edit_personal'])
  637. echo '
  638. <input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', ' class="input_check">
  639. <label for="make_personal">
  640. <strong>', $txt['mc_warning_template_personal'], '</strong>
  641. </label>
  642. <br>
  643. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  644. <br>';
  645. echo '
  646. <hr class="hrcolor">
  647. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit">
  648. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit">
  649. </div>
  650. </div>
  651. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  652. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '">
  653. </form>
  654. </div>
  655. <script><!-- // --><![CDATA[
  656. $(document).ready(function() {
  657. $("#preview_button").click(function() {
  658. return ajax_getTemplatePreview();
  659. });
  660. });
  661. function ajax_getTemplatePreview ()
  662. {
  663. $.ajax({
  664. type: "POST",
  665. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  666. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  667. context: document.body,
  668. success: function(request){
  669. $("#box_preview").css({display:""});
  670. $("#template_preview").html($(request).find(\'body\').text());
  671. if ($(request).find("error").text() != \'\')
  672. {
  673. $("#errors").css({display:""});
  674. var errors_html = \'\';
  675. var errors = $(request).find(\'error\').each(function() {
  676. errors_html += $(this).text() + \'<br>\';
  677. });
  678. $(document).find("#error_list").html(errors_html);
  679. }
  680. else
  681. {
  682. $("#errors").css({display:"none"});
  683. $("#error_list").html(\'\');
  684. }
  685. return false;
  686. },
  687. });
  688. return false;
  689. }
  690. // ]]></script>';
  691. }
  692. ?>