/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    // Show some statistics next to the link tree if SP1 info is off.
    echo '
<table width="100%" cellpadding="3" cellspacing="0">
	<tr>
		<td align="right">';
    if (!$settings['show_stats_index']) {
        echo '
			', $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'], '
			', $settings['show_latest_member'] ? '<br />' . $txt['welcome_member'] . ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>' . $txt['newest_member'] : '';
    }
    echo '
		</td>
	</tr>
</table>';
    // Show the news fader?  (assuming there are things to show...)
    if ($settings['show_newsfader'] && !empty($context['fader_news_lines'])) {
        echo '
<div class="tborder" style="margin-bottom: 2ex;">
	<table border="0" width="100%" cellspacing="1" cellpadding="0">
		<tr class="titlebg" align="center">
			<td><img id="newsupshrink" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="margin: 0 1ex; display: none;" />', $txt['news'], '</td>
		</tr>
		<tr>
			<td valign="middle" align="center" style="height: 60px;" id="smfNewsFaderContainer">';
        // Prepare all the javascript settings.
        echo '
				<div class="windowbg2" id="smfNewsFader">
					<div id="smfFadeScroller"><strong>', $context['news_lines'][0], '</strong></div>
				</div>
			</td>
		</tr>
	</table>
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
	<script type="text/javascript"><!-- // --><![CDATA[

		// Create a news fader object.
		var oNewsFader = new smf_NewsFader({
			sSelf: \'oNewsFader\',
			sFaderControlId: \'smfFadeScroller\',
			aFaderItems: [
				"', implode('",
				"', $context['fader_news_lines']), '"],
			sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
			iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
		});

		// Create the news fader toggle.
		var smfNewsFadeToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'smfNewsFaderContainer\'
			],
			aSwapImages: [
				{
					sId: \'newsupshrink\',
					srcExpanded: smf_images_url + \'/collapse.gif\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/expand.gif\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_news_fader\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), '
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'newsupshrink\'
			}
		});
	// ]]></script>

