Display.template.php 40 KB

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