drupal/drupal.patch

Tue, 28 Aug 2012 18:29:30 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:29:30 +0200
changeset 534
d2d0020cfafa
parent 529
7d4d11d301d6
child 734
6f237b68bce5
permissions
-rw-r--r--

Update from Drupal 6.x to 7.x and introduce several new HTML5 themes. Because
many themes from Drupal 6.x have since been abandoned, left unmaintained, or
not ported to Drupal 7.x, this package has changed in size and utility.

michael@529 1 Index: includes/bootstrap.inc
michael@529 2 --- includes/bootstrap.inc.orig 2008-02-11 15:36:21 +0100
michael@529 3 +++ includes/bootstrap.inc 2008-04-09 20:47:49 +0200
michael@530 4 @@ -730,6 +730,7 @@
michael@529 5 */
michael@530 6 function drupal_settings_initialize() {
michael@529 7 global $base_url, $base_path, $base_root;
michael@529 8 + global $base_url_local;
michael@529 9
michael@529 10 // Export the following settings.php variables to the global namespace
michael@530 11 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 12 @@ -1613,8 +1614,22 @@
michael@530 13 * equivalent using other environment variables.
michael@529 14 */
michael@529 15 function request_uri() {
michael@529 16 + global $base_url;
michael@529 17 + global $base_url_local;
michael@530 18 +
michael@529 19 if (isset($_SERVER['REQUEST_URI'])) {
michael@529 20 $uri = $_SERVER['REQUEST_URI'];
michael@529 21 + if (isset($base_url) && isset($base_url_local)) {
michael@529 22 + $parts = parse_url($base_url_local);
michael@529 23 + if ( strlen($uri) >= strlen($base_url_local)
michael@529 24 + && substr($uri, 0, strlen($base_url_local)) == $base_url_local) {
michael@529 25 + $uri = $base_url . substr($uri, strlen($base_url_local));
michael@529 26 + }
michael@529 27 + elseif ( strlen($uri) >= strlen($parts["path"])
michael@529 28 + && substr($uri, 0, strlen($parts["path"])) == $parts["path"]) {
michael@529 29 + $uri = $base_url . substr($uri, strlen($parts["path"]));
michael@529 30 + }
michael@529 31 + }
michael@529 32 }
michael@529 33 else {
michael@529 34 if (isset($_SERVER['argv'])) {
michael@530 35 @@ -1628,6 +1643,7 @@
michael@529 36 }
michael@529 37 }
michael@530 38 // Prevent multiple slashes to avoid cross site requests via the Form API.
michael@529 39 + if (substr($uri, 0, 1) == "/")
michael@530 40 $uri = '/' . ltrim($uri, '/');
michael@529 41
michael@529 42 return $uri;
michael@529 43 Index: includes/common.inc
michael@529 44 --- includes/common.inc.orig 2008-04-09 23:11:44 +0200
michael@529 45 +++ includes/common.inc 2008-06-26 20:16:16 +0200
michael@530 46 @@ -848,9 +848,14 @@
michael@529 47 }
michael@529 48
michael@529 49 // Construct the path to act on.
michael@529 50 - $path = isset($uri['path']) ? $uri['path'] : '/';
michael@529 51 - if (isset($uri['query'])) {
michael@530 52 - $path .= '?' . $uri['query'];
michael@529 53 + if (variable_get('proxy_server', '') != '') {
michael@529 54 + $path = $url;
michael@529 55 + }
michael@529 56 + else {
michael@529 57 + $path = isset($uri['path']) ? $uri['path'] : '/';
michael@529 58 + if (isset($uri['query'])) {
michael@529 59 + $path .= '?'. $uri['query'];
michael@529 60 + }
michael@529 61 }
michael@529 62
michael@530 63 // Merge the default headers.
michael@530 64 @@ -872,6 +877,14 @@
michael@530 65 $options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (isset($uri['pass']) ? ':' . $uri['pass'] : ''));
michael@529 66 }
michael@529 67
michael@529 68 + // If the proxy server required a username then attempt to authenticate with it
michael@529 69 + if (variable_get('proxy_username', '') != '') {
michael@529 70 + $username = variable_get('proxy_username', '');
michael@529 71 + $password = variable_get('proxy_password', '');
michael@529 72 + $auth_string = base64_encode($username . ($password != '' ? ':'. $password : ''));
michael@529 73 + $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n";
michael@529 74 + }
michael@529 75 +
michael@530 76 // If the database prefix is being used by SimpleTest to run the tests in a copied
michael@530 77 // database then set the user-agent header to the database prefix so that any
michael@530 78 // calls to other Drupal pages will run the SimpleTest prefixed database. The
michael@529 79 Index: modules/system/system.admin.inc
michael@529 80 --- modules/system/system.admin.inc.orig 2008-03-25 12:58:16 +0100
michael@529 81 +++ modules/system/system.admin.inc 2008-04-24 11:43:07 +0200
michael@530 82 @@ -1766,6 +1766,124 @@
michael@529 83 }
michael@529 84
michael@529 85 /**
michael@529 86 + * Form builder; Configure the site proxy settings.
michael@529 87 + *
michael@529 88 + * @ingroup forms
michael@529 89 + * @see system_settings_form()
michael@529 90 + */
michael@529 91 +function system_proxy_settings() {
michael@529 92 +
michael@529 93 + $form['forward_proxy'] = array(
michael@529 94 + '#type' => 'fieldset',
michael@529 95 + '#title' => t('Forward proxy settings'),
michael@529 96 + '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
michael@529 97 + );
michael@529 98 + $form['forward_proxy']['proxy_server'] = array(
michael@529 99 + '#type' => 'textfield',
michael@529 100 + '#title' => t('Proxy host name'),
michael@529 101 + '#default_value' => variable_get('proxy_server', ''),
michael@529 102 + '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
michael@529 103 + );
michael@529 104 + $form['forward_proxy']['proxy_port'] = array(
michael@529 105 + '#type' => 'textfield',
michael@529 106 + '#title' => t('Proxy port number'),
michael@529 107 + '#default_value' => variable_get('proxy_port', 8080),
michael@529 108 + '#description' => t('The port number of the proxy server, eg. 8080'),
michael@529 109 + );
michael@529 110 + $form['forward_proxy']['proxy_username'] = array(
michael@529 111 + '#type' => 'textfield',
michael@529 112 + '#title' => t('Proxy username'),
michael@529 113 + '#default_value' => variable_get('proxy_username', ''),
michael@529 114 + '#description' => t('The username used to authenticate with the proxy server.'),
michael@529 115 + );
michael@529 116 + $form['forward_proxy']['proxy_password'] = array(
michael@529 117 + '#type' => 'textfield',
michael@529 118 + '#title' => t('Proxy password'),
michael@529 119 + '#default_value' => variable_get('proxy_password', ''),
michael@529 120 + '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
michael@529 121 + );
michael@529 122 + $form['#validate'][] = 'system_proxy_settings_validate';
michael@529 123 +
michael@529 124 + return system_settings_form($form);
michael@529 125 +}
michael@529 126 +
michael@529 127 +/**
michael@529 128 + * Validate the submitted proxy form.
michael@529 129 + */
michael@529 130 +function system_proxy_settings_validate($form, &$form_state) {
michael@529 131 + // Validate the proxy settings
michael@529 132 + $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
michael@529 133 + if ($form_state['values']['proxy_server'] != '') {
michael@529 134 + // TCP allows the port to be between 0 and 65536 inclusive
michael@529 135 + if (!is_numeric($form_state['values']['proxy_port'])) {
michael@529 136 + form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
michael@529 137 + }
michael@529 138 + elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) {
michael@529 139 + form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
michael@529 140 + }
michael@529 141 + }
michael@529 142 +}
michael@529 143 +
michael@529 144 +/**
michael@530 145 + * Form builder; Configure the site proxy settings.
michael@530 146 + *
michael@530 147 + * @ingroup forms
michael@530 148 + * @see system_settings_form()
michael@530 149 + */
michael@530 150 +function system_proxy_settings() {
michael@530 151 +
michael@530 152 + $form['forward_proxy'] = array(
michael@530 153 + '#type' => 'fieldset',
michael@530 154 + '#title' => t('Forward proxy settings'),
michael@530 155 + '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
michael@530 156 + );
michael@530 157 + $form['forward_proxy']['proxy_server'] = array(
michael@530 158 + '#type' => 'textfield',
michael@530 159 + '#title' => t('Proxy host name'),
michael@530 160 + '#default_value' => variable_get('proxy_server', ''),
michael@530 161 + '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
michael@530 162 + );
michael@530 163 + $form['forward_proxy']['proxy_port'] = array(
michael@530 164 + '#type' => 'textfield',
michael@530 165 + '#title' => t('Proxy port number'),
michael@530 166 + '#default_value' => variable_get('proxy_port', 8080),
michael@530 167 + '#description' => t('The port number of the proxy server, eg. 8080'),
michael@530 168 + );
michael@530 169 + $form['forward_proxy']['proxy_username'] = array(
michael@530 170 + '#type' => 'textfield',
michael@530 171 + '#title' => t('Proxy username'),
michael@530 172 + '#default_value' => variable_get('proxy_username', ''),
michael@530 173 + '#description' => t('The username used to authenticate with the proxy server.'),
michael@530 174 + );
michael@530 175 + $form['forward_proxy']['proxy_password'] = array(
michael@530 176 + '#type' => 'textfield',
michael@530 177 + '#title' => t('Proxy password'),
michael@530 178 + '#default_value' => variable_get('proxy_password', ''),
michael@530 179 + '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
michael@530 180 + );
michael@530 181 + $form['#validate'][] = 'system_proxy_settings_validate';
michael@530 182 +
michael@530 183 + return system_settings_form($form);
michael@530 184 +}
michael@530 185 +
michael@530 186 +/**
michael@530 187 + * Validate the submitted proxy form.
michael@530 188 + */
michael@530 189 +function system_proxy_settings_validate($form, &$form_state) {
michael@530 190 + // Validate the proxy settings
michael@530 191 + $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
michael@530 192 + if ($form_state['values']['proxy_server'] != '') {
michael@530 193 + // TCP allows the port to be between 0 and 65536 inclusive
michael@530 194 + if (!is_numeric($form_state['values']['proxy_port'])) {
michael@530 195 + form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
michael@530 196 + }
michael@530 197 + elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) {
michael@530 198 + form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
michael@530 199 + }
michael@530 200 + }
michael@530 201 +}
michael@530 202 +
michael@530 203 +/**
michael@529 204 * Form builder; Configure the site file handling.
michael@529 205 *
michael@529 206 * @ingroup forms
michael@529 207 Index: modules/system/system.module
michael@529 208 --- modules/system/system.module.orig 2008-04-09 23:11:49 +0200
michael@529 209 +++ modules/system/system.module 2008-04-24 11:43:47 +0200
michael@530 210 @@ -723,6 +723,14 @@
michael@530 211 'access arguments' => array('access administration pages'),
michael@529 212 'file' => 'system.admin.inc',
michael@529 213 );
michael@529 214 + $items['admin/settings/proxy'] = array(
michael@529 215 + 'title' => 'Proxy server',
michael@529 216 + 'description' => 'Configure settings when the site is behind a proxy server.',
michael@529 217 + 'page callback' => 'drupal_get_form',
michael@529 218 + 'page arguments' => array('system_proxy_settings'),
michael@529 219 + 'access arguments' => array('administer site configuration'),
michael@529 220 + 'file' => 'system.admin.inc',
michael@529 221 + );
michael@530 222 $items['admin/config/media/file-system'] = array(
michael@529 223 'title' => 'File system',
michael@529 224 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
michael@530 225 Index: includes/install.core.inc
michael@530 226 --- includes/install.core.inc.orig 2012-08-01 18:27:42.000000000 +0200
michael@530 227 +++ includes/install.core.inc 2012-08-22 21:55:27.582420660 +0200
michael@530 228 @@ -1771,7 +1771,7 @@
michael@530 229 1 => st('Check for updates automatically'),
michael@530 230 2 => st('Receive e-mail notifications'),
michael@530 231 ),
michael@530 232 - '#default_value' => array(1, 2),
michael@529 233 + '#default_value' => array(),
michael@530 234 '#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 <a href="@drupal">Drupal.org</a>.', array('@drupal' => 'http://drupal.org')),
michael@529 235 '#weight' => 15,
michael@529 236 );
michael@530 237 Index: sites/default/default.settings.php
michael@530 238 --- sites/default/default.settings.php.orig 2012-08-01 18:27:42.000000000 +0200
michael@530 239 +++ sites/default/default.settings.php 2012-08-22 21:39:06.793031214 +0200
michael@530 240 @@ -257,6 +257,24 @@
michael@530 241 # $base_url = 'http://www.example.com'; // NO trailing slash!
michael@529 242
michael@529 243 /**
michael@530 244 + * Local Base URL (optional).
michael@530 245 + *
michael@530 246 + * If you are running Drupal behind a reverse proxy, $base_url (see above)
michael@530 247 + * usually points to the URL of the reverse proxy. Drupal uses this for
michael@530 248 + * all sorts of external URLs. In order to correctly calculate sub-URLs
michael@530 249 + * below $base_url for embedded HTML forms, Drupal also has to know the
michael@530 250 + * URL on the local/origin server under which Drupal is contacted by the
michael@530 251 + * reverse proxy. This is what $base_url_local is for.
michael@530 252 + *
michael@530 253 + * Examples:
michael@530 254 + * $base_url_local = 'http://www.example.com:8080/drupal';
michael@530 255 + *
michael@530 256 + * It is not allowed to have a trailing slash; Drupal will add it
michael@530 257 + * for you.
michael@530 258 + */
michael@530 259 +# $base_url_local = 'http://www.example.com:8080/drupal'; // NO trailing slash!
michael@530 260 +
michael@530 261 +/**
michael@530 262 * PHP settings:
michael@529 263 *
michael@530 264 * To see what PHP settings are possible, including whether they can be set at

mercurial