Who.template.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2014 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // The only template in the file.
  13. function template_main()
  14. {
  15. global $context, $settings, $scripturl, $txt;
  16. // Display the table header and linktree.
  17. echo '
  18. <div class="main_section" id="whos_online">
  19. <form action="', $scripturl, '?action=who" method="post" id="whoFilter" accept-charset="', $context['character_set'], '">
  20. <div class="cat_bar">
  21. <h4 class="catbg">', $txt['who_title'], '</h4>
  22. </div>
  23. <div class="topic_table" id="mlist">
  24. <div class="pagesection">
  25. <div class="pagelinks floatleft">', $context['page_index'], '</div>';
  26. echo '
  27. <div class="selectbox floatright" id="upper_show">', $txt['who_show1'], '
  28. <select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">';
  29. foreach ($context['show_methods'] as $value => $label)
  30. echo '
  31. <option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
  32. echo '
  33. </select>
  34. <noscript>
  35. <input type="submit" name="submit_top" value="', $txt['go'], '" class="button_submit">
  36. </noscript>
  37. </div>
  38. </div>
  39. <table class="table_grid" cellspacing="0">
  40. <thead>
  41. <tr class="catbg">
  42. <th scope="col" class="lefttext first_th" width="40%"><a href="', $scripturl, '?action=who;start=', $context['start'], ';show=', $context['show_by'], ';sort=user', $context['sort_direction'] != 'down' && $context['sort_by'] == 'user' ? '' : ';asc', '" rel="nofollow">', $txt['who_user'], $context['sort_by'] == 'user' ? '<span class="sort sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
  43. <th scope="col" class="lefttext" width="10%"><a href="', $scripturl, '?action=who;start=', $context['start'], ';show=', $context['show_by'], ';sort=time', $context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ? ';asc' : '', '" rel="nofollow">', $txt['who_time'], $context['sort_by'] == 'time' ? '<span class="sort sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
  44. <th scope="col" class="lefttext last_th" width="50%">', $txt['who_action'], '</th>
  45. </tr>
  46. </thead>
  47. <tbody>';
  48. // For every member display their name, time and action (and more for admin).
  49. $alternate = 0;
  50. foreach ($context['members'] as $member)
  51. {
  52. // $alternate will either be true or false. If it's true, use "windowbg2" and otherwise use "windowbg".
  53. echo '
  54. <tr class="windowbg', $alternate ? '2' : '', '">
  55. <td>';
  56. // Guests can't be messaged.
  57. if (!$member['is_guest'])
  58. {
  59. echo '
  60. <span class="contact_info floatright">
  61. ', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['text'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="bottom">' : $member['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
  62. </span>';
  63. }
  64. echo '
  65. <span class="member', $member['is_hidden'] ? ' hidden' : '', '">
  66. ', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '
  67. </span>';
  68. if (!empty($member['ip']))
  69. echo '
  70. (<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)';
  71. echo '
  72. </td>
  73. <td style="white-space: nowrap">', $member['time'], '</td>
  74. <td>', $member['action'], '</td>
  75. </tr>';
  76. // Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)
  77. $alternate = !$alternate;
  78. }
  79. // No members?
  80. if (empty($context['members']))
  81. {
  82. echo '
  83. <tr class="windowbg2">
  84. <td colspan="3" align="center">
  85. ', $txt['who_no_online_' . ($context['show_by'] == 'guests' || $context['show_by'] == 'spiders' ? $context['show_by'] : 'members')], '
  86. </td>
  87. </tr>';
  88. }
  89. echo '
  90. </tbody>
  91. </table>
  92. <div class="pagesection" id="lower_pagesection">
  93. <div class="pagelinks floatleft" id="lower_pagelinks">', $context['page_index'], '</div>';
  94. echo '
  95. <div class="selectbox floatright">', $txt['who_show1'], '
  96. <select name="show" onchange="document.forms.whoFilter.submit();">';
  97. foreach ($context['show_methods'] as $value => $label)
  98. echo '
  99. <option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
  100. echo '
  101. </select>
  102. <noscript>
  103. <input type="submit" value="', $txt['go'], '" class="button_submit">
  104. </noscript>
  105. </div>
  106. </div>
  107. </div>
  108. </form>
  109. </div>';
  110. }
  111. function template_credits()
  112. {
  113. global $context, $txt;
  114. // The most important part - the credits :P.
  115. echo '
  116. <div class="main_section" id="credits">
  117. <div class="cat_bar">
  118. <h3 class="catbg">', $txt['credits'], '</h3>
  119. </div>';
  120. foreach ($context['credits'] as $section)
  121. {
  122. if (isset($section['pretext']))
  123. echo '
  124. <div class="windowbg">
  125. <div class="content">
  126. <p>', $section['pretext'], '</p>
  127. </div>
  128. </div>';
  129. if (isset($section['title']))
  130. echo '
  131. <div class="cat_bar">
  132. <h3 class="catbg">', $section['title'], '</h3>
  133. </div>';
  134. echo '
  135. <div class="windowbg2">
  136. <div class="content">
  137. <dl>';
  138. foreach ($section['groups'] as $group)
  139. {
  140. if (isset($group['title']))
  141. echo '
  142. <dt>
  143. <strong>', $group['title'], '</strong>
  144. </dt>
  145. <dd>';
  146. // Try to make this read nicely.
  147. if (count($group['members']) <= 2)
  148. echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
  149. else
  150. {
  151. $last_peep = array_pop($group['members']);
  152. echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
  153. }
  154. echo '
  155. </dd>';
  156. }
  157. echo '
  158. </dl>';
  159. if (isset($section['posttext']))
  160. echo '
  161. <p class="posttext">', $section['posttext'], '</p>';
  162. echo '
  163. </div>
  164. </div>';
  165. }
  166. // Other software and graphics
  167. if (!empty($context['credits_software_graphics']))
  168. {
  169. echo '
  170. <div class="cat_bar">
  171. <h3 class="catbg">', $txt['credits_software_graphics'], '</h3>
  172. </div>
  173. <div class="windowbg">
  174. <div class="content">';
  175. if (!empty($context['credits_software_graphics']['graphics']))
  176. echo '
  177. <dl>
  178. <dt><strong>', $txt['credits_graphics'], '</strong></dt>
  179. <dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd>
  180. </dl>';
  181. if (!empty($context['credits_software_graphics']['software']))
  182. echo '
  183. <dl>
  184. <dt><strong>', $txt['credits_software'], '</strong></dt>
  185. <dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd>
  186. </dl>';
  187. if (!empty($context['credits_software_graphics']['fonts']))
  188. echo '
  189. <dl>
  190. <dt><strong>', $txt['credits_fonts'], '</strong></dt>
  191. <dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd>
  192. </dl>';
  193. echo '
  194. </div>
  195. </div>';
  196. }
  197. // How about Modifications, we all love em
  198. if (!empty($context['credits_modifications']))
  199. {
  200. echo '
  201. <div class="cat_bar">
  202. <h3 class="catbg">', $txt['credits_modifications'], '</h3>
  203. </div>
  204. <div class="windowbg">
  205. <div class="content">';
  206. echo '
  207. <dl>
  208. <dt><strong>', $txt['credits_modifications'], '</strong></dt>
  209. <dd>', implode('</dd><dd>', $context['credits_modifications']), '</dd>
  210. </dl>';
  211. echo '
  212. </div>
  213. </div>';
  214. }
  215. // SMF itself
  216. echo '
  217. <div class="cat_bar">
  218. <h3 class="catbg">', $txt['credits_copyright'], '</h3>
  219. </div>
  220. <div class="windowbg">
  221. <div class="content">
  222. <dl>
  223. <dt><strong>', $txt['credits_forum'], '</strong></dt>', '
  224. <dd>', $context['copyrights']['smf'];
  225. echo '
  226. </dd>
  227. </dl>';
  228. if (!empty($context['copyrights']['mods']))
  229. {
  230. echo '
  231. <dl>
  232. <dt><strong>', $txt['credits_modifications'], '</strong></dt>
  233. <dd>', implode('</dd><dd>', $context['copyrights']['mods']), '</dd>
  234. </dl>';
  235. }
  236. echo '
  237. </div>
  238. </div>
  239. </div>';
  240. }
  241. ?>