All pastes #2082199 Raw Edit

Something

public text v1 · immutable
#2082199 ·published 2011-09-22 16:22 UTC
rendered paste body
<?php
/**
 * SMF Curve
 *
 * Copyright 2010, Simple Machines
 * Thanks to Labradoodle-360
 *    for creating and donating this script to Simple Machines
 */

if (!defined('MEDIAWIKI'))
	die(-1);

// SMF Settings
// You may configure these to your liking:
// This is the url to the images directory.
global $imagesurl;
$imagesurl = 'http://www.simplemachines.org/community/Themes/smsite2/images/site/';

// Do not edit these. They will fix themselves.
$imagesurl = isset($setting['default_images_url']) ? $setting['default_images_url'] : $imagesurl;

class Skinsmfcurve extends SkinTemplate
{
	function initPage (OutputPage $out)
	{
		parent::initPage($out);
		$this->skinname = 'smfcurve';
		$this->stylename = 'smfcurve';
		$this->template = 'smfcurveTemplate';
		$this->useHeadElement = true;

	}
	/*var $skinname = 'SMF_Curve';
	var $stylename = 'SMF_Curve';
	var $template = 'SMF_CurveTemplate';
	var $useHeadElement = true;*/

	function setupSkinUserCss (OutputPage $out)
	{
		global $wgHandheldStyle;

		parent::setupSkinUserCss($out);

		// Append to the default screen common & print styles...
		$out->addStyle('smfcurve/main.css', 'screen');
		if ($wgHandheldStyle)
			$out->addStyle($wgHandheldStyle, 'handheld');

		$out->addStyle('smfcurve/IE50Fixes.css', 'screen', 'lt IE 5.5000');
		$out->addStyle('smfcurve/IE55Fixes.css', 'screen', 'IE 5.5000');
		$out->addStyle('smfcurve/IE60Fixes.css', 'screen', 'IE 6');
		$out->addStyle('smfCurve/IE70Fixes.css', 'screen', 'IE 7');

		$out->addStyle('smfcurve/rtl.css', 'screen', '', 'rtl');

		// This file contains all the changes we have done to curve and css we need around the entire site and forum.
		$out->addStyle('http://www.simplemachines.org/community/Themes/smsite2/css/smsite.css', 'screen', '');
	}
}

class smfcurveTemplate extends QuickTemplate
{
	var $skin;

