diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 4526904df..969e87e54 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -675,4 +675,26 @@ function get_current_theme() { return $current_theme; } +function validate_current_theme() { + $theme_loc = 'wp-content/themes'; + $theme_root = ABSPATH . $theme_loc; + + $template = get_settings('template'); + $stylesheet = get_settings('stylesheet'); + + if (($template != 'default') && (! file_exists("$theme_root/$template/index.php"))) { + update_option('template', 'default'); + update_option('stylesheet', 'default'); + return false; + } + + if (($stylesheet != 'default') && (! file_exists("$theme_root/$stylesheet/style.css"))) { + update_option('template', 'default'); + update_option('stylesheet', 'default'); + return false; + } + + return true; +} + ?> \ No newline at end of file diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 667aec7d1..b4b61a88e 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -28,7 +28,9 @@ if ($user_level < 9) die (__('Sorry, you must be at least a level 9 user to modify themes.')); ?> - + +

+