use standard header for theme manager

This commit is contained in:
Marc Delisle
2004-06-20 13:01:30 +00:00
parent 7708aba605
commit 38e93a4736
2 changed files with 125 additions and 105 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2004-06-20 Marc Delisle <lem9@users.sourceforge.net>
* themes.php: use standard headers. A iso-8859-1 charset was hardcoded
in this script, but it's better to use libraries/header_http.inc.php
2004-06-18 Marc Delisle <lem9@users.sourceforge.net> 2004-06-18 Marc Delisle <lem9@users.sourceforge.net>
* themes/original/img/item*.png, themes/original/css/theme_right.css.php, * themes/original/img/item*.png, themes/original/css/theme_right.css.php,
libraries/common.lib.php, libraries/display_export.lib.php, libraries/common.lib.php, libraries/display_export.lib.php,

View File

@@ -1,119 +1,135 @@
<?php <?php
/* get some globals */
require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/grab_globals.lib.php');
require_once('./libraries/common.lib.php'); require_once('./libraries/common.lib.php');
/* Theme Select */ /* Theme Select */
$path_to_themes = './' . $cfg['ThemePath'] . '/'; $path_to_themes = './' . $cfg['ThemePath'] . '/';
require_once('./libraries/select_theme.lib.php');
/* set language and charset */
require_once('./libraries/header_http.inc.php');
/* Gets the font sizes to use */
PMA_setFontSizes();
/* remove vertical scroll bar bug in ie */
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">";
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
<title>phpMyAdmin - <?php echo ($strTheme ? $strTheme : 'Theme / Style'); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <head>
<style type="text/css"> <title>phpMyAdmin <?php echo PMA_VERSION; ?></title>
<!-- <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
body { <meta http-equiv="imagetoolbar" content="no">
font-family: Verdana, Arial, Helvetica, sans-serif; <script language="JavaScript" type="text/javascript">
font-size: 12px; <!--
background-color: #666699; /* added 2004-06-10 by Michael Keck
* we need this for Backwards-Compatibility and resolving problems
* with non DOM browsers, which may have problems with css 2 (like NC 4)
*/
var isDOM = (typeof(document.getElementsByTagName) != 'undefined'
&& typeof(document.createElement) != 'undefined')
? 1 : 0;
var isIE4 = (typeof(document.all) != 'undefined'
&& parseInt(navigator.appVersion) >= 4)
? 1 : 0;
var isNS4 = (typeof(document.layers) != 'undefined')
? 1 : 0;
var capable = (isDOM || isIE4 || isNS4)
? 1 : 0;
// Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
if (capable) {
if (typeof(window.opera) != 'undefined') {
var browserName = ' ' + navigator.userAgent.toLowerCase();
if ((browserName.indexOf('konqueror 7') == 0)) {
capable = 0;
} }
td { } else if (typeof(navigator.userAgent) != 'undefined') {
font-family: Verdana, Arial, Helvetica, sans-serif; var browserName = ' ' + navigator.userAgent.toLowerCase();
font-size: 12px; if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) {
capable = 0;
} }
th{ } // end if... else if...
font-family: Verdana, Arial, Helvetica, sans-serif; } // end if
font-size: 16px; document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&amp;js_frame=right&amp;js_isDOM=' + isDOM + '" />');
font-weight: bold; //-->
} </script>
a:hover{ <noscript>
text-decoration: none; <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&amp;js_frame=right" />
} </noscript>
hr{ <script language="JavaScript">
color: #000000; <!--
background-color: #000000;
border: 0;
height: 1px;
}
img{
border: 1px solid #000000;
}
-->
</style>
<script language="JavaScript">
<!--
function takeThis(what){ function takeThis(what){
if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) { if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) {
window.opener.document.forms['setTheme'].elements['set_theme'].value = what; window.opener.document.forms['setTheme'].elements['set_theme'].value = what;
window.opener.document.forms['setTheme'].submit(); window.opener.document.forms['setTheme'].submit();
self.close(); self.close();
} else { } else {
alert('No theme support, please check your configs!'); alert('No theme support, please check your configs\nand/or your themes in <?php echo './' . $cfg['ThemePath']; ?>');
self.close(); self.close();
} }
} }
//--> //-->
</script> </script>
</head> </head>
<body bgcolor="#666699" text="#FFFFFF" link="#FF9900" vlink="#FF9900" alink="#FF9900" leftmargin="0" topmargin="0" marginwidth="3" marginheight="3"> <body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
<table width="480" border="0" align="center" cellpadding="2" cellspacing="0"> <table border="0" align="center" cellpadding="3" cellspacing="1">
<tr> <tr>
<th><b>phpMyAdmin - <?php echo ($strTheme ? $strTheme : 'Theme / Style'); ?></b></th> <th class="tblHeaders"><b>phpMyAdmin - <?php echo ($strTheme ? $strTheme : 'Theme / Style'); ?></b></th>
</tr> </tr>
<tr><td>&nbsp;</td></tr>
<?php
/*
$org_theme_screen = $path_to_themes . 'original/screen.png';
if(@file_exists($org_theme_screen)){ // check if original theme have a screen
<tr> <tr>
<td> <td><img src="./images/spacer.gif" width="1" height="1" border="0" /></td>
</tr>
<?php <?php
echo '<b>ORIGINAL</b><br /><br />'; if ($handleThemes = opendir($path_to_themes)) { // open themes
echo '<div align="center"><img src="' . $org_theme_screen . '" border="0" alt="Original - Theme" />';
echo '<script language="JavaScript"><!--' . "\n";
echo ' document.write("<br />[ <b><a href=\"#top\" onclick=\"takeThis(\'original\'); return false;\">';
echo (isset($strTakeIt) ? $strTakeIt : 'take it');
echo '</a></b> ]");' . "\n";
echo '//--></script></div><br />';
?>
</td>
</tr>
} // end original theme screen
*/
if ($handleThemes = opendir($path_to_themes)) { // open themes
while (false !== ($PMA_Theme = readdir($handleThemes))) { // get screens while (false !== ($PMA_Theme = readdir($handleThemes))) { // get screens
if ($PMA_Theme != "." && $PMA_Theme != "..") { // && !strstr($PMA_Theme,'original')) { // but not the original if ($PMA_Theme != "." && $PMA_Theme != "..") { // && !strstr($PMA_Theme,'original')) { // but not the original
$screen_directory = $path_to_themes . $PMA_Theme; $screen_directory = $path_to_themes . $PMA_Theme;
if (is_dir($screen_directory) && @file_exists($screen_directory.'/screen.png')) { // if screen exists then output if (is_dir($screen_directory) && @file_exists($screen_directory.'/screen.png')) { // if screen exists then output
?> ?>
<tr> <tr>
<td><hr size="1" noshade="noshade" /></td> <th align="left">
<?php
echo '<b>' . strtoupper(preg_replace("/_/"," ",$PMA_Theme)) . '</b>';
?>
</th>
</tr> </tr>
<tr> <tr>
<td> <td align="center" bgcolor="<?php echo $cfg['BgcolorOne']; ?>" class="navNorm">
<script language="JavaScript">
<!--
document.write('<a href="#top" onclick="takeThis(\'<?php echo $PMA_Theme; ?>\'); return false;">');
document.write('<img src="<?php echo $screen_directory; ?>/screen.png" border="1" ');
if (document.getElementById) {
document.write('style="border: 1px solid #000000;" ');
}
document.write('alt="<?php echo strtoupper(preg_replace("/_/"," ",$PMA_Theme)); ?> - Theme" ');
document.write('title="<?php echo strtoupper(preg_replace("/_/"," ",$PMA_Theme)); ?> - Theme" />');
document.write('</a><br />');
document.write('[ <b><a href="#top" onclick="takeThis(\'<?php echo $PMA_Theme; ?>\'); return false;">');
document.write('<?php echo (isset($strTakeIt) ? addslashes($strTakeIt) : 'take it'); ?>');
document.write('</a></b> ]');
//-->
</script>
<noscript>
<?php <?php
echo '<b>' . strtoupper(preg_replace("/_/"," ",$PMA_Theme)) . '</b><br /><br />'; echo '<img src="' . $screen_directory . '/screen.png" border="1" alt="' . strtoupper(preg_replace("/_/"," ",$PMA_Theme)) . ' - Theme" />';
echo '<div align="center"><img src="' . $screen_directory . '/screen.png" border="0" alt="' . strtoupper(preg_replace("/_/"," ",$PMA_Theme)) . ' - Theme" />';
echo '<script language="JavaScript"><!--' . "\n";
echo ' document.write("<br />[ <b><a href=\"#top\" onclick=\"takeThis(\'' . $PMA_Theme . '\'); return false;\">';
echo (isset($strTakeIt) ? $strTakeIt : 'take it');
echo '</a></b> ]");' . "\n";
echo '//--></script></div><br />';
?> ?>
</noscript>
</td> </td>
</tr> </tr>
<tr><td><img src="./images/spacer.gif" width="1" height="1" border="0" /></td></tr>
</tr>
<?php <?php
} // end 'screen output' } // end 'screen output'
} // end 'check theme' } // end 'check theme'
} // end 'get screens' } // end 'get screens'
closedir($handleThemes); closedir($handleThemes);
} // end 'open themes' } // end 'open themes'
?> ?>
</table> </table>
<br /> </body>
</body>
</html> </html>