Recent.template.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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;
  15. echo '
  16. <div id="recent" class="main_section">
  17. <div class="cat_bar">
  18. <h3 class="catbg">
  19. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/post/xx.png" alt="" class="icon" />',$txt['recent_posts'],'</span>
  20. </h3>
  21. </div>
  22. <div class="pagesection">
  23. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  24. </div>';
  25. foreach ($context['posts'] as $post)
  26. {
  27. echo '
  28. <div class="', $post['alternate'] == 0 ? 'windowbg' : 'windowbg2', ' core_posts">
  29. <span class="topslice"><span></span></span>
  30. <div class="content">
  31. <div class="counter">', $post['counter'], '</div>
  32. <div class="topic_details">
  33. <h5>', $post['board']['link'], ' / ', $post['link'], '</h5>
  34. <span class="smalltext">&#171;&nbsp;', $txt['last_post'], ' ', $txt['by'], ' <strong>', $post['poster']['link'], ' </strong> ', $txt['on'], '<em> ', $post['time'], '</em>&nbsp;&#187;</span>
  35. </div>
  36. <div class="list_posts">', $post['message'], '</div>
  37. </div>';
  38. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  39. echo '
  40. <div class="quickbuttons_wrap">
  41. <ul class="reset smalltext quickbuttons">';
  42. // If they *can* reply?
  43. if ($post['can_reply'])
  44. echo '
  45. <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '" class="reply_button"><span>', $txt['reply'], '</span></a></li>';
  46. // If they *can* quote?
  47. if ($post['can_quote'])
  48. echo '
  49. <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '" class="quote_button"><span>', $txt['quote'], '</span></a></li>';
  50. // Can we request notification of topics?
  51. if ($post['can_mark_notify'])
  52. echo '
  53. <li><a href="', $scripturl, '?action=notify;topic=', $post['topic'], '.', $post['start'], '" class="notify_button"><span>', $txt['notify'], '</span></a></li>';
  54. // How about... even... remove it entirely?!
  55. if ($post['can_delete'])
  56. echo '
  57. <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';recent;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="remove_button"><span>', $txt['remove'], '</span></a></li>';
  58. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  59. echo '
  60. </ul>
  61. </div>';
  62. echo '
  63. <span class="botslice clear"><span></span></span>
  64. </div>';
  65. }
  66. echo '
  67. <div class="pagesection">
  68. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  69. </div>
  70. </div>';
  71. }
  72. function template_unread()
  73. {
  74. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  75. echo '
  76. <div id="recent" class="main_content">';
  77. if ($context['showCheckboxes'])
  78. echo '
  79. <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;">
  80. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  81. <input type="hidden" name="qaction" value="markread" />
  82. <input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '" />';
  83. if (!empty($context['topics']))
  84. {
  85. echo '
  86. <div class="pagesection">';
  87. if (!empty($context['recent_buttons']) && !empty($settings['use_tabs']))
  88. template_button_strip($context['recent_buttons'], 'right');
  89. echo '
  90. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  91. </div>';
  92. echo '
  93. <div class="tborder topic_table" id="unread">
  94. <table class="table_grid" cellspacing="0">
  95. <thead>
  96. <tr class="catbg">
  97. <th scope="col" class="first_th" width="8%" colspan="2">&nbsp;</th>
  98. <th scope="col">
  99. <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  100. </th>
  101. <th scope="col" width="14%" align="center">
  102. <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  103. </th>';
  104. // Show a "select all" box for quick moderation?
  105. if ($context['showCheckboxes'])
  106. echo '
  107. <th scope="col" width="22%">
  108. <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  109. </th>
  110. <th class="last_th">
  111. <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />
  112. </th>';
  113. else
  114. echo '
  115. <th scope="col" class="smalltext last_th" width="22%">
  116. <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  117. </th>';
  118. echo '
  119. </tr>
  120. </thead>
  121. <tbody>';
  122. foreach ($context['topics'] as $topic)
  123. {
  124. // Calculate the color class of the topic.
  125. $color_class = '';
  126. if (strpos($topic['class'], 'sticky') !== false)
  127. $color_class = 'stickybg';
  128. if (strpos($topic['class'], 'locked') !== false)
  129. $color_class .= 'lockedbg';
  130. $color_class2 = !empty($color_class) ? $color_class . '2' : '';
  131. echo '
  132. <tr>
  133. <td class="', $color_class, ' icon1 windowbg">
  134. <img src="', $settings['images_url'], '/topic/', $topic['class'], '.png" alt="" />
  135. </td>
  136. <td class="', $color_class, ' icon2 windowbg">
  137. <img src="', $topic['first_post']['icon_url'], '" alt="" />
  138. </td>
  139. <td class="subject ', $color_class2, ' windowbg2">
  140. <div>
  141. ', $topic['is_sticky'] ? '<strong>' : '', '<span title="', $topic[(empty($settings['message_index_preview_first']) ? 'last_post' : 'first_post')]['preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</strong>' : '', '
  142. <a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '"><span class="new_posts">' . $txt['new'] . '</span></a>
  143. <p>
  144. ', $topic['first_post']['started_by'], '
  145. <small id="pages', $topic['first_post']['id'], '">', $topic['pages'], '</small>
  146. </p>
  147. </div>
  148. </td>
  149. <td class="', $color_class, ' stats windowbg">
  150. ', $topic['replies'], ' ', $txt['replies'], '
  151. <br />
  152. ', $topic['views'], ' ', $txt['views'], '
  153. </td>
  154. <td class="', $color_class2, ' lastpost windowbg2">
  155. <a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.png" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" class="floatright" /></a>
  156. ', $topic['last_post']['time'], '<br />
  157. ', $txt['by'], ' ', $topic['last_post']['member']['link'], '
  158. </td>';
  159. if ($context['showCheckboxes'])
  160. echo '
  161. <td class="' . (!empty($color_class) ? $color_class : 'windowbg2') . '" valign="middle" align="center">
  162. <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
  163. </td>';
  164. echo '
  165. </tr>';
  166. }
  167. if (empty($settings['use_tabs']) && !empty($context['recent_buttons']))
  168. echo '
  169. <tr class="catbg">
  170. <td colspan="', $context['showCheckboxes'] ? '6' : '5', '" align="right">
  171. ', template_button_strip($context['recent_buttons'], 'top'), '
  172. </td>
  173. </tr>';
  174. if (empty($context['topics']))
  175. echo '
  176. <tr style="display: none;"><td></td></tr>';
  177. echo '
  178. </tbody>
  179. </table>
  180. </div>
  181. <div class="pagesection" id="readbuttons">';
  182. if (!empty($settings['use_tabs']) && !empty($context['recent_buttons']))
  183. template_button_strip($context['recent_buttons'], 'right');
  184. echo '
  185. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  186. </div>';
  187. }
  188. else
  189. echo '
  190. <div class="cat_bar">
  191. <h3 class="catbg centertext">
  192. ', $context['showing_all_topics'] ? $txt['msg_alert_none'] : $txt['unread_topics_visit_none'], '
  193. </h3>
  194. </div>';
  195. if ($context['showCheckboxes'])
  196. echo '
  197. </form>';
  198. echo '
  199. <div class="description " id="topic_icons">
  200. <p class="smalltext floatleft">
  201. ', !empty($modSettings['enableParticipation']) ? '
  202. <img src="' . $settings['images_url'] . '/topic/my_normal_post.png" alt="" class="centericon" /> ' . $txt['participation_caption'] . '<br />' : '', '
  203. <img src="', $settings['images_url'], '/topic/normal_post.png" alt="" class="centericon" /> ', $txt['normal_topic'], '<br />
  204. <img src="', $settings['images_url'], '/topic/hot_post.png" alt="" class="centericon" /> ', sprintf($txt['hot_topics'], $modSettings['hotTopicPosts']), '<br />
  205. <img src="', $settings['images_url'], '/topic/veryhot_post.png" alt="" class="centericon" /> ', sprintf($txt['very_hot_topics'], $modSettings['hotTopicVeryPosts']), '
  206. </p>
  207. <p class="smalltext para2">
  208. <img src="', $settings['images_url'], '/icons/quick_lock.png" alt="" class="centericon" /> ', $txt['locked_topic'], '<br />', ($modSettings['enableStickyTopics'] == '1' ? '
  209. <img src="' . $settings['images_url'] . '/icons/quick_sticky.png" alt="" class="centericon" /> ' . $txt['sticky_topic'] . '<br />' : ''), ($modSettings['pollMode'] == '1' ? '
  210. <img src="' . $settings['images_url'] . '/topic/normal_poll.png" alt="" class="centericon" /> ' . $txt['poll'] : ''), '
  211. </p>
  212. </div>
  213. </div>';
  214. }
  215. function template_replies()
  216. {
  217. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  218. echo '
  219. <div id="recent">';
  220. if ($context['showCheckboxes'])
  221. echo '
  222. <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;">
  223. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  224. <input type="hidden" name="qaction" value="markread" />
  225. <input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '" />';
  226. if (!empty($context['topics']))
  227. {
  228. echo '
  229. <div class="pagesection">';
  230. if (!empty($context['recent_buttons']) && !empty($settings['use_tabs']))
  231. template_button_strip($context['recent_buttons'], 'right');
  232. echo '
  233. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  234. </div>';
  235. echo '
  236. <div class="tborder topic_table" id="unreadreplies">
  237. <table class="table_grid" cellspacing="0">
  238. <thead>
  239. <tr class="catbg">
  240. <th scope="col" class="first_th" width="8%" colspan="2">&nbsp;</th>
  241. <th scope="col">
  242. <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] === 'subject' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] === 'subject' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  243. </th>
  244. <th scope="col" width="14%" align="center">
  245. <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] === 'replies' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] === 'replies' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  246. </th>';
  247. // Show a "select all" box for quick moderation?
  248. if ($context['showCheckboxes'])
  249. echo '
  250. <th scope="col" width="22%">
  251. <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] === 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  252. </th>
  253. <th class="last_th">
  254. <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />
  255. </th>';
  256. else
  257. echo '
  258. <th scope="col" class="last_th" width="22%">
  259. <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] === 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
  260. </th>';
  261. echo '
  262. </tr>
  263. </thead>
  264. <tbody>';
  265. foreach ($context['topics'] as $topic)
  266. {
  267. // Calculate the color class of the topic.
  268. $color_class = '';
  269. if (strpos($topic['class'], 'sticky') !== false)
  270. $color_class = 'stickybg';
  271. if (strpos($topic['class'], 'locked') !== false)
  272. $color_class .= 'lockedbg';
  273. $color_class2 = !empty($color_class) ? $color_class . '2' : '';
  274. echo '
  275. <tr>
  276. <td class="', $color_class, ' icon1 windowbg">
  277. <img src="', $settings['images_url'], '/topic/', $topic['class'], '.png" alt="" />
  278. </td>
  279. <td class="', $color_class, ' icon2 windowbg">
  280. <img src="', $topic['first_post']['icon_url'], '" alt="" />
  281. </td>
  282. <td class="subject ', $color_class2, ' windowbg2">
  283. <div>
  284. ', $topic['is_sticky'] ? '<strong>' : '', '<span title="', $topic[(empty($settings['message_index_preview_first']) ? 'last_post' : 'first_post')]['preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</strong>' : '', '
  285. <a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '"><span class="new_posts">' . $txt['new'] . '</span></a>
  286. <p>
  287. ', $topic['first_post']['started_by'], '
  288. <small id="pages', $topic['first_post']['id'], '">', $topic['pages'], '</small>
  289. </p>
  290. </div>
  291. </td>
  292. <td class="', $color_class, ' stats windowbg">
  293. ', $topic['replies'], ' ', $txt['replies'], '
  294. <br />
  295. ', $topic['views'], ' ', $txt['views'], '
  296. </td>
  297. <td class="', $color_class2, ' lastpost windowbg2">
  298. <a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.png" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" class="floatright" /></a>
  299. ', $topic['last_post']['time'], '<br />
  300. ', $txt['by'], ' ', $topic['last_post']['member']['link'], '
  301. </td>';
  302. if ($context['showCheckboxes'])
  303. echo '
  304. <td class="' . (!empty($color_class) ? $color_class : 'windowbg2') . '" valign="middle" align="center">
  305. <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
  306. </td>';
  307. echo '
  308. </tr>';
  309. }
  310. if (empty($settings['use_tabs']) && !empty($context['recent_buttons']))
  311. echo '
  312. <tr class="catbg">
  313. <td colspan="', $context['showCheckboxes'] ? '6' : '5', '" align="right">
  314. ', template_button_strip($context['recent_buttons'], 'top'), '
  315. </td>
  316. </tr>';
  317. echo '
  318. </tbody>
  319. </table>
  320. </div>
  321. <div class="pagesection">';
  322. if (!empty($settings['use_tabs']) && !empty($context['recent_buttons']))
  323. template_button_strip($context['recent_buttons'], 'right');
  324. echo '
  325. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  326. </div>';
  327. }
  328. else
  329. echo '
  330. <div class="cat_bar">
  331. <h3 class="catbg centertext">
  332. ', $context['showing_all_topics'] ? $txt['msg_alert_none'] : $txt['unread_topics_visit_none'], '
  333. </h3>
  334. </div>';
  335. if ($context['showCheckboxes'])
  336. echo '
  337. </form>';
  338. echo '
  339. <div class="description flow_auto" id="topic_icons">
  340. <p class="smalltext floatleft">
  341. ', !empty($modSettings['enableParticipation']) ? '
  342. <img src="' . $settings['images_url'] . '/topic/my_normal_post.png" alt="" class="centericon" /> ' . $txt['participation_caption'] . '<br />' : '', '
  343. <img src="', $settings['images_url'], '/topic/normal_post.png" alt="" class="centericon" /> ', $txt['normal_topic'], '<br />
  344. <img src="', $settings['images_url'], '/topic/hot_post.png" alt="" class="centericon" /> ', sprintf($txt['hot_topics'], $modSettings['hotTopicPosts']), '<br />
  345. <img src="', $settings['images_url'], '/topic/veryhot_post.png" alt="" class="centericon" /> ', sprintf($txt['very_hot_topics'], $modSettings['hotTopicVeryPosts']), '
  346. </p>
  347. <p class="smalltext para2">
  348. <img src="', $settings['images_url'], '/icons/quick_lock.png" alt="" class="centericon" /> ', $txt['locked_topic'], '<br />', ($modSettings['enableStickyTopics'] == '1' ? '
  349. <img src="' . $settings['images_url'] . '/icons/quick_sticky.png" alt="" class="centericon" /> ' . $txt['sticky_topic'] . '<br />' : '') . ($modSettings['pollMode'] == '1' ? '
  350. <img src="' . $settings['images_url'] . '/topic/normal_poll.png" alt="" class="centericon" /> ' . $txt['poll'] : '') . '
  351. </p>
  352. </div>
  353. </div>';
  354. }
  355. ?>