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.

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

mercurial