ModerationCenter.template.php 26 KB

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