michael@529: Index: includes/bootstrap.inc michael@529: --- includes/bootstrap.inc.orig 2008-02-11 15:36:21 +0100 michael@529: +++ includes/bootstrap.inc 2008-04-09 20:47:49 +0200 michael@530: @@ -730,6 +730,7 @@ michael@529: */ michael@530: function drupal_settings_initialize() { michael@529: global $base_url, $base_path, $base_root; michael@529: + global $base_url_local; michael@529: michael@529: // Export the following settings.php variables to the global namespace michael@530: global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url; michael@530: @@ -1613,8 +1614,22 @@ michael@530: * equivalent using other environment variables. michael@529: */ michael@529: function request_uri() { michael@529: + global $base_url; michael@529: + global $base_url_local; michael@530: + michael@529: if (isset($_SERVER['REQUEST_URI'])) { michael@529: $uri = $_SERVER['REQUEST_URI']; michael@529: + if (isset($base_url) && isset($base_url_local)) { michael@529: + $parts = parse_url($base_url_local); michael@529: + if ( strlen($uri) >= strlen($base_url_local) michael@529: + && substr($uri, 0, strlen($base_url_local)) == $base_url_local) { michael@529: + $uri = $base_url . substr($uri, strlen($base_url_local)); michael@529: + } michael@529: + elseif ( strlen($uri) >= strlen($parts["path"]) michael@529: + && substr($uri, 0, strlen($parts["path"])) == $parts["path"]) { michael@529: + $uri = $base_url . substr($uri, strlen($parts["path"])); michael@529: + } michael@529: + } michael@529: } michael@529: else { michael@529: if (isset($_SERVER['argv'])) { michael@530: @@ -1628,6 +1643,7 @@ michael@529: } michael@529: } michael@530: // Prevent multiple slashes to avoid cross site requests via the Form API. michael@529: + if (substr($uri, 0, 1) == "/") michael@530: $uri = '/' . ltrim($uri, '/'); michael@529: michael@529: return $uri; michael@529: Index: includes/common.inc michael@529: --- includes/common.inc.orig 2008-04-09 23:11:44 +0200 michael@529: +++ includes/common.inc 2008-06-26 20:16:16 +0200 michael@530: @@ -848,9 +848,14 @@ michael@529: } michael@529: michael@529: // Construct the path to act on. michael@529: - $path = isset($uri['path']) ? $uri['path'] : '/'; michael@529: - if (isset($uri['query'])) { michael@530: - $path .= '?' . $uri['query']; michael@529: + if (variable_get('proxy_server', '') != '') { michael@529: + $path = $url; michael@529: + } michael@529: + else { michael@529: + $path = isset($uri['path']) ? $uri['path'] : '/'; michael@529: + if (isset($uri['query'])) { michael@529: + $path .= '?'. $uri['query']; michael@529: + } michael@529: } michael@529: michael@530: // Merge the default headers. michael@530: @@ -872,6 +877,14 @@ michael@530: $options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (isset($uri['pass']) ? ':' . $uri['pass'] : '')); michael@529: } michael@529: michael@529: + // If the proxy server required a username then attempt to authenticate with it michael@529: + if (variable_get('proxy_username', '') != '') { michael@529: + $username = variable_get('proxy_username', ''); michael@529: + $password = variable_get('proxy_password', ''); michael@529: + $auth_string = base64_encode($username . ($password != '' ? ':'. $password : '')); michael@529: + $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n"; michael@529: + } michael@529: + michael@530: // If the database prefix is being used by SimpleTest to run the tests in a copied michael@530: // database then set the user-agent header to the database prefix so that any michael@530: // calls to other Drupal pages will run the SimpleTest prefixed database. The michael@529: Index: modules/system/system.admin.inc michael@748: --- modules/system/system.admin.inc.orig 2012-10-17 22:45:04.000000000 +0200 michael@748: +++ modules/system/system.admin.inc 2012-10-27 13:56:02.343450754 +0200 michael@748: @@ -1766,6 +1766,65 @@ michael@529: } michael@529: michael@529: /** michael@529: + * Form builder; Configure the site proxy settings. michael@529: + * michael@529: + * @ingroup forms michael@529: + * @see system_settings_form() michael@529: + */ michael@529: +function system_proxy_settings() { michael@529: + michael@529: + $form['forward_proxy'] = array( michael@529: + '#type' => 'fieldset', michael@529: + '#title' => t('Forward proxy settings'), michael@529: + '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'), michael@529: + ); michael@529: + $form['forward_proxy']['proxy_server'] = array( michael@529: + '#type' => 'textfield', michael@529: + '#title' => t('Proxy host name'), michael@529: + '#default_value' => variable_get('proxy_server', ''), michael@529: + '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.') michael@529: + ); michael@529: + $form['forward_proxy']['proxy_port'] = array( michael@529: + '#type' => 'textfield', michael@529: + '#title' => t('Proxy port number'), michael@529: + '#default_value' => variable_get('proxy_port', 8080), michael@529: + '#description' => t('The port number of the proxy server, eg. 8080'), michael@529: + ); michael@529: + $form['forward_proxy']['proxy_username'] = array( michael@529: + '#type' => 'textfield', michael@529: + '#title' => t('Proxy username'), michael@529: + '#default_value' => variable_get('proxy_username', ''), michael@529: + '#description' => t('The username used to authenticate with the proxy server.'), michael@529: + ); michael@529: + $form['forward_proxy']['proxy_password'] = array( michael@529: + '#type' => 'textfield', michael@529: + '#title' => t('Proxy password'), michael@529: + '#default_value' => variable_get('proxy_password', ''), michael@529: + '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '') michael@529: + ); michael@529: + $form['#validate'][] = 'system_proxy_settings_validate'; michael@529: + michael@529: + return system_settings_form($form); michael@529: +} michael@529: + michael@529: +/** michael@529: + * Validate the submitted proxy form. michael@529: + */ michael@529: +function system_proxy_settings_validate($form, &$form_state) { michael@529: + // Validate the proxy settings michael@529: + $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']); michael@529: + if ($form_state['values']['proxy_server'] != '') { michael@529: + // TCP allows the port to be between 0 and 65536 inclusive michael@529: + if (!is_numeric($form_state['values']['proxy_port'])) { michael@529: + form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.')); michael@529: + } michael@529: + elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) { michael@529: + form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.')); michael@529: + } michael@529: + } michael@529: +} michael@529: + michael@529: +/** michael@529: * Form builder; Configure the site file handling. michael@529: * michael@529: * @ingroup forms michael@529: Index: modules/system/system.module michael@529: --- modules/system/system.module.orig 2008-04-09 23:11:49 +0200 michael@529: +++ modules/system/system.module 2008-04-24 11:43:47 +0200 michael@530: @@ -723,6 +723,14 @@ michael@530: 'access arguments' => array('access administration pages'), michael@529: 'file' => 'system.admin.inc', michael@529: ); michael@529: + $items['admin/settings/proxy'] = array( michael@529: + 'title' => 'Proxy server', michael@529: + 'description' => 'Configure settings when the site is behind a proxy server.', michael@529: + 'page callback' => 'drupal_get_form', michael@529: + 'page arguments' => array('system_proxy_settings'), michael@529: + 'access arguments' => array('administer site configuration'), michael@529: + 'file' => 'system.admin.inc', michael@529: + ); michael@530: $items['admin/config/media/file-system'] = array( michael@529: 'title' => 'File system', michael@529: 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.', michael@530: Index: includes/install.core.inc michael@530: --- includes/install.core.inc.orig 2012-08-01 18:27:42.000000000 +0200 michael@530: +++ includes/install.core.inc 2012-08-22 21:55:27.582420660 +0200 michael@748: @@ -1770,7 +1770,7 @@ michael@530: 1 => st('Check for updates automatically'), michael@530: 2 => st('Receive e-mail notifications'), michael@530: ), michael@530: - '#default_value' => array(1, 2), michael@529: + '#default_value' => array(), michael@530: '#description' => st('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to Drupal.org.', array('@drupal' => 'http://drupal.org')), michael@529: '#weight' => 15, michael@529: ); michael@530: Index: sites/default/default.settings.php michael@530: --- sites/default/default.settings.php.orig 2012-08-01 18:27:42.000000000 +0200 michael@530: +++ sites/default/default.settings.php 2012-08-22 21:39:06.793031214 +0200 michael@530: @@ -257,6 +257,24 @@ michael@530: # $base_url = 'http://www.example.com'; // NO trailing slash! michael@529: michael@529: /** michael@530: + * Local Base URL (optional). michael@530: + * michael@530: + * If you are running Drupal behind a reverse proxy, $base_url (see above) michael@530: + * usually points to the URL of the reverse proxy. Drupal uses this for michael@530: + * all sorts of external URLs. In order to correctly calculate sub-URLs michael@530: + * below $base_url for embedded HTML forms, Drupal also has to know the michael@530: + * URL on the local/origin server under which Drupal is contacted by the michael@530: + * reverse proxy. This is what $base_url_local is for. michael@530: + * michael@530: + * Examples: michael@530: + * $base_url_local = 'http://www.example.com:8080/drupal'; michael@530: + * michael@530: + * It is not allowed to have a trailing slash; Drupal will add it michael@530: + * for you. michael@530: + */ michael@530: +# $base_url_local = 'http://www.example.com:8080/drupal'; // NO trailing slash! michael@530: + michael@530: +/** michael@530: * PHP settings: michael@529: * michael@530: * To see what PHP settings are possible, including whether they can be set at