2
0

Who.template.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. // The only template in the file.
  13. function template_main()
  14. {
  15. global $context, $settings, $options, $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">', $txt['pages'], ': ', $context['page_index'], '</div>';
  26. echo '
  27. <div class="selectbox floatright">', $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="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' ? '<img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</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' ? '<img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</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, msn, 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']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="bottom" />' : $member['online']['text'], $context['can_send_pm'] ? '</a>' : '', '
  62. ', isset($context['disabled_fields']['icq']) ? '' : $member['icq']['link'] , ' ', isset($context['disabled_fields']['msn']) ? '' : $member['msn']['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>
  94. <div class="pagesection">
  95. <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
  96. echo '
  97. <div class="selectbox floatright">', $txt['who_show1'], '
  98. <select name="show" onchange="document.forms.whoFilter.submit();">';
  99. foreach ($context['show_methods'] as $value => $label)
  100. echo '
  101. <option value="', $value, '" ', $value == $context['show_by'] ? ' selected="selected"' : '', '>', $label, '</option>';
  102. echo '
  103. </select>
  104. <noscript>
  105. <input type="submit" value="', $txt['go'], '" class="button_submit" />
  106. </noscript>
  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. <span class="topslice"><span></span></span>
  127. <div class="content">
  128. <p>', $section['pretext'], '</p>
  129. </div>
  130. <span class="botslice"><span></span></span>
  131. </div>';
  132. if (isset($section['title']))
  133. echo '
  134. <div class="cat_bar">
  135. <h3 class="catbg">', $section['title'], '</h3>
  136. </div>';
  137. echo '
  138. <div class="windowbg2">
  139. <span class="topslice"><span></span></span>
  140. <div class="content">
  141. <dl>';
  142. foreach ($section['groups'] as $group)
  143. {
  144. if (isset($group['title']))
  145. echo '
  146. <dt>
  147. <strong>', $group['title'], '</strong>
  148. </dt>
  149. <dd>';
  150. // Try to make this read nicely.
  151. if (count($group['members']) <= 2)
  152. echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
  153. else
  154. {
  155. $last_peep = array_pop($group['members']);
  156. echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
  157. }
  158. echo '
  159. </dd>';
  160. }
  161. echo '
  162. </dl>';
  163. if (isset($section['posttext']))
  164. echo '
  165. <p class="posttext">', $section['posttext'], '</p>';
  166. echo '
  167. </div>
  168. <span class="botslice"><span></span></span>
  169. </div>';
  170. }
  171. echo '
  172. <div class="cat_bar">
  173. <h3 class="catbg">', $txt['credits_copyright'], '</h3>
  174. </div>
  175. <div class="windowbg">
  176. <span class="topslice"><span></span></span>
  177. <div class="content">
  178. <dl>
  179. <dt><strong>', $txt['credits_forum'], '</strong></dt>', '
  180. <dd>', $context['copyrights']['smf'];
  181. echo '
  182. </dd>
  183. </dl>';
  184. if (!empty($context['copyrights']['mods']))
  185. {
  186. echo '
  187. <dl>
  188. <dt><strong>', $txt['credits_modifications'], '</strong></dt>
  189. <dd>', implode('</dd><dd>', $context['copyrights']['mods']), '</dd>
  190. </dl>';
  191. }
  192. echo '
  193. </div>
  194. <span class="botslice"><span></span></span>
  195. </div>
  196. </div>';
  197. }
  198. ?>