	function execute ()
	{
		global $wgRequest, $imagesurl;

		$this->skin = $skin = $this->data['skin'];
		$action = $wgRequest->getText('action');

		// Suppress warnings to prevent notices about missing indexes in $this->data
		//wfSuppressWarnings();

		$this->html('headelement');

		echo '
<!--
	This is SMF Curve theme.
	Thank you to Labradoodle-360 for the generous donation.
-->
<div id="wrapper">
	<div id="header">
		<div class="frame">
			<div id="top_section">
				<div class="logo align_left">
					<a href="http://www.simplemachines.org" target="_self" class="logo"><img src="http://www.simplemachines.org/community/Themes/smsite2/images/site/smsite_logo.jpg" alt="Simple Machines" /></a>
				</div>
				', $this->site_menu(), '
			</div>

			<div id="userarea" class="upper_section">
				<div id="upper_search">', $this->template_search_box(), '</div>
				<div id="main_menu">
					<ul class="dropmenu" id="menu_nav">';

		foreach ($this->data['content_actions'] as $key => $tab)
		{
			/*
				We don't want to give the watch tab an accesskey if the
				page is being edited, because that conflicts with the
				accesskey on the watch checkbox.  We also don't want to
				give the edit tab an accesskey, because that's fairly su-
				perfluous and conflicts with an accesskey (Ctrl-E) often
				used for editing in Safari.
			*/
			echo '
						<li id="', Sanitizer::escapeId('ca-' . $key), '"', (!empty($tab['class']) ? ' class="' . htmlspecialchars($tab['class']) . '"' : ''), '>
							<a href="', htmlspecialchars($tab['href']), '"', (in_array($action, array('edit', 'submit')) && in_array($key, array('edit', 'watch', 'unwatch' )) ? $skin->tooltip('ca-' .$key) : $skin->tooltipAndAccesskey('ca-' . $key)), ' class="firstlevel', $tab['class'] == 'selected' ? ' active' : '', '"><span class="firstlevel">', htmlspecialchars($tab['text']), '</span></a>
						</li>';
		}
		echo '
					</ul>
				</div>
			</div>
			', $this->show_ad(), '
			<br class="clear" />
		</div>
	</div>
	<div id="content_section">
		<div class="frame">
			<div id="main_content_section">
				<div class="floatleft" style="width: 15% !important">
					<div id="column-one"', $this->html('userlangattributes'), '>
					<!-- This is the header, login, register... -->
						<h3 class="catbg"><span class="left"></span>User Info</h3>
						<div class="windowbg2">
							<span class="topslice"><span></span></span>
							<ul', $this->html('userlangattributes') , '>';

		foreach ($this->data['personal_urls'] as $key => $item)
		{
			echo '
								<li id="', Sanitizer::escapeId('pt-' . $key), '"', ($item['active'] ? ' class="active"' : ''), '>
									<a href="', htmlspecialchars($item['href']) , '"', $skin->tooltipAndAccesskey('pt-' . $key), (!empty($item['class']) ? ' class="' . htmlspecialchars($item['class']) . '"' : ''), '>', htmlspecialchars($item['text']), '</a>
								</li>';
		}
		echo '
							</ul>
							<span class="botslice"><span></span></span>
						</div>
						<br />';

		$sidebar = $this->data['sidebar'];
		if (!isset($sidebar['SEARCH']))
			$sidebar['SEARCH'] = true;
		if (!isset($sidebar['TOOLBOX']))
			$sidebar['TOOLBOX'] = true;
		if (!isset($sidebar['LANGUAGES']))
			$sidebar['LANGUAGES'] = true;
		foreach ($sidebar as $boxName => $cont)
		{
			if ($boxName === 'SEARCH')
				$this->searchBox();
			elseif ($boxName === 'TOOLBOX')
				$this->toolbox();
			elseif ($boxName === 'LANGUAGES')
				$this->languageBox();
			else
				$this->customBox($boxName, $cont);
		}

		echo '
					</div>
					<!-- end of the left (by default at least) column -->
				</div>
				<div class="floatright" style="width: 84% !important; margin-bottom: 0; margin-left: 16%">
					<div id="column-content" class="floatright">
						<div id="content" ', $this->html('specialpageattributes') , '>
							<a id="top"></a>', ($this->data['sitenotice'] ? '
							<div id="siteNotice">' . $this->html('sitenotice') . '</div>' : ''), '
							<h3 class="catbg">
								<span class="left"></span>', $this->html('title'), '
							</h3>
							<h3 id="siteSub">', $this->msg_ret('tagline'), '</h3>
							<div id="contentSub"', $this->html('userlangattributes'), '>', $this->html('subtitle'), '</div>

							<!-- start content -->
							<span class="clear upperframe"><span></span></span>
							<div class="roundframe flow_auto">
								<div class="innerframe">', ($this->data['undelete'] ? '
								<div id="contentSub2">' . $this->html('undelete') . '</div>' : ''), ($this->data['newtalk'] ? '
								<div class="usermessage">' . $this->html('newtalk') . '</div>' : ''), ($this->data['showjumplinks'] ? '
								<div id="jump-to-nav">
									' . $this->msg_ret('jumpto') . ' <a href="#column-one">' . $this->msg_ret('jumptonavigation') . '</a>, <a href="#searchInput">' . $this->msg_ret('jumptosearch') . '</a>
								</div>' : ''),
								$this->html('bodytext'), ($this->data['catlinks'] ? $this->html('catlinks') : ''), '
							</div>
						</div>
						<span class="lowerframe"><span></span></span>
						<br />
						<!-- end content -->', ($this->data['dataAfterContent'] ?
						$this->html ('dataAfterContent') : '') , '
						<div class="visualClear"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div id="footer_section">
	<div class="frame">
		<div class="smalltext floatleft">
			Copyright &copy; 2011 <a href="http://www.simplemachines.org/">Simple Machines</a>. All Rights Reserved.<br />
			<a href="http://wiki.simplemachines.org/index.php?title=Online_Manual:Privacy_policy" target="_self">Privacy Policy</a> | <a href="http://wiki.simplemachines.org/index.php?title=Online_Manual:About" target="_self">About</a> | <a href="http://wiki.simplemachines.org/index.php?title=Online_Manual:General_disclaimer" target="_self">Disclaimers</a><br />', 
			$this->html('viewcount') , '
			', $this->html('poweredbyico') , '<br />
			Page served by ', (!empty($_SERVER['HTTP_X_SERVER_ADDRESS']) ? $_SERVER['HTTP_X_SERVER_ADDRESS'] . ' (' . 
$_SERVER['SERVER_ADDR'] . ')' : $_SERVER['SERVER_ADDR']), '<br />
			Page created in ', sprintf('%01.3f', wfTime() - $GLOBALS['wgRequestTime']), ' seconds.
		</div>
		<div class="floatright">
			<div id="advert">
				<div id="ad">
				<div class="adbanner">Advertisement:</div>
<script type="text/javascript"><!--
google_ad_client = "pub-8122377091860221";
google_ad_slot = "9131625210";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
				</div>
			</div>
		</div>
	</div>
</div>
<br class="clear" />

</div></div></div>

', $this->html('bottomscripts') /* JS call to runBodyOnloadHook */ , '
', $this->html('reporttime'), '
', ($this->data['debug'] ? '
<!-- Debug output:
' . $this->text_ret('debug') . '
-->
' : ''), '
</body></html>';
//wfRestoreWarnings();
	}
