<?php
// Get the contents man.
// The contents.
if ($boardurl != 'http://svn.test')
$contents =
str_replace('http://svn.test',
$boardurl,
$contents);
// Only do the Theme changer in certain cases.
if (!
isset($_REQUEST['action']) || !
in_array($_REQUEST['action'],
array('xmlhttp',
'.xml',
'viewsmfile',
'viewquery',
'verificationcode',
'suggest',
'smstats',
'quickmod',
'quickmod2',
'quotefast',
'openidreturn',
'jsoption',
'jsmodify',
'jseditor'))) themechanger($contents);
function themechanger(&$contents)
{
if (empty($_SERVER['REQUEST_URL'])) return;
// Figure out our location easily.
$location =
preg_replace('~[;|?]theme=(\d+)~i',
'',
$_SERVER['REQUEST_URL']);
if (strpos($location,
'?') !==
false) $location = $location . ';';
else
$location = $location . '?';
// Is the current theme, wrong!
if (isset($_REQUEST['theme'])) $user_info['theme'] = (int) $_REQUEST['theme'];
elseif (!
empty($_SESSION['id_theme'])) $user_info['theme'] = (int) $_SESSION['id_theme'];
// Start.
$thestring = '
<div id="svn_theme_changer" style="position: absolute; top:1em; left: 40em; color:red; z-index:999; display: none;">
<form method="get" action="javascript://void;">
<select name="theme" onchange="location=\''. $location . 'theme=\' + this.options[this.selectedIndex].value">';
// Go database!
$request = $smcFunc['db_query']('', '
SELECT value, id_theme
FROM {db_prefix}themes
WHERE id_theme != {int:no_theme}
AND id_member = {int:guest_id}
AND variable = {string:theme_name}',
'no_theme' => 0,
'guest_id' => 0,
'theme_name' => 'name',
));
while ($row = $smcFunc['db_fetch_assoc']($request))
$thestring .= '
<option value="' . $row['id_theme'] . '"' . ($user_info['theme'] == $row['id_theme'] ? ' selected="selected"' : ''). '>' . $row['value'] . '</option>';
$thestring .= '
</select>
</form>
</div>
<div style="position: absolute; top:0; left: 0; right: 0; color:red; z-index:999; dislay: none;">
<div id="svn_theme_changer_show" style="display: block; float: right;" ><a href="#1" onclick="document.getElementById(\'svn_theme_changer\').style.display = \'\'; document.getElementById(\'svn_theme_changer_show\').style.display = \'none\'; document.getElementById(\'svn_theme_changer_hide\').style.display = \'\';"><img src="http://svn.test/Themes/default/images/smiley_select_spot.gif" alt="expand" /></a></div>
<div id="svn_theme_changer_hide" style="display: none; float: right;"><a href="#2" onclick="document.getElementById(\'svn_theme_changer\').style.display = \'none\'; document.getElementById(\'svn_theme_changer_show\').style.display = \'\'; document.getElementById(\'svn_theme_changer_hide\').style.display = \'none\';"><img src="http://svn.test/Themes/default/images/board_select_spot.gif" alt="collapse" /></a></div></div>';
// board_select_spot.gif collapse
// smiley_select_spot.gif expand
// Hack out and display the few themes we have quickly.
$contents =
str_replace('<body>',
'<body>' .
$thestring,
$contents);
return $contents;
}
?>