Index: system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.202 diff -u -F^f -r1.202 system.module --- system.module 23 Mar 2005 20:26:21 -0000 1.202 +++ system.module 27 Mar 2005 19:04:34 -0000 @@ -117,6 +117,13 @@ function system_menu($may_cache) { * Menu callback: dummy clean URL tester. */ function system_test() { + variable_set('clean_url_ok', 1); + header('Content-type: image/gif'); + header('Content-length: 42'); + printf( + '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%', + 71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59 + ); } /** @@ -203,10 +210,10 @@ 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')); + variable_set('clean_url_ok', 0); + global $base_url; + $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.')); + $group .= ''; // no way to cache this $output = form_group(t('General settings'), $group); @@ -547,6 +554,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); }