1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/drupal/drupal.patch Tue Aug 28 18:28:45 2012 +0200 1.3 @@ -0,0 +1,373 @@ 1.4 +Fix Reverse Proxy Support: 1.5 +http://drupal.org/node/244593 1.6 +http://drupal.org/files/issues/drupal_80.patch 1.7 + 1.8 +Index: includes/bootstrap.inc 1.9 +--- includes/bootstrap.inc.orig 2008-02-11 15:36:21 +0100 1.10 ++++ includes/bootstrap.inc 2008-04-09 20:47:49 +0200 1.11 +@@ -272,6 +272,7 @@ 1.12 + */ 1.13 + function conf_init() { 1.14 + global $base_url, $base_path, $base_root; 1.15 ++ global $base_url_local; 1.16 + 1.17 + // Export the following settings.php variables to the global namespace 1.18 + global $db_url, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access; 1.19 +@@ -723,9 +724,22 @@ 1.20 + * generate an equivalent using other environment variables. 1.21 + */ 1.22 + function request_uri() { 1.23 ++ global $base_url; 1.24 ++ global $base_url_local; 1.25 + 1.26 + if (isset($_SERVER['REQUEST_URI'])) { 1.27 + $uri = $_SERVER['REQUEST_URI']; 1.28 ++ if (isset($base_url) && isset($base_url_local)) { 1.29 ++ $parts = parse_url($base_url_local); 1.30 ++ if ( strlen($uri) >= strlen($base_url_local) 1.31 ++ && substr($uri, 0, strlen($base_url_local)) == $base_url_local) { 1.32 ++ $uri = $base_url . substr($uri, strlen($base_url_local)); 1.33 ++ } 1.34 ++ elseif ( strlen($uri) >= strlen($parts["path"]) 1.35 ++ && substr($uri, 0, strlen($parts["path"])) == $parts["path"]) { 1.36 ++ $uri = $base_url . substr($uri, strlen($parts["path"])); 1.37 ++ } 1.38 ++ } 1.39 + } 1.40 + else { 1.41 + if (isset($_SERVER['argv'])) { 1.42 +@@ -792,6 +806,7 @@ 1.43 + } 1.44 + } 1.45 + // Prevent multiple slashes to avoid cross site requests via the FAPI. 1.46 ++ if (substr($uri, 0, 1) == "/") 1.47 + $uri = '/'. ltrim($uri, '/'); 1.48 + 1.49 + return $uri; 1.50 +Index: sites/default/default.settings.php 1.51 +--- sites/default/default.settings.php.orig 2007-12-20 10:35:10 +0100 1.52 ++++ sites/default/default.settings.php 2008-04-09 20:47:32 +0200 1.53 +@@ -126,6 +126,24 @@ 1.54 + # $base_url = 'http://www.example.com'; // NO trailing slash! 1.55 + 1.56 + /** 1.57 ++ * Local Base URL (optional). 1.58 ++ * 1.59 ++ * If you are running Drupal behind a reverse proxy, $base_url (see above) 1.60 ++ * usually points to the URL of the reverse proxy. Drupal uses this for 1.61 ++ * all sorts of external URLs. In order to correctly calculate sub-URLs 1.62 ++ * below $base_url for embedded HTML forms, Drupal also has to know the 1.63 ++ * URL on the local/origin server under which Drupal is contacted by the 1.64 ++ * reverse proxy. This is what $base_url_local is for. 1.65 ++ * 1.66 ++ * Examples: 1.67 ++ * $base_url_local = 'http://www.example.com:8080/drupal'; 1.68 ++ * 1.69 ++ * It is not allowed to have a trailing slash; Drupal will add it 1.70 ++ * for you. 1.71 ++ */ 1.72 ++# $base_url_local = 'http://www.example.com:8080/drupal'; // NO trailing slash! 1.73 ++ 1.74 ++/** 1.75 + * PHP settings: 1.76 + * 1.77 + * To see what PHP settings are possible, including whether they can 1.78 + 1.79 +----------------------------------------------------------------------------- 1.80 + 1.81 +1. Support HTTP Proxies (mainly for update checks, RSS fetching, etc) 1.82 +http://drupal.org/node/7881 1.83 +http://drupal.org/files/issues/proxy_11.patch 1.84 +(post-adjusted and improved by RSE) 1.85 + 1.86 +2. Fix CSS Cache Building Procedure 1.87 +http://drupal.org/node/275381 1.88 +http://drupal.org/files/issues/drupal-css-cache-building.patch 1.89 +(created by RSE) 1.90 + 1.91 +Index: includes/common.inc 1.92 +--- includes/common.inc.orig 2008-04-09 23:11:44 +0200 1.93 ++++ includes/common.inc 2008-06-26 20:16:16 +0200 1.94 +@@ -439,13 +439,27 @@ 1.95 + case 'http': 1.96 + $port = isset($uri['port']) ? $uri['port'] : 80; 1.97 + $host = $uri['host'] . ($port != 80 ? ':'. $port : ''); 1.98 +- $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); 1.99 ++ if (variable_get('proxy_server', '') != '') { 1.100 ++ $proxy_server = variable_get('proxy_server', ''); 1.101 ++ $proxy_port = variable_get('proxy_port', 8080); 1.102 ++ $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15); 1.103 ++ } 1.104 ++ else { 1.105 ++ $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); 1.106 ++ } 1.107 + break; 1.108 + case 'https': 1.109 + // Note: Only works for PHP 4.3 compiled with OpenSSL. 1.110 + $port = isset($uri['port']) ? $uri['port'] : 443; 1.111 + $host = $uri['host'] . ($port != 443 ? ':'. $port : ''); 1.112 +- $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20); 1.113 ++ if (variable_get('proxy_server', '') != '') { 1.114 ++ $proxy_server = variable_get('proxy_server', ''); 1.115 ++ $proxy_port = variable_get('proxy_port', 8080); 1.116 ++ $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15); 1.117 ++ } 1.118 ++ else { 1.119 ++ $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20); 1.120 ++ } 1.121 + break; 1.122 + default: 1.123 + $result->error = 'invalid schema '. $uri['scheme']; 1.124 +@@ -462,9 +476,14 @@ 1.125 + } 1.126 + 1.127 + // Construct the path to act on. 1.128 +- $path = isset($uri['path']) ? $uri['path'] : '/'; 1.129 +- if (isset($uri['query'])) { 1.130 +- $path .= '?'. $uri['query']; 1.131 ++ if (variable_get('proxy_server', '') != '') { 1.132 ++ $path = $url; 1.133 ++ } 1.134 ++ else { 1.135 ++ $path = isset($uri['path']) ? $uri['path'] : '/'; 1.136 ++ if (isset($uri['query'])) { 1.137 ++ $path .= '?'. $uri['query']; 1.138 ++ } 1.139 + } 1.140 + 1.141 + // Create HTTP request. 1.142 +@@ -482,6 +501,14 @@ 1.143 + $defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : '')); 1.144 + } 1.145 + 1.146 ++ // If the proxy server required a username then attempt to authenticate with it 1.147 ++ if (variable_get('proxy_username', '') != '') { 1.148 ++ $username = variable_get('proxy_username', ''); 1.149 ++ $password = variable_get('proxy_password', ''); 1.150 ++ $auth_string = base64_encode($username . ($password != '' ? ':'. $password : '')); 1.151 ++ $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n"; 1.152 ++ } 1.153 ++ 1.154 + foreach ($headers as $header => $value) { 1.155 + $defaults[$header] = $header .': '. $value; 1.156 + } 1.157 +Index: modules/system/system.admin.inc 1.158 +--- modules/system/system.admin.inc.orig 2008-03-25 12:58:16 +0100 1.159 ++++ modules/system/system.admin.inc 2008-04-24 11:43:07 +0200 1.160 +@@ -1363,6 +1363,65 @@ 1.161 + } 1.162 + 1.163 + /** 1.164 ++ * Form builder; Configure the site proxy settings. 1.165 ++ * 1.166 ++ * @ingroup forms 1.167 ++ * @see system_settings_form() 1.168 ++ */ 1.169 ++function system_proxy_settings() { 1.170 ++ 1.171 ++ $form['forward_proxy'] = array( 1.172 ++ '#type' => 'fieldset', 1.173 ++ '#title' => t('Forward proxy settings'), 1.174 ++ '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'), 1.175 ++ ); 1.176 ++ $form['forward_proxy']['proxy_server'] = array( 1.177 ++ '#type' => 'textfield', 1.178 ++ '#title' => t('Proxy host name'), 1.179 ++ '#default_value' => variable_get('proxy_server', ''), 1.180 ++ '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.') 1.181 ++ ); 1.182 ++ $form['forward_proxy']['proxy_port'] = array( 1.183 ++ '#type' => 'textfield', 1.184 ++ '#title' => t('Proxy port number'), 1.185 ++ '#default_value' => variable_get('proxy_port', 8080), 1.186 ++ '#description' => t('The port number of the proxy server, eg. 8080'), 1.187 ++ ); 1.188 ++ $form['forward_proxy']['proxy_username'] = array( 1.189 ++ '#type' => 'textfield', 1.190 ++ '#title' => t('Proxy username'), 1.191 ++ '#default_value' => variable_get('proxy_username', ''), 1.192 ++ '#description' => t('The username used to authenticate with the proxy server.'), 1.193 ++ ); 1.194 ++ $form['forward_proxy']['proxy_password'] = array( 1.195 ++ '#type' => 'textfield', 1.196 ++ '#title' => t('Proxy password'), 1.197 ++ '#default_value' => variable_get('proxy_password', ''), 1.198 ++ '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '') 1.199 ++ ); 1.200 ++ $form['#validate'][] = 'system_proxy_settings_validate'; 1.201 ++ 1.202 ++ return system_settings_form($form); 1.203 ++} 1.204 ++ 1.205 ++/** 1.206 ++ * Validate the submitted proxy form. 1.207 ++ */ 1.208 ++function system_proxy_settings_validate($form, &$form_state) { 1.209 ++ // Validate the proxy settings 1.210 ++ $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']); 1.211 ++ if ($form_state['values']['proxy_server'] != '') { 1.212 ++ // TCP allows the port to be between 0 and 65536 inclusive 1.213 ++ if (!is_numeric($form_state['values']['proxy_port'])) { 1.214 ++ form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.')); 1.215 ++ } 1.216 ++ elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) { 1.217 ++ form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.')); 1.218 ++ } 1.219 ++ } 1.220 ++} 1.221 ++ 1.222 ++/** 1.223 + * Form builder; Configure the site file handling. 1.224 + * 1.225 + * @ingroup forms 1.226 +Index: modules/system/system.module 1.227 +--- modules/system/system.module.orig 2008-04-09 23:11:49 +0200 1.228 ++++ modules/system/system.module 2008-04-24 11:43:47 +0200 1.229 +@@ -55,7 +55,7 @@ 1.230 + $output .= '<li>'. t('support for enabling and disabling <a href="@themes">themes</a>, which determine the design and presentation of your site. Drupal comes packaged with several core themes and additional contributed themes are available at the <a href="@drupal-themes">Drupal.org theme page</a>.', array('@themes' => url('admin/build/themes'), '@drupal-themes' => 'http://drupal.org/project/themes')) .'</li>'; 1.231 + $output .= '<li>'. t('a robust <a href="@cache-settings">caching system</a> that allows the efficient re-use of previously-constructed web pages and web page components. Drupal stores the pages requested by anonymous users in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, Drupal\'s caching system may significantly increase the speed of your site.', array('@cache-settings' => url('admin/settings/performance'))) .'</li>'; 1.232 + $output .= '<li>'. t('a set of routine administrative operations that rely on a correctly-configured <a href="@cron">cron maintenance task</a> to run automatically. A number of other modules, including the feed aggregator, ping module and search also rely on <a href="@cron">cron maintenance tasks</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>.', array('@cron' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron')) .'</li>'; 1.233 +- $output .= '<li>'. t('basic configuration options for your site, including <a href="@date-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@site-maintenance">site maintenance</a> function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .'</li></ul>'; 1.234 ++ $output .= '<li>'. t('basic configuration options for your site, including <a href="@date-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@proxy-server">proxy server settings</a>, a href="@site-info">site name and other information</a>, and a <a href="@site-maintenance">site maintenance</a> function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .'</li></ul>'; 1.235 + $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/handbook/modules/system/')) .'</p>'; 1.236 + return $output; 1.237 + case 'admin': 1.238 +@@ -406,6 +406,14 @@ 1.239 + 'access arguments' => array('administer site configuration'), 1.240 + 'file' => 'system.admin.inc', 1.241 + ); 1.242 ++ $items['admin/settings/proxy'] = array( 1.243 ++ 'title' => 'Proxy server', 1.244 ++ 'description' => 'Configure settings when the site is behind a proxy server.', 1.245 ++ 'page callback' => 'drupal_get_form', 1.246 ++ 'page arguments' => array('system_proxy_settings'), 1.247 ++ 'access arguments' => array('administer site configuration'), 1.248 ++ 'file' => 'system.admin.inc', 1.249 ++ ); 1.250 + $items['admin/settings/file-system'] = array( 1.251 + 'title' => 'File system', 1.252 + 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.', 1.253 + 1.254 +----------------------------------------------------------------------------- 1.255 + 1.256 +Disable "Update notifications" check by default during installation. 1.257 + 1.258 +Index: install.php 1.259 +--- install.php.orig 2008-02-08 23:00:45 +0100 1.260 ++++ install.php 2008-05-09 13:18:09 +0200 1.261 +@@ -1069,7 +1069,7 @@ 1.262 + '#type' => 'checkboxes', 1.263 + '#title' => st('Update notifications'), 1.264 + '#options' => array(1 => st('Check for updates automatically')), 1.265 +- '#default_value' => array(1), 1.266 ++ '#default_value' => array(), 1.267 + '#description' => st('With this option enabled, Drupal will notify you when new releases are available. This will significantly enhance your site\'s security and is <strong>highly recommended</strong>. This requires your site to periodically send anonymous information on its installed components to <a href="@drupal">drupal.org</a>. For more information please see the <a href="@update">update notification information</a>.', array('@drupal' => 'http://drupal.org', '@update' => 'http://drupal.org/handbook/modules/update')), 1.268 + '#weight' => 15, 1.269 + ); 1.270 + 1.271 +----------------------------------------------------------------------------- 1.272 + 1.273 +No need to always expand the "Menu settings" on node edit pages. 1.274 + 1.275 +Index: modules/menu/menu.module 1.276 +--- modules/menu/menu.module.orig 2008-04-09 23:11:48 +0200 1.277 ++++ modules/menu/menu.module 2008-05-16 20:03:48 +0200 1.278 +@@ -366,7 +366,7 @@ 1.279 + '#title' => t('Menu settings'), 1.280 + '#access' => user_access('administer menu'), 1.281 + '#collapsible' => TRUE, 1.282 +- '#collapsed' => FALSE, 1.283 ++ '#collapsed' => TRUE, 1.284 + '#tree' => TRUE, 1.285 + '#weight' => -2, 1.286 + '#attributes' => array('class' => 'menu-item-form'), 1.287 + 1.288 +----------------------------------------------------------------------------- 1.289 + 1.290 +Use a larger text-area on node edit pages. 1.291 + 1.292 +Index: modules/node/node.pages.inc 1.293 +--- modules/node/node.pages.inc.orig 2008-02-27 20:44:44 +0100 1.294 ++++ modules/node/node.pages.inc 2008-05-16 20:06:45 +0200 1.295 +@@ -287,7 +287,8 @@ 1.296 + '#type' => 'textarea', 1.297 + '#title' => check_plain($label), 1.298 + '#default_value' => $include ? $node->body : ($node->teaser . $node->body), 1.299 +- '#rows' => 20, 1.300 ++ '#rows' => 30, 1.301 ++ '#cols' => 80, 1.302 + '#required' => ($word_count > 0), 1.303 + ); 1.304 + 1.305 +----------------------------------------------------------------------------- 1.306 + 1.307 +Avoid incorrect ordering of BLOG entries by removing the 1.308 +db_rewrite_sql() calls which seem to introduce a wrong ordering. 1.309 + 1.310 +Index: modules/blog/blog.module 1.311 +--- modules/blog/blog.module.orig 2008-05-19 09:27:35 +0200 1.312 ++++ modules/blog/blog.module 2008-07-29 21:20:42 +0200 1.313 +@@ -182,13 +182,13 @@ 1.314 + * Helper function to determine if a user has blog posts already. 1.315 + */ 1.316 + function _blog_post_exists($account) { 1.317 +- return (bool)db_result(db_query_range(db_rewrite_sql("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1"), $account->uid, 0, 1)); 1.318 ++ return (bool)db_result(db_query_range("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1", $account->uid, 0, 1)); 1.319 + } 1.320 + 1.321 + /** 1.322 + * Implementation of hook_block(). 1.323 + * 1.324 +- * Displays the most recent 10 blog titles. 1.325 ++ * Displays the most recent 5 blog titles. 1.326 + */ 1.327 + function blog_block($op = 'list', $delta = 0) { 1.328 + global $user; 1.329 +@@ -198,7 +198,7 @@ 1.330 + } 1.331 + else if ($op == 'view') { 1.332 + if (user_access('access content')) { 1.333 +- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10); 1.334 ++ $result = db_query_range("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC", 0, 5); 1.335 + if ($node_title_list = node_title_list($result)) { 1.336 + $block['content'] = $node_title_list; 1.337 + $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.')); 1.338 +Index: modules/blog/blog.pages.inc 1.339 +--- modules/blog/blog.pages.inc.orig 2009-09-14 17:08:00 +0200 1.340 ++++ modules/blog/blog.pages.inc 2009-09-19 08:53:18 +0200 1.341 +@@ -25,7 +25,7 @@ 1.342 + 1.343 + $output = theme('item_list', $items); 1.344 + 1.345 +- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid); 1.346 ++ $result = pager_query("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC", variable_get('default_nodes_main', 10), 0, NULL, $account->uid); 1.347 + $has_posts = FALSE; 1.348 + 1.349 + while ($node = db_fetch_object($result)) { 1.350 +@@ -64,7 +64,7 @@ 1.351 + 1.352 + $output = theme('item_list', $items); 1.353 + 1.354 +- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10)); 1.355 ++ $result = pager_query("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC", variable_get('default_nodes_main', 10)); 1.356 + $has_posts = FALSE; 1.357 + 1.358 + while ($node = db_fetch_object($result)) { 1.359 +@@ -87,7 +87,7 @@ 1.360 + * Menu callback; displays an RSS feed containing recent blog entries of a given user. 1.361 + */ 1.362 + function blog_feed_user($account) { 1.363 +- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10)); 1.364 ++ $result = db_query_range("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC", $account->uid, 0, variable_get('feed_default_items', 10)); 1.365 + $channel['title'] = t("!name's blog", array('!name' => $account->name)); 1.366 + $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE)); 1.367 + 1.368 +@@ -102,7 +102,7 @@ 1.369 + * Menu callback; displays an RSS feed containing recent blog entries of all users. 1.370 + */ 1.371 + function blog_feed_last() { 1.372 +- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10)); 1.373 ++ $result = db_query_range("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC", 0, variable_get('feed_default_items', 10)); 1.374 + $channel['title'] = t('!site_name blogs', array('!site_name' => variable_get('site_name', 'Drupal'))); 1.375 + $channel['link'] = url('blog', array('absolute' => TRUE)); 1.376 +