ModerationCenter.template.php 29 KB

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