You are here

function drupal_settings in Drupal 4

Implementation of hook_settings().

File

modules/drupal.module, line 59
Lets users log in using a Drupal ID and can notify a central server about your site.

Code

function drupal_settings() {

  // Check if all required fields are present
  if (variable_get('site_name', 'drupal') == 'drupal' || variable_get('site_name', 'drupal') == '') {
    form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer &raquo; settings</a> page.', array(
      '%url' => url('admin/settings'),
    )));
  }
  else {
    if (variable_get('site_mail', ini_get('sendmail_from')) == '') {
      form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">administer &raquo; settings</a> page.', array(
        '%url' => url('admin/settings'),
      )));
    }
    else {
      if (variable_get('site_slogan', '') == '') {
        form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">administer &raquo; settings</a> page.', array(
          '%url' => url('admin/settings'),
        )));
      }
      else {
        if (variable_get('site_mission', '') == '') {
          form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">administer &raquo; settings</a> page.', array(
            '%url' => url('admin/settings'),
          )));
        }
      }
    }
  }
  $options = array(
    '1' => t('Enabled'),
    '0' => t('Disabled'),
  );
  $form['drupal'] = array(
    '#type' => 'fieldset',
    '#title' => t('Post data to another site'),
    '#tree' => FALSE,
  );
  $form['drupal']['drupal_register'] = array(
    '#type' => 'radios',
    '#title' => t('Register with a Drupal server'),
    '#default_value' => variable_get('drupal_register', 0),
    '#options' => $options,
    '#description' => t("If enabled, your Drupal site will register itself with the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will register itself with drupal.org. Requires the cron feature to be enabled.", array(
      "%drupal-xml-rpc" => "http://drupal.org/xmlrpc.php",
      "%drupal-sites" => "http://drupal.org/drupal-sites/",
    )),
  );
  $form['drupal']['drupal_server'] = array(
    '#type' => 'textfield',
    '#title' => t('Drupal XML-RPC server'),
    '#default_value' => variable_get('drupal_server', 'http://drupal.org/xmlrpc.php'),
    '#description' => t('The URL of the Drupal XML-RPC server you wish to register with.'),
  );
  $form['drupal']['drupal_system'] = array(
    '#type' => 'radios',
    '#title' => t('Send system information'),
    '#default_value' => variable_get('drupal_system', 0),
    '#options' => $options,
    '#description' => t("If enabled, your site will send information on its installed components (modules, themes, and theme engines). This information can help in compiling statistics on usage of Drupal projects."),
  );
  $form['drupal']['drupal_statistics'] = array(
    '#type' => 'radios',
    '#title' => t('Send statistics'),
    '#default_value' => variable_get('drupal_statistics', 0),
    '#options' => $options,
    '#description' => t("If enabled, your site will send summary statistics on the number of registered users and the total number of posts. No private information will be sent. These data help to improve the ranking statistics of Drupal projects."),
  );
  $form['services'] = array(
    '#type' => 'fieldset',
    '#title' => t('Receive data from other sites'),
    '#tree' => FALSE,
  );
  $form['services']['drupal_client_service'] = array(
    '#type' => 'radios',
    '#title' => t('Allow other Drupal sites to register'),
    '#default_value' => variable_get('drupal_client_service', 0),
    '#options' => $options,
    '#description' => t('If enabled, your Drupal site will allow other sites to register with your site and send information to this site. This functionality can be used to maintain a list of related sites.'),
  );
  $form['services']['drupal_authentication_service'] = array(
    '#type' => 'radios',
    '#title' => t('Authentication service'),
    '#default_value' => variable_get('drupal_authentication_service', 0),
    '#options' => $options,
    '#description' => t('If enabled, your Drupal site will accept logins with the user names of other Drupal sites, and likewise provide authentication for users logging into other Drupal sites, based on their user accounts here.'),
  );
  return $form;
}