ModerationCenter.template.php 27 KB

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