PageRenderTime 59ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/Themes/default/Display.template.php

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