ModerationCenter.template.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2014 Simple Machines and individual contributors
  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, $context, $txt, $scripturl;
  15. // Show moderators notes.
  16. template_notes();
  17. // Show a welcome message to the user.
  18. echo '
  19. <div id="modcenter">';
  20. $alternate = true;
  21. // Show all the blocks they want to see.
  22. foreach ($context['mod_blocks'] as $block)
  23. {
  24. $block_function = 'template_' . $block;
  25. echo '
  26. <div class="modblock_', $alternate ? 'left' : 'right', '">', function_exists($block_function) ? $block_function() : '', '</div>';
  27. if (!$alternate)
  28. echo '
  29. <br class="clear">';
  30. $alternate = !$alternate;
  31. }
  32. echo '
  33. </div>
  34. <br class="clear">';
  35. }
  36. // Show all the group requests the user can see.
  37. function template_group_requests_block()
  38. {
  39. global $context, $txt, $scripturl;
  40. echo '
  41. <div class="cat_bar">
  42. <h3 class="catbg">
  43. <span id="group_requests_toggle" class="', !empty($context['admin_prefs']['mcgr']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  44. <a href="', $scripturl, '?action=groups;sa=requests" id="group_requests_link">', $txt['mc_group_requests'], '</a>
  45. </h3>
  46. </div>
  47. <div class="windowbg" id="group_requests_panel">
  48. <div class="content modbox">
  49. <ul class="reset">';
  50. foreach ($context['group_requests'] as $request)
  51. echo '
  52. <li class="smalltext">
  53. <a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
  54. </li>';
  55. // Don't have any watched users right now?
  56. if (empty($context['group_requests']))
  57. echo '
  58. <li>
  59. <strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
  60. </li>';
  61. echo '
  62. </ul>
  63. </div>
  64. </div>
  65. <script><!-- // --><![CDATA[
  66. var oGroupRequestsPanelToggle = new smc_Toggle({
  67. bToggleEnabled: true,
  68. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcgr']) ? 'true' : 'false', ',
  69. aSwappableContainers: [
  70. \'group_requests_panel\'
  71. ],
  72. aSwapImages: [
  73. {
  74. sId: \'group_requests_toggle\',
  75. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  76. altCollapsed: ', JavaScriptEscape($txt['show']), '
  77. }
  78. ],
  79. aSwapLinks: [
  80. {
  81. sId: \'group_requests_link\',
  82. msgExpanded: ', JavaScriptEscape($txt['mc_group_requests']), ',
  83. msgCollapsed: ', JavaScriptEscape($txt['mc_group_requests']), '
  84. }
  85. ],
  86. oThemeOptions: {
  87. bUseThemeSettings: true,
  88. sOptionName: \'admin_preferences\',
  89. sSessionVar: smf_session_var,
  90. sSessionId: smf_session_id,
  91. sThemeId: \'1\',
  92. sAdditionalVars: \';admin_key=mcgr\'
  93. }
  94. });
  95. // ]]></script>';
  96. }
  97. function template_watched_users()
  98. {
  99. global $context, $txt, $scripturl;
  100. echo '
  101. <div class="cat_bar">
  102. <h3 class="catbg">
  103. <span id="watched_users_toggle" class="', !empty($context['admin_prefs']['mcwu']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  104. <a href="', $scripturl, '?action=moderate;area=userwatch" id="watched_users_link">', $txt['mc_watched_users'], '</a>
  105. </h3>
  106. </div>
  107. <div class="windowbg" id="watched_users_panel">
  108. <div class="content modbox">
  109. <ul class="reset">';
  110. foreach ($context['watched_users'] as $user)
  111. echo '
  112. <li>
  113. <span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
  114. </li>';
  115. // Don't have any watched users right now?
  116. if (empty($context['watched_users']))
  117. echo '
  118. <li>
  119. <strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
  120. </li>';
  121. echo '
  122. </ul>
  123. </div>
  124. </div>
  125. <script><!-- // --><![CDATA[
  126. var oWatchedUsersToggle = new smc_Toggle({
  127. bToggleEnabled: true,
  128. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcwu']) ? 'true' : 'false', ',
  129. aSwappableContainers: [
  130. \'watched_users_panel\'
  131. ],
  132. aSwapImages: [
  133. {
  134. sId: \'watched_users_toggle\',
  135. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  136. altCollapsed: ', JavaScriptEscape($txt['show']), '
  137. }
  138. ],
  139. aSwapLinks: [
  140. {
  141. sId: \'watched_users_link\',
  142. msgExpanded: ', JavaScriptEscape($txt['mc_watched_users']), ',
  143. msgCollapsed: ', JavaScriptEscape($txt['mc_watched_users']), '
  144. }
  145. ],
  146. oThemeOptions: {
  147. bUseThemeSettings: true,
  148. sOptionName: \'admin_preferences\',
  149. sSessionVar: smf_session_var,
  150. sSessionId: smf_session_id,
  151. sThemeId: \'1\',
  152. sAdditionalVars: \';admin_key=mcwu\'
  153. }
  154. });
  155. // ]]></script>';
  156. }
  157. // Little section for making... notes.
  158. function template_notes()
  159. {
  160. global $context, $txt, $scripturl;
  161. // Let them know the action was a success.
  162. if (!empty($context['report_post_action']))
  163. {
  164. echo '
  165. <div class="infobox">
  166. ', $txt['report_action_'. $context['report_post_action']], '
  167. </div>';
  168. }
  169. echo '
  170. <div class="modnotes">
  171. <form action="', $scripturl, '?action=moderate;area=index;modnote" method="post">
  172. <div class="cat_bar">
  173. <h3 class="catbg">', $txt['mc_notes'], '</h3>
  174. </div>
  175. <div class="windowbg">
  176. <div class="content modbox">';
  177. if (!empty($context['notes']))
  178. {
  179. echo '
  180. <ul class="reset moderation_notes">';
  181. // Cycle through the notes.
  182. foreach ($context['notes'] as $note)
  183. echo '
  184. <li class="smalltext"><a href="', $note['delete_href'], ';', $context['mod-modnote-del_token_var'], '=', $context['mod-modnote-del_token'], '" class="delete_modnote"><span class="generic_icons del_small"></span></a>', $note['time'] ,' <strong>', $note['author']['link'], ':</strong> ', $note['text'], '</li>';
  185. echo '
  186. </ul>
  187. <div class="pagesection notes">
  188. <span class="smalltext">', $context['page_index'], '</span>
  189. </div>';
  190. }
  191. echo '
  192. <div class="floatleft post_note">
  193. <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">
  194. </div>
  195. <input type="hidden" name="', $context['mod-modnote-add_token_var'], '" value="', $context['mod-modnote-add_token'], '">
  196. <input type="submit" name="makenote" value="', $txt['mc_add_note'], '" class="button_submit">
  197. </div>
  198. </div>
  199. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  200. </form>
  201. </div>';
  202. }
  203. // Show a list of all the unapproved posts
  204. function template_unapproved_posts()
  205. {
  206. global $options, $context, $txt, $scripturl;
  207. // Just a big table of it all really...
  208. echo '
  209. <div id="modcenter">
  210. <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="', $context['character_set'], '">
  211. <div class="cat_bar">
  212. <h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3>
  213. </div>';
  214. // Make up some buttons
  215. $approve_button = create_button('approve.png', 'approve', 'approve', 'class="centericon"');
  216. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  217. // No posts?
  218. if (empty($context['unapproved_items']))
  219. echo '
  220. <div class="windowbg2">
  221. <div class="content">
  222. <p class="centertext">', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '</p>
  223. </div>
  224. </div>';
  225. else
  226. echo '
  227. <div class="pagesection floatleft">
  228. ', $context['page_index'], '
  229. </div>';
  230. foreach ($context['unapproved_items'] as $item)
  231. {
  232. echo '
  233. <div class="topic clear">
  234. <div class="', $item['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  235. <div class="content">
  236. <div class="counter">', $item['counter'], '</div>
  237. <div class="topic_details">
  238. <h5><strong>', $item['category']['link'], ' / ', $item['board']['link'], ' / ', $item['link'], '</strong></h5>
  239. <span class="smalltext"><strong>', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ':</strong> ', $item['time'], '</span>
  240. </div>
  241. <div class="list_posts">
  242. <div class="post">', $item['body'], '</div>
  243. </div>
  244. <span class="floatright">
  245. <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>';
  246. if ($item['can_delete'])
  247. echo '
  248. ', $context['menu_separator'], '
  249. <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>';
  250. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  251. echo '
  252. <input type="checkbox" name="item[]" value="', $item['id'], '" checked class="input_check"> ';
  253. echo '
  254. </span>
  255. </div>
  256. </div>
  257. </div>';
  258. }
  259. echo '
  260. <div class="pagesection">';
  261. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  262. echo '
  263. <div class="floatright">
  264. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  265. <option value="0">', $txt['with_selected'], ':</option>
  266. <option value="0">-------------------</option>
  267. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  268. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  269. </select>
  270. <noscript><input type="submit" name="mc_go" value="', $txt['go'], '" class="button_submit"></noscript>
  271. </div>';
  272. if (!empty($context['unapproved_items']))
  273. echo '
  274. <div class="floatleft">
  275. <div class="pagelinks">', $context['page_index'], '</div>
  276. </div>';
  277. echo '
  278. </div>
  279. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  280. </form>
  281. </div>';
  282. }
  283. function template_viewmodreport()
  284. {
  285. global $context, $scripturl, $txt;
  286. echo '
  287. <div id="modcenter">
  288. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  289. <div class="cat_bar">
  290. <h3 class="catbg">
  291. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  292. </h3>
  293. </div>
  294. <div class="title_bar">
  295. <h3 class="titlebg">
  296. <span class="floatleft">
  297. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  298. </span>
  299. <span class="floatright">';
  300. // Make the buttons.
  301. $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"');
  302. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  303. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  304. echo '
  305. <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>
  306. <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>
  307. </span>
  308. </h3>
  309. </div>
  310. <div class="windowbg2">
  311. <div class="content">
  312. ', $context['report']['body'], '
  313. </div>
  314. </div>
  315. <br>
  316. <div class="cat_bar">
  317. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  318. </div>';
  319. foreach ($context['report']['comments'] as $comment)
  320. echo '
  321. <div class="windowbg">
  322. <div class="content">
  323. <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>
  324. <p>', $comment['message'], '</p>
  325. </div>
  326. </div>';
  327. echo '
  328. <br>
  329. <div class="cat_bar">
  330. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  331. </div>';
  332. if (empty($context['report']['mod_comments']))
  333. echo '
  334. <div class="description">
  335. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  336. </div>';
  337. echo '
  338. <div class="windowbg2">
  339. <div class="content">';
  340. foreach ($context['report']['mod_comments'] as $comment)
  341. echo
  342. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  343. echo '
  344. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  345. <div>
  346. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
  347. </div>
  348. </div>
  349. </div>
  350. <br>';
  351. $alt = false;
  352. template_show_list('moderation_actions_list');
  353. echo '
  354. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  355. </form>
  356. </div>';
  357. }
  358. function template_viewmemberreport()
  359. {
  360. global $context, $scripturl, $txt;
  361. echo '
  362. <div id="modcenter">
  363. <form action="', $scripturl, '?action=moderate;area=memberreports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  364. <div class="cat_bar">
  365. <h3 class="catbg">
  366. ', sprintf($txt['mc_viewmemberreport'], $context['report']['user']['link']), '
  367. </h3>
  368. </div>
  369. <div class="title_bar">
  370. <h3 class="titlebg">
  371. <span class="floatleft">
  372. ', sprintf($txt['mc_memberreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  373. </span>
  374. <span class="floatright">';
  375. // Make the buttons.
  376. $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"');
  377. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  378. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  379. echo '
  380. <a href="', $scripturl, '?action=moderate;area=memberreports;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>
  381. <a href="', $scripturl, '?action=moderate;area=memberreports;close=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a>
  382. </span>
  383. </h3>
  384. </div>
  385. <br>
  386. <div class="cat_bar">
  387. <h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
  388. </div>';
  389. foreach ($context['report']['comments'] as $comment)
  390. echo '
  391. <div class="windowbg">
  392. <div class="content">
  393. <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>
  394. <p>', $comment['message'], '</p>
  395. </div>
  396. </div>';
  397. echo '
  398. <br>
  399. <div class="cat_bar">
  400. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  401. </div>';
  402. if (empty($context['report']['mod_comments']))
  403. echo '
  404. <div class="description">
  405. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  406. </div>';
  407. echo '
  408. <div class="windowbg2">
  409. <div class="content">';
  410. foreach ($context['report']['mod_comments'] as $comment)
  411. echo
  412. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  413. echo '
  414. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  415. <div>
  416. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
  417. </div>
  418. </div>
  419. </div>
  420. <br>';
  421. $alt = false;
  422. template_show_list('memreport_actions_list');
  423. echo '
  424. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  425. </form>
  426. </div>';
  427. }
  428. // Callback function for showing a watched users post in the table.
  429. function template_user_watch_post_callback($post)
  430. {
  431. global $scripturl, $context, $txt, $delete_button;
  432. // We'll have a delete please bob.
  433. if (empty($delete_button))
  434. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  435. $output_html = '
  436. <div>
  437. <div class="floatleft">
  438. <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>
  439. </div>
  440. <div class="floatright">';
  441. if ($post['can_delete'])
  442. $output_html .= '
  443. <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>
  444. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check">';
  445. $output_html .= '
  446. </div>
  447. </div><br>
  448. <div class="smalltext">
  449. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  450. </div>
  451. <hr>
  452. ' . $post['body'];
  453. return $output_html;
  454. }
  455. // Moderation settings
  456. function template_moderation_settings()
  457. {
  458. global $context, $txt, $scripturl;
  459. echo '
  460. <div id="modcenter">
  461. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  462. <div class="windowbg2">
  463. <div class="content">
  464. <dl class="settings">';
  465. if ($context['can_moderate_approvals'])
  466. {
  467. echo '
  468. <dt>
  469. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  470. </dt>
  471. <dd>
  472. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval"', $context['mod_settings']['notify_approval'] ? ' checked' : '', ' class="input_check">
  473. </dd>';
  474. }
  475. echo '
  476. </dl>
  477. <hr class="hrcolor">
  478. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  479. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '">
  480. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit">
  481. </div>
  482. </div>
  483. </form>
  484. </div>';
  485. }
  486. // Show a notice sent to a user.
  487. function template_show_notice()
  488. {
  489. global $txt, $settings, $context, $modSettings;
  490. // We do all the HTML for this one!
  491. echo '<!DOCTYPE html>
  492. <html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  493. <head>
  494. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '">
  495. <title>', $context['page_title'], '</title>
  496. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'">
  497. </head>
  498. <body>
  499. <div class="cat_bar">
  500. <h3 class="catbg">', $txt['show_notice'], '</h3>
  501. </div>
  502. <div class="title_bar">
  503. <h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  504. </div>
  505. <div class="windowbg">
  506. <div class="content">
  507. <dl>
  508. <dt>
  509. <strong>', $txt['show_notice_text'], ':</strong>
  510. </dt>
  511. <dd>
  512. ', $context['notice_body'], '
  513. </dd>
  514. </dl>
  515. </div>
  516. </div>
  517. </body>
  518. </html>';
  519. }
  520. // Add or edit a warning template.
  521. function template_warn_template()
  522. {
  523. global $context, $txt, $scripturl;
  524. echo '
  525. <div id="modcenter">
  526. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  527. <div class="cat_bar">
  528. <h3 class="catbg">', $context['page_title'], '</h3>
  529. </div>
  530. <div class="information">
  531. ', $txt['mc_warning_template_desc'], '
  532. </div>
  533. <div class="windowbg">
  534. <div class="content">
  535. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  536. <dl>
  537. <dt>
  538. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  539. </dt>
  540. <dd class="error" id="error_list">
  541. ', empty($context['warning_errors']) ? '' : implode('<br>', $context['warning_errors']), '
  542. </dd>
  543. </dl>
  544. </div>
  545. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  546. <dl class="settings">
  547. <dt>
  548. <strong>', $txt['preview'] , '</strong>
  549. </dt>
  550. <dd id="template_preview">
  551. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  552. </dd>
  553. </dl>
  554. </div>
  555. <dl class="settings">
  556. <dt>
  557. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  558. </dt>
  559. <dd>
  560. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text">
  561. </dd>
  562. <dt>
  563. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br>
  564. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  565. </dt>
  566. <dd>
  567. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  568. </dd>
  569. </dl>';
  570. if ($context['template_data']['can_edit_personal'])
  571. echo '
  572. <input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', ' class="input_check">
  573. <label for="make_personal">
  574. <strong>', $txt['mc_warning_template_personal'], '</strong>
  575. </label>
  576. <br>
  577. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  578. <br>';
  579. echo '
  580. <hr class="hrcolor">
  581. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit">
  582. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit">
  583. </div>
  584. </div>
  585. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  586. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '">
  587. </form>
  588. </div>
  589. <script><!-- // --><![CDATA[
  590. $(document).ready(function() {
  591. $("#preview_button").click(function() {
  592. return ajax_getTemplatePreview();
  593. });
  594. });
  595. function ajax_getTemplatePreview ()
  596. {
  597. $.ajax({
  598. type: "POST",
  599. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  600. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  601. context: document.body,
  602. success: function(request){
  603. $("#box_preview").css({display:""});
  604. $("#template_preview").html($(request).find(\'body\').text());
  605. if ($(request).find("error").text() != \'\')
  606. {
  607. $("#errors").css({display:""});
  608. var errors_html = \'\';
  609. var errors = $(request).find(\'error\').each(function() {
  610. errors_html += $(this).text() + \'<br>\';
  611. });
  612. $(document).find("#error_list").html(errors_html);
  613. }
  614. else
  615. {
  616. $("#errors").css({display:"none"});
  617. $("#error_list").html(\'\');
  618. }
  619. return false;
  620. },
  621. });
  622. return false;
  623. }
  624. // ]]></script>';
  625. }
  626. // A block to show the current top reported member profiles.
  627. function template_reported_members_block()
  628. {
  629. global $context, $txt, $scripturl;
  630. echo '
  631. <div class="cat_bar">
  632. <h3 class="catbg">
  633. <span id="reported_members_toggle" class="', !empty($context['admin_prefs']['mcru']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
  634. <a href="', $scripturl, '?action=moderate;area=memberreports" id="reported_members_link">', $txt['mc_recent_member_reports'], '</a>
  635. </h3>
  636. </div>
  637. <div class="windowbg" id="reported_users_panel">
  638. <div class="content modbox">
  639. <ul class="reset">';
  640. foreach ($context['reported_members'] as $report)
  641. echo '
  642. <li class="smalltext">
  643. <a href="', $report['report_href'], '">', $report['user_name'], '</a>
  644. </li>';
  645. // Don't have any reported members right now?
  646. if (empty($context['reported_members']))
  647. echo '
  648. <li>
  649. <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
  650. </li>';
  651. echo '
  652. </ul>
  653. </div>
  654. </div>
  655. <script><!-- // --><![CDATA[
  656. var oReportedPostsPanelToggle = new smc_Toggle({
  657. bToggleEnabled: true,
  658. bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrm']) ? 'true' : 'false', ',
  659. aSwappableContainers: [
  660. \'reported_posts_panel\'
  661. ],
  662. aSwapImages: [
  663. {
  664. sId: \'reported_members_toggle\',
  665. altExpanded: ', JavaScriptEscape($txt['hide']), ',
  666. altCollapsed: ', JavaScriptEscape($txt['show']), '
  667. }
  668. ],
  669. aSwapLinks: [
  670. {
  671. sId: \'reported_members_link\',
  672. msgExpanded: ', JavaScriptEscape($txt['mc_recent_member_reports']), ',
  673. msgCollapsed: ', JavaScriptEscape($txt['mc_recent_member_reports']), '
  674. }
  675. ],
  676. oThemeOptions: {
  677. bUseThemeSettings: true,
  678. sOptionName: \'admin_preferences\',
  679. sSessionVar: smf_session_var,
  680. sSessionId: smf_session_id,
  681. sThemeId: \'1\',
  682. sAdditionalVars: \';admin_key=mcrm\'
  683. }
  684. });
  685. // ]]></script>';
  686. }
  687. function template_reported_members()
  688. {
  689. global $context, $txt, $scripturl;
  690. // Let them know the action was a success.
  691. if (!empty($context['report_post_action']) && !empty($txt['report_action_'. $context['report_post_action']]))
  692. {
  693. echo '
  694. <div class="infobox">
  695. ', $txt['report_action_'. $context['report_post_action']], '
  696. </div>';
  697. }
  698. echo '
  699. <form id="reported_members" action="', $scripturl, '?action=moderate;area=memberreports', $context['view_closed'] ? ';sa=closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  700. <div class="cat_bar">
  701. <h3 class="catbg">
  702. ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
  703. </h3>
  704. </div>
  705. <div class="pagesection">
  706. <div class="pagelinks">', $context['page_index'], '</div>
  707. </div>';
  708. // Make the buttons.
  709. $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"');
  710. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  711. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  712. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  713. $ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
  714. foreach ($context['reports'] as $report)
  715. {
  716. echo '
  717. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  718. <div class="content">
  719. <h5>
  720. <strong><a href="', $report['user']['href'], '">', $report['user']['name'], '</a></strong>
  721. </h5>
  722. <div class="smalltext">
  723. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  724. // Prepare the comments...
  725. $comments = array();
  726. foreach ($report['comments'] as $comment)
  727. $comments[$comment['member']['id']] = $comment['member']['link'];
  728. echo '
  729. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  730. </div>
  731. <hr>
  732. <ul class="quickbuttons">
  733. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  734. <li><a href="', $scripturl, '?action=moderate;area=memberreports', $context['view_closed'] ? ';sa=closed' : '', ';ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$report['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
  735. <li><a href="', $scripturl, '?action=moderate;area=memberreports', $context['view_closed'] ? ';sa=closed' : '', ';close=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a></li>';
  736. // Ban this user button.
  737. if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id']))
  738. echo '
  739. <li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'] ,';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
  740. echo '
  741. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check">' : '', '</li>
  742. </ul>
  743. </div>
  744. </div>';
  745. }
  746. // Were none found?
  747. if (empty($context['reports']))
  748. echo '
  749. <div class="windowbg2">
  750. <div class="content">
  751. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  752. </div>
  753. </div>';
  754. echo '
  755. <div class="pagesection">
  756. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  757. <div class="floatright">
  758. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit">' : '', '
  759. </div>
  760. </div>
  761. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  762. </form>';
  763. }
  764. ?>