| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
function _drupal_maintenance_theme() {
|
| 18 |
global $theme, $theme_key;
|
| 19 |
|
| 20 |
|
| 21 |
if (isset($theme)) {
|
| 22 |
return;
|
| 23 |
}
|
| 24 |
|
| 25 |
require_once DRUPAL_ROOT . '/includes/path.inc';
|
| 26 |
require_once DRUPAL_ROOT . '/includes/theme.inc';
|
| 27 |
require_once DRUPAL_ROOT . '/includes/common.inc';
|
| 28 |
require_once DRUPAL_ROOT . '/includes/unicode.inc';
|
| 29 |
require_once DRUPAL_ROOT . '/includes/file.inc';
|
| 30 |
require_once DRUPAL_ROOT . '/includes/module.inc';
|
| 31 |
require_once DRUPAL_ROOT . '/includes/database/database.inc';
|
| 32 |
unicode_check();
|
| 33 |
|
| 34 |
|
| 35 |
if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
|
| 36 |
$theme = 'minnelli';
|
| 37 |
}
|
| 38 |
|
| 39 |
if (!db_is_active()) {
|
| 40 |
|
| 41 |
|
| 42 |
$module_list['system']['filename'] = 'modules/system/system.module';
|
| 43 |
$module_list['filter']['filename'] = 'modules/filter/filter.module';
|
| 44 |
module_list(TRUE, FALSE, $module_list);
|
| 45 |
drupal_load('module', 'system');
|
| 46 |
drupal_load('module', 'filter');
|
| 47 |
}
|
| 48 |
|
| 49 |
$theme = variable_get('maintenance_theme', 'minnelli');
|
| 50 |
|
| 51 |
|
| 52 |
$themes = list_themes();
|
| 53 |
|
| 54 |
|
| 55 |
$theme_key = $theme;
|
| 56 |
|
| 57 |
|
| 58 |
$base_theme = array();
|
| 59 |
$ancestor = $theme;
|
| 60 |
while ($ancestor && isset($themes[$ancestor]->base_theme)) {
|
| 61 |
$base_theme[] = $new_base_theme = $themes[$themes[$ancestor]->base_theme];
|
| 62 |
$ancestor = $themes[$ancestor]->base_theme;
|
| 63 |
}
|
| 64 |
_drupal_theme_initialize($themes[$theme], array_reverse($base_theme), '_theme_load_offline_registry');
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
drupal_add_css(drupal_get_path('module', 'system') . '/defaults.css');
|
| 69 |
drupal_add_css(drupal_get_path('module', 'system') . '/system.css');
|
| 70 |
drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css');
|
| 71 |
drupal_add_css(drupal_get_path('module', 'system') . '/maintenance.css');
|
| 72 |
drupal_add_css(drupal_get_path('module', 'system') . '/admin.css');
|
| 73 |
}
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
function _theme_load_offline_registry($theme, $base_theme = NULL, $theme_engine = NULL) {
|
| 79 |
$registry = _theme_build_registry($theme, $base_theme, $theme_engine);
|
| 80 |
_theme_set_registry($registry);
|
| 81 |
}
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
function theme_task_list($items, $active = NULL) {
|
| 89 |
$done = isset($items[$active]) || $active == NULL;
|
| 90 |
$output = '<ol class="task-list">';
|
| 91 |
foreach ($items as $k => $item) {
|
| 92 |
if ($active == $k) {
|
| 93 |
$class = 'active';
|
| 94 |
$done = FALSE;
|
| 95 |
}
|
| 96 |
|
| 97 |
$class = $done ? 'done' : '';
|
| 98 |
|
| 99 |
$output .= '<li class="' . $class . '">' . $item . '</li>';
|
| 100 |
}
|
| 101 |
$output .= '</ol>';
|
| 102 |
return $output;
|
| 103 |
}
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
function theme_install_page($content) {
|
| 114 |
drupal_set_header('Content-Type', 'text/html; charset=utf-8');
|
| 115 |
|
| 116 |
|
| 117 |
$variables['content'] = $content;
|
| 118 |
|
| 119 |
$variables['show_messages'] = FALSE;
|
| 120 |
|
| 121 |
|
| 122 |
template_preprocess($variables, 'install_page');
|
| 123 |
template_preprocess_maintenance_page($variables);
|
| 124 |
template_process($variables, 'install_page');
|
| 125 |
|
| 126 |
|
| 127 |
$messages = drupal_set_message();
|
| 128 |
if (isset($messages['error'])) {
|
| 129 |
$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');
|
| 130 |
$variables['messages'] .= '<h3>' . $title . ':</h3>';
|
| 131 |
$variables['messages'] .= theme('status_messages', 'error');
|
| 132 |
$variables['content'] .= '<p>' . st('Please check the error messages and <a href="!url">try again</a>.', array('!url' => request_uri())) . '</p>';
|
| 133 |
}
|
| 134 |
|
| 135 |
|
| 136 |
if (isset($messages['warning'])) {
|
| 137 |
$title = count($messages['warning']) > 1 ? st('The following installation warnings should be carefully reviewed') : st('The following installation warning should be carefully reviewed');
|
| 138 |
$variables['messages'] .= '<h4>' . $title . ':</h4>';
|
| 139 |
$variables['messages'] .= theme('status_messages', 'warning');
|
| 140 |
}
|
| 141 |
|
| 142 |
|
| 143 |
if (isset($messages['status'])) {
|
| 144 |
$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');
|
| 145 |
$variables['messages'] .= '<h4>' . $title . ':</h4>';
|
| 146 |
$variables['messages'] .= theme('status_messages', 'status');
|
| 147 |
}
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
global $theme_path;
|
| 153 |
$theme_path = 'themes/garland';
|
| 154 |
|
| 155 |
return theme_render_template('themes/garland/maintenance-page.tpl.php', $variables);
|
| 156 |
}
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
function theme_update_page($content, $show_messages = TRUE) {
|
| 170 |
|
| 171 |
drupal_set_header('Content-Type', 'text/html; charset=utf-8');
|
| 172 |
|
| 173 |
|
| 174 |
$variables['content'] = $content;
|
| 175 |
$variables['show_messages'] = $show_messages;
|
| 176 |
|
| 177 |
|
| 178 |
template_preprocess($variables, 'update_page');
|
| 179 |
template_preprocess_maintenance_page($variables);
|
| 180 |
template_process($variables, 'update_page');
|
| 181 |
|
| 182 |
|
| 183 |
$messages = drupal_set_message();
|
| 184 |
if (isset($messages['warning'])) {
|
| 185 |
$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';
|
| 186 |
$variables['messages'] .= '<h4>' . $title . ':</h4>';
|
| 187 |
$variables['messages'] .= theme('status_messages', 'warning');
|
| 188 |
}
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
global $theme_path;
|
| 194 |
$theme_path = 'themes/garland';
|
| 195 |
|
| 196 |
return theme_render_template('themes/garland/maintenance-page.tpl.php', $variables);
|
| 197 |
}
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
function template_preprocess_maintenance_page(&$variables) {
|
| 216 |
|
| 217 |
if (theme_get_setting('toggle_favicon')) {
|
| 218 |
$favicon = theme_get_setting('favicon');
|
| 219 |
$type = theme_get_setting('favicon_mimetype');
|
| 220 |
drupal_add_html_head('<link rel="shortcut icon" href="' . check_url($favicon) . '" type="' . check_plain($type) . '" />');
|
| 221 |
}
|
| 222 |
|
| 223 |
global $theme;
|
| 224 |
|
| 225 |
$theme_data = _system_get_theme_data();
|
| 226 |
$regions = $theme_data[$theme]->info['regions'];
|
| 227 |
|
| 228 |
|
| 229 |
foreach (array_keys($regions) as $region) {
|
| 230 |
|
| 231 |
$region_content = drupal_get_region_content($region);
|
| 232 |
isset($variables[$region]) ? $variables[$region] .= $region_content : $variables[$region] = $region_content;
|
| 233 |
}
|
| 234 |
|
| 235 |
|
| 236 |
$variables['layout'] = 'none';
|
| 237 |
if (!empty($variables['sidebar_first'])) {
|
| 238 |
$variables['layout'] = 'first';
|
| 239 |
}
|
| 240 |
if (!empty($variables['sidebar_second'])) {
|
| 241 |
$variables['layout'] = ($variables['layout'] == 'first') ? 'both' : 'second';
|
| 242 |
}
|
| 243 |
|
| 244 |
|
| 245 |
if (drupal_get_title()) {
|
| 246 |
$head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
|
| 247 |
}
|
| 248 |
|
| 249 |
$head_title = array(variable_get('site_name', 'Drupal'));
|
| 250 |
if (variable_get('site_slogan', '')) {
|
| 251 |
$head_title[] = variable_get('site_slogan', '');
|
| 252 |
}
|
| 253 |
|
| 254 |
$variables['head_title'] = implode(' | ', $head_title);
|
| 255 |
$variables['base_path'] = base_path();
|
| 256 |
$variables['front_page'] = url();
|
| 257 |
$variables['breadcrumb'] = '';
|
| 258 |
$variables['feed_icons'] = '';
|
| 259 |
$variables['head'] = drupal_get_html_head();
|
| 260 |
$variables['help'] = '';
|
| 261 |
$variables['language'] = $GLOBALS['language'];
|
| 262 |
$variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
|
| 263 |
$variables['logo'] = theme_get_setting('logo');
|
| 264 |
$variables['messages'] = $variables['show_messages'] ? theme('status_messages') : '';
|
| 265 |
$variables['main_menu'] = array();
|
| 266 |
$variables['secondary_menu'] = array();
|
| 267 |
$variables['search_box'] = '';
|
| 268 |
$variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
|
| 269 |
$variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : '');
|
| 270 |
$variables['css'] = drupal_add_css();
|
| 271 |
$variables['styles'] = drupal_get_css();
|
| 272 |
$variables['scripts'] = drupal_get_js();
|
| 273 |
$variables['tabs'] = '';
|
| 274 |
$variables['title'] = drupal_get_title();
|
| 275 |
$variables['closure'] = '';
|
| 276 |
|
| 277 |
|
| 278 |
$variables['classes_array'][] = 'in-maintenance';
|
| 279 |
if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
|
| 280 |
$variables['classes_array'][] = 'db-offline';
|
| 281 |
}
|
| 282 |
if ($variables['layout'] == 'both') {
|
| 283 |
$variables['classes_array'][] = 'two-sidebars';
|
| 284 |
}
|
| 285 |
elseif ($variables['layout'] == 'none') {
|
| 286 |
$variables['classes_array'][] = 'no-sidebars';
|
| 287 |
}
|
| 288 |
|
| 289 |
$variables['classes_array'][] = 'one-sidebar sidebar-' . $variables['layout'];
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
|
| 295 |
$variables['template_file'] = 'maintenance-page-offline';
|
| 296 |
}
|
| 297 |
}
|
| 298 |
|