diff options
author | jim-p <jimp@pfsense.org> | 2012-11-02 10:47:50 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-11-02 10:50:35 -0400 |
commit | 1e1e1ec8b1bf4c7bc0737c1caa82ff4f0a6a922e (patch) | |
tree | 36efab59fa4a7d2f899c7159d76121bebb737767 /etc/inc/util.inc | |
parent | 158f0e7de9c2b4bfb90b7f535e219a144360a51a (diff) | |
download | pfsense-1e1e1ec8b1bf4c7bc0737c1caa82ff4f0a6a922e.zip pfsense-1e1e1ec8b1bf4c7bc0737c1caa82ff4f0a6a922e.tar.gz |
Make a function to get the current theme and use it everywhere rather than duplicating code or missing functions. (Fixes forced themes using the wrong theme for login screen)
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index e7a0734..94e8553 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1852,4 +1852,27 @@ function setup_library_paths() { } } +function get_current_theme() { + global $config, $g; + /* + * if user has selected a custom template, use it. + * otherwise default to pfsense tempalte + */ + if (($g["disablethemeselection"] === true) && !empty($g["default_theme"]) && (is_dir($g["www_path"].'/themes/'.$g["default_theme"]))) + $theme = $g["default_theme"]; + elseif($config['theme'] <> "" && (is_dir($g["www_path"].'/themes/'.$config['theme']))) + $theme = $config['theme']; + else + $theme = "pfsense"; + /* + * If this device is an apple ipod/iphone + * switch the theme to one that works with it. + */ + $lowres_ua = array("iPhone", "iPod", "iPad", "Android", "BlackBerry", "Opera Mini", "Opera Mobi", "PlayBook"); + foreach($lowres_ua as $useragent) + if(strstr($_SERVER['HTTP_USER_AGENT'], $useragent)) + $theme = (empty($g['theme_lowres']) && (is_dir($g["www_path"].'/themes/'.$g['theme_lowres']))) ? "pfsense" : $g['theme_lowres']; + return $theme; +} + ?> |