Display.template.php 42 KB

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