</div>';
    }
    /* Each category in categories is made up of:
    		id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
    		new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down iamge),
    		and boards. (see below.) */
    foreach ($context['categories'] as $category) {
        // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
        if (empty($category['boards']) && !$category['is_collapsed']) {
            continue;
        }
        echo '
<div class="tborder"><table border="0" width="100%" cellspacing="1" cellpadding="5">
	<tr class="catbg', $category['new'] ? '2' : '', '">
		<td colspan="', $context['user']['is_guest'] ? '5' : '4', '" height="18">';
        if (!$context['user']['is_guest'] && !empty($category['show_unread'])) {
            echo '
			<div class="floatright">
				<a href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>
			</div>';
        }
        // If this category even can collapse, show a link to collapse it.
        if ($category['can_collapse']) {
            echo '
			<a href="', $category['collapse_href'], '" rel="nofollow">', $category['collapse_image'], '</a>';
        }
        echo '
			', $category['link'], '
		</td>
	</tr>';
        // Assuming the category hasn't been collapsed...
        if (!$category['is_collapsed']) {
            /* Each board in each category's boards has:
            			new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
            			children (see below.), link_children (easier to use.), children_new (are they new?),
            			topics (# of), posts (# of), link, href, and last_post. (see below.) */
            foreach ($category['boards'] as $board) {
                echo '
	<tr class="windowbg2">
		<td class="windowbg" width="6%" align="center" valign="top"><a href="', $board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children', '">';
                // If the board or children is new, show an indicator.
                if ($board['new'] || $board['children_new']) {
                    echo '<img src="', $settings['images_url'], '/on', $board['new'] ? '' : '2', '.gif" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" border="0" />';
                } elseif ($board['is_redirect']) {
                    echo '<img src="', $settings['images_url'], '/redirect.gif" alt="*" title="*" border="0" />';
                } else {
                    echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" border="0" />';
                }
                echo '</a></td>
		<td>
			<strong><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></strong>';
                // Has it outstanding posts for approval?
                if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) {
                    echo '
					<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>';
                }
                echo '
			<br />
			', $board['description'];
                // Show the "Moderators: ".  Each has name, href, link, and id. (but we're gonna use link_moderators.)
                if (!empty($board['moderators'])) {
                    echo '
			<div style="padding-top: 1px;" class="smalltext"><em>', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</em></div>';
                }
                // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
                if (!empty($board['children'])) {
                    // Sort the links into an array with new boards bold so it can be imploded.
                    $children = array();
                    /* Each child in each board's children has:
                    			id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
                    foreach ($board['children'] as $child) {
                        if (!$child['is_redirect']) {
                            $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>';
                        } else {
                            $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
                        }
                        // Does the child have any posts awaiting approval?!
                        if ($child['can_approve_posts'] && $child['unapproved_posts'] | $child['unapproved_topics']) {
                            $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>';
                        }
                        $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
                    }
                    echo '
			<div style="padding-top: 1px;" class="smalltext"><em>', $txt['parent_boards'], ': ', implode(', ', $children), '</em></div>';
                }
                // Show some basic information about the number of posts, etc.
                echo '
		</td>
		<td class="windowbg" valign="middle" align="center" style="width: 12ex;"><span class="smalltext">
			', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], !$board['is_redirect'] ? ' ' . $txt['in'] . '<br />
			' . comma_format($board['topics']) . ' ' . $txt['board_topics'] : '', '
		</span></td>
		<td class="smalltext" valign="middle" width="22%">';
                /* The board's and children's 'last_post's have:
                			time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
                			link, href, subject, start (where they should go for the first unread post.),
                			and member. (which has id, name, link, href, username in it.) */
                if (!empty($board['last_post']['id'])) {
                    echo '
			', $txt['last_post'], ' ', $txt['on'], ' ', $board['last_post']['time'], '<br />
			', $txt['in'], ' ', $board['last_post']['link'], ' ', $txt['by'], ' ', $board['last_post']['member']['link'];
                }
                echo '
		</td>
	</tr>';
            }
        }
        echo '
</table></div>
<br />';
    }
    if ($context['user']['is_logged']) {
        echo '
<div class="tborder" style="padding: 3px;"><table border="0" width="100%" cellspacing="0" cellpadding="5">
	<tr class="titlebg">
		<td align="', !$context['right_to_left'] ? 'left' : 'right', '" class="smalltext">
			<img src="', $settings['images_url'], '/new_some.gif" alt="" border="0" align="middle" /> ', $txt['new_posts'], '
			<img src="', $settings['images_url'], '/new_none.gif" alt="" border="0" align="middle" style="margin-left: 4ex;" /> ', $txt['old_posts'], '
		</td>
		<td align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext">';
        // Show the mark all as read button?
        if ($settings['show_mark_read']) {
            echo '
			<a href="', $scripturl, '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id'] . '">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/markread.gif" alt="' . $txt['mark_as_read'] . '" border="0" />' : $txt['mark_as_read'], '</a>';
        }
        echo '
		</td>
	</tr>
</table></div>';
    }
    template_info_center();
}
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */

