diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-03-11 23:08:01 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-03-11 23:08:01 +0000 |
commit | 7a88330d9d38cc556d57dd746cd2ad1b7916a199 (patch) | |
tree | d4f74e33aa80c7d1ee935118e3799e7034f7a619 /includes | |
parent | 4079abab3b7928ff245dda0004424702151df633 (diff) | |
download | brdo-7a88330d9d38cc556d57dd746cd2ad1b7916a199.tar.gz brdo-7a88330d9d38cc556d57dd746cd2ad1b7916a199.tar.bz2 |
- Committed slightly modified version of Kjartan's theme.inc patch: Drupal
will now barf when trying to instantiate a non-existing theme class.
This should help to identify broken themes, and to track down theme system
related bugs.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/theme.inc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 56ed30c1f..f4ef6a08c 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -116,9 +116,13 @@ function theme_error($message) { return "<div style=\"color: red;\">$message</div>"; } -function theme_list() { +function theme_list($refresh = 0) { static $list; + if ($refresh) { + unset($list); + } + if (!$list) { $list = array(); $result = db_query("SELECT * FROM system where type = 'theme' AND status = '1' ORDER BY name"); @@ -142,16 +146,18 @@ function theme_init() { $themes = theme_list(); $name = $user->theme ? $user->theme : variable_get("theme_default", 0); + if (is_object($themes[$name])) { include_once($themes[$name]->filename); - $theme_class = "Theme_$name"; - @$obj =& new $theme_class(); - $obj->path = dirname($themes[$name]->filename); - return $obj; + $class = "Theme_$name"; + $instance =& new $class(); + $instance->path = dirname($themes[$name]->filename); + } + else { + $instance =& new BaseTheme; } - @$obj =& new BaseTheme; - return $obj; + return $instance; } /** |