You are here

function system_themes_submit in Drupal 4

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

File

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

Code

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

        // Always enable the default theme, despite its status checkbox being checked:
        if ($choice || $values['theme_default'] == $key) {

          // If theme status is being set to 1 from 0, initialize block data for this theme if necessary.
          if (db_num_rows(db_query("SELECT status FROM {system} WHERE type = 'theme' AND name = '%s' AND status = 0", $key))) {
            system_initialize_theme_blocks($key);
          }
          db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", $key);
        }
      }
    }
    variable_set('theme_default', $values['theme_default']);
  }
  else {
    variable_del('theme_default');
    db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' AND name = 'bluemarine'");
  }
  menu_rebuild();
  drupal_set_message(t('The configuration options have been saved.'));
  return 'admin/themes';
}