// end of execute() method

	function template_search_box()
	{
		global $wgUseTwoButtonsSearchForm;

		echo '
		<form action="', $this->text_ret('wgScript'), '" id="searchform" class="middletext">
				<input type="hidden" name="title" value="', $this->text_ret('searchtitle'), '"/>
				', Html::input('search', (isset($this->data['search']) ? $this->data['search'] : ''), 'search',
				array(
					'id' => 'searchInput',
					'title' => $this->skin->titleAttrib('search'),
					'accesskey' => $this->skin->accesskey('search')
				)), '
				<input type="submit" name="go" class="button_submit" value="', $this->msg_ret('searcharticle'), '" ', $this->skin->tooltipAndAccesskey('search-go'), ' />';
				if ($wgUseTwoButtonsSearchForm)
					echo '&nbsp;
				<input type="submit" name="fulltext" class="button_submit" value="', $this->msg_ret('searchbutton'), '" ' . $this->skin->tooltipAndAccesskey('search-fulltext') . ' />';
				else
					echo '
				<div>
					<a href="' . $this->text_ret('searchaction') . '" rel="search">', $this->msg_ret('powersearch-legend'), '</a>
				</div>';
				echo '
			</form>';
	}

	// Search Box
	function searchBox ()
	{
		global $wgUseTwoButtonsSearchForm;

		echo '
	<h3 class="catbg"><span class="left"></span>Search</h3>
	<div class="windowbg2">
		<span class="topslice"><span></span></span>
		<form action="', $this->text_ret('wgScript'), 
		'" id="searchform">
			<input type="hidden" name="title" value="', $this->text_ret('searchtitle') , '"/>',
			Html::input(
				'search',
				isset($this->data['search']) ? $this->data['search'] : '', 'search',
				array(
					'id' => 'searchInput',
					'title' => $this->skin->titleAttrib('search'),
					'accesskey' => $this->skin->accesskey('search')
				)
			), '

			<br /><br />
			<input type="submit" name="go" class="button_submit" value="', $this->msg_ret('searcharticle'), '"', $this->skin->tooltipAndAccesskey('search-go'), ' />', ($wgUseTwoButtonsSearchForm ? '&nbsp;
			<input type="submit" name="fulltext" class="button_submit" value="' . $this->msg_ret('searchbutton') . '"' . $this->skin->tooltipAndAccesskey('search-fulltext') . ' />' : '
			<div>
				<a href="' . $this->text_ret('searchaction') . '" rel="search">' . $this->msg_ret('powersearch-legend') . '</a>
			</div>'), '
		</form>
		<span class="botslice"><span></span></span>
	</div>
	<br />';
	}

	/*************************************************************************************************/
	function toolbox ()
	{
		echo '
	<h3 class="catbg"><span class="left"></span>', $this->msg_ret('toolbox'), '</h3>
	<div class="windowbg2">
		<span class="topslice"><span></span></span>
		<ul>';

		if ($this->data['notspecialpage'])
			echo '
			<li id="t-whatlinkshere">
				<a href="', htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href']), '"', $this->skin->tooltipAndAccesskey('t-whatlinkshere'), '>', 
					$this->msg_ret('whatlinkshere'), '
				</a>
			</li>', ($this->data['nav_urls']['recentchangeslinked'] ? '
			<li id="t-recentchangeslinked">
				<a href="' . htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href']) . '"' . $this->skin->tooltipAndAccesskey('t-recentchangeslinked') . '>' . 
					$this->msg_ret('recentchangeslinked-toolbox') . '
				</a>
			</li>' : '');

		if (isset($this->data['nav_urls']['trackbacklink']) && $this->data['nav_urls']['trackbacklink'])
			echo '
			<li id="t-trackbacklink">
				<a href="', htmlspecialchars($this->data['nav_urls']['trackbacklink']['href']), '"', $this->skin->tooltipAndAccesskey('t-trackbacklink'), '>
					', $this->msg_ret('trackbacklink'), '
				</a>
			</li>';

		if ($this->data['feeds'])
		{
			echo '
			<li id="feedlinks">';
			foreach($this->data['feeds'] as $key => $feed)
				echo '
				<a id="', Sanitizer::escapeId('feed-' . $key). '" href="', htmlspecialchars($feed['href']), '" rel="alternate" type="application/', $key, '+xml" class="feedlink"', $this->skin->tooltipAndAccesskey('feed-'.$key), '>', htmlspecialchars($feed['text']), '</a>&nbsp;';
			echo '
			</li>';
		}

		foreach (array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special)
			if($this->data['nav_urls'][$special])
				echo '
			<li id="t-', $special, '">
				<a href="', htmlspecialchars($this->data['nav_urls'][$special]['href']), '"', $this->skin->tooltipAndAccesskey('t-'.$special), '>', $this->msg_ret($special), '</a>
			</li>';

		if (!empty($this->data['nav_urls']['print']['href']))
			echo '
			<li id="t-print">
				<a href="', htmlspecialchars($this->data['nav_urls']['print']['href']), '" rel="alternate"', $this->skin->tooltipAndAccesskey('t-print'), '>', $this->msg_ret('printableversion'), '</a>
			</li>';

		if (!empty($this->data['nav_urls']['permalink']['href']))
			echo '
			<li id="t-permalink">
				<a href="', htmlspecialchars($this->data['nav_urls']['permalink']['href']), '"', $this->skin->tooltipAndAccesskey('t-permalink'), '>', $this->msg_ret('permalink'), '</a></li>';
		elseif ($this->data['nav_urls']['permalink']['href'] === '')
			echo '
			<li id="t-ispermalink"', $this->skin->tooltip('t-ispermalink'), '>', $this->msg_ret('permalink'), '</li>';

		wfRunHooks('SMF_CurveTemplateToolboxEnd', array(&$this));
		wfRunHooks('SkinTemplateToolboxEnd', array(&$this));
		
		echo '
		</ul>
		<span class="botslice"><span></span></span>
	</div>
	<br />';
	}

	/*************************************************************************************************/
	function languageBox ()
	{
		if(!$this->data['language_urls'])
			return;

		echo '
	<h3', $this->html('userlangattributes'), ' class="catbg"><span class="left"></span>', $this->msg_ret('otherlanguages'), '</h3>
	<div class="windowbg2">
		<span class="topslice"><span></span></span>
		<ul>';

		foreach($this->data['language_urls'] as $langlink)
		{
			echo '
            <li class="', htmlspecialchars($langlink['class']), '">
				<a href="', htmlspecialchars($langlink['href']), '">', $langlink['text'], '</a>
			</li>';
		}

		echo '
		</ul>
		<span class="botslice"><span></span></span>
	</div>
	<br />';
	}

	/*************************************************************************************************/
	function customBox ($bar, $cont)
	{
		$out = wfMsg($bar);
		echo '
	<h3 class="catbg"><span class="left"></span>', (wfEmptyMsg($bar, $out) ? htmlspecialchars($bar) : htmlspecialchars($out)), '</h3>
	<div class="windowbg2" id="', Sanitizer::escapeId('p-' . $bar), '"', $this->skin->tooltip('p-' . $bar), '>
		<span class="topslice"><span></span></span>';

		if (is_array($cont))
		{
			echo '
         <ul>';

			foreach($cont as $key => $val)
			{
				echo '
			<li id="', Sanitizer::escapeId($val['id']), '"', ($val['active'] ? ' class="active" ' : ''), '>
				<a href="', htmlspecialchars($val['href']), '"', $this->skin->tooltipAndAccesskey($val['id']), '>', htmlspecialchars($val['text']), '</a></li>';
			}

			echo '
         </ul>';
		} 
		else
			// allow raw HTML block to be defined by extensions
			echo $cont;

		echo '
		<span class="botslice"><span></span></span>
	</div>
	<br />';
	}

	// Why is there no function that does what msg() does but returns it?
	function msg_ret ($str)
	{
		return htmlspecialchars($this->translator->translate($str));
	}

	// Same thing for text()!
	function text_ret ($str)
	{
		return htmlspecialchars($this->data[$str]);
	}

	function site_menu()
	{
		global $wgSMFPath, $user_settings, $context, $scripturl, $txt, $user_info, $sourcedir, $section, $menulink;

		// Setup our menu stuff.
		$section = $menulink = 'wiki';
		require_once($wgSMFPath . '/Settings.php');
		require_once($sourcedir . '/Subs-Site.php');
		require_once($wgSMFPath . '/Themes/smsite2/languages/Site.english.php');

		// First, try our SMF groups.
		$user_info['groups'] = !empty($user_settings['smf_groups']) ? $user_settings['smf_groups'] : array();
		$scripturl = 'http://www.simplemachines.org/community/index.php';

		// Now call our menu.
		setupSiteMenuContext();

		echo '
			<div id="site_menu" class="align_right">
				<ul class="dropmenu" id="site_nav">';

		// This will be fun.	
		foreach ($context['sitemenu_buttons'] as $act => $button)
		{
			if (empty($button['show']))
				continue;
	
			echo '
					<li id="site_button_', $act, '">
						<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
							<span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel" title="', isset($button['title_long']) ? $button['title_long'] : $button['title'], '">', $button['title'], '</span>
						</a>';
	
			if (!empty($button['menu_show_sub']) && !empty($button['sub_buttons']))
			{
				echo '
						<ul>';
	
				foreach ($button['sub_buttons'] as $childbutton)
				{
					if (!empty($childbutton['hide_in_menu']))
						continue;
	
					echo '
							<li>
								<a href="', $childbutton['href'], '"', isset($childbutton['target']) ? ' target="' . $childbutton['target'] . '"' : '', '>
									<span', isset($childbutton['is_last']) ? ' class="last"' : '', '>', $childbutton['title'], !empty($childbutton['sub_buttons']) ? '...' : '', '</span>
								</a>';
	
					// 3rd level menus :)
					if (!empty($childbutton['menu_show_sub']) && !empty($childbutton['sub_buttons']))
					{
						echo '
								<ul>';
	
						foreach ($childbutton['sub_buttons'] as $grandchildbutton)
						{
							if (!empty($grandchildbutton['hide_in_menu']))
								continue;
	
	
							echo '
									<li>
										<a', !empty($grandchildbutton['active_button']) ? ' class="active"' : '', ' href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
											<span', isset($grandchildbutton['is_last']) ? ' class="last"' : '', '>', $grandchildbutton['title'], '</span>
										</a>
									</li>';
						}
	
						echo '
								</ul>';
					}
	
					echo '
							</li>';
				}
				echo '
						</ul>';
			}
			echo '
					</li>';
		}
	
		echo '
				</ul>
			</div>';	
	}

	// Show me the money!
	function show_ad()
	{
		global $context;

		if (!file_exists('/home/sites/adsystem.simplemachines.org/public_html/www/delivery/alocal.php'))
			return;
	
		echo '<div id="siteadbanner" class="adbanner align_right"><div id="advert_notice">Advertisement:</div>';
		//<!--/* OpenX Local Mode Tag v2.6.3 */-->

		// No need to switch really.
		$zone = 3;
	
		// Uncomment this during an openx upgrade.
// !! THIS IS LIKE THIS UNTIL WIKI IS TRUELY LIVE SO WE DON'T WASTE AD SPACE HERE.
//		$zone = -1;
	
		if ($zone == -1)
			echo '<img src="http://www.simplemachines.org/images/ad_banner_curve.png" alt="Advertise with us!" />';
		else
		{
			// It seems phpAdNews will use a combat code for register globals, the problem is that it allows $_GET['context'].
			$oldContext = $context;
			define('MAX_PATH', '/home/sites/adsystem.simplemachines.org/public_html');
			if (@include_once(MAX_PATH . '/www/delivery/alocal.php'))
			{
				if (!isset($phpAds_context))
					$phpAds_context = array();
				$phpAds_raw = view_local('', $zone, 0, 0, '', '', '0', $phpAds_context, '');
			}
	                echo '<!-- ', $phpAds_raw['bannerid'], ' -->', $phpAds_raw['html'];
	
			// Revert!
			$context = $oldContext;
		}
	
		echo '</div>';
	
		// Fix the timezone because OpenX doesn't reset it.
		date_default_timezone_set('America/New_York');
	}
} // end of class