annotate forum/Themes/core/BoardIndex.template.php @ 76:e3e11437ecea website

Add forum code
author Chris Cannam
date Sun, 07 Jul 2013 11:25:48 +0200
parents
children
rev   line source
Chris@76 1 <?php
Chris@76 2 /**
Chris@76 3 * Simple Machines Forum (SMF)
Chris@76 4 *
Chris@76 5 * @package SMF
Chris@76 6 * @author Simple Machines
Chris@76 7 * @copyright 2011 Simple Machines
Chris@76 8 * @license http://www.simplemachines.org/about/smf/license.php BSD
Chris@76 9 *
Chris@76 10 * @version 2.0
Chris@76 11 */
Chris@76 12
Chris@76 13 function template_main()
Chris@76 14 {
Chris@76 15 global $context, $settings, $options, $txt, $scripturl, $modSettings;
Chris@76 16
Chris@76 17 // Show some statistics if stat info is off.
Chris@76 18 if (!$settings['show_stats_index'])
Chris@76 19 echo '
Chris@76 20 <p id="stats">
Chris@76 21 ', $txt['members'], ': ', $context['common_stats']['total_members'], ' &nbsp;&#8226;&nbsp; ', $txt['posts_made'], ': ', $context['common_stats']['total_posts'], ' &nbsp;&#8226;&nbsp; ', $txt['topics'], ': ', $context['common_stats']['total_topics'], '
Chris@76 22 ', ($settings['show_latest_member'] ? '<br />' . $txt['welcome_member'] . ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>' . $txt['newest_member'] : '') , '
Chris@76 23 </p>';
Chris@76 24
Chris@76 25 // Show the news fader? (assuming there are things to show...)
Chris@76 26 if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
Chris@76 27 {
Chris@76 28 echo '
Chris@76 29 <div class="tborder marginbottom">
Chris@76 30 <h3 id="newsfader" class="catbg">
Chris@76 31 <img id="newsupshrink" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="display: none;" />
Chris@76 32 ', $txt['news'], '
Chris@76 33 </h3>
Chris@76 34 <div class="windowbg2" id="smfNewsFader">
Chris@76 35 <div id="smfFadeScroller"><span>', $context['news_lines'][0], '</span></div>
Chris@76 36 </div>
Chris@76 37 </div>
Chris@76 38 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
Chris@76 39 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 40
Chris@76 41 // Create a news fader object.
Chris@76 42 var oNewsFader = new smf_NewsFader({
Chris@76 43 sSelf: \'oNewsFader\',
Chris@76 44 sFaderControlId: \'smfFadeScroller\',
Chris@76 45 aFaderItems: [
Chris@76 46 "',
Chris@76 47 implode('",
Chris@76 48 "', $context['fader_news_lines']), '"],
Chris@76 49 sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
Chris@76 50 iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
Chris@76 51 });
Chris@76 52
Chris@76 53 // Create the news fader toggle.
Chris@76 54 var smfNewsFadeToggle = new smc_Toggle({
Chris@76 55 bToggleEnabled: true,
Chris@76 56 bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
Chris@76 57 aSwappableContainers: [
Chris@76 58 \'smfNewsFader\'
Chris@76 59 ],
Chris@76 60 aSwapImages: [
Chris@76 61 {
Chris@76 62 sId: \'newsupshrink\',
Chris@76 63 srcExpanded: smf_images_url + \'/collapse.gif\',
Chris@76 64 altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
Chris@76 65 srcCollapsed: smf_images_url + \'/expand.gif\',
Chris@76 66 altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
Chris@76 67 }
Chris@76 68 ],
Chris@76 69 oThemeOptions: {
Chris@76 70 bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
Chris@76 71 sOptionName: \'collapse_news_fader\',
Chris@76 72 sSessionVar: ', JavaScriptEscape($context['session_var']), ',
Chris@76 73 sSessionId: ', JavaScriptEscape($context['session_id']), '
Chris@76 74 },
Chris@76 75 oCookieOptions: {
Chris@76 76 bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
Chris@76 77 sCookieName: \'newsupshrink\'
Chris@76 78 }
Chris@76 79 });
Chris@76 80 // ]]></script>';
Chris@76 81 }
Chris@76 82
Chris@76 83 /* Each category in categories is made up of:
Chris@76 84 id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
Chris@76 85 new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
Chris@76 86 and boards. (see below.) */
Chris@76 87 foreach ($context['categories'] as $category)
Chris@76 88 {
Chris@76 89 // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
Chris@76 90 if (empty($category['boards']) && !$category['is_collapsed'])
Chris@76 91 continue;
Chris@76 92
Chris@76 93 echo '
Chris@76 94 <div class="categoryframe tborder clearfix">
Chris@76 95 <h3 class="catbg', $category['new'] ? '2' : '', '">';
Chris@76 96
Chris@76 97 if (!$context['user']['is_guest'] && !empty($category['show_unread']))
Chris@76 98 echo '
Chris@76 99 <a class="floatright" href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>';
Chris@76 100
Chris@76 101 // If this category even can collapse, show a link to collapse it.
Chris@76 102 if ($category['can_collapse'])
Chris@76 103 echo '
Chris@76 104 <a href="', $category['collapse_href'], '">', $category['collapse_image'], '</a>&nbsp;';
Chris@76 105
Chris@76 106 echo $category['link'];
Chris@76 107
Chris@76 108 echo '
Chris@76 109 </h3>';
Chris@76 110
Chris@76 111 // Assuming the category hasn't been collapsed...
Chris@76 112 if (!$category['is_collapsed'])
Chris@76 113 {
Chris@76 114 echo '
Chris@76 115 <table cellspacing="1" class="bordercolor boardsframe">';
Chris@76 116
Chris@76 117 /* Each board in each category's boards has:
Chris@76 118 new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
Chris@76 119 children (see below.), link_children (easier to use.), children_new (are they new?),
Chris@76 120 topics (# of), posts (# of), link, href, and last_post. (see below.) */
Chris@76 121 foreach ($category['boards'] as $board)
Chris@76 122 {
Chris@76 123 echo '
Chris@76 124 <tr>
Chris@76 125 <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg icon">
Chris@76 126 <a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
Chris@76 127
Chris@76 128 // If the board or children is new, show an indicator.
Chris@76 129 if ($board['new'] || $board['children_new'])
Chris@76 130 echo '
Chris@76 131 <img src="', $settings['images_url'], '/on', $board['new'] ? '' : '2', '.gif" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" border="0" />';
Chris@76 132 // Is it a redirection board?
Chris@76 133 elseif ($board['is_redirect'])
Chris@76 134 echo '
Chris@76 135 <img src="', $settings['images_url'], '/redirect.gif" alt="*" title="*" border="0" />';
Chris@76 136 // No new posts at all! The agony!!
Chris@76 137 else
Chris@76 138 echo '
Chris@76 139 <img src="', $settings['images_url'], '/off.gif" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
Chris@76 140
Chris@76 141 echo '
Chris@76 142 </a>
Chris@76 143 </td>
Chris@76 144 <td class="windowbg2 info">
Chris@76 145 <h4><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
Chris@76 146
Chris@76 147 // Has it outstanding posts for approval?
Chris@76 148 if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
Chris@76 149 echo '
Chris@76 150 <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';
Chris@76 151
Chris@76 152 echo '
Chris@76 153 </h4>
Chris@76 154 <p>', $board['description'] , '</p>';
Chris@76 155
Chris@76 156 // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
Chris@76 157 if (!empty($board['moderators']))
Chris@76 158 echo '
Chris@76 159 <p class="moderators">', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
Chris@76 160
Chris@76 161 // Show some basic information about the number of posts, etc.
Chris@76 162 echo '
Chris@76 163 </td>
Chris@76 164 <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg stats smalltext">
Chris@76 165 ', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
Chris@76 166 ', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
Chris@76 167 </td>
Chris@76 168 <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg2 smalltext lastpost">';
Chris@76 169
Chris@76 170 /* The board's and children's 'last_post's have:
Chris@76 171 time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
Chris@76 172 link, href, subject, start (where they should go for the first unread post.),
Chris@76 173 and member. (which has id, name, link, href, username in it.) */
Chris@76 174 if (!empty($board['last_post']['id']))
Chris@76 175 echo '
Chris@76 176 <strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
Chris@76 177 ', $txt['in'], ' ', $board['last_post']['link'], '<br />
Chris@76 178 ', $txt['on'], ' ', $board['last_post']['time'];
Chris@76 179 echo '
Chris@76 180 </td>
Chris@76 181 </tr>';
Chris@76 182
Chris@76 183 // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
Chris@76 184 if (!empty($board['children']))
Chris@76 185 {
Chris@76 186 // Sort the links into an array with new boards bold so it can be imploded.
Chris@76 187 $children = array();
Chris@76 188 /* Each child in each board's children has:
Chris@76 189 id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
Chris@76 190 foreach ($board['children'] as $child)
Chris@76 191 {
Chris@76 192 if (!$child['is_redirect'])
Chris@76 193 $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
Chris@76 194 else
Chris@76 195 $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
Chris@76 196
Chris@76 197 // Has it posts awaiting approval?
Chris@76 198 if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
Chris@76 199 $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
Chris@76 200
Chris@76 201 $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
Chris@76 202 }
Chris@76 203 echo '
Chris@76 204 <tr>
Chris@76 205 <td class="windowbg3 smalltext largepadding"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td>
Chris@76 206 </tr>';
Chris@76 207 }
Chris@76 208 }
Chris@76 209 echo '
Chris@76 210 </table>';
Chris@76 211 }
Chris@76 212 echo '
Chris@76 213 </div>';
Chris@76 214 }
Chris@76 215
Chris@76 216 if ($context['user']['is_logged'])
Chris@76 217 {
Chris@76 218 echo '
Chris@76 219 <div id="modbuttons_bottom" class="modbuttons clearfix">
Chris@76 220 <div id="posticons" class="clearfix marginbottom">
Chris@76 221 <div class="smalltext floatleft">
Chris@76 222 <img src="', $settings['images_url'], '/new_some.gif" alt="" align="middle" /> ', $txt['new_posts'], '
Chris@76 223 <img src="', $settings['images_url'], '/new_none.gif" alt="" align="middle" style="margin-left: 4ex;" /> ', $txt['old_posts'], '
Chris@76 224 </div>';
Chris@76 225
Chris@76 226 // Mark read button.
Chris@76 227 $mark_read_button = array(
Chris@76 228 'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
Chris@76 229 );
Chris@76 230
Chris@76 231 // Show the mark all as read button?
Chris@76 232 if ($settings['show_mark_read'] && !empty($context['categories']))
Chris@76 233 template_button_strip($mark_read_button, 'top');
Chris@76 234
Chris@76 235 echo '
Chris@76 236 </div>
Chris@76 237 </div>';
Chris@76 238 }
Chris@76 239
Chris@76 240 template_info_center();
Chris@76 241 }
Chris@76 242
Chris@76 243 function template_info_center()
Chris@76 244 {
Chris@76 245 global $context, $settings, $options, $txt, $scripturl, $modSettings;
Chris@76 246
Chris@76 247 // Here's where the "Info Center" starts...
Chris@76 248 echo '
Chris@76 249 <div class="tborder clearfix" id="infocenterframe">
Chris@76 250 <h3 class="catbg">
Chris@76 251 <img id="upshrink_ic" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />
Chris@76 252 ', sprintf($txt['info_center_title'], $context['forum_name_html_safe']), '
Chris@76 253 </h3>
Chris@76 254 <div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>';
Chris@76 255
Chris@76 256 // This is the "Recent Posts" bar.
Chris@76 257 if (!empty($settings['number_recent_posts']) && (!empty($context['latest_posts']) || !empty($context['latest_post'])))
Chris@76 258 {
Chris@76 259 echo '
Chris@76 260 <div class="infocenter_section">
Chris@76 261 <h4 class="titlebg">', $txt['recent_posts'], '</h4>
Chris@76 262 <div class="windowbg">
Chris@76 263 <p class="section">
Chris@76 264 <a href="', $scripturl, '?action=recent"><img src="', $settings['images_url'], '/post/xx.gif" alt="', $txt['recent_posts'], '" /></a>
Chris@76 265 </p>
Chris@76 266 <div class="windowbg2 sectionbody hslice clearfix" id="recent_posts_content"><div class="entry-title" style="display: none;">', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '</div><div class="entry-content" style="display: none;"><a rel="feedurl" href="', $scripturl, '?action=.xml;type=webslice">', $txt['subscribe_webslice'], '</a></div>';
Chris@76 267
Chris@76 268 // Only show one post.
Chris@76 269 if ($settings['number_recent_posts'] == 1)
Chris@76 270 {
Chris@76 271 // latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
Chris@76 272 echo '
Chris@76 273 <strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
Chris@76 274 <p id="infocenter_onepost" class="smalltext">
Chris@76 275 ', $txt['recent_view'], ' &quot;', $context['latest_post']['link'], '&quot; ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
Chris@76 276 </p>';
Chris@76 277 }
Chris@76 278 // Show lots of posts.
Chris@76 279 elseif (!empty($context['latest_posts']))
Chris@76 280 {
Chris@76 281 echo '
Chris@76 282 <dl id="infocenter_recentposts" class="middletext">';
Chris@76 283
Chris@76 284 /* Each post in latest_posts has:
Chris@76 285 board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
Chris@76 286 subject, short_subject (shortened with...), time, link, and href. */
Chris@76 287 foreach ($context['latest_posts'] as $post)
Chris@76 288 echo '
Chris@76 289 <dt><strong>', $post['link'], '</strong> ', $txt['by'], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</dt>
Chris@76 290 <dd>', $post['time'], '</dd>';
Chris@76 291 echo '
Chris@76 292 </dl>';
Chris@76 293 }
Chris@76 294 echo '
Chris@76 295 </div>
Chris@76 296 </div>
Chris@76 297 </div>';
Chris@76 298 }
Chris@76 299
Chris@76 300 // Show information about events, birthdays, and holidays on the calendar.
Chris@76 301 if ($context['show_calendar'])
Chris@76 302 {
Chris@76 303 echo '
Chris@76 304 <div class="infocenter_section">
Chris@76 305 <h4 class="titlebg">', $context['calendar_only_today'] ? $txt['calendar_today'] : $txt['calendar_upcoming'], '</h4>
Chris@76 306 <div class="windowbg">
Chris@76 307 <p class="section">
Chris@76 308 <a href="', $scripturl, '?action=calendar' . '"><img src="', $settings['images_url'], '/icons/calendar.gif', '" alt="', $context['calendar_only_today'] ? $txt['calendar_today'] : $txt['calendar_upcoming'], '" /></a>
Chris@76 309 </p>
Chris@76 310 <div class="sectionbody windowbg2 smalltext">';
Chris@76 311
Chris@76 312 // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
Chris@76 313 if (!empty($context['calendar_holidays']))
Chris@76 314 echo '
Chris@76 315 <span class="holiday">', $txt['calendar_prompt'], ' ', implode(', ', $context['calendar_holidays']), '</span><br />';
Chris@76 316
Chris@76 317 // People's birthdays. Like mine. And yours, I guess. Kidding.
Chris@76 318 if (!empty($context['calendar_birthdays']))
Chris@76 319 {
Chris@76 320 echo '
Chris@76 321 <span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span> ';
Chris@76 322 /* Each member in calendar_birthdays has:
Chris@76 323 id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
Chris@76 324 foreach ($context['calendar_birthdays'] as $member)
Chris@76 325 echo '
Chris@76 326 <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong>' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';
Chris@76 327 }
Chris@76 328 // Events like community get-togethers.
Chris@76 329 if (!empty($context['calendar_events']))
Chris@76 330 {
Chris@76 331 echo '
Chris@76 332 <span class="event">', $context['calendar_only_today'] ? $txt['events'] : $txt['events_upcoming'], '</span> ';
Chris@76 333 /* Each event in calendar_events should have:
Chris@76 334 title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
Chris@76 335 foreach ($context['calendar_events'] as $event)
Chris@76 336 echo '
Chris@76 337 ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', ';
Chris@76 338
Chris@76 339 // Show a little help text to help them along ;).
Chris@76 340 if ($context['calendar_can_edit'])
Chris@76 341 echo '
Chris@76 342 (<a href="', $scripturl, '?action=helpadmin;help=calendar_how_edit" onclick="return reqWin(this.href);">', $txt['calendar_how_edit'], '</a>)';
Chris@76 343 }
Chris@76 344 echo '
Chris@76 345 </div>
Chris@76 346 </div>
Chris@76 347 </div>';
Chris@76 348 }
Chris@76 349
Chris@76 350 // Show statistical style information...
Chris@76 351 if ($settings['show_stats_index'])
Chris@76 352 {
Chris@76 353 echo '
Chris@76 354 <div class="infocenter_section">
Chris@76 355 <h4 class="titlebg">', $txt['forum_stats'], '</h4>
Chris@76 356 <div class="windowbg">
Chris@76 357 <p class="section">
Chris@76 358 <a href="', $scripturl, '?action=stats"><img src="', $settings['images_url'], '/icons/info.gif" alt="', $txt['forum_stats'], '" /></a>
Chris@76 359 </p>
Chris@76 360 <div class="windowbg2 sectionbody middletext">
Chris@76 361 ', $context['common_stats']['total_posts'], ' ', $txt['posts_made'], ' ', $txt['in'], ' ', $context['common_stats']['total_topics'], ' ', $txt['topics'], ' ', $txt['by'], ' ', $context['common_stats']['total_members'], ' ', $txt['members'], '. ', !empty($settings['show_latest_member']) ? $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', '<br />
Chris@76 362 ', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong> ( ' . $context['latest_post']['time'] . ' )<br />' : ''), '
Chris@76 363 <a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a>', $context['show_stats'] ? '<br />
Chris@76 364 <a href="' . $scripturl . '?action=stats">' . $txt['more_stats'] . '</a>' : '', '
Chris@76 365 </div>
Chris@76 366 </div>
Chris@76 367 </div>';
Chris@76 368 }
Chris@76 369
Chris@76 370 // "Users online" - in order of activity.
Chris@76 371 echo '
Chris@76 372 <div class="infocenter_section">
Chris@76 373 <h4 class="titlebg">', $txt['online_users'], '</h4>
Chris@76 374 <div class="windowbg">
Chris@76 375 <p class="section">
Chris@76 376 ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who' . '">' : '', '<img src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['online_users'], '" />', $context['show_who'] ? '</a>' : '', '
Chris@76 377 </p>
Chris@76 378 <div class="windowbg2 sectionbody">
Chris@76 379 ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Chris@76 380
Chris@76 381 // Handle hidden users and buddies.
Chris@76 382 $bracketList = array();
Chris@76 383 if ($context['show_buddies'])
Chris@76 384 $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
Chris@76 385 if (!empty($context['num_spiders']))
Chris@76 386 $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
Chris@76 387 if (!empty($context['num_users_hidden']))
Chris@76 388 $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . $txt['hidden'];
Chris@76 389
Chris@76 390 if (!empty($bracketList))
Chris@76 391 echo ' (' . implode(', ', $bracketList) . ')';
Chris@76 392
Chris@76 393 echo $context['show_who'] ? '</a>' : '', '
Chris@76 394 <div class="smalltext">';
Chris@76 395
Chris@76 396 // Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
Chris@76 397 if (!empty($context['users_online']))
Chris@76 398 {
Chris@76 399 echo '
Chris@76 400 ', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);
Chris@76 401
Chris@76 402 // Showing membergroups?
Chris@76 403 if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
Chris@76 404 echo '
Chris@76 405 <br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';
Chris@76 406 }
Chris@76 407
Chris@76 408 echo '
Chris@76 409 </div>
Chris@76 410 <hr class="hrcolor" />
Chris@76 411 <div class="smalltext">
Chris@76 412 ', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
Chris@76 413 ', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
Chris@76 414 </div>
Chris@76 415 </div>
Chris@76 416 </div>
Chris@76 417 </div>';
Chris@76 418
Chris@76 419 // If they are logged in, but statistical information is off... show a personal message bar.
Chris@76 420 if ($context['user']['is_logged'] && !$settings['show_stats_index'])
Chris@76 421 {
Chris@76 422 echo '
Chris@76 423 <div class="infocenter_section">
Chris@76 424 <h4 class="titlebg">', $txt['personal_message'], '</h4>
Chris@76 425 <div class="windowbg">
Chris@76 426 <p class="section">
Chris@76 427 ', $context['allow_pm'] ? '<a href="' . $scripturl . '?action=pm">' : '', '<img src="', $settings['images_url'], '/message_sm.gif" alt="', $txt['personal_message'], '" />', $context['allow_pm'] ? '</a>' : '', '
Chris@76 428 </p>
Chris@76 429 <div class="windowbg2 sectionbody">
Chris@76 430 <strong><a href="', $scripturl, '?action=pm">', $txt['personal_message'], '</a></strong>
Chris@76 431 <div class="smalltext">
Chris@76 432 ', $txt['you_have'], ' ', comma_format($context['user']['messages']), ' ', $context['user']['messages'] == 1 ? $txt['message_lowercase'] : $txt['msg_alert_messages'], '.... ', $txt['click'], ' <a href="', $scripturl, '?action=pm">', $txt['here'], '</a> ', $txt['to_view'], '
Chris@76 433 </div>
Chris@76 434 </div>
Chris@76 435 </div>
Chris@76 436 </div>';
Chris@76 437 }
Chris@76 438
Chris@76 439 // Show the login bar. (it's only true if they are logged out anyway.)
Chris@76 440 if ($context['show_login_bar'])
Chris@76 441 {
Chris@76 442 echo '
Chris@76 443 <div class="infocenter_section">
Chris@76 444 <h4 class="titlebg">', $txt['login'], ' <a href="', $scripturl, '?action=reminder" class="smalltext">', $txt['forgot_your_password'], '</a></h4>
Chris@76 445 <div class="windowbg">
Chris@76 446 <p class="section">
Chris@76 447 <a href="', $scripturl, '?action=login"><img src="', $settings['images_url'], '/icons/login.gif', '" alt="', $txt['login'], '" /></a>
Chris@76 448 </p>
Chris@76 449 <div class="windowbg2 sectionbody">
Chris@76 450 <form id="infocenter_login" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '">
Chris@76 451 <ul class="reset horizlist clearfix">
Chris@76 452 <li>
Chris@76 453 <label for="user">', $txt['username'], ':<br />
Chris@76 454 <input type="text" name="user" id="user" size="15" class="input_text" /></label>
Chris@76 455 </li>
Chris@76 456 <li>
Chris@76 457 <label for="passwrd">', $txt['password'], ':<br />
Chris@76 458 <input type="password" name="passwrd" id="passwrd" size="15" class="input_password" /></label>
Chris@76 459 </li>
Chris@76 460 <li>
Chris@76 461 <label for="cookielength">', $txt['mins_logged_in'], ':<br />
Chris@76 462 <input type="text" name="cookielength" id="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '" class="input_text" /></label>
Chris@76 463 </li>
Chris@76 464 <li>
Chris@76 465 <label for="cookieneverexp">', $txt['always_logged_in'], ':<br />
Chris@76 466 <input type="checkbox" name="cookieneverexp" id="cookieneverexp" checked="checked" class="input_check" /></label>
Chris@76 467 </li>
Chris@76 468 <li>
Chris@76 469 <input type="submit" value="', $txt['login'], '" class="button_submit" />
Chris@76 470 </li>
Chris@76 471 </ul>
Chris@76 472 </form>
Chris@76 473 </div>
Chris@76 474 </div>
Chris@76 475 </div>';
Chris@76 476 }
Chris@76 477
Chris@76 478 // Info center collapse object.
Chris@76 479 echo '
Chris@76 480 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 481 var oInfoCenterToggle = new smc_Toggle({
Chris@76 482 bToggleEnabled: true,
Chris@76 483 bCurrentlyCollapsed: ', empty($options['collapse_header_ic']) ? 'false' : 'true', ',
Chris@76 484 aSwappableContainers: [
Chris@76 485 \'upshrinkHeaderIC\'
Chris@76 486 ],
Chris@76 487 aSwapImages: [
Chris@76 488 {
Chris@76 489 sId: \'upshrink_ic\',
Chris@76 490 srcExpanded: smf_images_url + \'/collapse.gif\',
Chris@76 491 altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
Chris@76 492 srcCollapsed: smf_images_url + \'/expand.gif\',
Chris@76 493 altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
Chris@76 494 }
Chris@76 495 ],
Chris@76 496 oThemeOptions: {
Chris@76 497 bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
Chris@76 498 sOptionName: \'collapse_header_ic\',
Chris@76 499 sSessionVar: ', JavaScriptEscape($context['session_var']), ',
Chris@76 500 sSessionId: ', JavaScriptEscape($context['session_id']), '
Chris@76 501 },
Chris@76 502 oCookieOptions: {
Chris@76 503 bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
Chris@76 504 sCookieName: \'upshrinkIC\'
Chris@76 505 }
Chris@76 506 });
Chris@76 507 // ]]></script>';
Chris@76 508
Chris@76 509 echo '
Chris@76 510 </div>
Chris@76 511 </div>';
Chris@76 512 }
Chris@76 513 ?>