From 7a88330d9d38cc556d57dd746cd2ad1b7916a199 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 11 Mar 2003 23:08:01 +0000 Subject: - 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. --- includes/theme.inc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'includes') 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 "
$message
"; } -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; } /** -- cgit v1.2.3