You are here

function system_themes_submit in Drupal 5

Same name and namespace in other branches
  1. 4 modules/system.module \system_themes_submit()

File

modules/system/system.module, line 1197
Configuration system that lets administrators modify the workings of the site.

Code

function system_themes_submit($form_id, $form_values) {
  db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");
  if ($form_values['op'] == t('Save configuration')) {
    if (is_array($form_values['status'])) {
      foreach ($form_values['status'] as $key => $choice) {

        // Always enable the default theme, despite its status checkbox being checked:
        if ($choice || $form_values['theme_default'] == $key) {
          system_initialize_theme_blocks($key);
          db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", $key);
        }
      }
    }
    if (($admin_theme = variable_get('admin_theme', '0')) != '0' && $admin_theme != $form_values['theme_default']) {
      drupal_set_message(t('Please note that the <a href="!admin_theme_page">administration theme</a> is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array(
        '!admin_theme_page' => url('admin/settings/admin'),
        '%admin_theme' => $admin_theme,
        '%selected_theme' => $form_values['theme_default'],
      )));
    }
    variable_set('theme_default', $form_values['theme_default']);
  }
  else {
    variable_del('theme_default');
    db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' AND name = 'garland'");
  }
  menu_rebuild();
  drupal_set_message(t('The configuration options have been saved.'));
  return 'admin/build/themes';
}