1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
<?php
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
* phpMyAdmin Theme Manager
* 2004-05-20: Michael Keck <mail_at_michaelkeck_dot_de>
*
* The theme manager checks the directory /themes/ for subdirectories
* wich are the themes.
* If you're building a new theme for PMA, your theme should include
* make a folder theme_name/ in the directoriy /themes which includes
* a subdirectory css/.
* In the css-directory you should (if you want) edit the follow files:
* - theme_left.css.php // includes css-styles for the left frame
* - theme_right.css.php // includes css-styles for the main frame
* - theme_print.css.php // includes css-styles for printing
*
* If you want to use default themes for left, right or print
* so you need not to build the css-file and PMA will use it's own css.
* If you want to use own images for your theme, you should make all
* images (buttons, symbols, arrows) wich are included in the default
* images directory PMA and store them into the subdirectory /img/ of
* your theme.
* Note:
* The images must be named as in the default images directory of
* PMA and they must have the same size in pixels.
* You can only use own images, if you've edit own css files.
*/
/**
* We need some elements of the superglobal $_SERVER array.
*/
require_once('./libraries/grab_globals.lib.php');
global $PHP_SELF;
/**
* theme manager
*/
$PMA_ThemeDefault = FALSE;
$PMA_ThemeAvailable = FALSE;
if ($cfg['ThemeManager']){
$PMA_ThemeAvailable = TRUE;
}
if ($PMA_ThemeAvailable == TRUE){ // check after default theme
$tmp_path_default = $cfg['ThemePath'] . '/' .$cfg['ThemeDefault'];
if (isset($cfg['ThemeDefault']) && $cfg['ThemeDefault']!='original' && is_dir($tmp_path_default)){
// default theme is not 'original'
$available_themes_choices[]=$cfg['ThemeDefault'];
$PMA_ThemeDefault = TRUE;
} else if (isset($cfg['ThemeDefault']) && $cfg['ThemeDefault']=='original'){
// default theme is 'original'
$PMA_ThemeDefault = TRUE;
}
} // end check default theme
if ($PMA_ThemeAvailable == TRUE) { // themeManager is available
/*if ($PMA_ThemeDefault == TRUE) {
// we must add default theme, because it has no directory
$available_themes_choices[]='original';
}*/
if ($handleThemes = opendir($cfg['ThemePath'])) { // check for themes directory
while (false !== ($PMA_Theme = readdir($handleThemes))) { // get themes
//if ($PMA_Theme != "." && $PMA_Theme != ".." && $PMA_Theme!='original' && $PMA_Theme!=$cfg['ThemeDefault'] && $PMA_Theme != 'CVS') { // file check
if ($PMA_Theme != "." && $PMA_Theme != ".." && $PMA_Theme!=$cfg['ThemeDefault'] && $PMA_Theme != 'CVS') { // file check
if (@is_dir($cfg['ThemePath'].'/'.$PMA_Theme)) { // check the theme
$available_themes_choices[]=$PMA_Theme;
} // end check the theme
} // end file check
} // end get themes
} // end check for themes directory
closedir($handleThemes);
} // end themeManger
if (!isset($pma_uri_parts)) { // cookie-setup if needed
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
$cookie_path = substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/'));
$is_https = (isset($pma_uri_parts['scheme']) && $pma_uri_parts['scheme'] == 'https') ? 1 : 0;
} // end cookie setup
if (isset($set_theme)) { // if user submit a theme
setcookie('pma_theme', $set_theme, time() + 60*60*24*30, $cookie_path, '', $is_https);
} else { // else check if user have a theme cookie
if (!isset($_COOKIE['pma_theme']) || empty($_COOKIE['pma_theme'])) {
if ($PMA_ThemeDefault == TRUE) {
if (basename($PHP_SELF) == 'index.php') {
setcookie('pma_theme', $cfg['ThemeDefault'], time() + 60*60*24*30, $cookie_path, '', $is_https);
}
$pmaTheme=$cfg['ThemeDefault'];
}else{
if (basename($PHP_SELF) == 'index.php') {
setcookie('pma_theme', 'original', time() + 60*60*24*30, $cookie_path, '', $is_https);
}
$pmaTheme='original';
}
} else {
$pmaTheme=$_COOKIE['pma_theme'];
if (basename($PHP_SELF) == 'index.php') {
setcookie('pma_theme', $pmaTheme, time() + 60*60*24*30, $cookie_path, '', $is_https);
}
}
} // end if
?>
|