Display.template.php 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  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_main()
  13. {
  14. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  15. // Let them know, if their report was a success!
  16. if ($context['report_sent'])
  17. {
  18. echo '
  19. <div class="infobox">
  20. ', $txt['report_sent'], '
  21. </div>';
  22. }
  23. // Show the anchor for the top and for the first message. If the first message is new, say so.
  24. echo '
  25. <a id="top"></a>
  26. <a id="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a id="new"></a>' : '';
  27. // Is this topic also a poll?
  28. if ($context['is_poll'])
  29. {
  30. echo '
  31. <div id="poll">
  32. <div class="cat_bar">
  33. <h3 class="catbg">
  34. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.png" alt="" class="icon" /> ', $txt['poll'], '</span>
  35. </h3>
  36. </div>
  37. <div class="windowbg">
  38. <span class="topslice"><span></span></span>
  39. <div class="content" id="poll_options">
  40. <h4 id="pollquestion">
  41. ', $context['poll']['question'], '
  42. </h4>';
  43. // Are they not allowed to vote but allowed to view the options?
  44. if ($context['poll']['show_results'] || !$context['allow_vote'])
  45. {
  46. echo '
  47. <dl class="options">';
  48. // Show each option with its corresponding percentage bar.
  49. foreach ($context['poll']['options'] as $option)
  50. {
  51. echo '
  52. <dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
  53. <dd class="middletext statsbar', $option['voted_this'] ? ' voted' : '', '">';
  54. if ($context['allow_poll_view'])
  55. echo '
  56. ', $option['bar_ndt'], '
  57. <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';
  58. echo '
  59. </dd>';
  60. }
  61. echo '
  62. </dl>';
  63. if ($context['allow_poll_view'])
  64. echo '
  65. <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>';
  66. }
  67. // They are allowed to vote! Go to it!
  68. else
  69. {
  70. echo '
  71. <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">';
  72. // Show a warning if they are allowed more than one option.
  73. if ($context['poll']['allowed_warning'])
  74. echo '
  75. <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>';
  76. echo '
  77. <ul class="reset options">';
  78. // Show each option with its button - a radio likely.
  79. foreach ($context['poll']['options'] as $option)
  80. echo '
  81. <li class="middletext">', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
  82. echo '
  83. </ul>
  84. <div class="submitbutton">
  85. <input type="submit" value="', $txt['poll_vote'], '" class="button_submit" />
  86. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  87. </div>
  88. </form>';
  89. }
  90. // Is the clock ticking?
  91. if (!empty($context['poll']['expire_time']))
  92. echo '
  93. <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>';
  94. echo '
  95. </div>
  96. <span class="botslice"><span></span></span>
  97. </div>
  98. </div>
  99. <div id="pollmoderation">';
  100. // Build the poll moderation button array.
  101. $poll_buttons = array(
  102. 'vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.png', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']),
  103. 'results' => array('test' => 'show_view_results_button', 'text' => 'poll_results', 'image' => 'poll_results.png', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'),
  104. 'change_vote' => array('test' => 'allow_change_vote', 'text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'lang' => true, 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  105. 'lock' => array('test' => 'allow_lock_poll', 'text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'lang' => true, 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  106. 'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.png', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']),
  107. 'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  108. );
  109. template_button_strip($poll_buttons);
  110. echo '
  111. </div>';
  112. }
  113. // Does this topic have some events linked to it?
  114. if (!empty($context['linked_calendar_events']))
  115. {
  116. echo '
  117. <div class="linked_events">
  118. <div class="title_bar">
  119. <h3 class="titlebg headerpadding">', $txt['calendar_linked_events'], '</h3>
  120. </div>
  121. <div class="windowbg">
  122. <span class="topslice"><span></span></span>
  123. <div class="content">
  124. <ul class="reset">';
  125. foreach ($context['linked_calendar_events'] as $event)
  126. echo '
  127. <li>
  128. ', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '"> <img src="' . $settings['images_url'] . '/icons/calendar_modify.png" alt="" title="' . $txt['modify'] . '" class="edit_event" /></a> ' : ''), '<strong>', $event['title'], '</strong>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), '
  129. </li>';
  130. echo '
  131. </ul>
  132. </div>
  133. <span class="botslice"><span></span></span>
  134. </div>
  135. </div>';
  136. }
  137. // Build the normal button array.
  138. $normal_buttons = array(
  139. 'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true),
  140. 'add_poll' => array('test' => 'can_add_poll', 'text' => 'add_poll', 'image' => 'add_poll.png', 'lang' => true, 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']),
  141. 'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  142. 'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  143. 'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.png', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'),
  144. 'print' => array('test' => 'can_print', 'text' => 'print', 'image' => 'print.png', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
  145. );
  146. // Allow adding new buttons easily.
  147. call_integration_hook('integrate_display_buttons', array(&$normal_buttons));
  148. // Show the page index... "Pages: [1]".
  149. echo '
  150. <div class="pagesection">
  151. <div class="nextlinks">', $context['previous_next'], '</div>', template_button_strip($normal_buttons, 'right'), '
  152. <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>
  153. </div>';
  154. // Show the topic information - icon, subject, etc.
  155. echo '
  156. <div id="forumposts">
  157. <div class="cat_bar">
  158. <h3 class="catbg">
  159. <img src="', $settings['images_url'], '/topic/', $context['class'], '.png" align="bottom" alt="" />
  160. <span id="author">', $txt['author'], '</span>
  161. ', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
  162. </h3>
  163. </div>';
  164. if (!empty($settings['display_who_viewing']))
  165. {
  166. echo '
  167. <p id="whoisviewing" class="smalltext">';
  168. // Show just numbers...?
  169. if ($settings['display_who_viewing'] == 1)
  170. echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
  171. // Or show the actual people viewing the topic?
  172. else
  173. echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
  174. // Now show how many guests are here too.
  175. echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
  176. </p>';
  177. }
  178. echo '
  179. <form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;" onsubmit="return oQuickModify.bInEditMode ? oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\') : false">';
  180. $ignoredMsgs = array();
  181. $removableMessageIDs = array();
  182. $alternate = false;
  183. // Get all the messages...
  184. while ($message = $context['get_message']())
  185. {
  186. $ignoring = false;
  187. $alternate = !$alternate;
  188. if ($message['can_remove'])
  189. $removableMessageIDs[] = $message['id'];
  190. // Are we ignoring this message?
  191. if (!empty($message['is_ignored']))
  192. {
  193. $ignoring = true;
  194. $ignoredMsgs[] = $message['id'];
  195. }
  196. // Show the message anchor and a "new" anchor if this message is new.
  197. if ($message['id'] != $context['first_message'])
  198. echo '
  199. <a id="msg', $message['id'], '"></a>', $message['first_new'] ? '<a id="new"></a>' : '';
  200. echo '
  201. <div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
  202. <span class="topslice"><span></span></span>
  203. <div class="post_wrapper">';
  204. // Show information about the poster of this message.
  205. echo '
  206. <div class="poster">
  207. <h4>';
  208. // Show online and offline buttons?
  209. if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
  210. echo '
  211. ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<img src="', $message['member']['online']['image_href'], '" alt="', $message['member']['online']['text'], '" />', $context['can_send_pm'] ? '</a>' : '';
  212. // Show a link to the member's profile.
  213. echo '
  214. ', $message['member']['link'], '
  215. </h4>
  216. <ul class="reset smalltext" id="msg_', $message['id'], '_extra_info">';
  217. // Show the member's custom title, if they have one.
  218. if (!empty($message['member']['title']))
  219. echo '
  220. <li class="title">', $message['member']['title'], '</li>';
  221. // Show the member's primary group (like 'Administrator') if they have one.
  222. if (!empty($message['member']['group']))
  223. echo '
  224. <li class="membergroup">', $message['member']['group'], '</li>';
  225. // Don't show these things for guests.
  226. if (!$message['member']['is_guest'])
  227. {
  228. // Show the post group if and only if they have no other group or the option is on, and they are in a post group.
  229. if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
  230. echo '
  231. <li class="postgroup">', $message['member']['post_group'], '</li>';
  232. echo '
  233. <li class="icons">', $message['member']['group_icons'], '</li>';
  234. // Show avatars, images, etc.?
  235. if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
  236. echo '
  237. <li class="avatar">
  238. <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">
  239. ', $message['member']['avatar']['image'], '
  240. </a>
  241. </li>';
  242. // Show how many posts they have made.
  243. if (!isset($context['disabled_fields']['posts']))
  244. echo '
  245. <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
  246. // Is karma display enabled? Total or +/-?
  247. if ($modSettings['karmaMode'] == '1')
  248. echo '
  249. <li class="karma">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';
  250. elseif ($modSettings['karmaMode'] == '2')
  251. echo '
  252. <li class="karma">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';
  253. // Is this user allowed to modify this member's karma?
  254. if ($message['member']['karma']['allow'])
  255. echo '
  256. <li class="karma_allow">
  257. <a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
  258. <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>
  259. </li>';
  260. // Show the member's gender icon?
  261. if (!empty($settings['show_gender']) && $message['member']['gender']['image'] != '' && !isset($context['disabled_fields']['gender']))
  262. echo '
  263. <li class="gender">', $txt['gender'], ': ', $message['member']['gender']['image'], '</li>';
  264. // Show their personal text?
  265. if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
  266. echo '
  267. <li class="blurb">', $message['member']['blurb'], '</li>';
  268. // Any custom fields to show as icons?
  269. if (!empty($message['member']['custom_fields']))
  270. {
  271. $shown = false;
  272. foreach ($message['member']['custom_fields'] as $custom)
  273. {
  274. if ($custom['placement'] != 1 || empty($custom['value']))
  275. continue;
  276. if (empty($shown))
  277. {
  278. $shown = true;
  279. echo '
  280. <li class="im_icons">
  281. <ul>';
  282. }
  283. echo '
  284. <li>', $custom['value'], '</li>';
  285. }
  286. if ($shown)
  287. echo '
  288. </ul>
  289. </li>';
  290. }
  291. // This shows the popular messaging icons.
  292. if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
  293. echo '
  294. <li class="im_icons">
  295. <ul>
  296. ', !empty($message['member']['icq']['link']) ? '<li>' . $message['member']['icq']['link'] . '</li>' : '', '
  297. ', !empty($message['member']['msn']['link']) ? '<li>' . $message['member']['msn']['link'] . '</li>' : '', '
  298. ', !empty($message['member']['aim']['link']) ? '<li>' . $message['member']['aim']['link'] . '</li>' : '', '
  299. ', !empty($message['member']['yim']['link']) ? '<li>' . $message['member']['yim']['link'] . '</li>' : '', '
  300. </ul>
  301. </li>';
  302. // Show the profile, website, email address, and personal message buttons.
  303. if ($message['member']['show_profile_buttons'])
  304. {
  305. echo '
  306. <li class="profile">
  307. <ul>';
  308. // Don't show the profile button if you're not allowed to view the profile.
  309. if ($message['member']['can_view_profile'])
  310. echo '
  311. <li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '" />' : $txt['view_profile']), '</a></li>';
  312. // Don't show an icon if they haven't specified a website.
  313. if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website']))
  314. echo '
  315. <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/www_sm.png" alt="' . $message['member']['website']['title'] . '" />' : $txt['www']), '</a></li>';
  316. // Don't show the email address if they want it hidden.
  317. if (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) && $context['can_send_email'])
  318. echo '
  319. <li><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a></li>';
  320. // Since we know this person isn't a guest, you *can* message them.
  321. if ($context['can_send_pm'])
  322. echo '
  323. <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.png" alt="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '" />' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
  324. echo '
  325. </ul>
  326. </li>';
  327. }
  328. // Any custom fields for standard placement?
  329. if (!empty($message['member']['custom_fields']))
  330. {
  331. foreach ($message['member']['custom_fields'] as $custom)
  332. if (empty($custom['placement']) || empty($custom['value']))
  333. echo '
  334. <li class="custom">', $custom['title'], ': ', $custom['value'], '</li>';
  335. }
  336. // Are we showing the warning status?
  337. if ($message['member']['can_see_warning'])
  338. echo '
  339. <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<img src="', $settings['images_url'], '/warning_', $message['member']['warning_status'], '.png" alt="', $txt['user_warn_' . $message['member']['warning_status']], '" />', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
  340. }
  341. // Otherwise, show the guest's email.
  342. elseif (!empty($message['member']['email']) && in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) && $context['can_send_email'])
  343. echo '
  344. <li class="email"><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a></li>';
  345. // Done with the information about the poster... on to the post itself.
  346. echo '
  347. </ul>
  348. </div>
  349. <div class="postarea">
  350. <div class="flow_hidden">
  351. <div class="keyinfo">
  352. <div class="messageicon">
  353. <img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
  354. </div>
  355. <h5 id="subject_', $message['id'], '">
  356. <a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
  357. </h5>
  358. <div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
  359. <div id="msg_', $message['id'], '_quick_mod"></div>
  360. </div>';
  361. // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
  362. if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
  363. echo '
  364. <ul class="reset smalltext quickbuttons">';
  365. // Maybe we can approve it, maybe we should?
  366. if ($message['can_approve'])
  367. echo '
  368. <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="approve_button">', $txt['approve'], '</a></li>';
  369. // Can they reply? Have they turned on quick reply?
  370. if ($context['can_quote'] && !empty($options['display_quick_reply']))
  371. echo '
  372. <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');" class="quote_button">', $txt['quote'], '</a></li>';
  373. // So... quick reply is off, but they *can* reply?
  374. elseif ($context['can_quote'])
  375. echo '
  376. <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" class="quote_button">', $txt['quote'], '</a></li>';
  377. // Can the user modify the contents of this post?
  378. if ($message['can_modify'])
  379. echo '
  380. <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '" class="modify_button">', $txt['modify'], '</a></li>';
  381. // How about... even... remove it entirely?!
  382. if ($message['can_remove'])
  383. echo '
  384. <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="remove_button">', $txt['remove'], '</a></li>';
  385. // What about splitting it off the rest of the topic?
  386. if ($context['can_split'] && !empty($context['real_num_replies']))
  387. echo '
  388. <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '" class="split_button">', $txt['split'], '</a></li>';
  389. // Can we restore topics?
  390. if ($context['can_restore_msg'])
  391. echo '
  392. <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="restore_button">', $txt['restore_message'], '</a></li>';
  393. // Show a checkbox for quick moderation?
  394. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
  395. echo '
  396. <li class="inline_mod_check" style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
  397. if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
  398. echo '
  399. </ul>';
  400. echo '
  401. </div>';
  402. // Ignoring this user? Hide the post.
  403. if ($ignoring)
  404. echo '
  405. <div id="msg_', $message['id'], '_ignored_prompt">
  406. ', $txt['ignoring_user'], '
  407. <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
  408. </div>';
  409. // Show the post itself, finally!
  410. echo '
  411. <div class="post">';
  412. if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
  413. echo '
  414. <div class="approve_post">
  415. ', $txt['post_awaiting_approval'], '
  416. </div>';
  417. echo '
  418. <div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
  419. </div>';
  420. // Can the user modify the contents of this post? Show the modify inline image.
  421. if ($message['can_modify'])
  422. echo '
  423. <img src="', $settings['images_url'], '/icons/modify_inline.png" alt="', $txt['modify_msg'], '" title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" style="cursor: pointer; display: none;" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')" />';
  424. // Assuming there are attachments...
  425. if (!empty($message['attachment']))
  426. {
  427. echo '
  428. <div id="msg_', $message['id'], '_footer" class="attachments smalltext">
  429. <div style="overflow: ', isBrowser('is_firefox') ? 'visible' : 'auto', ';">';
  430. $last_approved_state = 1;
  431. $attachments_per_line = 4;
  432. $i = 0;
  433. foreach ($message['attachment'] as $attachment)
  434. {
  435. // Show a special box for unapproved attachments...
  436. if ($attachment['is_approved'] != $last_approved_state)
  437. {
  438. $last_approved_state = 0;
  439. echo '
  440. <fieldset>
  441. <legend>', $txt['attach_awaiting_approve'];
  442. if ($context['can_approve'])
  443. echo '
  444. &nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]';
  445. echo '
  446. </legend>';
  447. }
  448. echo '
  449. <div class="floatleft padding">
  450. <div class="attachments_top">';
  451. if ($attachment['is_image'])
  452. {
  453. if ($attachment['thumbnail']['has_thumb'])
  454. echo '
  455. <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" /></a><br />';
  456. else
  457. echo '
  458. <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '"/><br />';
  459. }
  460. echo '
  461. </div>
  462. <div class="attachments_bot">
  463. <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*" />&nbsp;' . $attachment['name'] . '</a> ';
  464. if (!$attachment['is_approved'] && $context['can_approve'])
  465. echo '
  466. [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
  467. echo '
  468. <br />', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br />' . $txt['attach_viewed'] : '<br />' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '
  469. </div>';
  470. echo '
  471. </div>';
  472. // Next attachment line ?
  473. if (++$i % $attachments_per_line === 0)
  474. echo '
  475. <br class="clear" />';
  476. }
  477. // no more attachments, clear the float if its open
  478. if ($i % $attachments_per_line !== 0)
  479. echo '
  480. <br class="clear" />';
  481. // If we had unapproved attachments clean up.
  482. if ($last_approved_state == 0)
  483. echo '
  484. </fieldset>';
  485. echo '
  486. </div>
  487. </div>';
  488. }
  489. echo '
  490. </div>
  491. <div class="moderatorbar">
  492. <div class="smalltext modified" id="modified_', $message['id'], '">';
  493. // Show "<< Last Edit: Time by Person >>" if this post was edited.
  494. if ($settings['show_modify'] && !empty($message['modified']['name']))
  495. echo '
  496. &#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> &#187;';
  497. echo '
  498. </div>
  499. <div class="smalltext reportlinks">';
  500. // Maybe they want to report this post to the moderator(s)?
  501. if ($context['can_report_moderator'])
  502. echo '
  503. <a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> &nbsp;';
  504. // Can we issue a warning because of this post? Remember, we can't give guests warnings.
  505. if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest'])
  506. echo '
  507. <a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><img src="', $settings['images_url'], '/warn.png" alt="', $txt['issue_warning_post'], '" title="', $txt['issue_warning_post'], '" /></a>';
  508. echo '
  509. <img class="centericon" src="', $settings['images_url'], '/ip.png" alt="" />';
  510. // Show the IP to this user for this post - because you can moderate?
  511. if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
  512. echo '
  513. <a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqWin(this.href);" class="help">(?)</a>';
  514. // Or, should we show it because this is you?
  515. elseif ($message['can_see_ip'])
  516. echo '
  517. <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $message['member']['ip'], '</a>';
  518. // Okay, are you at least logged in? Then we can show something about why IPs are logged...
  519. elseif (!$context['user']['is_guest'])
  520. echo '
  521. <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $txt['logged'], '</a>';
  522. // Otherwise, you see NOTHING!
  523. else
  524. echo '
  525. ', $txt['logged'];
  526. echo '
  527. </div>';
  528. // Are there any custom profile fields for above the signature?
  529. if (!empty($message['member']['custom_fields']))
  530. {
  531. $shown = false;
  532. foreach ($message['member']['custom_fields'] as $custom)
  533. {
  534. if ($custom['placement'] != 2 || empty($custom['value']))
  535. continue;
  536. if (empty($shown))
  537. {
  538. $shown = true;
  539. echo '
  540. <div class="custom_fields_above_signature">
  541. <ul class="reset nolist">';
  542. }
  543. echo '
  544. <li>', $custom['value'], '</li>';
  545. }
  546. if ($shown)
  547. echo '
  548. </ul>
  549. </div>';
  550. }
  551. // Show the member's signature?
  552. if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
  553. echo '
  554. <div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';
  555. echo '
  556. </div>
  557. </div>
  558. <span class="botslice"><span></span></span>
  559. </div>
  560. <hr class="post_separator" />';
  561. }
  562. echo '
  563. </form>
  564. </div>
  565. <a id="lastPost"></a>';
  566. // Show the page index... "Pages: [1]".
  567. echo '
  568. <div class="pagesection">
  569. ', template_button_strip($normal_buttons, 'right'), '
  570. <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div>
  571. <div class="nextlinks_bottom">', $context['previous_next'], '</div>
  572. </div>';
  573. // Show the lower breadcrumbs.
  574. theme_linktree();
  575. $mod_buttons = array(
  576. 'move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.png', 'lang' => true, 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'),
  577. 'delete' => array('test' => 'can_delete', 'text' => 'remove_topic', 'image' => 'admin_rem.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_remove_topic'] . '\');"', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
  578. 'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  579. 'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  580. 'merge' => array('test' => 'can_merge', 'text' => 'merge', 'image' => 'merge.png', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']),
  581. 'calendar' => array('test' => 'calendar_post', 'text' => 'calendar_link', 'image' => 'linktocal.png', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'),
  582. );
  583. // Restore topic. eh? No monkey business.
  584. if ($context['can_restore_topic'])
  585. $mod_buttons[] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
  586. // Allow adding new mod buttons easily.
  587. call_integration_hook('integrate_mod_buttons', array(&$mod_buttons));
  588. echo '
  589. <div id="moderationbuttons">', template_button_strip($mod_buttons, 'bottom', array('id' => 'moderationbuttons_strip')), '</div>';
  590. // Show the jumpto box, or actually...let Javascript do it.
  591. echo '
  592. <div class="plainbox" id="display_jump_to">&nbsp;</div>';
  593. if ($context['can_reply'] && !empty($options['display_quick_reply']))
  594. {
  595. echo '
  596. <a id="quickreply"></a>
  597. <div class="tborder" id="quickreplybox">
  598. <div class="cat_bar">
  599. <h3 class="catbg">
  600. <span class="ie6_header floatright">
  601. <a href="javascript:oQuickReply.swap();"><img src="', $settings['images_url'], '/', $options['display_quick_reply'] > 1 ? 'collapse' : 'expand', '.png" alt="+" id="quickReplyExpand" class="icon" /></a>
  602. </span>
  603. <span>
  604. <a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
  605. </span>
  606. </h3>
  607. </div>
  608. <div id="quickReplyOptions"', $options['display_quick_reply'] > 1 ? '' : ' style="display: none"', '>
  609. <span class="upperframe"><span></span></span>
  610. <div class="roundframe">
  611. <p class="smalltext lefttext">', $txt['quick_reply_desc'], '</p>
  612. ', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '',
  613. $context['oldTopicError'] ? '<p class="alert smalltext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</p>' : '', '
  614. ', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
  615. ', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
  616. <form action="', $scripturl, '?board=', $context['current_board'], ';action=post2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
  617. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  618. <input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
  619. <input type="hidden" name="icon" value="xx" />
  620. <input type="hidden" name="from_qr" value="1" />
  621. <input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
  622. <input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '" />
  623. <input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
  624. <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />
  625. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  626. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />';
  627. // Guests just need more.
  628. if ($context['user']['is_guest'])
  629. echo '
  630. <strong>', $txt['name'], ':</strong> <input type="text" name="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
  631. <strong>', $txt['email'], ':</strong> <input type="text" name="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" /><br />';
  632. // Is visual verification enabled?
  633. if ($context['require_verification'])
  634. echo '
  635. <strong>', $txt['verification'], ':</strong>', template_control_verification($context['visual_verification_id'], 'quick_reply'), '<br />';
  636. if ($options['display_quick_reply'] < 3)
  637. {
  638. echo '
  639. <div class="quickReplyContent">
  640. <textarea cols="600" rows="7" name="message" tabindex="', $context['tabindex']++, '"></textarea>
  641. </div>';
  642. }
  643. else
  644. {
  645. // Show the actual posting area...
  646. if ($context['show_bbc'])
  647. {
  648. echo '
  649. <div id="bbcBox_message"></div>';
  650. }
  651. // What about smileys?
  652. if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
  653. echo '
  654. <div id="smileyBox_message"></div>';
  655. echo '
  656. ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
  657. <script type="text/javascript"><!-- // --><![CDATA[
  658. function insertQuoteFast(messageid)
  659. {
  660. if (window.XMLHttpRequest)
  661. getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), onDocReceived);
  662. else
  663. reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), 240, 90);
  664. return false;
  665. }
  666. function onDocReceived(XMLDoc)
  667. {
  668. var text = \'\';
  669. for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
  670. text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
  671. oEditorHandle_', $context['post_box_name'], '.insertText(text, false, true);
  672. ajax_indicator(false);
  673. }
  674. // ]]></script>';
  675. }
  676. echo '
  677. <div class="padding">
  678. <hr class="hrcolor" />
  679. <input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="', $context['tabindex']++, '" class="button_submit" />
  680. <input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />';
  681. if ($context['show_spellchecking'])
  682. echo '
  683. <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" tabindex="', $context['tabindex']++, '" class="button_submit" />';
  684. echo '
  685. <br class="clear_right" />
  686. </div>
  687. </form>
  688. </div>
  689. <span class="lowerframe"><span></span></span>
  690. </div>
  691. </div>';
  692. }
  693. else
  694. echo '
  695. <br class="clear" />';
  696. if ($context['show_spellchecking'])
  697. echo '
  698. <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>
  699. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
  700. echo '
  701. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
  702. <script type="text/javascript"><!-- // --><![CDATA[';
  703. if (!empty($options['display_quick_reply']))
  704. echo '
  705. var oQuickReply = new QuickReply({
  706. bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 1 ? 'false' : 'true', ',
  707. iTopicId: ', $context['current_topic'], ',
  708. iStart: ', $context['start'], ',
  709. sScriptUrl: smf_scripturl,
  710. sImagesUrl: smf_images_url,
  711. sContainerId: "quickReplyOptions",
  712. sImageId: "quickReplyExpand",
  713. sImageCollapsed: "collapse.png",
  714. sImageExpanded: "expand.png",
  715. sJumpAnchor: "quickreply",
  716. bIsFull: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 2 ? 'true' : 'false', '
  717. });';
  718. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post'])
  719. echo '
  720. var oInTopicModeration = new InTopicModeration({
  721. sSelf: \'oInTopicModeration\',
  722. sCheckboxContainerMask: \'in_topic_mod_check_\',
  723. aMessageIds: [\'', implode('\', \'', $removableMessageIDs), '\'],
  724. sSessionId: smf_session_id,
  725. sSessionVar: smf_session_var,
  726. sButtonStrip: \'moderationbuttons\',
  727. sButtonStripDisplay: \'moderationbuttons_strip\',
  728. bUseImageButton: false,
  729. bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
  730. sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
  731. sRemoveButtonImage: \'delete_selected.png\',
  732. sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
  733. bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
  734. sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
  735. sRestoreButtonImage: \'restore_selected.png\',
  736. sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
  737. bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
  738. sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
  739. sSplitButtonImage: \'split_selected.png\',
  740. sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
  741. sFormId: \'quickModForm\'
  742. });';
  743. echo '
  744. if (\'XMLHttpRequest\' in window)
  745. {
  746. var oQuickModify = new QuickModify({
  747. sScriptUrl: smf_scripturl,
  748. bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
  749. iTopicId: ', $context['current_topic'], ',
  750. sTemplateBodyEdit: ', JavaScriptEscape('
  751. <div id="quick_edit_body_container" style="width: 90%">
  752. <div id="error_box" style="padding: 4px;" class="error"></div>
  753. <textarea class="editor" name="message" rows="12" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 100%') . '; margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
  754. <input type="hidden" name="\' + smf_session_var + \'" value="\' + smf_session_id + \'" />
  755. <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
  756. <input type="hidden" name="msg" value="%msg_id%" />
  757. <div class="righttext">
  758. <input type="submit" name="post" value="' . $txt['save'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s" class="button_submit" />&nbsp;&nbsp;' . ($context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" tabindex="' . $context['tabindex']++ . '" onclick="spellCheck(\'quickModForm\', \'message\');" class="button_submit" />&nbsp;&nbsp;' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifyCancel();" class="button_submit" />
  759. </div>
  760. </div>'), ',
  761. sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
  762. sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
  763. sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
  764. sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')'), ',
  765. sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), '
  766. });
  767. aJumpTo[aJumpTo.length] = new JumpTo({
  768. sContainerId: "display_jump_to",
  769. sJumpToTemplate: "<label class=\"smalltext\" for=\"%select_id%\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
  770. iCurBoardId: ', $context['current_board'], ',
  771. iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
  772. sCurBoardName: "', $context['jump_to']['board_name'], '",
  773. sBoardChildLevelIndicator: "==",
  774. sBoardPrefix: "=> ",
  775. sCatSeparator: "-----------------------------",
  776. sCatPrefix: "",
  777. sGoButtonLabel: "', $txt['go'], '"
  778. });
  779. aIconLists[aIconLists.length] = new IconList({
  780. sBackReference: "aIconLists[" + aIconLists.length + "]",
  781. sIconIdPrefix: "msg_icon_",
  782. sScriptUrl: smf_scripturl,
  783. bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
  784. iBoardId: ', $context['current_board'], ',
  785. iTopicId: ', $context['current_topic'], ',
  786. sSessionId: smf_session_id,
  787. sSessionVar: smf_session_var,
  788. sLabelIconList: "', $txt['message_icon'], '",
  789. sBoxBackground: "transparent",
  790. sBoxBackgroundHover: "#ffffff",
  791. iBoxBorderWidthHover: 1,
  792. sBoxBorderColorHover: "#adadad" ,
  793. sContainerBackground: "#ffffff",
  794. sContainerBorder: "1px solid #adadad",
  795. sItemBorder: "1px solid #ffffff",
  796. sItemBorderHover: "1px dotted gray",
  797. sItemBackground: "transparent",
  798. sItemBackgroundHover: "#e0e0f0"
  799. });
  800. }';
  801. if (!empty($ignoredMsgs))
  802. {
  803. echo '
  804. var aIgnoreToggles = new Array();';
  805. foreach ($ignoredMsgs as $msgid)
  806. {
  807. echo '
  808. aIgnoreToggles[', $msgid, '] = new smc_Toggle({
  809. bToggleEnabled: true,
  810. bCurrentlyCollapsed: true,
  811. aSwappableContainers: [
  812. \'msg_', $msgid, '_extra_info\',
  813. \'msg_', $msgid, '\',
  814. \'msg_', $msgid, '_footer\',
  815. \'msg_', $msgid, '_quick_mod\',
  816. \'modify_button_', $msgid, '\',
  817. \'msg_', $msgid, '_signature\'
  818. ],
  819. aSwapLinks: [
  820. {
  821. sId: \'msg_', $msgid, '_ignored_link\',
  822. msgExpanded: \'\',
  823. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  824. }
  825. ]
  826. });';
  827. }
  828. }
  829. echo '
  830. // ]]></script>';
  831. }
  832. ?>