You are here

function system_clean_url_settings in Drupal 5

Same name and namespace in other branches
  1. 6 modules/system/system.admin.inc \system_clean_url_settings()
  2. 7 modules/system/system.admin.inc \system_clean_url_settings()
1 string reference to 'system_clean_url_settings'
system_menu in modules/system/system.module
Implementation of hook_menu().

File

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

Code

function system_clean_url_settings() {

  // We check for clean URL support using an image on the client side.
  $form['clean_url'] = array(
    '#type' => 'radios',
    '#title' => t('Clean URLs'),
    '#default_value' => variable_get('clean_url', 0),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without <code>?q=</code> in the URL.)'),
  );
  if (!variable_get('clean_url', 0)) {
    if (strpos(request_uri(), '?q=') !== FALSE) {
      $form['clean_url']['#description'] .= t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="@handbook">handbook page on Clean URLs</a> has additional troubleshooting information. !run-test', array(
        '@handbook' => 'http://drupal.org/node/15365',
        '!run-test' => '<a href ="' . base_path() . 'admin/settings/clean-urls">' . t('Run the clean URL test') . '</a>',
      ));
      $form['clean_url']['#disabled'] = TRUE;
    }
    else {
      $form['clean_url']['#description'] .= t(' You have successfully demonstrated that clean URLs work on your server. You may enable/disable them as you wish.');
      $form['#collapsed'] = FALSE;
    }
  }
  return system_settings_form($form);
}