Display.template.php 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  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. template_button_strip($context['poll_buttons']);
  101. echo '
  102. </div>';
  103. }
  104. // Does this topic have some events linked to it?
  105. if (!empty($context['linked_calendar_events']))
  106. {
  107. echo '
  108. <div class="linked_events">
  109. <div class="title_bar">
  110. <h3 class="titlebg headerpadding">', $txt['calendar_linked_events'], '</h3>
  111. </div>
  112. <div class="windowbg">
  113. <span class="topslice"><span></span></span>
  114. <div class="content">
  115. <ul class="reset">';
  116. foreach ($context['linked_calendar_events'] as $event)
  117. echo '
  118. <li>
  119. ', ($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'] : ''), '
  120. </li>';
  121. echo '
  122. </ul>
  123. </div>
  124. <span class="botslice"><span></span></span>
  125. </div>
  126. </div>';
  127. }
  128. // Show the page index... "Pages: [1]".
  129. echo '
  130. <div class="pagesection">
  131. <div class="nextlinks">', $context['previous_next'], '</div>', template_button_strip($context['normal_buttons'], 'right'), '
  132. <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>
  133. </div>';
  134. // Show the topic information - icon, subject, etc.
  135. echo '
  136. <div id="forumposts">
  137. <div class="cat_bar">
  138. <h3 class="catbg">
  139. <img src="', $settings['images_url'], '/topic/', $context['class'], '.png" align="bottom" alt="" />
  140. <span id="author">', $txt['author'], '</span>
  141. ', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
  142. </h3>
  143. </div>';
  144. if (!empty($settings['display_who_viewing']))
  145. {
  146. echo '
  147. <p id="whoisviewing" class="smalltext">';
  148. // Show just numbers...?
  149. if ($settings['display_who_viewing'] == 1)
  150. echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
  151. // Or show the actual people viewing the topic?
  152. else
  153. 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'] . ')');
  154. // Now show how many guests are here too.
  155. echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
  156. </p>';
  157. }
  158. echo '
  159. <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">';
  160. $ignoredMsgs = array();
  161. $removableMessageIDs = array();
  162. $alternate = false;
  163. // Get all the messages...
  164. while ($message = $context['get_message']())
  165. {
  166. $ignoring = false;
  167. $alternate = !$alternate;
  168. if ($message['can_remove'])
  169. $removableMessageIDs[] = $message['id'];
  170. // Are we ignoring this message?
  171. if (!empty($message['is_ignored']))
  172. {
  173. $ignoring = true;
  174. $ignoredMsgs[] = $message['id'];
  175. }
  176. // Show the message anchor and a "new" anchor if this message is new.
  177. if ($message['id'] != $context['first_message'])
  178. echo '
  179. <a id="msg', $message['id'], '"></a>', $message['first_new'] ? '<a id="new"></a>' : '';
  180. echo '
  181. <div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
  182. <span class="topslice"><span></span></span>
  183. <div class="post_wrapper">';
  184. // Show information about the poster of this message.
  185. echo '
  186. <div class="poster">
  187. <h4>';
  188. // Show online and offline buttons?
  189. if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
  190. echo '
  191. ', $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>' : '';
  192. // Show a link to the member's profile.
  193. echo '
  194. ', $message['member']['link'], '
  195. </h4>
  196. <ul class="reset smalltext" id="msg_', $message['id'], '_extra_info">';
  197. // Show the member's custom title, if they have one.
  198. if (!empty($message['member']['title']))
  199. echo '
  200. <li class="title">', $message['member']['title'], '</li>';
  201. // Show the member's primary group (like 'Administrator') if they have one.
  202. if (!empty($message['member']['group']))
  203. echo '
  204. <li class="membergroup">', $message['member']['group'], '</li>';
  205. // Don't show these things for guests.
  206. if (!$message['member']['is_guest'])
  207. {
  208. // 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.
  209. if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
  210. echo '
  211. <li class="postgroup">', $message['member']['post_group'], '</li>';
  212. echo '
  213. <li class="icons">', $message['member']['group_icons'], '</li>';
  214. // Show avatars, images, etc.?
  215. if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
  216. echo '
  217. <li class="avatar">
  218. <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">
  219. ', $message['member']['avatar']['image'], '
  220. </a>
  221. </li>';
  222. // Show how many posts they have made.
  223. if (!isset($context['disabled_fields']['posts']))
  224. echo '
  225. <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
  226. // Is karma display enabled? Total or +/-?
  227. if ($modSettings['karmaMode'] == '1')
  228. echo '
  229. <li class="karma">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';
  230. elseif ($modSettings['karmaMode'] == '2')
  231. echo '
  232. <li class="karma">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';
  233. // Is this user allowed to modify this member's karma?
  234. if ($message['member']['karma']['allow'])
  235. echo '
  236. <li class="karma_allow">
  237. <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>
  238. <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>
  239. </li>';
  240. // Show the member's gender icon?
  241. if (!empty($settings['show_gender']) && $message['member']['gender']['image'] != '' && !isset($context['disabled_fields']['gender']))
  242. echo '
  243. <li class="gender">', $txt['gender'], ': ', $message['member']['gender']['image'], '</li>';
  244. // Show their personal text?
  245. if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
  246. echo '
  247. <li class="blurb">', $message['member']['blurb'], '</li>';
  248. // Any custom fields to show as icons?
  249. if (!empty($message['member']['custom_fields']))
  250. {
  251. $shown = false;
  252. foreach ($message['member']['custom_fields'] as $custom)
  253. {
  254. if ($custom['placement'] != 1 || empty($custom['value']))
  255. continue;
  256. if (empty($shown))
  257. {
  258. $shown = true;
  259. echo '
  260. <li class="im_icons">
  261. <ul>';
  262. }
  263. echo '
  264. <li>', $custom['value'], '</li>';
  265. }
  266. if ($shown)
  267. echo '
  268. </ul>
  269. </li>';
  270. }
  271. // This shows the popular messaging icons.
  272. if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
  273. echo '
  274. <li class="im_icons">
  275. <ul>
  276. ', !empty($message['member']['icq']['link']) ? '<li>' . $message['member']['icq']['link'] . '</li>' : '', '
  277. ', !empty($message['member']['msn']['link']) ? '<li>' . $message['member']['msn']['link'] . '</li>' : '', '
  278. ', !empty($message['member']['aim']['link']) ? '<li>' . $message['member']['aim']['link'] . '</li>' : '', '
  279. ', !empty($message['member']['yim']['link']) ? '<li>' . $message['member']['yim']['link'] . '</li>' : '', '
  280. </ul>
  281. </li>';
  282. // Show the profile, website, email address, and personal message buttons.
  283. if ($message['member']['show_profile_buttons'])
  284. {
  285. echo '
  286. <li class="profile">
  287. <ul>';
  288. // Don't show the profile button if you're not allowed to view the profile.
  289. if ($message['member']['can_view_profile'])
  290. echo '
  291. <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>';
  292. // Don't show an icon if they haven't specified a website.
  293. if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website']))
  294. echo '
  295. <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>';
  296. // Don't show the email address if they want it hidden.
  297. if (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) && $context['can_send_email'])
  298. echo '
  299. <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>';
  300. // Since we know this person isn't a guest, you *can* message them.
  301. if ($context['can_send_pm'])
  302. echo '
  303. <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>';
  304. echo '
  305. </ul>
  306. </li>';
  307. }
  308. // Any custom fields for standard placement?
  309. if (!empty($message['member']['custom_fields']))
  310. {
  311. foreach ($message['member']['custom_fields'] as $custom)
  312. if (empty($custom['placement']) || empty($custom['value']))
  313. echo '
  314. <li class="custom">', $custom['title'], ': ', $custom['value'], '</li>';
  315. }
  316. // Are we showing the warning status?
  317. if ($message['member']['can_see_warning'])
  318. echo '
  319. <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>';
  320. }
  321. // Otherwise, show the guest's email.
  322. elseif (!empty($message['member']['email']) && in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) && $context['can_send_email'])
  323. echo '
  324. <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>';
  325. // Done with the information about the poster... on to the post itself.
  326. echo '
  327. </ul>
  328. </div>
  329. <div class="postarea">
  330. <div class="flow_hidden">
  331. <div class="keyinfo">
  332. <div class="messageicon">
  333. <img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
  334. </div>
  335. <h5 id="subject_', $message['id'], '">
  336. <a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
  337. </h5>
  338. <div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
  339. <div id="msg_', $message['id'], '_quick_mod"></div>
  340. </div>';
  341. // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
  342. if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
  343. echo '
  344. <ul class="reset smalltext quickbuttons">';
  345. // Maybe we can approve it, maybe we should?
  346. if ($message['can_approve'])
  347. echo '
  348. <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>';
  349. // Can they reply? Have they turned on quick reply?
  350. if ($context['can_quote'] && !empty($options['display_quick_reply']))
  351. echo '
  352. <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>';
  353. // So... quick reply is off, but they *can* reply?
  354. elseif ($context['can_quote'])
  355. echo '
  356. <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>';
  357. // Can the user modify the contents of this post?
  358. if ($message['can_modify'])
  359. echo '
  360. <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '" class="modify_button">', $txt['modify'], '</a></li>';
  361. // How about... even... remove it entirely?!
  362. if ($message['can_remove'])
  363. echo '
  364. <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>';
  365. // What about splitting it off the rest of the topic?
  366. if ($context['can_split'] && !empty($context['real_num_replies']))
  367. echo '
  368. <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '" class="split_button">', $txt['split'], '</a></li>';
  369. // Can we restore topics?
  370. if ($context['can_restore_msg'])
  371. echo '
  372. <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="restore_button">', $txt['restore_message'], '</a></li>';
  373. // Show a checkbox for quick moderation?
  374. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
  375. echo '
  376. <li class="inline_mod_check" style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
  377. if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
  378. echo '
  379. </ul>';
  380. echo '
  381. </div>';
  382. // Ignoring this user? Hide the post.
  383. if ($ignoring)
  384. echo '
  385. <div id="msg_', $message['id'], '_ignored_prompt">
  386. ', $txt['ignoring_user'], '
  387. <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
  388. </div>';
  389. // Show the post itself, finally!
  390. echo '
  391. <div class="post">';
  392. if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
  393. echo '
  394. <div class="approve_post">
  395. ', $txt['post_awaiting_approval'], '
  396. </div>';
  397. echo '
  398. <div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
  399. </div>';
  400. // Can the user modify the contents of this post? Show the modify inline image.
  401. if ($message['can_modify'])
  402. echo '
  403. <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'], '\')" />';
  404. // Assuming there are attachments...
  405. if (!empty($message['attachment']))
  406. {
  407. echo '
  408. <div id="msg_', $message['id'], '_footer" class="attachments smalltext">
  409. <div style="overflow: ', isBrowser('is_firefox') ? 'visible' : 'auto', ';">';
  410. $last_approved_state = 1;
  411. $attachments_per_line = 4;
  412. $i = 0;
  413. foreach ($message['attachment'] as $attachment)
  414. {
  415. // Show a special box for unapproved attachments...
  416. if ($attachment['is_approved'] != $last_approved_state)
  417. {
  418. $last_approved_state = 0;
  419. echo '
  420. <fieldset>
  421. <legend>', $txt['attach_awaiting_approve'];
  422. if ($context['can_approve'])
  423. echo '
  424. &nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]';
  425. echo '
  426. </legend>';
  427. }
  428. echo '
  429. <div class="floatleft padding">
  430. <div class="attachments_top">';
  431. if ($attachment['is_image'])
  432. {
  433. if ($attachment['thumbnail']['has_thumb'])
  434. echo '
  435. <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 />';
  436. else
  437. echo '
  438. <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '"/><br />';
  439. }
  440. echo '
  441. </div>
  442. <div class="attachments_bot">
  443. <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*" />&nbsp;' . $attachment['name'] . '</a> ';
  444. if (!$attachment['is_approved'] && $context['can_approve'])
  445. echo '
  446. [<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>] ';
  447. echo '
  448. <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'] . '
  449. </div>';
  450. echo '
  451. </div>';
  452. // Next attachment line ?
  453. if (++$i % $attachments_per_line === 0)
  454. echo '
  455. <br class="clear" />';
  456. }
  457. // no more attachments, clear the float if its open
  458. if ($i % $attachments_per_line !== 0)
  459. echo '
  460. <br class="clear" />';
  461. // If we had unapproved attachments clean up.
  462. if ($last_approved_state == 0)
  463. echo '
  464. </fieldset>';
  465. echo '
  466. </div>
  467. </div>';
  468. }
  469. echo '
  470. </div>
  471. <div class="moderatorbar">
  472. <div class="smalltext modified" id="modified_', $message['id'], '">';
  473. // Show "<< Last Edit: Time by Person >>" if this post was edited.
  474. if ($settings['show_modify'] && !empty($message['modified']['name']))
  475. echo '
  476. &#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> &#187;';
  477. echo '
  478. </div>
  479. <div class="smalltext reportlinks">';
  480. // Maybe they want to report this post to the moderator(s)?
  481. if ($context['can_report_moderator'])
  482. echo '
  483. <a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> &nbsp;';
  484. // Can we issue a warning because of this post? Remember, we can't give guests warnings.
  485. if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest'])
  486. echo '
  487. <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>';
  488. echo '
  489. <img class="centericon" src="', $settings['images_url'], '/ip.png" alt="" />';
  490. // Show the IP to this user for this post - because you can moderate?
  491. if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
  492. echo '
  493. <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>';
  494. // Or, should we show it because this is you?
  495. elseif ($message['can_see_ip'])
  496. echo '
  497. <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $message['member']['ip'], '</a>';
  498. // Okay, are you at least logged in? Then we can show something about why IPs are logged...
  499. elseif (!$context['user']['is_guest'])
  500. echo '
  501. <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $txt['logged'], '</a>';
  502. // Otherwise, you see NOTHING!
  503. else
  504. echo '
  505. ', $txt['logged'];
  506. echo '
  507. </div>';
  508. // Are there any custom profile fields for above the signature?
  509. if (!empty($message['member']['custom_fields']))
  510. {
  511. $shown = false;
  512. foreach ($message['member']['custom_fields'] as $custom)
  513. {
  514. if ($custom['placement'] != 2 || empty($custom['value']))
  515. continue;
  516. if (empty($shown))
  517. {
  518. $shown = true;
  519. echo '
  520. <div class="custom_fields_above_signature">
  521. <ul class="reset nolist">';
  522. }
  523. echo '
  524. <li>', $custom['value'], '</li>';
  525. }
  526. if ($shown)
  527. echo '
  528. </ul>
  529. </div>';
  530. }
  531. // Show the member's signature?
  532. if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
  533. echo '
  534. <div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';
  535. echo '
  536. </div>
  537. </div>
  538. <span class="botslice"><span></span></span>
  539. </div>
  540. <hr class="post_separator" />';
  541. }
  542. echo '
  543. </form>
  544. </div>
  545. <a id="lastPost"></a>';
  546. // Show the page index... "Pages: [1]".
  547. echo '
  548. <div class="pagesection">
  549. ', template_button_strip($context['normal_buttons'], 'right'), '
  550. <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>
  551. <div class="nextlinks_bottom">', $context['previous_next'], '</div>
  552. </div>';
  553. // Show the lower breadcrumbs.
  554. theme_linktree();
  555. echo '
  556. <div id="moderationbuttons">', template_button_strip($context['mod_buttons'], 'bottom', array('id' => 'moderationbuttons_strip')), '</div>';
  557. // Show the jumpto box, or actually...let Javascript do it.
  558. echo '
  559. <div class="plainbox" id="display_jump_to">&nbsp;</div>';
  560. if ($context['can_reply'] && !empty($options['display_quick_reply']))
  561. {
  562. echo '
  563. <a id="quickreply"></a>
  564. <div class="tborder" id="quickreplybox">
  565. <div class="cat_bar">
  566. <h3 class="catbg">
  567. <span class="ie6_header floatright">
  568. <a href="javascript:oQuickReply.swap();"><img src="', $settings['images_url'], '/', $options['display_quick_reply'] > 1 ? 'collapse' : 'expand', '.png" alt="+" id="quickReplyExpand" class="icon" /></a>
  569. </span>
  570. <span>
  571. <a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
  572. </span>
  573. </h3>
  574. </div>
  575. <div id="quickReplyOptions"', $options['display_quick_reply'] > 1 ? '' : ' style="display: none"', '>
  576. <span class="upperframe"><span></span></span>
  577. <div class="roundframe">
  578. <p class="smalltext lefttext">', $txt['quick_reply_desc'], '</p>
  579. ', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '',
  580. $context['oldTopicError'] ? '<p class="alert smalltext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</p>' : '', '
  581. ', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
  582. ', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
  583. <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;">
  584. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  585. <input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
  586. <input type="hidden" name="icon" value="xx" />
  587. <input type="hidden" name="from_qr" value="1" />
  588. <input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
  589. <input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '" />
  590. <input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
  591. <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />
  592. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  593. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />';
  594. // Guests just need more.
  595. if ($context['user']['is_guest'])
  596. echo '
  597. <strong>', $txt['name'], ':</strong> <input type="text" name="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
  598. <strong>', $txt['email'], ':</strong> <input type="text" name="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" /><br />';
  599. // Is visual verification enabled?
  600. if ($context['require_verification'])
  601. echo '
  602. <strong>', $txt['verification'], ':</strong>', template_control_verification($context['visual_verification_id'], 'quick_reply'), '<br />';
  603. if ($options['display_quick_reply'] < 3)
  604. {
  605. echo '
  606. <div class="quickReplyContent">
  607. <textarea cols="600" rows="7" name="message" tabindex="', $context['tabindex']++, '"></textarea>
  608. </div>';
  609. }
  610. else
  611. {
  612. // Show the actual posting area...
  613. if ($context['show_bbc'])
  614. {
  615. echo '
  616. <div id="bbcBox_message"></div>';
  617. }
  618. // What about smileys?
  619. if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
  620. echo '
  621. <div id="smileyBox_message"></div>';
  622. echo '
  623. ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
  624. <script type="text/javascript"><!-- // --><![CDATA[
  625. function insertQuoteFast(messageid)
  626. {
  627. if (window.XMLHttpRequest)
  628. 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);
  629. else
  630. 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);
  631. return false;
  632. }
  633. function onDocReceived(XMLDoc)
  634. {
  635. var text = \'\';
  636. for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
  637. text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
  638. oEditorHandle_', $context['post_box_name'], '.insertText(text, false, true);
  639. ajax_indicator(false);
  640. }
  641. // ]]></script>';
  642. }
  643. echo '
  644. <div class="padding">
  645. <hr class="hrcolor" />
  646. <input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="', $context['tabindex']++, '" class="button_submit" />
  647. <input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />';
  648. if ($context['show_spellchecking'])
  649. echo '
  650. <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" tabindex="', $context['tabindex']++, '" class="button_submit" />';
  651. echo '
  652. <br class="clear_right" />
  653. </div>
  654. </form>
  655. </div>
  656. <span class="lowerframe"><span></span></span>
  657. </div>
  658. </div>';
  659. }
  660. else
  661. echo '
  662. <br class="clear" />';
  663. if ($context['show_spellchecking'])
  664. echo '
  665. <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>
  666. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
  667. echo '
  668. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
  669. <script type="text/javascript"><!-- // --><![CDATA[';
  670. if (!empty($options['display_quick_reply']))
  671. echo '
  672. var oQuickReply = new QuickReply({
  673. bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 1 ? 'false' : 'true', ',
  674. iTopicId: ', $context['current_topic'], ',
  675. iStart: ', $context['start'], ',
  676. sScriptUrl: smf_scripturl,
  677. sImagesUrl: smf_images_url,
  678. sContainerId: "quickReplyOptions",
  679. sImageId: "quickReplyExpand",
  680. sImageCollapsed: "collapse.png",
  681. sImageExpanded: "expand.png",
  682. sJumpAnchor: "quickreply",
  683. bIsFull: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 2 ? 'true' : 'false', '
  684. });';
  685. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post'])
  686. echo '
  687. var oInTopicModeration = new InTopicModeration({
  688. sSelf: \'oInTopicModeration\',
  689. sCheckboxContainerMask: \'in_topic_mod_check_\',
  690. aMessageIds: [\'', implode('\', \'', $removableMessageIDs), '\'],
  691. sSessionId: smf_session_id,
  692. sSessionVar: smf_session_var,
  693. sButtonStrip: \'moderationbuttons\',
  694. sButtonStripDisplay: \'moderationbuttons_strip\',
  695. bUseImageButton: false,
  696. bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
  697. sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
  698. sRemoveButtonImage: \'delete_selected.png\',
  699. sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
  700. bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
  701. sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
  702. sRestoreButtonImage: \'restore_selected.png\',
  703. sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
  704. bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
  705. sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
  706. sSplitButtonImage: \'split_selected.png\',
  707. sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
  708. sFormId: \'quickModForm\'
  709. });';
  710. echo '
  711. if (\'XMLHttpRequest\' in window)
  712. {
  713. var oQuickModify = new QuickModify({
  714. sScriptUrl: smf_scripturl,
  715. bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
  716. iTopicId: ', $context['current_topic'], ',
  717. sTemplateBodyEdit: ', JavaScriptEscape('
  718. <div id="quick_edit_body_container" style="width: 90%">
  719. <div id="error_box" style="padding: 4px;" class="error"></div>
  720. <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 />
  721. <input type="hidden" name="\' + smf_session_var + \'" value="\' + smf_session_id + \'" />
  722. <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
  723. <input type="hidden" name="msg" value="%msg_id%" />
  724. <div class="righttext">
  725. <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" />
  726. </div>
  727. </div>'), ',
  728. sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
  729. sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
  730. sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
  731. sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')'), ',
  732. sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), '
  733. });
  734. aJumpTo[aJumpTo.length] = new JumpTo({
  735. sContainerId: "display_jump_to",
  736. sJumpToTemplate: "<label class=\"smalltext\" for=\"%select_id%\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
  737. iCurBoardId: ', $context['current_board'], ',
  738. iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
  739. sCurBoardName: "', $context['jump_to']['board_name'], '",
  740. sBoardChildLevelIndicator: "==",
  741. sBoardPrefix: "=> ",
  742. sCatSeparator: "-----------------------------",
  743. sCatPrefix: "",
  744. sGoButtonLabel: "', $txt['go'], '"
  745. });
  746. aIconLists[aIconLists.length] = new IconList({
  747. sBackReference: "aIconLists[" + aIconLists.length + "]",
  748. sIconIdPrefix: "msg_icon_",
  749. sScriptUrl: smf_scripturl,
  750. bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
  751. iBoardId: ', $context['current_board'], ',
  752. iTopicId: ', $context['current_topic'], ',
  753. sSessionId: smf_session_id,
  754. sSessionVar: smf_session_var,
  755. sLabelIconList: "', $txt['message_icon'], '",
  756. sBoxBackground: "transparent",
  757. sBoxBackgroundHover: "#ffffff",
  758. iBoxBorderWidthHover: 1,
  759. sBoxBorderColorHover: "#adadad" ,
  760. sContainerBackground: "#ffffff",
  761. sContainerBorder: "1px solid #adadad",
  762. sItemBorder: "1px solid #ffffff",
  763. sItemBorderHover: "1px dotted gray",
  764. sItemBackground: "transparent",
  765. sItemBackgroundHover: "#e0e0f0"
  766. });
  767. }';
  768. if (!empty($ignoredMsgs))
  769. {
  770. echo '
  771. var aIgnoreToggles = new Array();';
  772. foreach ($ignoredMsgs as $msgid)
  773. {
  774. echo '
  775. aIgnoreToggles[', $msgid, '] = new smc_Toggle({
  776. bToggleEnabled: true,
  777. bCurrentlyCollapsed: true,
  778. aSwappableContainers: [
  779. \'msg_', $msgid, '_extra_info\',
  780. \'msg_', $msgid, '\',
  781. \'msg_', $msgid, '_footer\',
  782. \'msg_', $msgid, '_quick_mod\',
  783. \'modify_button_', $msgid, '\',
  784. \'msg_', $msgid, '_signature\'
  785. ],
  786. aSwapLinks: [
  787. {
  788. sId: \'msg_', $msgid, '_ignored_link\',
  789. msgExpanded: \'\',
  790. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  791. }
  792. ]
  793. });';
  794. }
  795. }
  796. echo '
  797. // ]]></script>';
  798. }
  799. ?>