2
0

ModerationCenter.template.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2013 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, $options, $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 $settings, $options, $context, $txt, $scripturl;
  40. echo '
  41. <div class="cat_bar">
  42. <h3 class="catbg">
  43. <a href="', $scripturl, '?action=groups;sa=requests">', $txt['mc_group_requests'], '</a>
  44. </h3>
  45. </div>
  46. <div class="windowbg">
  47. <div class="content modbox">
  48. <ul class="reset">';
  49. foreach ($context['group_requests'] as $request)
  50. echo '
  51. <li class="smalltext">
  52. <a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
  53. </li>';
  54. // Don't have any watched users right now?
  55. if (empty($context['group_requests']))
  56. echo '
  57. <li>
  58. <strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
  59. </li>';
  60. echo '
  61. </ul>
  62. </div>
  63. </div>';
  64. }
  65. // A block to show the current top reported posts.
  66. function template_reported_posts_block()
  67. {
  68. global $settings, $options, $context, $txt, $scripturl;
  69. echo '
  70. <div class="cat_bar">
  71. <h3 class="catbg">
  72. <a href="', $scripturl, '?action=moderate;area=reports">', $txt['mc_recent_reports'], '</a>
  73. </h3>
  74. </div>
  75. <div class="windowbg">
  76. <div class="content modbox">
  77. <ul class="reset">';
  78. foreach ($context['reported_posts'] as $report)
  79. echo '
  80. <li class="smalltext">
  81. <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
  82. </li>';
  83. // Don't have any watched users right now?
  84. if (empty($context['reported_posts']))
  85. echo '
  86. <li>
  87. <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
  88. </li>';
  89. echo '
  90. </ul>
  91. </div>
  92. </div>';
  93. }
  94. function template_watched_users()
  95. {
  96. global $settings, $options, $context, $txt, $scripturl;
  97. echo '
  98. <div class="cat_bar">
  99. <h3 class="catbg">
  100. <a href="', $scripturl, '?action=moderate;area=userwatch">', $txt['mc_watched_users'], '</a>
  101. </h3>
  102. </div>
  103. <div class="windowbg">
  104. <div class="content modbox">
  105. <ul class="reset">';
  106. foreach ($context['watched_users'] as $user)
  107. echo '
  108. <li>
  109. <span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
  110. </li>';
  111. // Don't have any watched users right now?
  112. if (empty($context['watched_users']))
  113. echo '
  114. <li>
  115. <strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
  116. </li>';
  117. echo '
  118. </ul>
  119. </div>
  120. </div>';
  121. }
  122. // Little section for making... notes.
  123. function template_notes()
  124. {
  125. global $settings, $options, $context, $txt, $scripturl;
  126. echo '
  127. <div class="modnotes">
  128. <form action="', $scripturl, '?action=moderate;area=index;modnote" method="post">
  129. <div class="cat_bar">
  130. <h3 class="catbg">', $txt['mc_notes'], '</h3>
  131. </div>
  132. <div class="windowbg">
  133. <div class="content modbox">';
  134. if (!empty($context['notes']))
  135. {
  136. echo '
  137. <ul class="reset moderation_notes">';
  138. // Cycle through the notes.
  139. foreach ($context['notes'] as $note)
  140. echo '
  141. <li class="smalltext"><a href="', $note['delete_href'], '"><img src="', $settings['images_url'], '/pm_recipient_delete.png" alt="" /></a>', $note['time'] ,' <strong>', $note['author']['link'], ':</strong> ', $note['text'], '</li>';
  142. echo '
  143. </ul>
  144. <div class="pagesection notes">
  145. <span class="smalltext">', $context['page_index'], '</span>
  146. </div>';
  147. }
  148. echo '
  149. <div class="floatleft post_note">
  150. <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" />
  151. </div>
  152. <input type="submit" name="makenote" value="', $txt['mc_add_note'], '" class="button_submit" />
  153. </div>
  154. </div>
  155. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  156. </form>
  157. </div>';
  158. }
  159. function template_reported_posts()
  160. {
  161. global $settings, $options, $context, $txt, $scripturl;
  162. // Let them know the action was a success.
  163. if (!empty($context['report_post_action']) && !empty($txt['report_action_'. $context['report_post_action']]))
  164. {
  165. echo '
  166. <div class="infobox">
  167. ', $txt['report_action_'. $context['report_post_action']], '
  168. </div>';
  169. }
  170. echo '
  171. <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'], '">
  172. <div class="cat_bar">
  173. <h3 class="catbg">
  174. ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
  175. </h3>
  176. </div>
  177. <div class="pagesection">
  178. <div class="pagelinks">', $context['page_index'], '</div>
  179. </div>';
  180. // Make the buttons.
  181. $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"');
  182. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  183. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  184. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  185. $ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
  186. $delete_button = create_button('delete.png', 'mc_reportedp_delete', 'mc_reportedp_delete', 'class="centericon"');
  187. foreach ($context['reports'] as $report)
  188. {
  189. echo '
  190. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  191. <div class="content">
  192. <h5>
  193. <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>
  194. </h5>
  195. <div class="smalltext">
  196. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  197. // Prepare the comments...
  198. $comments = array();
  199. foreach ($report['comments'] as $comment)
  200. $comments[$comment['member']['id']] = $comment['member']['link'];
  201. echo '
  202. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  203. </div>
  204. <hr />
  205. ', $report['body'], '
  206. <br />
  207. <ul class="quickbuttons">
  208. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  209. <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>
  210. <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>';
  211. // Delete message button.
  212. if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
  213. echo '
  214. <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>';
  215. // Ban this user button.
  216. if (!$report['closed'] && !empty($context['report_manage_bans']))
  217. echo '
  218. <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>';
  219. echo '
  220. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check" />' : '', '</li>
  221. </ul>
  222. </div>
  223. </div>';
  224. }
  225. // Were none found?
  226. if (empty($context['reports']))
  227. echo '
  228. <div class="windowbg2">
  229. <div class="content">
  230. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  231. </div>
  232. </div>';
  233. echo '
  234. <div class="pagesection">
  235. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  236. <div class="floatright">
  237. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit" />' : '', '
  238. </div>
  239. </div>
  240. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  241. </form>';
  242. }
  243. // Show a list of all the unapproved posts
  244. function template_unapproved_posts()
  245. {
  246. global $settings, $options, $context, $txt, $scripturl;
  247. // Just a big table of it all really...
  248. echo '
  249. <div id="modcenter">
  250. <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="', $context['character_set'], '">
  251. <div class="cat_bar">
  252. <h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3>
  253. </div>';
  254. // Make up some buttons
  255. $approve_button = create_button('approve.png', 'approve', 'approve', 'class="centericon"');
  256. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  257. // No posts?
  258. if (empty($context['unapproved_items']))
  259. echo '
  260. <div class="windowbg2">
  261. <div class="content">
  262. <p class="centertext">', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '</p>
  263. </div>
  264. </div>';
  265. else
  266. echo '
  267. <div class="pagesection floatleft">
  268. ', $context['page_index'], '
  269. </div>';
  270. foreach ($context['unapproved_items'] as $item)
  271. {
  272. echo '
  273. <div class="topic clear">
  274. <div class="', $item['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  275. <div class="content">
  276. <div class="counter">', $item['counter'], '</div>
  277. <div class="topic_details">
  278. <h5><strong>', $item['category']['link'], ' / ', $item['board']['link'], ' / ', $item['link'], '</strong></h5>
  279. <span class="smalltext"><strong>', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ':</strong> ', $item['time'], '</span>
  280. </div>
  281. <div class="list_posts">
  282. <div class="post">', $item['body'], '</div>
  283. </div>
  284. <span class="floatright">
  285. <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>';
  286. if ($item['can_delete'])
  287. echo '
  288. ', $context['menu_separator'], '
  289. <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>';
  290. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  291. echo '
  292. <input type="checkbox" name="item[]" value="', $item['id'], '" checked="checked" class="input_check" /> ';
  293. echo '
  294. </span>
  295. </div>
  296. </div>
  297. </div>';
  298. }
  299. echo '
  300. <div class="pagesection">';
  301. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  302. echo '
  303. <div class="floatright">
  304. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  305. <option value="0">', $txt['with_selected'], ':</option>
  306. <option value="0">-------------------</option>
  307. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  308. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  309. </select>
  310. <noscript><input type="submit" name="mc_go" value="', $txt['go'], '" class="button_submit" /></noscript>
  311. </div>';
  312. if (!empty($context['unapproved_items']))
  313. echo '
  314. <div class="floatleft">
  315. <div class="pagelinks">', $context['page_index'], '</div>
  316. </div>';
  317. echo '
  318. </div>
  319. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  320. </form>
  321. </div>';
  322. }
  323. function template_viewmodreport()
  324. {
  325. global $context, $scripturl, $txt;
  326. echo '
  327. <div id="modcenter">
  328. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  329. <div class="cat_bar">
  330. <h3 class="catbg">
  331. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  332. </h3>
  333. </div>
  334. <div class="title_bar">
  335. <h3 class="titlebg">
  336. <span class="floatleft">
  337. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  338. </span>
  339. <span class="floatright">';
  340. // Make the buttons.
  341. $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"');
  342. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  343. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  344. echo '
  345. <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>
  346. <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>
  347. </span>
  348. </h3>
  349. </div>
  350. <div class="windowbg2">
  351. <div class="content">
  352. ', $context['report']['body'], '
  353. </div>
  354. </div>
  355. <br />
  356. <div class="cat_bar">
  357. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  358. </div>';
  359. foreach ($context['report']['comments'] as $comment)
  360. echo '
  361. <div class="windowbg">
  362. <div class="content">
  363. <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>
  364. <p>', $comment['message'], '</p>
  365. </div>
  366. </div>';
  367. echo '
  368. <br />
  369. <div class="cat_bar">
  370. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  371. </div>
  372. <div class="windowbg2">
  373. <div class="content">';
  374. if (empty($context['report']['mod_comments']))
  375. echo '
  376. <div class="information">
  377. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  378. </div>';
  379. foreach ($context['report']['mod_comments'] as $comment)
  380. echo
  381. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  382. echo '
  383. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  384. <div>
  385. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit" />
  386. </div>
  387. </div>
  388. </div>
  389. <br />';
  390. $alt = false;
  391. template_show_list('moderation_actions_list');
  392. echo '
  393. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  394. </form>
  395. </div>';
  396. }
  397. // Callback function for showing a watched users post in the table.
  398. function template_user_watch_post_callback($post)
  399. {
  400. global $scripturl, $context, $txt, $delete_button;
  401. // We'll have a delete please bob.
  402. if (empty($delete_button))
  403. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  404. $output_html = '
  405. <div>
  406. <div class="floatleft">
  407. <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>
  408. </div>
  409. <div class="floatright">';
  410. if ($post['can_delete'])
  411. $output_html .= '
  412. <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>
  413. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check" />';
  414. $output_html .= '
  415. </div>
  416. </div><br />
  417. <div class="smalltext">
  418. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  419. </div>
  420. <hr />
  421. ' . $post['body'];
  422. return $output_html;
  423. }
  424. // Moderation settings
  425. function template_moderation_settings()
  426. {
  427. global $settings, $options, $context, $txt, $scripturl;
  428. echo '
  429. <div id="modcenter">
  430. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  431. <div class="windowbg2">
  432. <div class="content">
  433. <dl class="settings">
  434. <dt>
  435. <strong>', $txt['mc_prefs_homepage'], ':</strong>
  436. </dt>
  437. <dd>';
  438. foreach ($context['homepage_blocks'] as $k => $v)
  439. echo '
  440. <label for="mod_homepage_', $k, '"><input type="checkbox" id="mod_homepage_', $k, '" name="mod_homepage[', $k, ']"', in_array($k, $context['mod_settings']['user_blocks']) ? ' checked="checked"' : '', ' class="input_check" /> ', $v, '</label><br />';
  441. echo '
  442. </dd>';
  443. // If they can moderate boards they have more options!
  444. if ($context['can_moderate_boards'])
  445. {
  446. echo '
  447. <dt>
  448. <strong><label for="mod_show_reports">', $txt['mc_prefs_show_reports'], '</label>:</strong>
  449. </dt>
  450. <dd>
  451. <input type="checkbox" id="mod_show_reports" name="mod_show_reports" ', $context['mod_settings']['show_reports'] ? 'checked="checked"' : '', ' class="input_check" />
  452. </dd>
  453. <dt>
  454. <strong><label for="mod_notify_report">', $txt['mc_prefs_notify_report'], '</label>:</strong>
  455. </dt>
  456. <dd>
  457. <select id="mod_notify_report" name="mod_notify_report">
  458. <option value="0" ', $context['mod_settings']['notify_report'] == 0 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_never'], '</option>
  459. <option value="1" ', $context['mod_settings']['notify_report'] == 1 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_moderator'], '</option>
  460. <option value="2" ', $context['mod_settings']['notify_report'] == 2 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_always'], '</option>
  461. </select>
  462. </dd>';
  463. }
  464. if ($context['can_moderate_approvals'])
  465. {
  466. echo '
  467. <dt>
  468. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  469. </dt>
  470. <dd>
  471. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval" ', $context['mod_settings']['notify_approval'] ? 'checked="checked"' : '', ' class="input_check" />
  472. </dd>';
  473. }
  474. echo '
  475. </dl>
  476. <hr class="hrcolor" />
  477. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  478. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '" />
  479. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />
  480. </div>
  481. </div>
  482. </form>
  483. </div>';
  484. }
  485. // Show a notice sent to a user.
  486. function template_show_notice()
  487. {
  488. global $txt, $settings, $options, $context;
  489. // We do all the HTML for this one!
  490. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  491. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  492. <head>
  493. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  494. <title>', $context['page_title'], '</title>
  495. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21" />
  496. </head>
  497. <body>
  498. <div class="cat_bar">
  499. <h3 class="catbg">', $txt['show_notice'], '</h3>
  500. </div>
  501. <div class="title_bar">
  502. <h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  503. </div>
  504. <div class="windowbg">
  505. <div class="content">
  506. <dl>
  507. <dt>
  508. <strong>', $txt['show_notice_text'], ':</strong>
  509. </dt>
  510. <dd>
  511. ', $context['notice_body'], '
  512. </dd>
  513. </dl>
  514. </div>
  515. </div>
  516. </body>
  517. </html>';
  518. }
  519. // Add or edit a warning template.
  520. function template_warn_template()
  521. {
  522. global $context, $settings, $options, $txt, $scripturl;
  523. echo '
  524. <div id="modcenter">
  525. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  526. <div class="cat_bar">
  527. <h3 class="catbg">', $context['page_title'], '</h3>
  528. </div>
  529. <div class="information">
  530. ', $txt['mc_warning_template_desc'], '
  531. </div>
  532. <div class="windowbg">
  533. <div class="content">
  534. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  535. <dl>
  536. <dt>
  537. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  538. </dt>
  539. <dd class="error" id="error_list">
  540. ', empty($context['warning_errors']) ? '' : implode('<br />', $context['warning_errors']), '
  541. </dd>
  542. </dl>
  543. </div>
  544. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  545. <dl class="settings">
  546. <dt>
  547. <strong>', $txt['preview'] , '</strong>
  548. </dt>
  549. <dd id="template_preview">
  550. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  551. </dd>
  552. </dl>
  553. </div>
  554. <dl class="settings">
  555. <dt>
  556. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  557. </dt>
  558. <dd>
  559. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text" />
  560. </dd>
  561. <dt>
  562. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br />
  563. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  564. </dt>
  565. <dd>
  566. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  567. </dd>
  568. </dl>';
  569. if ($context['template_data']['can_edit_personal'])
  570. echo '
  571. <input type="checkbox" name="make_personal" id="make_personal" ', $context['template_data']['personal'] ? 'checked="checked"' : '', ' class="input_check" />
  572. <label for="make_personal">
  573. <strong>', $txt['mc_warning_template_personal'], '</strong>
  574. </label>
  575. <br />
  576. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  577. <br />';
  578. echo '
  579. <hr class="hrcolor" />
  580. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
  581. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit" />
  582. </div>
  583. </div>
  584. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  585. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '" />
  586. </form>
  587. </div>
  588. <script type="text/javascript"><!-- // --><![CDATA[
  589. $(document).ready(function() {
  590. $("#preview_button").click(function() {
  591. return ajax_getTemplatePreview();
  592. });
  593. });
  594. function ajax_getTemplatePreview ()
  595. {
  596. $.ajax({
  597. type: "POST",
  598. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  599. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  600. context: document.body,
  601. success: function(request){
  602. $("#box_preview").css({display:""});
  603. $("#template_preview").html($(request).find(\'body\').text());
  604. if ($(request).find("error").text() != \'\')
  605. {
  606. $("#errors").css({display:""});
  607. var errors_html = \'\';
  608. var errors = $(request).find(\'error\').each(function() {
  609. errors_html += $(this).text() + \'<br />\';
  610. });
  611. $(document).find("#error_list").html(errors_html);
  612. }
  613. else
  614. {
  615. $("#errors").css({display:"none"});
  616. $("#error_list").html(\'\');
  617. }
  618. return false;
  619. },
  620. });
  621. return false;
  622. }
  623. // ]]></script>';
  624. }
  625. ?>