diff options
| author | fisharebest <fisharebest@gmail.com> | 2010-11-21 16:29:46 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2010-11-21 16:29:46 +0000 |
| commit | dd2d36e1f1c1d39314a50e70d17c46815c0bc113 (patch) | |
| tree | 4fc06c16497e0555d87bacfd259ea17221db3383 /includes/session.php | |
| parent | 0ccddf9067fe32a8890325a5a78530b6f07390db (diff) | |
| download | webtrees-dd2d36e1f1c1d39314a50e70d17c46815c0bc113.tar.gz webtrees-dd2d36e1f1c1d39314a50e70d17c46815c0bc113.tar.bz2 webtrees-dd2d36e1f1c1d39314a50e70d17c46815c0bc113.zip | |
Allow certain scripts to set their own themes (e.g. new administration module)
Diffstat (limited to 'includes/session.php')
| -rw-r--r-- | includes/session.php | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/includes/session.php b/includes/session.php index 9d0c9b3c71..316b49b08a 100644 --- a/includes/session.php +++ b/includes/session.php @@ -453,33 +453,35 @@ if (WT_USER_ID) { } // Set the theme -if (get_site_setting('ALLOW_USER_THEMES')) { - // Requested change of theme? - $THEME_DIR=safe_GET('theme', get_theme_names()); - unset($_GET['theme']); - // Last theme used? - if (!$THEME_DIR && isset($_SESSION['theme_dir']) && in_array($_SESSION['theme_dir'], get_theme_names())) { - $THEME_DIR=$_SESSION['theme_dir']; - } -} -if (!$THEME_DIR) { - // User cannot choose (or has not chosen) a theme. - // 1) gedcom setting - // 2) site setting - // 3) webtrees - // 4) first one found - $THEME_DIR=get_gedcom_setting(WT_GED_ID, 'THEME_DIR'); - if (!in_array($THEME_DIR, get_theme_names())) { - $THEME_DIR=get_site_setting('THEME_DIR', 'themes/webtrees/'); - } - if (!in_array($THEME_DIR, get_theme_names())) { - $THEME_DIR='themes/webtrees/'; +if (!defined('WT_THEME_DIR')) { + if (get_site_setting('ALLOW_USER_THEMES')) { + // Requested change of theme? + $THEME_DIR=safe_GET('theme', get_theme_names()); + unset($_GET['theme']); + // Last theme used? + if (!$THEME_DIR && isset($_SESSION['theme_dir']) && in_array($_SESSION['theme_dir'], get_theme_names())) { + $THEME_DIR=$_SESSION['theme_dir']; + } } - if (!in_array($THEME_DIR, get_theme_names())) { - list($THEME_DIR)=get_theme_names(); + if (!$THEME_DIR) { + // User cannot choose (or has not chosen) a theme. + // 1) gedcom setting + // 2) site setting + // 3) webtrees + // 4) first one found + $THEME_DIR=get_gedcom_setting(WT_GED_ID, 'THEME_DIR'); + if (!in_array($THEME_DIR, get_theme_names())) { + $THEME_DIR=get_site_setting('THEME_DIR', 'themes/webtrees/'); + } + if (!in_array($THEME_DIR, get_theme_names())) { + $THEME_DIR='themes/webtrees/'; + } + if (!in_array($THEME_DIR, get_theme_names())) { + list($THEME_DIR)=get_theme_names(); + } } + define('WT_THEME_DIR', $THEME_DIR); } -define('WT_THEME_DIR', $THEME_DIR); // Remember this setting $_SESSION['theme_dir']=WT_THEME_DIR; |
