--- system.module?rev=1.202 2005-03-25 23:48:35.000000000 +0100 +++ system.module 2005-03-28 00:46:01.000000000 +0200 @@ -117,6 +117,7 @@ function system_menu($may_cache) { * Menu callback: dummy clean URL tester. */ function system_test() { + variable_set('clean_url_ok', 1); } /** @@ -203,10 +204,11 @@ function system_view_general() { $group .= form_textfield(t('Anonymous user'), 'anonymous', variable_get('anonymous', 'Anonymous'), 70, 70, t('The name used to indicate anonymous users.')); $group .= form_textfield(t('Default front page'), 'site_frontpage', variable_get('site_frontpage', 'node'), 70, 70, t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".')); - // check if clean URLs are supported (HTTP 200 = Ok) - $request = drupal_http_request($GLOBALS['base_url'] . '/system/test'); - $supported = $request->code == 200; - $group .= form_radios(t('Clean URLs'), 'clean_url', variable_get('clean_url', 0), array(t('Disabled'), t('Enabled')), t('This option makes Drupal emit clean URLs (i.e. without ?q= in the URL). You\'ll need ModRewrite support for this to work. See the .htaccess file in Drupal\'s top-level directory for more information.'), false, $supported ? NULL : array('disabled' => 'disabled')); + $group .= form_radios(t('Clean URLs'), 'clean_url', variable_get('clean_url', 0), array(t('Disabled'), t('Enabled')), t('This option makes Drupal emit clean URLs (i.e. without ?q= in the URL). You\'ll need ModRewrite support for this to work. See the .htaccess file in Drupal\'s top-level directory for more information.')); + variable_set('clean_url_ok', 0); + 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. + $group .= ''; $output = form_group(t('General settings'), $group); @@ -547,6 +549,10 @@ function system_settings_save() { } else if ($op == t('Save configuration')) { if (is_array($edit)) { + if ($edit['clean_url'] && !variable_get('clean_url_ok', 0)) { + drupal_set_message(t('Clean URL testing failed. Please recheck ModRewrite support.'), 'error'); + $edit['clean_url'] = 0; + } foreach ($edit as $name => $value) { variable_set($name, $value); }