00001 <?php
00002
00003
00017 function _drupal_maintenance_theme() {
00018 global $theme, $theme_key;
00019
00020
00021 if (isset($theme)) {
00022 return;
00023 }
00024
00025 require_once './includes/path.inc';
00026 require_once './includes/theme.inc';
00027 require_once './includes/common.inc';
00028 require_once './includes/unicode.inc';
00029 require_once './includes/file.inc';
00030 require_once './includes/module.inc';
00031 require_once './includes/database.inc';
00032 unicode_check();
00033
00034
00035 if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
00036 $theme = 'minnelli';
00037 }
00038 else {
00039
00040 $module_list['system']['filename'] = 'modules/system/system.module';
00041 $module_list['filter']['filename'] = 'modules/filter/filter.module';
00042 module_list(TRUE, FALSE, FALSE, $module_list);
00043 drupal_load('module', 'system');
00044 drupal_load('module', 'filter');
00045
00046 $theme = variable_get('maintenance_theme', 'minnelli');
00047 }
00048
00049 $themes = list_themes();
00050
00051
00052 $theme_key = $theme;
00053
00054
00055 $base_theme = array();
00056 $ancestor = $theme;
00057 while ($ancestor && isset($themes[$ancestor]->base_theme)) {
00058 $base_theme[] = $new_base_theme = $themes[$themes[$ancestor]->base_theme];
00059 $ancestor = $themes[$ancestor]->base_theme;
00060 }
00061 _init_theme($themes[$theme], array_reverse($base_theme), '_theme_load_offline_registry');
00062
00063
00064
00065 drupal_add_css(drupal_get_path('module', 'system') . '/defaults.css', 'module');
00066 drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module');
00067 drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css', 'module');
00068 drupal_add_css(drupal_get_path('module', 'system') . '/maintenance.css', 'module');
00069 }
00070
00074 function _theme_load_offline_registry($theme, $base_theme = NULL, $theme_engine = NULL) {
00075 $registry = _theme_build_registry($theme, $base_theme, $theme_engine);
00076 _theme_set_registry($registry);
00077 }
00078
00084 function theme_task_list($items, $active = NULL) {
00085 $done = isset($items[$active]) || $active == NULL;
00086 $output = '<ol class="task-list">';
00087 foreach ($items as $k => $item) {
00088 if ($active == $k) {
00089 $class = 'active';
00090 $done = false;
00091 }
00092 else {
00093 $class = $done ? 'done' : '';
00094 }
00095 $output .= '<li class="' . $class . '">' . $item . '</li>';
00096 }
00097 $output .= '</ol>';
00098 return $output;
00099 }
00100
00109 function theme_install_page($content) {
00110 drupal_set_header('Content-Type: text/html; charset=utf-8');
00111
00112
00113 $variables['content'] = $content;
00114
00115 $variables['show_messages'] = FALSE;
00116
00117 template_preprocess_maintenance_page($variables);
00118
00119
00120 $messages = drupal_set_message();
00121 if (isset($messages['error'])) {
00122 $title = count($messages['error']) > 1 ? st('The following errors must be resolved before you can continue the installation process') : st('The following error must be resolved before you can continue the installation process');
00123 $variables['messages'] .= '<h3>' . $title . ':</h3>';
00124 $variables['messages'] .= theme('status_messages', 'error');
00125 $variables['content'] .= '<p>' . st('Please check the error messages and <a href="!url">try again</a>.', array('!url' => request_uri())) . '</p>';
00126 }
00127
00128
00129 if (isset($messages['warning'])) {
00130 $title = count($messages['warning']) > 1 ? st('The following installation warnings should be carefully reviewed') : st('The following installation warning should be carefully reviewed');
00131 $variables['messages'] .= '<h4>' . $title . ':</h4>';
00132 $variables['messages'] .= theme('status_messages', 'warning');
00133 }
00134
00135
00136 if (isset($messages['status'])) {
00137 $title = count($messages['status']) > 1 ? st('The following installation warnings should be carefully reviewed, but in most cases may be safely ignored') : st('The following installation warning should be carefully reviewed, but in most cases may be safely ignored');
00138 $variables['messages'] .= '<h4>' . $title . ':</h4>';
00139 $variables['messages'] .= theme('status_messages', 'status');
00140 }
00141
00142
00143
00144
00145 global $theme_path;
00146 $theme_path = 'themes/garland';
00147
00148 return theme_render_template('themes/garland/maintenance-page.tpl.php', $variables);
00149 }
00150
00162 function theme_update_page($content, $show_messages = TRUE) {
00163
00164 drupal_set_header('Content-Type: text/html; charset=utf-8');
00165
00166
00167 $variables['content'] = $content;
00168 $variables['show_messages'] = $show_messages;
00169
00170 template_preprocess_maintenance_page($variables);
00171
00172
00173 $messages = drupal_set_message();
00174 if (isset($messages['warning'])) {
00175 $title = count($messages['warning']) > 1 ? 'The following update warnings should be carefully reviewed before continuing' : 'The following update warning should be carefully reviewed before continuing';
00176 $variables['messages'] .= '<h4>' . $title . ':</h4>';
00177 $variables['messages'] .= theme('status_messages', 'warning');
00178 }
00179
00180
00181
00182
00183 global $theme_path;
00184 $theme_path = 'themes/garland';
00185
00186 return theme_render_template('themes/garland/maintenance-page.tpl.php', $variables);
00187 }
00188
00205 function template_preprocess_maintenance_page(&$variables) {
00206
00207 if (theme_get_setting('toggle_favicon')) {
00208 drupal_set_html_head('<link rel="shortcut icon" href="' . check_url(theme_get_setting('favicon')) . '" type="image/x-icon" />');
00209 }
00210
00211 global $theme;
00212
00213 $theme_data = _system_theme_data();
00214 $regions = $theme_data[$theme]->info['regions'];
00215
00216
00217 foreach (array_keys($regions) as $region) {
00218
00219 $region_content = drupal_get_content($region);
00220 isset($variables[$region]) ? $variables[$region] .= $region_content : $variables[$region] = $region_content;
00221 }
00222
00223
00224 $variables['layout'] = 'none';
00225 if (!empty($variables['left'])) {
00226 $variables['layout'] = 'left';
00227 }
00228 if (!empty($variables['right'])) {
00229 $variables['layout'] = ($variables['layout'] == 'left') ? 'both' : 'right';
00230 }
00231
00232
00233 if (drupal_get_title()) {
00234 $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
00235 }
00236 else {
00237 $head_title = array(variable_get('site_name', 'Drupal'));
00238 if (variable_get('site_slogan', '')) {
00239 $head_title[] = variable_get('site_slogan', '');
00240 }
00241 }
00242 $variables['head_title'] = implode(' | ', $head_title);
00243 $variables['base_path'] = base_path();
00244 $variables['front_page'] = url();
00245 $variables['breadcrumb'] = '';
00246 $variables['feed_icons'] = '';
00247 $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE));
00248 $variables['head'] = drupal_get_html_head();
00249 $variables['help'] = '';
00250 $variables['language'] = $GLOBALS['language'];
00251 $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
00252 $variables['logo'] = theme_get_setting('logo');
00253 $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : '';
00254 $variables['mission'] = '';
00255 $variables['primary_links'] = array();
00256 $variables['secondary_links'] = array();
00257 $variables['search_box'] = '';
00258 $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
00259 $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : '');
00260 $variables['css'] = drupal_add_css();
00261 $variables['styles'] = drupal_get_css();
00262 $variables['scripts'] = drupal_get_js();
00263 $variables['tabs'] = '';
00264 $variables['title'] = drupal_get_title();
00265 $variables['closure'] = '';
00266
00267
00268 $body_classes = array();
00269 $body_classes[] = 'in-maintenance';
00270 if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
00271 $body_classes[] = 'db-offline';
00272 }
00273 if ($variables['layout'] == 'both') {
00274 $body_classes[] = 'two-sidebars';
00275 }
00276 elseif ($variables['layout'] == 'none') {
00277 $body_classes[] = 'no-sidebars';
00278 }
00279 else {
00280 $body_classes[] = 'one-sidebar sidebar-' . $variables['layout'];
00281 }
00282 $variables['body_classes'] = implode(' ', $body_classes);
00283
00284
00285
00286 if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
00287 $variables['template_file'] = 'maintenance-page-offline';
00288 }
00289 }