summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/system.module39
-rw-r--r--modules/system/system.module39
2 files changed, 20 insertions, 58 deletions
diff --git a/modules/system.module b/modules/system.module
index b675e3ce7..9841632f1 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -97,12 +97,6 @@ function system_menu($may_cache) {
'access' => TRUE,
'type' => MENU_CALLBACK);
- // Clean URL tester
- $items[] = array('path' => 'system/test-clean-url',
- 'callback' => 'system_test_clean_url',
- 'access' => TRUE,
- 'type' => MENU_CALLBACK);
-
$access = user_access('administer site configuration');
$items[] = array('path' => 'admin', 'title' => t('administer'),
@@ -151,15 +145,6 @@ function system_menu($may_cache) {
}
/**
- * Menu callback: dummy clean URL tester and reset.
- *
- * When used as form #pre_render, it will reset the test variable.
- */
-function system_test_clean_url($form_id) {
- variable_set('clean_url_ok', $form_id != 'system_settings_form');
-}
-
-/**
* Implementation of hook_user().
*
* Allows users to individually set their theme and time zone.
@@ -295,15 +280,17 @@ function system_view_general() {
);
// We check for clean URL support using an image on the client side.
- $form['general']['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). You\'ll need <code>ModRewrite</code> support for this to work. See the <code>.htaccess</code> file in Drupal\'s top-level directory for more information.')
- );
+ $form['general']['clean_url'] = array('#type' => 'radios', '#title' => t('Clean URLs'), '#default_value' => variable_get('clean_url', 0), '#options' => array(t('Disabled'), t('Enabled')));
- global $base_url;
- // We will use a random URL so there is no way a proxy or a browser could cache the "no such image" answer.
- $form['general']['clean_url_test'] = array('#type' => 'markup', '#value' => '<img style="position: relative; left: -1000em;" src="'. $base_url. '/system/test-clean-url/'. user_password(20) .'.png" alt="" />');
- $form['#pre_render'] = array('system_test_clean_url');
+ if (!variable_get('clean_url', 0)) {
+ if (strpos(request_uri(), '?q=') !== FALSE) {
+ $form['general']['clean_url']['#description'] = t('Before enabling clean URLs, you must demonstrate that your server is properly configured. Click %here to issue a request using a clean url syntax. If you see this page again, you have succeeded and the radio buttons above will be available. If you get an error such as 404 Page Not Found, you need to change the configuration of your server. See http://drupal.org/node/15365 for more.', array('%here' => '<a href ="'. str_replace('?q=', '', url('admin/settings')) .'">'. t('here') .'</a>'));
+ $form['general']['clean_url']['#attributes'] = array('disabled' => 'disabled');
+ }
+ else {
+ $form['general']['clean_url']['#description'] = t('You have successfully demonstrated that clean urls work on your server. You are welcome to enable/disable them as you wish.');
+ }
+ }
// Error handling:
@@ -783,12 +770,6 @@ function system_theme_settings_submit($form_id, $values) {
function system_settings_form_submit($form_id, $values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
- // Do the clean url validation, changing the form property if it doesn't work.
- if ($values['clean_url'] && !variable_get('clean_url_ok', 0)) {
- drupal_set_message(t('It appears your host is not configured correctly for Clean URLs. Please check for <code>ModRewrite</code> support with your administrator.'), 'error');
- $values['clean_url'] = 0;
- }
-
// Exclude unnecessary elements.
unset($values['submit'], $values['reset'], $values['form_id']);
diff --git a/modules/system/system.module b/modules/system/system.module
index b675e3ce7..9841632f1 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -97,12 +97,6 @@ function system_menu($may_cache) {
'access' => TRUE,
'type' => MENU_CALLBACK);
- // Clean URL tester
- $items[] = array('path' => 'system/test-clean-url',
- 'callback' => 'system_test_clean_url',
- 'access' => TRUE,
- 'type' => MENU_CALLBACK);
-
$access = user_access('administer site configuration');
$items[] = array('path' => 'admin', 'title' => t('administer'),
@@ -151,15 +145,6 @@ function system_menu($may_cache) {
}
/**
- * Menu callback: dummy clean URL tester and reset.
- *
- * When used as form #pre_render, it will reset the test variable.
- */
-function system_test_clean_url($form_id) {
- variable_set('clean_url_ok', $form_id != 'system_settings_form');
-}
-
-/**
* Implementation of hook_user().
*
* Allows users to individually set their theme and time zone.
@@ -295,15 +280,17 @@ function system_view_general() {
);
// We check for clean URL support using an image on the client side.
- $form['general']['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). You\'ll need <code>ModRewrite</code> support for this to work. See the <code>.htaccess</code> file in Drupal\'s top-level directory for more information.')
- );
+ $form['general']['clean_url'] = array('#type' => 'radios', '#title' => t('Clean URLs'), '#default_value' => variable_get('clean_url', 0), '#options' => array(t('Disabled'), t('Enabled')));
- global $base_url;
- // We will use a random URL so there is no way a proxy or a browser could cache the "no such image" answer.
- $form['general']['clean_url_test'] = array('#type' => 'markup', '#value' => '<img style="position: relative; left: -1000em;" src="'. $base_url. '/system/test-clean-url/'. user_password(20) .'.png" alt="" />');
- $form['#pre_render'] = array('system_test_clean_url');
+ if (!variable_get('clean_url', 0)) {
+ if (strpos(request_uri(), '?q=') !== FALSE) {
+ $form['general']['clean_url']['#description'] = t('Before enabling clean URLs, you must demonstrate that your server is properly configured. Click %here to issue a request using a clean url syntax. If you see this page again, you have succeeded and the radio buttons above will be available. If you get an error such as 404 Page Not Found, you need to change the configuration of your server. See http://drupal.org/node/15365 for more.', array('%here' => '<a href ="'. str_replace('?q=', '', url('admin/settings')) .'">'. t('here') .'</a>'));
+ $form['general']['clean_url']['#attributes'] = array('disabled' => 'disabled');
+ }
+ else {
+ $form['general']['clean_url']['#description'] = t('You have successfully demonstrated that clean urls work on your server. You are welcome to enable/disable them as you wish.');
+ }
+ }
// Error handling:
@@ -783,12 +770,6 @@ function system_theme_settings_submit($form_id, $values) {
function system_settings_form_submit($form_id, $values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
- // Do the clean url validation, changing the form property if it doesn't work.
- if ($values['clean_url'] && !variable_get('clean_url_ok', 0)) {
- drupal_set_message(t('It appears your host is not configured correctly for Clean URLs. Please check for <code>ModRewrite</code> support with your administrator.'), 'error');
- $values['clean_url'] = 0;
- }
-
// Exclude unnecessary elements.
unset($values['submit'], $values['reset'], $values['form_id']);