ModerationCenter.template.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  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. echo '
  163. <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'], '">
  164. <div class="cat_bar">
  165. <h3 class="catbg">
  166. ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
  167. </h3>
  168. </div>
  169. <div class="pagesection">
  170. <div class="pagelinks">', $context['page_index'], '</div>
  171. </div>';
  172. // Make the buttons.
  173. $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"');
  174. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  175. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  176. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  177. $ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
  178. $delete_button = create_button('delete.png', 'mc_reportedp_delete', 'mc_reportedp_delete', 'class="centericon"');
  179. foreach ($context['reports'] as $report)
  180. {
  181. echo '
  182. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  183. <div class="content">
  184. <h5>
  185. <strong><a href="', $report['topic']['href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</strong>
  186. </h5>
  187. <div class="smalltext">
  188. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  189. // Prepare the comments...
  190. $comments = array();
  191. foreach ($report['comments'] as $comment)
  192. $comments[$comment['member']['id']] = $comment['member']['link'];
  193. echo '
  194. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  195. </div>
  196. <hr />
  197. ', $report['body'], '
  198. <br />
  199. <ul class="quickbuttons">
  200. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  201. <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>
  202. <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>';
  203. // Delete message button.
  204. if (allowedTo('remove_any', $report['topic']['id_board']))
  205. echo '
  206. <li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'] ,'.0;msg=', $report['topic']['id_msg'] ,'" onclick="return confirm(\'' , $txt['mc_reportedp_delete_confirm'] , '\');>', $delete_button, '</a></li>';
  207. // Ban this user button.
  208. if (allowedTo('manage_bans', $report['topic']['id_board']))
  209. echo '
  210. <li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['author']['id'] ,'">', $ban_button, '</a></li>';
  211. echo '
  212. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check" />' : '', '</li>
  213. </ul>
  214. </div>
  215. </div>';
  216. }
  217. // Were none found?
  218. if (empty($context['reports']))
  219. echo '
  220. <div class="windowbg2">
  221. <div class="content">
  222. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  223. </div>
  224. </div>';
  225. echo '
  226. <div class="pagesection">
  227. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  228. <div class="floatright">
  229. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit" />' : '', '
  230. </div>
  231. </div>
  232. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  233. </form>';
  234. }
  235. // Show a list of all the unapproved posts
  236. function template_unapproved_posts()
  237. {
  238. global $settings, $options, $context, $txt, $scripturl;
  239. // Just a big table of it all really...
  240. echo '
  241. <div id="modcenter">
  242. <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="', $context['character_set'], '">
  243. <div class="cat_bar">
  244. <h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3>
  245. </div>';
  246. // Make up some buttons
  247. $approve_button = create_button('approve.png', 'approve', 'approve', 'class="centericon"');
  248. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  249. // No posts?
  250. if (empty($context['unapproved_items']))
  251. echo '
  252. <div class="windowbg2">
  253. <div class="content">
  254. <p class="centertext">', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '</p>
  255. </div>
  256. </div>';
  257. else
  258. echo '
  259. <div class="pagesection floatleft">
  260. ', $context['page_index'], '
  261. </div>';
  262. foreach ($context['unapproved_items'] as $item)
  263. {
  264. echo '
  265. <div class="topic clear">
  266. <div class="', $item['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  267. <div class="content">
  268. <div class="counter">', $item['counter'], '</div>
  269. <div class="topic_details">
  270. <h5><strong>', $item['category']['link'], ' / ', $item['board']['link'], ' / ', $item['link'], '</strong></h5>
  271. <span class="smalltext"><strong>', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ':</strong> ', $item['time'], '</span>
  272. </div>
  273. <div class="list_posts">
  274. <div class="post">', $item['body'], '</div>
  275. </div>
  276. <span class="floatright">
  277. <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>';
  278. if ($item['can_delete'])
  279. echo '
  280. ', $context['menu_separator'], '
  281. <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>';
  282. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  283. echo '
  284. <input type="checkbox" name="item[]" value="', $item['id'], '" checked="checked" class="input_check" /> ';
  285. echo '
  286. </span>
  287. </div>
  288. </div>
  289. </div>';
  290. }
  291. echo '
  292. <div class="pagesection">';
  293. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  294. echo '
  295. <div class="floatright">
  296. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  297. <option value="0">', $txt['with_selected'], ':</option>
  298. <option value="0">-------------------</option>
  299. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  300. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  301. </select>
  302. <noscript><input type="submit" name="mc_go" value="', $txt['go'], '" class="button_submit" /></noscript>
  303. </div>';
  304. if (!empty($context['unapproved_items']))
  305. echo '
  306. <div class="floatleft">
  307. <div class="pagelinks">', $context['page_index'], '</div>
  308. </div>';
  309. echo '
  310. </div>
  311. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  312. </form>
  313. </div>';
  314. }
  315. function template_viewmodreport()
  316. {
  317. global $context, $scripturl, $txt;
  318. echo '
  319. <div id="modcenter">
  320. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  321. <div class="cat_bar">
  322. <h3 class="catbg">
  323. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  324. </h3>
  325. </div>
  326. <div class="title_bar">
  327. <h3 class="titlebg">
  328. <span class="floatleft">
  329. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  330. </span>
  331. <span class="floatright">';
  332. // Make the buttons.
  333. $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"');
  334. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  335. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  336. echo '
  337. <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>
  338. <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>
  339. </span>
  340. </h3>
  341. </div>
  342. <div class="windowbg2">
  343. <div class="content">
  344. ', $context['report']['body'], '
  345. </div>
  346. </div>
  347. <br />
  348. <div class="cat_bar">
  349. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  350. </div>';
  351. foreach ($context['report']['comments'] as $comment)
  352. echo '
  353. <div class="windowbg">
  354. <div class="content">
  355. <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>
  356. <p>', $comment['message'], '</p>
  357. </div>
  358. </div>';
  359. echo '
  360. <br />
  361. <div class="cat_bar">
  362. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  363. </div>
  364. <div class="windowbg2">
  365. <div class="content">';
  366. if (empty($context['report']['mod_comments']))
  367. echo '
  368. <div class="information">
  369. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  370. </div>';
  371. foreach ($context['report']['mod_comments'] as $comment)
  372. echo
  373. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  374. echo '
  375. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  376. <div>
  377. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit" />
  378. </div>
  379. </div>
  380. </div>
  381. <br />';
  382. $alt = false;
  383. template_show_list('moderation_actions_list');
  384. echo '
  385. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  386. </form>
  387. </div>';
  388. }
  389. // Callback function for showing a watched users post in the table.
  390. function template_user_watch_post_callback($post)
  391. {
  392. global $scripturl, $context, $txt, $delete_button;
  393. // We'll have a delete please bob.
  394. if (empty($delete_button))
  395. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  396. $output_html = '
  397. <div>
  398. <div class="floatleft">
  399. <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>
  400. </div>
  401. <div class="floatright">';
  402. if ($post['can_delete'])
  403. $output_html .= '
  404. <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>
  405. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check" />';
  406. $output_html .= '
  407. </div>
  408. </div><br />
  409. <div class="smalltext">
  410. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  411. </div>
  412. <hr />
  413. ' . $post['body'];
  414. return $output_html;
  415. }
  416. // Moderation settings
  417. function template_moderation_settings()
  418. {
  419. global $settings, $options, $context, $txt, $scripturl;
  420. echo '
  421. <div id="modcenter">
  422. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  423. <div class="windowbg2">
  424. <div class="content">
  425. <dl class="settings">
  426. <dt>
  427. <strong>', $txt['mc_prefs_homepage'], ':</strong>
  428. </dt>
  429. <dd>';
  430. foreach ($context['homepage_blocks'] as $k => $v)
  431. echo '
  432. <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 />';
  433. echo '
  434. </dd>';
  435. // If they can moderate boards they have more options!
  436. if ($context['can_moderate_boards'])
  437. {
  438. echo '
  439. <dt>
  440. <strong><label for="mod_show_reports">', $txt['mc_prefs_show_reports'], '</label>:</strong>
  441. </dt>
  442. <dd>
  443. <input type="checkbox" id="mod_show_reports" name="mod_show_reports" ', $context['mod_settings']['show_reports'] ? 'checked="checked"' : '', ' class="input_check" />
  444. </dd>
  445. <dt>
  446. <strong><label for="mod_notify_report">', $txt['mc_prefs_notify_report'], '</label>:</strong>
  447. </dt>
  448. <dd>
  449. <select id="mod_notify_report" name="mod_notify_report">
  450. <option value="0" ', $context['mod_settings']['notify_report'] == 0 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_never'], '</option>
  451. <option value="1" ', $context['mod_settings']['notify_report'] == 1 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_moderator'], '</option>
  452. <option value="2" ', $context['mod_settings']['notify_report'] == 2 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_always'], '</option>
  453. </select>
  454. </dd>';
  455. }
  456. if ($context['can_moderate_approvals'])
  457. {
  458. echo '
  459. <dt>
  460. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  461. </dt>
  462. <dd>
  463. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval" ', $context['mod_settings']['notify_approval'] ? 'checked="checked"' : '', ' class="input_check" />
  464. </dd>';
  465. }
  466. echo '
  467. </dl>
  468. <hr class="hrcolor" />
  469. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  470. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '" />
  471. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />
  472. </div>
  473. </div>
  474. </form>
  475. </div>';
  476. }
  477. // Show a notice sent to a user.
  478. function template_show_notice()
  479. {
  480. global $txt, $settings, $options, $context;
  481. // We do all the HTML for this one!
  482. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  483. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  484. <head>
  485. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  486. <title>', $context['page_title'], '</title>
  487. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21" />
  488. </head>
  489. <body>
  490. <div class="cat_bar">
  491. <h3 class="catbg">', $txt['show_notice'], '</h3>
  492. </div>
  493. <div class="title_bar">
  494. <h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  495. </div>
  496. <div class="windowbg">
  497. <div class="content">
  498. <dl>
  499. <dt>
  500. <strong>', $txt['show_notice_text'], ':</strong>
  501. </dt>
  502. <dd>
  503. ', $context['notice_body'], '
  504. </dd>
  505. </dl>
  506. </div>
  507. </div>
  508. </body>
  509. </html>';
  510. }
  511. // Add or edit a warning template.
  512. function template_warn_template()
  513. {
  514. global $context, $settings, $options, $txt, $scripturl;
  515. echo '
  516. <div id="modcenter">
  517. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  518. <div class="cat_bar">
  519. <h3 class="catbg">', $context['page_title'], '</h3>
  520. </div>
  521. <div class="information">
  522. ', $txt['mc_warning_template_desc'], '
  523. </div>
  524. <div class="windowbg">
  525. <div class="content">
  526. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  527. <dl>
  528. <dt>
  529. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  530. </dt>
  531. <dd class="error" id="error_list">
  532. ', empty($context['warning_errors']) ? '' : implode('<br />', $context['warning_errors']), '
  533. </dd>
  534. </dl>
  535. </div>
  536. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  537. <dl class="settings">
  538. <dt>
  539. <strong>', $txt['preview'] , '</strong>
  540. </dt>
  541. <dd id="template_preview">
  542. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  543. </dd>
  544. </dl>
  545. </div>
  546. <dl class="settings">
  547. <dt>
  548. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  549. </dt>
  550. <dd>
  551. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text" />
  552. </dd>
  553. <dt>
  554. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br />
  555. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  556. </dt>
  557. <dd>
  558. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  559. </dd>
  560. </dl>';
  561. if ($context['template_data']['can_edit_personal'])
  562. echo '
  563. <input type="checkbox" name="make_personal" id="make_personal" ', $context['template_data']['personal'] ? 'checked="checked"' : '', ' class="input_check" />
  564. <label for="make_personal">
  565. <strong>', $txt['mc_warning_template_personal'], '</strong>
  566. </label>
  567. <br />
  568. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  569. <br />';
  570. echo '
  571. <hr class="hrcolor" />
  572. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
  573. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit" />
  574. </div>
  575. </div>
  576. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  577. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '" />
  578. </form>
  579. </div>
  580. <script type="text/javascript"><!-- // --><![CDATA[
  581. $(document).ready(function() {
  582. $("#preview_button").click(function() {
  583. return ajax_getTemplatePreview();
  584. });
  585. });
  586. function ajax_getTemplatePreview ()
  587. {
  588. $.ajax({
  589. type: "POST",
  590. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  591. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  592. context: document.body,
  593. success: function(request){
  594. $("#box_preview").css({display:""});
  595. $("#template_preview").html($(request).find(\'body\').text());
  596. if ($(request).find("error").text() != \'\')
  597. {
  598. $("#errors").css({display:""});
  599. var errors_html = \'\';
  600. var errors = $(request).find(\'error\').each(function() {
  601. errors_html += $(this).text() + \'<br />\';
  602. });
  603. $(document).find("#error_list").html(errors_html);
  604. }
  605. else
  606. {
  607. $("#errors").css({display:"none"});
  608. $("#error_list").html(\'\');
  609. }
  610. return false;
  611. },
  612. });
  613. return false;
  614. }
  615. // ]]></script>';
  616. }
  617. ?>