ModerationCenter.template.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  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">
  227. <div class="floatleft">
  228. ', $txt['pages'], ': ', $context['page_index'], '
  229. </div>
  230. </div>';
  231. // Make the buttons.
  232. $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"');
  233. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  234. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  235. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  236. foreach ($context['reports'] as $report)
  237. {
  238. echo '
  239. <div class="', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  240. <span class="topslice"><span></span></span>
  241. <div class="content">
  242. <div>
  243. <div class="floatleft">
  244. <strong><a href="', $report['topic_href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</strong>
  245. </div>
  246. <div class="floatright">
  247. <a href="', $report['report_href'], '">', $details_button, '</a>
  248. <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>
  249. <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>
  250. ', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check" />' : '', '
  251. </div>
  252. </div><br />
  253. <div class="smalltext">
  254. &#171; ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], ' &#187;<br />';
  255. // Prepare the comments...
  256. $comments = array();
  257. foreach ($report['comments'] as $comment)
  258. $comments[$comment['member']['id']] = $comment['member']['link'];
  259. echo '
  260. &#171; ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), ' &#187;
  261. </div>
  262. <hr />
  263. ', $report['body'], '
  264. </div>
  265. <span class="botslice"><span></span></span>
  266. </div>';
  267. }
  268. // Were none found?
  269. if (empty($context['reports']))
  270. echo '
  271. <div class="windowbg2">
  272. <span class="topslice"><span></span></span>
  273. <div class="content">
  274. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  275. </div>
  276. <span class="botslice"><span></span></span>
  277. </div>';
  278. echo '
  279. <div class="pagesection">
  280. <div class="floatleft">
  281. ', $txt['pages'], ': ', $context['page_index'], '
  282. </div>
  283. <div class="floatright">
  284. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit" />' : '', '
  285. </div>
  286. </div>
  287. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  288. </form>
  289. <br class="clear" />';
  290. }
  291. // Show a list of all the unapproved posts
  292. function template_unapproved_posts()
  293. {
  294. global $settings, $options, $context, $txt, $scripturl;
  295. // Just a big table of it all really...
  296. echo '
  297. <div id="modcenter">
  298. <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="', $context['character_set'], '">
  299. <div class="cat_bar">
  300. <h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3>
  301. </div>';
  302. // Make up some buttons
  303. $approve_button = create_button('approve.png', 'approve', 'approve', 'class="centericon"');
  304. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  305. // No posts?
  306. if (empty($context['unapproved_items']))
  307. echo '
  308. <div class="windowbg2">
  309. <span class="topslice"><span></span></span>
  310. <div class="content">
  311. <p class="centertext">', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '</p>
  312. </div>
  313. <span class="botslice"><span></span></span>
  314. </div>';
  315. else
  316. echo '
  317. <div class="pagesection">
  318. <div class="floatleft">
  319. ', $txt['pages'], ': ', $context['page_index'], '
  320. </div>
  321. </div>';
  322. foreach ($context['unapproved_items'] as $item)
  323. {
  324. echo '
  325. <div class="topic">
  326. <div class="', $item['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  327. <span class="topslice"><span></span></span>
  328. <div class="content">
  329. <div class="counter">', $item['counter'], '</div>
  330. <div class="topic_details">
  331. <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>
  332. <span class="smalltext"><strong>', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ':</strong> ', $item['time'], '</span>
  333. </div>
  334. <div class="list_posts">
  335. <div class="post">', $item['body'], '</div>
  336. </div>
  337. <span class="floatright">
  338. <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>';
  339. if ($item['can_delete'])
  340. echo '
  341. ', $context['menu_separator'], '
  342. <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>';
  343. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  344. echo '
  345. <input type="checkbox" name="item[]" value="', $item['id'], '" checked="checked" class="input_check" /> ';
  346. echo '
  347. </span>
  348. <br class="clear" />
  349. </div>
  350. <span class="botslice"><span></span></span>
  351. </div>
  352. </div>';
  353. }
  354. echo '
  355. <div class="pagesection">';
  356. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  357. echo '
  358. <div class="floatright">
  359. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  360. <option value="0">', $txt['with_selected'], ':</option>
  361. <option value="0">-------------------</option>
  362. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  363. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  364. </select>
  365. <noscript><input type="submit" name="mc_go" value="', $txt['go'], '" class="button_submit" /></noscript>
  366. </div>';
  367. if (!empty($context['unapproved_items']))
  368. echo '
  369. <div class="floatleft">
  370. <div class="pagelinks">', $txt['pages'], ': ', $context['page_index'], '</div>
  371. </div>';
  372. echo '
  373. </div>
  374. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  375. </form>
  376. </div>
  377. <br class="clear" />';
  378. }
  379. // List all attachments awaiting approval.
  380. function template_unapproved_attachments()
  381. {
  382. global $settings, $options, $context, $txt, $scripturl;
  383. // Show all the attachments still oustanding.
  384. echo '
  385. <div id="modcenter">
  386. <div class="cat_bar">
  387. <h3 class="catbg">', $txt['mc_unapproved_attachments'], '</h3>
  388. </div>
  389. <div class="information">
  390. ', $txt['mc_unapproved_attachments_desc'], '
  391. </div>';
  392. template_show_list('mc_unapproved_attach');
  393. echo '
  394. </div>
  395. <br class="clear" />';
  396. }
  397. function template_viewmodreport()
  398. {
  399. global $context, $scripturl, $txt;
  400. echo '
  401. <div id="modcenter">
  402. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  403. <div class="cat_bar">
  404. <h3 class="catbg">
  405. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  406. </h3>
  407. </div>
  408. <div class="title_bar">
  409. <h3 class="titlebg">
  410. <span class="floatleft">
  411. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  412. </span>
  413. <span class="floatright">';
  414. // Make the buttons.
  415. $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"');
  416. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  417. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  418. echo '
  419. <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>
  420. <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>
  421. </span>
  422. </h3>
  423. </div>
  424. <div class="windowbg2">
  425. <span class="topslice"><span></span></span>
  426. <div class="content">
  427. ', $context['report']['body'], '
  428. </div>
  429. <span class="botslice"><span></span></span>
  430. </div>
  431. <br />
  432. <div class="cat_bar">
  433. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  434. </div>';
  435. foreach ($context['report']['comments'] as $comment)
  436. echo '
  437. <div class="windowbg">
  438. <span class="topslice"><span></span></span>
  439. <div class="content">
  440. <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>
  441. <p>', $comment['message'], '</p>
  442. </div>
  443. <span class="botslice"><span></span></span>
  444. </div>';
  445. echo '
  446. <br />
  447. <div class="cat_bar">
  448. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  449. </div>
  450. <div class="windowbg2">
  451. <span class="topslice"><span></span></span>
  452. <div class="content">';
  453. if (empty($context['report']['mod_comments']))
  454. echo '
  455. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>';
  456. foreach ($context['report']['mod_comments'] as $comment)
  457. echo
  458. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  459. echo '
  460. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  461. <div>
  462. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit" />
  463. </div>
  464. </div>
  465. <span class="botslice"><span></span></span>
  466. </div>
  467. <br />';
  468. $alt = false;
  469. template_show_list('moderation_actions_list');
  470. if (!empty($context['entries']))
  471. {
  472. echo '
  473. <div class="cat_bar">
  474. <h3 class="catbg">', $txt['mc_modreport_modactions'], '</h3>
  475. </div>
  476. <table width="100%" class="table_grid">
  477. <thead>
  478. <tr class="catbg">
  479. <th>', $txt['modlog_action'], '</th>
  480. <th>', $txt['modlog_date'], '</th>
  481. <th>', $txt['modlog_member'], '</th>
  482. <th>', $txt['modlog_position'], '</th>
  483. <th>', $txt['modlog_ip'], '</th>
  484. </tr>
  485. </thead>
  486. <tbody>';
  487. foreach ($context['entries'] as $entry)
  488. {
  489. echo '
  490. <tr class="', $alt ? 'windowbg2' : 'windowbg', '">
  491. <td>', $entry['action'], '</td>
  492. <td>', $entry['time'], '</td>
  493. <td>', $entry['moderator']['link'], '</td>
  494. <td>', $entry['position'], '</td>
  495. <td>', $entry['ip'], '</td>
  496. </tr>
  497. <tr>
  498. <td colspan="5" class="', $alt ? 'windowbg2' : 'windowbg', '">';
  499. foreach ($entry['extra'] as $key => $value)
  500. echo '
  501. <em>', $key, '</em>: ', $value;
  502. echo '
  503. </td>
  504. </tr>';
  505. }
  506. echo '
  507. </tbody>
  508. </table>';
  509. }
  510. echo '
  511. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  512. </form>
  513. </div>
  514. <br class="clear" />';
  515. }
  516. // Callback function for showing a watched users post in the table.
  517. function template_user_watch_post_callback($post)
  518. {
  519. global $scripturl, $context, $txt, $delete_button;
  520. // We'll have a delete please bob.
  521. if (empty($delete_button))
  522. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  523. $output_html = '
  524. <div>
  525. <div class="floatleft">
  526. <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>
  527. </div>
  528. <div class="floatright">';
  529. if ($post['can_delete'])
  530. $output_html .= '
  531. <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>
  532. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check" />';
  533. $output_html .= '
  534. </div>
  535. </div><br />
  536. <div class="smalltext">
  537. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  538. </div>
  539. <hr />
  540. ' . $post['body'];
  541. return $output_html;
  542. }
  543. // Moderation settings
  544. function template_moderation_settings()
  545. {
  546. global $settings, $options, $context, $txt, $scripturl;
  547. echo '
  548. <div id="modcenter">
  549. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  550. <div class="cat_bar">
  551. <h3 class="catbg">', $txt['mc_prefs_title'], '</h3>
  552. </div>
  553. <div class="information">
  554. ', $txt['mc_prefs_desc'], '
  555. </div>
  556. <div class="windowbg2">
  557. <span class="topslice"><span></span></span>
  558. <div class="content">
  559. <dl class="settings">
  560. <dt>
  561. <strong>', $txt['mc_prefs_homepage'], ':</strong>
  562. </dt>
  563. <dd>';
  564. foreach ($context['homepage_blocks'] as $k => $v)
  565. echo '
  566. <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 />';
  567. echo '
  568. </dd>';
  569. // If they can moderate boards they have more options!
  570. if ($context['can_moderate_boards'])
  571. {
  572. echo '
  573. <dt>
  574. <strong><label for="mod_show_reports">', $txt['mc_prefs_show_reports'], '</label>:</strong>
  575. </dt>
  576. <dd>
  577. <input type="checkbox" id="mod_show_reports" name="mod_show_reports" ', $context['mod_settings']['show_reports'] ? 'checked="checked"' : '', ' class="input_check" />
  578. </dd>
  579. <dt>
  580. <strong><label for="mod_notify_report">', $txt['mc_prefs_notify_report'], '</label>:</strong>
  581. </dt>
  582. <dd>
  583. <select id="mod_notify_report" name="mod_notify_report">
  584. <option value="0" ', $context['mod_settings']['notify_report'] == 0 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_never'], '</option>
  585. <option value="1" ', $context['mod_settings']['notify_report'] == 1 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_moderator'], '</option>
  586. <option value="2" ', $context['mod_settings']['notify_report'] == 2 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_always'], '</option>
  587. </select>
  588. </dd>';
  589. }
  590. if ($context['can_moderate_approvals'])
  591. {
  592. echo '
  593. <dt>
  594. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  595. </dt>
  596. <dd>
  597. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval" ', $context['mod_settings']['notify_approval'] ? 'checked="checked"' : '', ' class="input_check" />
  598. </dd>';
  599. }
  600. echo '
  601. </dl>
  602. <hr class="hrcolor" />
  603. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  604. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '" />
  605. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />
  606. <br class="clear_right" />
  607. </div>
  608. <span class="botslice"><span></span></span>
  609. </div>
  610. </form>
  611. </div>
  612. <br class="clear" />';
  613. }
  614. // Show a notice sent to a user.
  615. function template_show_notice()
  616. {
  617. global $txt, $settings, $options, $context;
  618. // We do all the HTML for this one!
  619. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  620. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  621. <head>
  622. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  623. <title>', $context['page_title'], '</title>
  624. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21" />
  625. </head>
  626. <body>
  627. <div class="cat_bar">
  628. <h3 class="catbg">', $txt['show_notice'], '</h3>
  629. </div>
  630. <div class="title_bar">
  631. <h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  632. </div>
  633. <div class="windowbg">
  634. <span class="topslice"><span></span></span>
  635. <div class="content">
  636. <dl>
  637. <dt>
  638. <strong>', $txt['show_notice_text'], ':</strong>
  639. </dt>
  640. <dd>
  641. ', $context['notice_body'], '
  642. </dd>
  643. </dl>
  644. </div>
  645. <span class="botslice"><span></span></span>
  646. </div>
  647. </body>
  648. </html>';
  649. }
  650. // Add or edit a warning template.
  651. function template_warn_template()
  652. {
  653. global $context, $settings, $options, $txt, $scripturl;
  654. echo '
  655. <div id="modcenter">
  656. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  657. <div class="cat_bar">
  658. <h3 class="catbg">', $context['page_title'], '</h3>
  659. </div>
  660. <div class="information">
  661. ', $txt['mc_warning_template_desc'], '
  662. </div>
  663. <div class="windowbg">
  664. <span class="topslice"><span></span></span>
  665. <div class="content">
  666. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  667. <dl>
  668. <dt>
  669. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  670. </dt>
  671. <dd class="error" id="error_list">
  672. ', empty($context['warning_errors']) ? '' : implode('<br />', $context['warning_errors']), '
  673. </dd>
  674. </dl>
  675. </div>
  676. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  677. <dl class="settings">
  678. <dt>
  679. <strong>', $txt['preview'] , '</strong>
  680. </dt>
  681. <dd id="template_preview">
  682. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  683. </dd>
  684. </dl>
  685. </div>
  686. <dl class="settings">
  687. <dt>
  688. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  689. </dt>
  690. <dd>
  691. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text" />
  692. </dd>
  693. <dt>
  694. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br />
  695. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  696. </dt>
  697. <dd>
  698. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  699. </dd>
  700. </dl>';
  701. if ($context['template_data']['can_edit_personal'])
  702. echo '
  703. <input type="checkbox" name="make_personal" id="make_personal" ', $context['template_data']['personal'] ? 'checked="checked"' : '', ' class="input_check" />
  704. <label for="make_personal">
  705. <strong>', $txt['mc_warning_template_personal'], '</strong>
  706. </label>
  707. <br />
  708. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  709. <br />';
  710. echo '
  711. <hr class="hrcolor" />
  712. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
  713. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit" />
  714. <br class="clear_right" />
  715. </div>
  716. <span class="botslice"><span></span></span>
  717. </div>
  718. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  719. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '" />
  720. </form>
  721. </div>
  722. <br class="clear" />
  723. <script type="text/javascript"><!-- // --><![CDATA[
  724. $(document).ready(function() {
  725. $("#preview_button").click(function() {
  726. return ajax_getTemplatePreview();
  727. });
  728. });
  729. function ajax_getTemplatePreview ()
  730. {
  731. $.ajax({
  732. type: "POST",
  733. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  734. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  735. context: document.body,
  736. success: function(request){
  737. $("#box_preview").css({display:""});
  738. $("#template_preview").html($(request).find(\'body\').text());
  739. if ($(request).find("error").text() != \'\')
  740. {
  741. $("#errors").css({display:""});
  742. var errors_html = \'\';
  743. var errors = $(request).find(\'error\').each(function() {
  744. errors_html += $(this).text() + \'<br />\';
  745. });
  746. $(document).find("#error_list").html(errors_html);
  747. }
  748. else
  749. {
  750. $("#errors").css({display:"none"});
  751. $("#error_list").html(\'\');
  752. }
  753. return false;
  754. },
  755. });
  756. return false;
  757. }
  758. // ]]></script>';
  759. }
  760. ?>