summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-01-02 16:24:28 +0000
committerDries Buytaert <dries@buytaert.net>2004-01-02 16:24:28 +0000
commitf6082cda98eab9732801e815a05aad1017446b12 (patch)
tree2c30aabd47f518b47d94c6378116ea8235c23093 /includes
parent604064b52395da6713b6e579f7d2d0ad219b8148 (diff)
downloadbrdo-f6082cda98eab9732801e815a05aad1017446b12.tar.gz
brdo-f6082cda98eab9732801e815a05aad1017446b12.tar.bz2
- Fixed bug 4916: users can have disabled themes. Modified patch by Mathias.
1. Remove the theme object. There is no need to keep it around since meta information for a theme can be retrieved via list_themes(). All we really need is the theme name. 2. Check if the user selected theme is enabled during theme initialization. This is the easiest place to put the check and doesn't mess with the user's settings. Their database profile will still contain the disabled theme selection, but they will be rendering the default admin-selected theme until their chosen theme is once again activated.
Diffstat (limited to 'includes')
-rw-r--r--includes/theme.inc26
1 files changed, 14 insertions, 12 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index 78875509e..53d1dafc3 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -32,7 +32,7 @@ function theme_help($section) {
}
/**
- * Initialized the theme system.
+ * Initialize the theme system by loading the theme.
*
* @return the name of the currently selected theme.
*/
@@ -40,16 +40,15 @@ function init_theme() {
global $user;
$themes = list_themes();
- $name = $user->theme ? $user->theme : variable_get("theme_default", 0);
- $theme->path = "";
- $theme->name = "";
+ /*
+ ** Only select the user selected theme if it is availible in the
+ ** list of enabled themes.
+ */
- if (is_object($themes[$name])) {
- include_once($themes[$name]->filename);
- $theme->path = dirname($themes[$name]->filename);
- $theme->name = $name;
- }
+ $theme = $themes[$user->theme] ? $user->theme : variable_get("theme_default", 0);
+
+ include_once($themes[$theme]->filename);
return $theme;
}
@@ -97,8 +96,8 @@ function theme() {
$args = func_get_args();
$function = array_shift($args);
- if (($theme->name != "") && (function_exists($theme->name ."_". $function))) {
- return call_user_func_array($theme->name ."_". $function, $args);
+ if (($theme != "") && (function_exists($theme ."_". $function))) {
+ return call_user_func_array($theme ."_". $function, $args);
}
elseif (function_exists("theme_". $function)){
return call_user_func_array("theme_". $function, $args);
@@ -112,7 +111,10 @@ function theme() {
*/
function path_to_theme() {
global $theme;
- return $theme->path;
+
+ $themes = list_themes();
+
+ return dirname($themes[$theme]->filename);
}
/**