Who.template.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  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="title_bar">
  21. <h4 class="titlebg margin_lower">', $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 don't have information like icq, skype, y!, and aim... and they 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. ', isset($context['disabled_fields']['icq']) ? '' : $member['icq']['link'] , ' ', isset($context['disabled_fields']['skype']) ? '' : $member['skype']['link'], ' ', isset($context['disabled_fields']['yim']) ? '' : $member['yim']['link'], ' ', isset($context['disabled_fields']['aim']) ? '' : $member['aim']['link'], '
  63. </span>';
  64. }
  65. echo '
  66. <span class="member', $member['is_hidden'] ? ' hidden' : '', '">
  67. ', $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>', '
  68. </span>';
  69. if (!empty($member['ip']))
  70. echo '
  71. (<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)';
  72. echo '
  73. </td>
  74. <td nowrap="nowrap">', $member['time'], '</td>
  75. <td>', $member['action'], '</td>
  76. </tr>';
  77. // Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)
  78. $alternate = !$alternate;
  79. }
  80. // No members?
  81. if (empty($context['members']))
  82. {
  83. echo '
  84. <tr class="windowbg2">
  85. <td colspan="3" align="center">
  86. ', $txt['who_no_online_' . ($context['show_by'] == 'guests' || $context['show_by'] == 'spiders' ? $context['show_by'] : 'members')], '
  87. </td>
  88. </tr>';
  89. }
  90. echo '
  91. </tbody>
  92. </table>
  93. <div class="pagesection" id="lower_pagesection">
  94. <div class="pagelinks floatleft" id="lower_pagelinks">', $context['page_index'], '</div>';
  95. echo '
  96. <div class="selectbox floatright">', $txt['who_show1'], '
  97. <select name="show" onchange="document.forms.whoFilter.submit();">';
  98. foreach ($context['show_methods'] as $value => $label)
  99. echo '
  100. <option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
  101. echo '
  102. </select>
  103. <noscript>
  104. <input type="submit" value="', $txt['go'], '" class="button_submit" />
  105. </noscript>
  106. </div>
  107. </div>
  108. </div>
  109. </form>
  110. </div>';
  111. }
  112. function template_credits()
  113. {
  114. global $context, $txt;
  115. // The most important part - the credits :P.
  116. echo '
  117. <div class="main_section" id="credits">
  118. <div class="cat_bar">
  119. <h3 class="catbg">', $txt['credits'], '</h3>
  120. </div>';
  121. foreach ($context['credits'] as $section)
  122. {
  123. if (isset($section['pretext']))
  124. echo '
  125. <div class="windowbg">
  126. <div class="content">
  127. <p>', $section['pretext'], '</p>
  128. </div>
  129. </div>';
  130. if (isset($section['title']))
  131. echo '
  132. <div class="cat_bar">
  133. <h3 class="catbg">', $section['title'], '</h3>
  134. </div>';
  135. echo '
  136. <div class="windowbg2">
  137. <div class="content">
  138. <dl>';
  139. foreach ($section['groups'] as $group)
  140. {
  141. if (isset($group['title']))
  142. echo '
  143. <dt>
  144. <strong>', $group['title'], '</strong>
  145. </dt>
  146. <dd>';
  147. // Try to make this read nicely.
  148. if (count($group['members']) <= 2)
  149. echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
  150. else
  151. {
  152. $last_peep = array_pop($group['members']);
  153. echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
  154. }
  155. echo '
  156. </dd>';
  157. }
  158. echo '
  159. </dl>';
  160. if (isset($section['posttext']))
  161. echo '
  162. <p class="posttext">', $section['posttext'], '</p>';
  163. echo '
  164. </div>
  165. </div>';
  166. }
  167. // Other software and graphics
  168. if (!empty($context['credits_software_graphics']))
  169. {
  170. echo '
  171. <div class="cat_bar">
  172. <h3 class="catbg">', $txt['credits_software_graphics'], '</h3>
  173. </div>
  174. <div class="windowbg">
  175. <div class="content">';
  176. if (!empty($context['credits_software_graphics']['graphics']))
  177. echo '
  178. <dl>
  179. <dt><strong>', $txt['credits_graphics'], '</strong></dt>
  180. <dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd>
  181. </dl>';
  182. if (!empty($context['credits_software_graphics']['software']))
  183. echo '
  184. <dl>
  185. <dt><strong>', $txt['credits_software'], '</strong></dt>
  186. <dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd>
  187. </dl>';
  188. if (!empty($context['credits_software_graphics']['fonts']))
  189. echo '
  190. <dl>
  191. <dt><strong>', $txt['credits_fonts'], '</strong></dt>
  192. <dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd>
  193. </dl>';
  194. echo '
  195. </div>
  196. </div>';
  197. }
  198. // How about Modifications, we all love em
  199. if (!empty($context['credits_modifications']))
  200. {
  201. echo '
  202. <div class="cat_bar">
  203. <h3 class="catbg">', $txt['credits_modifications'], '</h3>
  204. </div>
  205. <div class="windowbg">
  206. <div class="content">';
  207. echo '
  208. <dl>
  209. <dt><strong>', $txt['credits_modifications'], '</strong></dt>
  210. <dd>', implode('</dd><dd>', $context['credits_modifications']), '</dd>
  211. </dl>';
  212. echo '
  213. </div>
  214. </div>';
  215. }
  216. // SMF itself
  217. echo '
  218. <div class="cat_bar">
  219. <h3 class="catbg">', $txt['credits_copyright'], '</h3>
  220. </div>
  221. <div class="windowbg">
  222. <div class="content">
  223. <dl>
  224. <dt><strong>', $txt['credits_forum'], '</strong></dt>', '
  225. <dd>', $context['copyrights']['smf'];
  226. echo '
  227. </dd>
  228. </dl>';
  229. if (!empty($context['copyrights']['mods']))
  230. {
  231. echo '
  232. <dl>
  233. <dt><strong>', $txt['credits_modifications'], '</strong></dt>
  234. <dd>', implode('</dd><dd>', $context['copyrights']['mods']), '</dd>
  235. </dl>';
  236. }
  237. echo '
  238. </div>
  239. </div>
  240. </div>';
  241. }
  242. ?>