ModerationCenter.template.php 33 KB

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