ModerationCenter.template.php 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  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?fin20"></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="cat_bar">
  322. <h3 class="catbg">
  323. <span class="smalltext floatleft">', $item['counter'], '&nbsp;</span>
  324. <span class="smalltext floatleft"><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']['id'], '.msg', $item['id'], '#msg', $item['id'], '">', $item['subject'], '</a></span>
  325. <span class="smalltext floatright">', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ': ', $item['time'], '</span>
  326. </h3>
  327. </div>
  328. <div class="', $item['alternate'] ? 'windowbg' : 'windowbg2', '">
  329. <span class="topslice"><span></span></span>
  330. <div class="content">
  331. <div class="post">', $item['body'], '</div>
  332. <span class="floatright">
  333. <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>';
  334. if ($item['can_delete'])
  335. echo '
  336. ', $context['menu_separator'], '
  337. <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>';
  338. echo '
  339. <input type="checkbox" name="item[]" value="', $item['id'], '" checked="checked" class="input_check" /> ';
  340. echo '
  341. </span>
  342. <br class="clear" />
  343. </div>
  344. <span class="botslice"><span></span></span>
  345. </div>';
  346. }
  347. echo '
  348. <div class="pagesection">
  349. <div class="floatright">
  350. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  351. <option value="0">', $txt['with_selected'], ':</option>
  352. <option value="0">-------------------</option>
  353. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  354. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  355. </select>
  356. <noscript><input type="submit" name="mc_go" value="', $txt['go'], '" class="button_submit" /></noscript>
  357. </div>';
  358. if (!empty($context['unapproved_items']))
  359. echo '
  360. <div class="floatleft">
  361. <div class="pagelinks">', $txt['pages'], ': ', $context['page_index'], '</div>
  362. </div>';
  363. echo '
  364. </div>
  365. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  366. </form>
  367. </div>
  368. <br class="clear" />';
  369. }
  370. // List all attachments awaiting approval.
  371. function template_unapproved_attachments()
  372. {
  373. global $settings, $options, $context, $txt, $scripturl;
  374. // Show all the attachments still oustanding.
  375. echo '
  376. <div id="modcenter">
  377. <form action="', $scripturl, '?action=moderate;area=attachmod;sa=attachments;start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  378. <div class="cat_bar">
  379. <h3 class="catbg">', $txt['mc_unapproved_attachments'], '</h3>
  380. </div>
  381. <div class="information">
  382. ', $txt['mc_unapproved_attachments_desc'], '
  383. </div>';
  384. // The ever popular approve button, with the massively unpopular delete.
  385. $approve_button = create_button('approve.png', 'approve', 'approve', 'class="centericon"');
  386. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  387. // None awaiting?
  388. if (empty($context['unapproved_items']))
  389. echo '
  390. <div class="windowbg">
  391. <span class="topslice"><span></span></span>
  392. <div class="content">
  393. <p class="centertext">', $txt['mc_unapproved_attachments_none_found'], '</p>
  394. </div>
  395. <span class="botslice"><span></span></span>
  396. </div>';
  397. else
  398. echo '
  399. <div class="pagesection floatleft">
  400. ', $txt['pages'], ': ', $context['page_index'], '
  401. </div>
  402. <table class="table_grid" width="100%">
  403. <thead>
  404. <tr class="catbg">
  405. <th class="first_th">', $txt['mc_unapproved_attach_name'], '</th>
  406. <th>', $txt['mc_unapproved_attach_size'], '</th>
  407. <th>', $txt['mc_unapproved_attach_poster'], '</th>
  408. <th>', $txt['date'], '</th>
  409. <th class="last_th" nowrap="nowrap" align="center"><input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" checked="checked" /></th>
  410. </tr>
  411. </thead>
  412. <tbody>';
  413. foreach ($context['unapproved_items'] as $item)
  414. {
  415. echo '
  416. <tr class="', $item['alternate'] ? 'windowbg' : 'windowbg2', '">
  417. <td>
  418. ', $item['filename'], '
  419. </td>
  420. <td align="right">
  421. ', $item['size'], $txt['kilobyte'], '
  422. </td>
  423. <td>
  424. ', $item['poster']['link'], '
  425. </td>
  426. <td class="smalltext">
  427. ', $item['time'], '<br />', $txt['in'], ' <a href="', $item['message']['href'], '">', $item['message']['subject'], '</a>
  428. </td>
  429. <td width="4%" align="center">
  430. <input type="checkbox" name="item[]" value="', $item['id'], '" checked="checked" class="input_check" />
  431. </td>
  432. </tr>';
  433. }
  434. if (!empty($context['unapproved_items']))
  435. echo '
  436. </tbody>
  437. </table>';
  438. echo '
  439. <div class="pagesection">
  440. <div class="floatright">
  441. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  442. <option value="0">', $txt['with_selected'], ':</option>
  443. <option value="0">-------------------</option>
  444. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  445. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  446. </select>
  447. <noscript><input type="submit" name="ml_go" value="', $txt['go'], '" class="button_submit" /></noscript>
  448. </div>';
  449. if (!empty($context['unapproved_items']))
  450. echo '
  451. <div class="floatleft">
  452. <div class="pagelinks">', $txt['pages'], ': ', $context['page_index'], '</div>
  453. </div>';
  454. echo '
  455. </div>
  456. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  457. </form>
  458. </div>
  459. <br class="clear" />';
  460. }
  461. function template_viewmodreport()
  462. {
  463. global $context, $scripturl, $txt;
  464. echo '
  465. <div id="modcenter">
  466. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  467. <div class="cat_bar">
  468. <h3 class="catbg">
  469. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  470. </h3>
  471. </div>
  472. <div class="title_bar">
  473. <h3 class="titlebg">
  474. <span class="floatleft">
  475. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  476. </span>
  477. <span class="floatright">';
  478. // Make the buttons.
  479. $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"');
  480. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  481. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  482. echo '
  483. <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>
  484. <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>
  485. </span>
  486. </h3>
  487. </div>
  488. <div class="windowbg2">
  489. <span class="topslice"><span></span></span>
  490. <div class="content">
  491. ', $context['report']['body'], '
  492. </div>
  493. <span class="botslice"><span></span></span>
  494. </div>
  495. <br />
  496. <div class="cat_bar">
  497. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  498. </div>';
  499. foreach ($context['report']['comments'] as $comment)
  500. echo '
  501. <div class="windowbg">
  502. <span class="topslice"><span></span></span>
  503. <div class="content">
  504. <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>
  505. <p>', $comment['message'], '</p>
  506. </div>
  507. <span class="botslice"><span></span></span>
  508. </div>';
  509. echo '
  510. <br />
  511. <div class="cat_bar">
  512. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  513. </div>
  514. <div class="windowbg2">
  515. <span class="topslice"><span></span></span>
  516. <div class="content">';
  517. if (empty($context['report']['mod_comments']))
  518. echo '
  519. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>';
  520. foreach ($context['report']['mod_comments'] as $comment)
  521. echo
  522. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  523. echo '
  524. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  525. <div>
  526. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit" />
  527. </div>
  528. </div>
  529. <span class="botslice"><span></span></span>
  530. </div>
  531. <br />';
  532. $alt = false;
  533. template_show_list('moderation_actions_list');
  534. if (!empty($context['entries']))
  535. {
  536. echo '
  537. <div class="cat_bar">
  538. <h3 class="catbg">', $txt['mc_modreport_modactions'], '</h3>
  539. </div>
  540. <table width="100%" class="table_grid">
  541. <thead>
  542. <tr class="catbg">
  543. <th>', $txt['modlog_action'], '</th>
  544. <th>', $txt['modlog_date'], '</th>
  545. <th>', $txt['modlog_member'], '</th>
  546. <th>', $txt['modlog_position'], '</th>
  547. <th>', $txt['modlog_ip'], '</th>
  548. </tr>
  549. </thead>
  550. <tbody>';
  551. foreach ($context['entries'] as $entry)
  552. {
  553. echo '
  554. <tr class="', $alt ? 'windowbg2' : 'windowbg', '">
  555. <td>', $entry['action'], '</td>
  556. <td>', $entry['time'], '</td>
  557. <td>', $entry['moderator']['link'], '</td>
  558. <td>', $entry['position'], '</td>
  559. <td>', $entry['ip'], '</td>
  560. </tr>
  561. <tr>
  562. <td colspan="5" class="', $alt ? 'windowbg2' : 'windowbg', '">';
  563. foreach ($entry['extra'] as $key => $value)
  564. echo '
  565. <em>', $key, '</em>: ', $value;
  566. echo '
  567. </td>
  568. </tr>';
  569. }
  570. echo '
  571. </tbody>
  572. </table>';
  573. }
  574. echo '
  575. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  576. </form>
  577. </div>
  578. <br class="clear" />';
  579. }
  580. // Callback function for showing a watched users post in the table.
  581. function template_user_watch_post_callback($post)
  582. {
  583. global $scripturl, $context, $txt, $delete_button;
  584. // We'll have a delete please bob.
  585. if (empty($delete_button))
  586. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  587. $output_html = '
  588. <div>
  589. <div class="floatleft">
  590. <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>
  591. </div>
  592. <div class="floatright">';
  593. if ($post['can_delete'])
  594. $output_html .= '
  595. <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>
  596. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check" />';
  597. $output_html .= '
  598. </div>
  599. </div><br />
  600. <div class="smalltext">
  601. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  602. </div>
  603. <hr />
  604. ' . $post['body'];
  605. return $output_html;
  606. }
  607. // Moderation settings
  608. function template_moderation_settings()
  609. {
  610. global $settings, $options, $context, $txt, $scripturl;
  611. echo '
  612. <div id="modcenter">
  613. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  614. <div class="cat_bar">
  615. <h3 class="catbg">', $txt['mc_prefs_title'], '</h3>
  616. </div>
  617. <div class="information">
  618. ', $txt['mc_prefs_desc'], '
  619. </div>
  620. <div class="windowbg2">
  621. <span class="topslice"><span></span></span>
  622. <div class="content">
  623. <dl class="settings">
  624. <dt>
  625. <strong>', $txt['mc_prefs_homepage'], ':</strong>
  626. </dt>
  627. <dd>';
  628. foreach ($context['homepage_blocks'] as $k => $v)
  629. echo '
  630. <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 />';
  631. echo '
  632. </dd>';
  633. // If they can moderate boards they have more options!
  634. if ($context['can_moderate_boards'])
  635. {
  636. echo '
  637. <dt>
  638. <strong><label for="mod_show_reports">', $txt['mc_prefs_show_reports'], '</label>:</strong>
  639. </dt>
  640. <dd>
  641. <input type="checkbox" id="mod_show_reports" name="mod_show_reports" ', $context['mod_settings']['show_reports'] ? 'checked="checked"' : '', ' class="input_check" />
  642. </dd>
  643. <dt>
  644. <strong><label for="mod_notify_report">', $txt['mc_prefs_notify_report'], '</label>:</strong>
  645. </dt>
  646. <dd>
  647. <select id="mod_notify_report" name="mod_notify_report">
  648. <option value="0" ', $context['mod_settings']['notify_report'] == 0 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_never'], '</option>
  649. <option value="1" ', $context['mod_settings']['notify_report'] == 1 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_moderator'], '</option>
  650. <option value="2" ', $context['mod_settings']['notify_report'] == 2 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_always'], '</option>
  651. </select>
  652. </dd>';
  653. }
  654. if ($context['can_moderate_approvals'])
  655. {
  656. echo '
  657. <dt>
  658. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  659. </dt>
  660. <dd>
  661. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval" ', $context['mod_settings']['notify_approval'] ? 'checked="checked"' : '', ' class="input_check" />
  662. </dd>';
  663. }
  664. echo '
  665. </dl>
  666. <hr class="hrcolor" />
  667. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  668. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '" />
  669. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />
  670. <br class="clear_right" />
  671. </div>
  672. <span class="botslice"><span></span></span>
  673. </div>
  674. </form>
  675. </div>
  676. <br class="clear" />';
  677. }
  678. // Show a notice sent to a user.
  679. function template_show_notice()
  680. {
  681. global $txt, $settings, $options, $context;
  682. // We do all the HTML for this one!
  683. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  684. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  685. <head>
  686. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  687. <title>', $context['page_title'], '</title>
  688. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20" />
  689. </head>
  690. <body>
  691. <div class="cat_bar">
  692. <h3 class="catbg">', $txt['show_notice'], '</h3>
  693. </div>
  694. <div class="title_bar">
  695. <h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  696. </div>
  697. <div class="windowbg">
  698. <span class="topslice"><span></span></span>
  699. <div class="content">
  700. <dl>
  701. <dt>
  702. <strong>', $txt['show_notice_text'], ':</strong>
  703. </dt>
  704. <dd>
  705. ', $context['notice_body'], '
  706. </dd>
  707. </dl>
  708. </div>
  709. <span class="botslice"><span></span></span>
  710. </div>
  711. </body>
  712. </html>';
  713. }
  714. // Add or edit a warning template.
  715. function template_warn_template()
  716. {
  717. global $context, $settings, $options, $txt, $scripturl;
  718. echo '
  719. <div id="modcenter">
  720. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  721. <div class="cat_bar">
  722. <h3 class="catbg">', $context['page_title'], '</h3>
  723. </div>
  724. <div class="information">
  725. ', $txt['mc_warning_template_desc'], '
  726. </div>
  727. <div class="windowbg">
  728. <span class="topslice"><span></span></span>
  729. <div class="content">
  730. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  731. <dl>
  732. <dt>
  733. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  734. </dt>
  735. <dd class="error" id="error_list">
  736. ', empty($context['warning_errors']) ? '' : implode('<br />', $context['warning_errors']), '
  737. </dd>
  738. </dl>
  739. </div>
  740. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  741. <dl class="settings">
  742. <dt>
  743. <strong>', $txt['preview'] , '</strong>
  744. </dt>
  745. <dd id="template_preview">
  746. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  747. </dd>
  748. </dl>
  749. </div>
  750. <dl class="settings">
  751. <dt>
  752. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  753. </dt>
  754. <dd>
  755. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text" />
  756. </dd>
  757. <dt>
  758. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br />
  759. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  760. </dt>
  761. <dd>
  762. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  763. </dd>
  764. </dl>';
  765. if ($context['template_data']['can_edit_personal'])
  766. echo '
  767. <input type="checkbox" name="make_personal" id="make_personal" ', $context['template_data']['personal'] ? 'checked="checked"' : '', ' class="input_check" />
  768. <label for="make_personal">
  769. <strong>', $txt['mc_warning_template_personal'], '</strong>
  770. </label>
  771. <br />
  772. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  773. <br />';
  774. echo '
  775. <hr class="hrcolor" />
  776. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
  777. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit" />
  778. <br class="clear_right" />
  779. </div>
  780. <span class="botslice"><span></span></span>
  781. </div>
  782. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  783. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '" />
  784. </form>
  785. </div>
  786. <br class="clear" />
  787. <script type="text/javascript"><!-- // --><![CDATA[
  788. $(document).ready(function() {
  789. $("#preview_button").click(function() {
  790. return ajax_getTemplatePreview();
  791. });
  792. });
  793. function ajax_getTemplatePreview ()
  794. {
  795. $.ajax({
  796. type: "POST",
  797. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  798. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  799. context: document.body,
  800. success: function(request){
  801. $("#box_preview").css({display:""});
  802. $("#template_preview").html($(request).find(\'body\').text());
  803. if ($(request).find("error").text() != \'\')
  804. {
  805. $("#errors").css({display:""});
  806. var errors_html = \'\';
  807. var errors = $(request).find(\'error\').each(function() {
  808. errors_html += $(this).text() + \'<br />\';
  809. });
  810. $(document).find("#error_list").html(errors_html);
  811. }
  812. else
  813. {
  814. $("#errors").css({display:"none"});
  815. $("#error_list").html(\'\');
  816. }
  817. return false;
  818. },
  819. });
  820. return false;
  821. }
  822. // ]]></script>';
  823. }
  824. ?>