Commit 32bc8911 authored by Dries's avatar Dries

- Patch #629902 by andypost, JohnAlbin, David_Rothstein: critical bug:...

- Patch #629902 by andypost, JohnAlbin, David_Rothstein: critical bug: theme_get_setting() should return NULL for features that are disabled in a theme.
parent 866a2bae
......@@ -1152,18 +1152,12 @@ function theme_get_setting($setting_name, $theme = NULL) {
'favicon_path' => '',
// Use the IANA-registered MIME type for ICO files as default.
'favicon_mimetype' => 'image/vnd.microsoft.icon',
'main_menu' => 1,
'secondary_menu' => 1,
'toggle_logo' => 1,
'toggle_favicon' => 1,
'toggle_name' => 1,
'toggle_slogan' => 1,
'toggle_node_user_picture' => 1,
'toggle_comment_user_picture' => 1,
'toggle_comment_user_verification' => 1,
'toggle_main_menu' => 1,
'toggle_secondary_menu' => 1,
);
// Turn on all default features.
$features = _system_default_theme_features();
foreach ($features as $feature) {
$cache[$theme]['toggle_' . $feature] = 1;
}
// Get the values for the theme-specific settings from the .info files of
// the theme and all its base themes.
......@@ -1193,6 +1187,16 @@ function theme_get_setting($setting_name, $theme = NULL) {
// Get the saved theme-specific settings from the database.
$cache[$theme] = array_merge($cache[$theme], variable_get('theme_' . $theme . '_settings', array()));
// If the theme does not support a particular feature, override the global
// setting and set the value to NULL.
if (!empty($theme_object->info['features'])) {
foreach ($features as $feature) {
if (!in_array($feature, $theme_object->info['features'])) {
$cache[$theme]['toggle_' . $feature] = NULL;
}
}
}
// Generate the path to the logo image.
if ($cache[$theme]['toggle_logo']) {
if ($cache[$theme]['default_logo']) {
......
......@@ -2316,17 +2316,7 @@ function _system_rebuild_theme_data() {
'page_bottom' => 'Page bottom',
),
'description' => '',
'features' => array(
'comment_user_picture',
'comment_user_verification',
'favicon',
'logo',
'name',
'node_user_picture',
'slogan',
'main_menu',
'secondary_menu',
),
'features' => _system_default_theme_features(),
'screenshot' => 'screenshot.png',
'php' => DRUPAL_MINIMUM_PHP,
);
......@@ -2432,6 +2422,23 @@ function system_rebuild_theme_data() {
return $themes;
}
/**
* Returns an array of default theme features.
*/
function _system_default_theme_features() {
return array(
'logo',
'favicon',
'name',
'slogan',
'node_user_picture',
'comment_user_picture',
'comment_user_verification',
'main_menu',
'secondary_menu',
);
}
/**
* Find all the base themes for the specified theme.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment