diff options
author | jim-p <jimp@pfsense.org> | 2012-11-02 11:06:52 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-11-02 11:06:52 -0400 |
commit | 7e669778016a5fb09ea6ba913cac7b19ab13c19b (patch) | |
tree | 014b9164d6aaed9e64b31353643b38e81daab1b2 /etc | |
parent | 7cf76e8bb53dbb637f2800150380601105fb1ce2 (diff) | |
download | pfsense-7e669778016a5fb09ea6ba913cac7b19ab13c19b.zip pfsense-7e669778016a5fb09ea6ba913cac7b19ab13c19b.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)
Conflicts:
etc/inc/util.inc
usr/local/www/head.inc
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/authgui.inc | 4 | ||||
-rw-r--r-- | etc/inc/util.inc | 23 |
2 files changed, 25 insertions, 2 deletions
diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc index 8c9e3fa..e950345 100644 --- a/etc/inc/authgui.inc +++ b/etc/inc/authgui.inc @@ -92,7 +92,7 @@ if (!$_SESSION['Post_Login']) { */ function display_error_form($http_code, $desc) { global $config, $g; - $g['theme'] = $config['theme']; + $g['theme'] = get_current_theme(); if(isAjax()) { echo "Error: {$http_code} Description: {$desc}"; return; @@ -150,7 +150,7 @@ function display_error_form($http_code, $desc) { function display_login_form() { require_once("globals.inc"); global $config, $g; - $g['theme'] = $config['theme']; + $g['theme'] = get_current_theme(); unset($input_errors); diff --git a/etc/inc/util.inc b/etc/inc/util.inc index fcfc21e..0f8d78a 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1541,4 +1541,27 @@ function get_staticroutes($returnsubnetsonly = false) { return $allstaticroutes; } } + +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; +} ?> |