function template_main()
{
	global $context, $settings, $options, $txt, $scripturl, $modSettings;

	// Show some statistics if stat info is off.
	if (!$settings['show_stats_index'])
		echo '
	<div id="index_common_stats">
		', $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'], '
		', ($settings['show_latest_member'] ? ' ' . $txt['welcome_member'] . ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>' . $txt['newest_member'] : '') , '
	</div>';

	// Show the news fader?  (assuming there are things to show...)
	if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
	{
		echo '
	<div id="newsfader">
		<div class="cat_bar">
			<h3 class="catbg">
				<img id="newsupshrink" src="', $settings['images_url'], '/icons/16/collapse.png" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="display: none;" />
				', $txt['news'], '
			</h3>
		</div>
		<ul class="reset" id="smfFadeScroller"', empty($options['collapse_news_fader']) ? '' : ' style="display: none;"', '>';

			foreach ($context['news_lines'] as $news)
				echo '
			<li>', $news, '</li>';

	echo '
		</ul>
	</div>
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
	<script type="text/javascript"><!-- // --><![CDATA[

		// Create a news fader object.
		var oNewsFader = new smf_NewsFader({
			sSelf: \'oNewsFader\',
			sFaderControlId: \'smfFadeScroller\',
			sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
			iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
		});

		// Create the news fader toggle.
		var smfNewsFadeToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'smfFadeScroller\'
			],
			aSwapImages: [
				{
					sId: \'newsupshrink\',
					srcExpanded: smf_images_url + \'/icons/16/collapse.png\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/icons/16/expand.png\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_news_fader\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), '
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'newsupshrink\'
			}
		});
	// ]]></script>';
	}

	echo '
	<div id="boardindex_table">
		<table class="table_list">';

	/* Each category in categories is made up of:
	id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
	new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
	and boards. (see below.) */
	foreach ($context['categories'] as $category)
	{
		// If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
		//if (empty($category['boards']) && !$category['is_collapsed'])
		//	continue;

		echo '
			<tbody class="header" id="category_', $category['id'], '">
				<tr>
					<td colspan="4">
						<div class="cat_bar">
							<h3 class="catbg">';

		if (!$context['user']['is_guest'] && !empty($category['show_unread']))
			echo '
								<a class="unread" href="', $scripturl, '?action=unread;c=', $category['id'], '" title="Unread posts in this board">
								  <svg viewBox="0 0 32 32"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#IconNewPosts"></use></svg>
								</a>';

		echo '
								<span class="category-name">', $category['name'], '</span>
							</h3>
						</div>
					</td>
				</tr>
			</tbody>';
    
		echo '
			<tbody class="content" id="category_', $category['id'], '_boards">';
			/* Each board in each category's boards has:
			new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
			children (see below.), link_children (easier to use.), children_new (are they new?),
			topics (# of), posts (# of), link, href, and last_post. (see below.) */
			foreach ($category['boards'] as $board)
			{
				echo '
				<tr id="board_', $board['id'], '" class="windowbg2">
					<td class="icon windowbg"', !empty($board['children']) ? ' rowspan="2"' : '', '>
						';

				// If the board or children is new, show an indicator.
				if ($board['new'])
                      echo '<svg class="star new-posts" viewBox="0 0 32 32" ><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#FullStar"></use></svg>';
                    elseif ($board['children_new'])
				  echo '<svg class="star child-posts" viewBox="0 0 32 32" ><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ChildStar"></use></svg>';
				// Is it a redirection board?
				elseif ($board['is_redirect'])
					echo '
							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
				// No new posts at all! The agony!!
				else
					echo '<svg class="star no-posts" viewBox="0 0 32 32" ><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#NoStar"></use></svg>';
				echo '
						
					</td>
					<td class="info">
						<a class="subject" href="', $board['href'], '">', $board['name'], '</a>';

				// Has it outstanding posts for approval?
				if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
					echo '
						<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>';

				echo '

						<p>', $board['description'] , '</p>';

				// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
				if (!empty($board['moderators']))
					echo '
						<p class="moderators">', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';

				// Show some basic information about the number of posts, etc.
					echo '
					</td>
					<td class="stats windowbg">
						<p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
						', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
						</p>
					</td>
					<td class="lastpost">';

				/* The board's and children's 'last_post's have:
				time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
				link, href, subject, start (where they should go for the first unread post.),
				and member. (which has id, name, link, href, username in it.) */
				if (!empty($board['last_post']['id']))
					echo '
						<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
						', $txt['in'], ' ', $board['last_post']['link'], '<br />
						', $txt['on'], ' ', $board['last_post']['time'],'
						</p>';
				echo '
					</td>
				</tr>';
				// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
				if (!empty($board['children']))
				{
					// Sort the links into an array with new boards bold so it can be imploded.
					$children = array();
					/* Each child in each board's children has:
							id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
					foreach ($board['children'] as $child)
					{
						if (!$child['is_redirect'])
							$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <span class="new-post-in-child"><svg viewBox="0 0 32 32" ><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#IconNewPosts"></use></svg>' : '') . '</a>';
						else
							$child['link'] = '<a data-line="212" href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';

						// Has it posts awaiting approval?
						if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
							$child['link'] .= ' <a data-line="216" 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>';

						$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
					}
					echo '
					<tr id="board_', $board['id'], '_children">
						<td colspan="3" class="children windowbg">
							<strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '
						</td>
					</tr>';
				}
			}
		echo '
			</tbody>';
		echo '
			<tbody class="divider">
				<tr>
					<td colspan="4"></td>
				</tr>
			</tbody>';
	}
	echo '
		</table>
	</div>';

	if ($context['user']['is_logged'])
	{
		echo '
	<div id="posting_icons">';

		// Mark read button.
		$mark_read_button = array(
			'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
		);

		echo '
		<ul class="icon_glossary">
            <li>
              <svg viewBox="0 0 32 32" alt="normal topic"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#NoStar"></use></svg>
              <span>Board</span>
            </li>
		  <li>
              <svg viewBox="0 0 32 32" alt="normal topic"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#FullStar"></use></svg>
              <span>has new posts</span>
            </li>
            <li>
              <svg viewBox="0 0 32 32" alt="normal topic"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ChildStar"></use></svg>
              <span>only in children</span>
            </li>
            <li>
              <svg viewBox="0 0 32 32" alt="normal topic"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#IconNewPosts"></use></svg>
              <span>new in this</span>
            </li>
		</ul>
	</div>';

		// Show the mark all as read button?
		if ($settings['show_mark_read'] && !empty($context['categories']))
			echo '<div class="mark_read">', template_button_strip($mark_read_button, 'right'), '</div>';
	}
	else
	{
		echo '
	<div id="posting_icons" class="flow_hidden">
		<span style="font-size:11px; color:#666;">More forums will be visible if you <a href="http://ballp.it/index.php?action=register">register</a>.</span>
	</div>';
	}

	template_info_center();
}
/**
 * Show information below the boardindex, like stats, infocenter
 */
function template_boardindex_outer_below()
{
    global $context, $settings, $txt;
    // @todo - Just <div> for the parent, <p>'s for the icon stuffz, and the buttonlist <ul> for "Mark read".
    // Sort the floats in the CSS file, as other tricks will be needed as well (media queries, for instance).
    echo '
		<div id="posting_icons">';
    // Show the mark all as read button?
    if ($settings['show_mark_read'] && !$context['user']['is_guest'] && !empty($context['categories'])) {
        echo '
			', template_button_strip($context['mark_read_button'], 'right');
    }
    if ($context['user']['is_logged']) {
        echo '
			<p class="board_key new_some_board" title="', $txt['new_posts'], '">', $txt['new_posts'], '</p>';
    }
    echo '
			<p class="board_key new_none_board" title="', $txt['old_posts'], '">', $txt['old_posts'], '</p>
			<p class="board_key new_redirect_board" title="', $txt['redirect_board'], '">', $txt['redirect_board'], '</p>
		</div>';
    if (!empty($context['info_center_callbacks'])) {
        template_info_center();
    }
}
Exemple #4
0
function template_boardindex_outer_below()
{
    global $modSettings;
    // Info center collapse object.
    echo '</td></tr></tbody></table>';
    if (!empty($modSettings['sideright'])) {
        echo '<td valign="top" id="upshrinkRightBarTD">
				<div id="upshrinkRightBar" style="width:', $modSettings['siderightwidth'] ? $modSettings['siderightwidth'] : '200px', '; overflow:hidden;">
				', empty($modSettings['sideright1']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['righthtmlbaslik'] . '</h3></div>' . $modSettings['sideright1'] . '', '
				', empty($modSettings['siderightphp']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['rightphpbaslik'] . '</h3></div>';
        eval($modSettings['siderightphp']);
        if (!empty($modSettings['siderighthaberetkin'])) {
            $array = ssi_boardNews($modSettings['siderighthaber'], $modSettings['siderightsay'], null, 1000, 'array');
            echo '<div class="cat_bar">
							<h3 class="catbg">', $modSettings['rbaslik'], '</h3>
						</div>';
            global $memberContext;
            foreach ($array as $news) {
                loadMemberData($news['poster']['id']);
                loadMemberContext($news['poster']['id']);
                echo '<div class="sidehaber">
								<div class="sideBaslik">
								
								<h3><a href="', $news['href'], '"><span class="generic_icons sort_up"></span> ', shorten_subject($news['subject'], 30), '</a></h3>
								</div>
								<div class="snrj"> ', $memberContext[$news['poster']['id']]['avatar']['image'], ' 
								<p>', $txt['by'], '', $news['poster']['link'], '</p>
								</div>
								</div>';
            }
        }
        echo '</div>
			</td>
			<td valign="top">
			<button type="button" onclick="rightPanel.toggle();" id="teknoright"></button>
			</td>';
    }
    echo '</td>
		</tr></tbody></table>';
    template_info_center();
}
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2012 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 Alpha 1
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    // Show some statistics if stat info is off.
    if (!$settings['show_stats_index']) {
        echo '
	<div id="index_common_stats">
		', $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'], '
		', $settings['show_latest_member'] ? ' ' . $txt['welcome_member'] . ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>' . $txt['newest_member'] : '', '
	</div>';
    }
    // Show the news fader?  (assuming there are things to show...)
    if ($settings['show_newsfader'] && !empty($context['fader_news_lines'])) {
        echo '
	<div id="newsfader">
		<div class="cat_bar">
			<h3 class="catbg">
				<img id="newsupshrink" src="', $settings['images_url'], '/collapse.png" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="display: none;" />
				', $txt['news'], '
			</h3>
		</div>
		<ul class="reset" id="smfFadeScroller"', empty($options['collapse_news_fader']) ? '' : ' style="display: none;"', '>';
        foreach ($context['news_lines'] as $news) {
            echo '
			<li>', $news, '</li>';
        }
        echo '
		</ul>
	</div>
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
	<script type="text/javascript"><!-- // --><![CDATA[

		// Create a news fader object.
		var oNewsFader = new smc_NewsFader({
			sFaderControlId: \'smfFadeScroller\',
			sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
			iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
		});

		// Create the news fader toggle.
		var smfNewsFadeToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'smfFadeScroller\'
			],
			aSwapImages: [
				{
					sId: \'newsupshrink\',
					srcExpanded: smf_images_url + \'/collapse.png\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/expand.png\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_news_fader\',
				sSessionVar: smf_session_var,
				sSessionId: smf_session_id
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'newsupshrink\'
			}
		});
	// ]]></script>';
    }
    echo '
	<div id="boardindex_table" class="boardindex_table">
		<table class="table_list">';
    /* Each category in categories is made up of:
    	id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
    	new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
    	and boards. (see below.) */
    foreach ($context['categories'] as $category) {
        // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
        if (empty($category['boards']) && !$category['is_collapsed']) {
            continue;
        }
        echo '
			<tbody class="header" id="category_', $category['id'], '">
				<tr>
					<td colspan="4">
						<div class="cat_bar">
							<h3 class="catbg">';
        // If this category even can collapse, show a link to collapse it.
        if ($category['can_collapse']) {
            echo '
								<a class="collapse" href="', $category['collapse_href'], '" title="', $category['is_collapsed'] ? $txt['show'] : $txt['hide'], '">', $category['collapse_image'], '</a>';
        }
        echo '
								', $category['link'], '
							</h3>
						</div>
					</td>
				</tr>
			</tbody>';
        // Assuming the category hasn't been collapsed...
        if (!$category['is_collapsed']) {
            echo '
			<tbody class="content" id="category_', $category['id'], '_boards">';
            /* Each board in each category's boards has:
            			new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
            			children (see below.), link_children (easier to use.), children_new (are they new?),
            			topics (# of), posts (# of), link, href, and last_post. (see below.) */
            foreach ($category['boards'] as $board) {
                echo '
				<tr id="board_', $board['id'], '" class="windowbg2">
					<td class="windowbg icon"', !empty($board['children']) ? ' rowspan="2"' : '', '>
						<a href="', $board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children', '">';
                // If the board or children is new, show an indicator.
                if ($board['new'] || $board['children_new']) {
                    echo '
							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
                } elseif ($board['is_redirect']) {
                    echo '
							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
                } else {
                    echo '
							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
                }
                echo '
						</a>
					</td>
					<td class="info">
						<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
                // Has it outstanding posts for approval?
                if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) {
                    echo '
						<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>';
                }
                echo '

						<p>', $board['description'], '</p>';
                // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
                if (!empty($board['moderators'])) {
                    echo '
						<p class="moderators">', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
                }
                // Show some basic information about the number of posts, etc.
                echo '
					</td>
					<td class="windowbg stats">
						<p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], '
						', $board['is_redirect'] ? '' : '<br /> ' . comma_format($board['topics']) . ' ' . $txt['board_topics'], '
						</p>
					</td>
					<td class="lastpost">';
                if (!empty($board['last_post']['id'])) {
                    echo '
						<p>', $board['last_post']['last_post_message'], '</p>';
                }
                echo '
					</td>
				</tr>';
                // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
                if (!empty($board['children'])) {
                    // Sort the links into an array with new boards bold so it can be imploded.
                    $children = array();
                    /* Each child in each board's children has:
                    			id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
                    foreach ($board['children'] as $child) {
                        if (!$child['is_redirect']) {
                            $child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</a>';
                        } else {
                            $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
                        }
                        // Has it posts awaiting approval?
                        if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) {
                            $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>';
                        }
                        $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
                    }
                    echo '
					<tr id="board_', $board['id'], '_children" class="windowbg2">
						<td colspan="3" class="windowbg children">
							<p><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</p>
						</td>
					</tr>';
                }
            }
            echo '
			</tbody>';
        }
        echo '
			<tbody class="divider">
				<tr>
					<td colspan="4"></td>
				</tr>
			</tbody>';
    }
    echo '
		</table>
	</div>
		<ul id="posting_icons">';
    if ($context['user']['is_logged']) {
        echo '
			<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_some.png" alt="" /> ', $txt['new_posts'], '</li>';
    }
    echo '
			<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_none.png" alt="" /> ', $txt['old_posts'], '</li>
			<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
		</ul>';
    // Show the mark all as read button?
    if ($settings['show_mark_read'] && !empty($context['categories'])) {
        echo '
		<div class="mark_read">', template_button_strip($context['mark_read_button'], 'right'), '</div>';
    }
    template_info_center();
}
/**
 * @name      EosAlpha BBS
 * @copyright 2011 Alex Vie silvercircle(AT)gmail(DOT)com
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:  	BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0pre
 */
function template_main()
{
    global $context, $settings, $txt, $scripturl;
    echo $context['template_hooks']['boardindex']['above_boardlisting'], '
	<div id="boardindex">';
    /* Each category in categories is made up of:
    	id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
    	new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
    	and boards. (see below.) */
    foreach ($context['categories'] as &$category) {
        // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
        if (empty($category['boards']) && !$category['is_collapsed']) {
            continue;
        }
        if (!$category['is_root']) {
            echo '
			<div class="category" id="category_', $category['id'], '">
 			  <div class="cat_bar2">';
            // If this category even can collapse, show a link to collapse it.
            if ($category['can_collapse']) {
                echo '
					<div class="csrcwrapper16px floatright"><a onclick="catCollapse($(this));return(false);" data-id="', $category['id'], '" class="collapse floatright" href="', $category['collapse_href'], '">', $category['collapse_image'], '</a></div>';
            }
            if (!$context['user']['is_guest'] && $category['new']) {
                echo '
					<a class="unreadlink" href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>';
            }
            echo '
				<h3>
				', $category['link'], '
			  	</h3>
		      </div>
			</div>';
        }
        echo '
			<div class="framed_region cleantop ', $category['is_root'] ? 'root_cat' : 'normal_cat', '" style="', ' ', $category['is_collapsed'] ? 'display:none;" ' : '', '" id="category_', $category['id'], '_boards">
			<ol class="commonlist category">';
        if (!empty($category['desc'])) {
            echo '
			<li class="cat_desc">
			<h3>', $category['desc'], '</h3>
			</li>';
        }
        foreach ($category['boards'] as &$board) {
            template_boardbit($board);
        }
        echo '
			</ol>
			</div>
			<div class="cContainer_end"></div>';
    }
    if ($context['hidden_boards']['hidden_count']) {
        echo '
			<div id="show_hidden_boards" class="orange_container norounded gradient_darken_down tinytext"><span class="floatright">', $context['hidden_boards']['setup_notice'], '</span><strong>', sprintf($context['hidden_boards']['notice'], $context['hidden_boards']['hidden_count'], '<a onclick="$(\'div#category_0\').fadeIn();return(false);" href="!#">'), '</strong></div>
			<div class="category" id="category_', $context['hidden_boards']['id'], '" style="display:none;">
				<div class="framed_region cleantop root_cat" id="category_', $context['hidden_boards']['id'], '_boards">
					<ol class="commonlist category">';
        foreach ($context['hidden_boards']['boards'] as &$board) {
            template_boardbit($board);
        }
        echo '
					</ol>
				</div>
			</div>
			<div class="cContainer_end"></div>';
    }
    echo '
	</div>';
    if ($context['user']['is_logged']) {
        echo '
	<div id="posting_icons" class="floatleft">';
        // Mark read button.
        $mark_read_button = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']));
        echo '
		<table>
		<tr>
			<td>
			<div>
				<div style="left:-25px;margin-right:-25px;" class="csrcwrapper24px"><img class="clipsrc _off" src="', $settings['images_url'], '/clipsrc.png" alt="" />
			    <img alt="" style="position:absolute;bottom:-4px;right:-28px;" src="', $settings['images_url'], '/new.png" />
				</div>
			</div>
			</td>
			<td class="nowrap smalltext" style="padding-left:28px;">', $txt['new_posts'], '</td>
			<td><div class="csrcwrapper24px"><img class="clipsrc _off" src="', $settings['images_url'], '/clipsrc.png" alt="" /></div></td><td class="nowrap smalltext" style="padding-left:28px;">', $txt['old_posts'], '</td>
			<td><div class="csrcwrapper24px"><img class="clipsrc _redirect" src="', $settings['images_url'], '/clipsrc.png" alt="" /></div></td><td class="nowrap smalltext" style="padding-left:28px;">', $txt['redirect_board'], '</td>
			<td><div class="csrcwrapper24px"><img class="clipsrc _page" src="', $settings['images_url'], '/clipsrc.png" alt="" /></div></td><td class="nowrap smalltext" style="padding-left:28px;">', $txt['a_page'], '</td>
		</tr>
		</table>
	</div>';
        // Show the mark all as read button?
        if ($settings['show_mark_read'] && !empty($context['categories'])) {
            echo '<div class="mark_read">', template_button_strip($mark_read_button, 'right'), '</div>';
        }
    } else {
        echo '
	<div id="posting_icons" class="flow_hidden">
		<table>
		<tr>
			<td><div class="csrcwrapper24px"><img class="clipsrc _off" src="', $settings['images_url'], '/clipsrc.png" alt="" /></div></td><td class="nowrap smalltext" style="padding-left:28px;">', $txt['old_posts'], '</td>
			<td><div class="csrcwrapper24px"><img class="clipsrc _redirect" src="', $settings['images_url'], '/clipsrc.png" alt="" /></div></td><td class="nowrap smalltext" style="padding-left:28px;">', $txt['redirect_board'], '</td>
			<td><div class="csrcwrapper24px"><img class="clipsrc _page" src="', $settings['images_url'], '/clipsrc.png" alt="" /></div></td><td class="nowrap smalltext" style="padding-left:28px;">', $txt['a_page'], '</td>
		</tr>
		</table>
	</div>';
    }
    template_info_center();
    echo $context['template_hooks']['boardindex']['below_boardlisting'];
}
function template_boardindex_outer_below()
{
    template_info_center();
}
function my_boards()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    loadtemplate('Common');
    // Show the news fader?  (assuming there are things to show...)
    if ($settings['show_newsfader'] && !empty($context['fader_news_lines'])) {
        echo '
	<div class="themepadding catbg">
		<h3>
			<img id="newsupshrink" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" class="floatright" style="display: none;" />
			', $txt['news'], '
		</h3>
		<p class="subtitle">ttt</p>
	</div>
	<div id="newsfader"><div class="themepadding windowbg">
		<ul class="reset" id="smfFadeScroller"', empty($options['collapse_news_fader']) ? '' : ' style="display: none;"', '>';
        foreach ($context['news_lines'] as $news) {
            echo '
			<li>', $news, '</li>';
        }
        echo '
		</ul>
	</div></div>
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
	<script type="text/javascript"><!-- // --><![CDATA[

		// Create a news fader object.
		var oNewsFader = new smf_NewsFader({
			sSelf: \'oNewsFader\',
			sFaderControlId: \'smfFadeScroller\',
			sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
			iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
		});

		// Create the news fader toggle.
		var smfNewsFadeToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'newsfader\'
			],
			aSwapImages: [
				{
					sId: \'newsupshrink\',
					srcExpanded: smf_images_url + \'/collapse.gif\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/expand.gif\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_news_fader\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), '
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'newsupshrink\'
			}
		});
	// ]]></script>';
    }
    echo '
	<div id="boardindex_table">';
    $first = true;
    foreach ($context['categories'] as $category) {
        // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
        if (empty($category['boards']) && !$category['is_collapsed']) {
            continue;
        }
        echo '
		<div class="catbg', !$first ? ' catbg2' : '', '">';
        if (!$category['is_collapsed']) {
            echo '
			<span class="floatright circleborder">', my_toggle($category['id'], 'category_boards_' . $category['id']), '</span>';
        }
        echo '
			<h3>', $category['link'], '</h3>
			<p class="subtitle">';
        if (!$context['user']['is_guest'] && !empty($category['show_unread'])) {
            echo '
				<a class="unreadlink" href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>';
        }
        // If this category even can collapse, show a link to collapse it.
        if ($category['can_collapse']) {
            echo '
				<a href="', $category['collapse_href'], '"> | ', $category['is_collapsed'] ? $txt['o_toggle2'] : $txt['o_toggle'], '</a>';
        }
        echo '
			</p>
		</div>';
        $alt = true;
        // Assuming the category hasn't been collapsed...
        if (!$category['is_collapsed']) {
            echo '
		<div id="category_boards_', $category['id'], '" class="', !empty($options['togglecat' . $category['id']]) ? '' : 'no', 'togglecat">';
            template_board($category['boards']);
            echo '
		</div>';
        }
    }
    echo '
	</div>
	<div class="themepadding">';
    if ($context['user']['is_logged']) {
        // Mark read button.
        $mark_read_button = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']));
        // Show the mark all as read button?
        if ($settings['show_mark_read'] && !empty($context['categories'])) {
            echo '<div class="mark_read">', template_button_strip($mark_read_button, 'right'), '</div>';
        }
    }
    echo '
	</div>';
    template_info_center();
}