ModerationCenter.template.php 27 KB

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