ModerationCenter.template.php 27 KB

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