drupal.patch 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. Fix Reverse Proxy Support:
  2. http://drupal.org/node/244593
  3. http://drupal.org/files/issues/drupal_80.patch
  4. Index: includes/bootstrap.inc
  5. --- includes/bootstrap.inc.orig 2008-02-11 15:36:21 +0100
  6. +++ includes/bootstrap.inc 2008-04-09 20:47:49 +0200
  7. @@ -272,6 +272,7 @@
  8. */
  9. function conf_init() {
  10. global $base_url, $base_path, $base_root;
  11. + global $base_url_local;
  12. // Export the following settings.php variables to the global namespace
  13. global $db_url, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access;
  14. @@ -723,9 +724,22 @@
  15. * generate an equivalent using other environment variables.
  16. */
  17. function request_uri() {
  18. + global $base_url;
  19. + global $base_url_local;
  20. if (isset($_SERVER['REQUEST_URI'])) {
  21. $uri = $_SERVER['REQUEST_URI'];
  22. + if (isset($base_url) && isset($base_url_local)) {
  23. + $parts = parse_url($base_url_local);
  24. + if ( strlen($uri) >= strlen($base_url_local)
  25. + && substr($uri, 0, strlen($base_url_local)) == $base_url_local) {
  26. + $uri = $base_url . substr($uri, strlen($base_url_local));
  27. + }
  28. + elseif ( strlen($uri) >= strlen($parts["path"])
  29. + && substr($uri, 0, strlen($parts["path"])) == $parts["path"]) {
  30. + $uri = $base_url . substr($uri, strlen($parts["path"]));
  31. + }
  32. + }
  33. }
  34. else {
  35. if (isset($_SERVER['argv'])) {
  36. Index: sites/default/default.settings.php
  37. --- sites/default/default.settings.php.orig 2007-12-20 10:35:10 +0100
  38. +++ sites/default/default.settings.php 2008-04-09 20:47:32 +0200
  39. @@ -126,6 +126,24 @@
  40. # $base_url = 'http://www.example.com'; // NO trailing slash!
  41. /**
  42. + * Local Base URL (optional).
  43. + *
  44. + * If you are running Drupal behind a reverse proxy, $base_url (see above)
  45. + * usually points to the URL of the reverse proxy. Drupal uses this for
  46. + * all sorts of external URLs. In order to correctly calculate sub-URLs
  47. + * below $base_url for embedded HTML forms, Drupal also has to know the
  48. + * URL on the local/origin server under which Drupal is contacted by the
  49. + * reverse proxy. This is what $base_url_local is for.
  50. + *
  51. + * Examples:
  52. + * $base_url_local = 'http://www.example.com:8080/drupal';
  53. + *
  54. + * It is not allowed to have a trailing slash; Drupal will add it
  55. + * for you.
  56. + */
  57. +# $base_url_local = 'http://www.example.com:8080/drupal'; // NO trailing slash!
  58. +
  59. +/**
  60. * PHP settings:
  61. *
  62. * To see what PHP settings are possible, including whether they can
  63. -----------------------------------------------------------------------------
  64. Support HTTP Proxies (mainly for update checks, RSS fetching, etc)
  65. http://drupal.org/node/7881
  66. http://drupal.org/files/issues/proxy_11.patch
  67. (post-adjusted and improved by RSE)
  68. Index: includes/common.inc
  69. --- includes/common.inc.orig 2008-04-09 23:11:44 +0200
  70. +++ includes/common.inc 2008-04-24 11:41:40 +0200
  71. @@ -439,13 +439,27 @@
  72. case 'http':
  73. $port = isset($uri['port']) ? $uri['port'] : 80;
  74. $host = $uri['host'] . ($port != 80 ? ':'. $port : '');
  75. - $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
  76. + if (variable_get('proxy_server', '') != '') {
  77. + $proxy_server = variable_get('proxy_server', '');
  78. + $proxy_port = variable_get('proxy_port', 8080);
  79. + $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
  80. + }
  81. + else {
  82. + $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
  83. + }
  84. break;
  85. case 'https':
  86. // Note: Only works for PHP 4.3 compiled with OpenSSL.
  87. $port = isset($uri['port']) ? $uri['port'] : 443;
  88. $host = $uri['host'] . ($port != 443 ? ':'. $port : '');
  89. - $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
  90. + if (variable_get('proxy_server', '') != '') {
  91. + $proxy_server = variable_get('proxy_server', '');
  92. + $proxy_port = variable_get('proxy_port', 8080);
  93. + $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
  94. + }
  95. + else {
  96. + $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
  97. + }
  98. break;
  99. default:
  100. $result->error = 'invalid schema '. $uri['scheme'];
  101. @@ -462,9 +476,14 @@
  102. }
  103. // Construct the path to act on.
  104. - $path = isset($uri['path']) ? $uri['path'] : '/';
  105. - if (isset($uri['query'])) {
  106. - $path .= '?'. $uri['query'];
  107. + if (variable_get('proxy_server', '') != '') {
  108. + $path = $url;
  109. + }
  110. + else {
  111. + $path = isset($uri['path']) ? $uri['path'] : '/';
  112. + if (isset($uri['query'])) {
  113. + $path .= '?'. $uri['query'];
  114. + }
  115. }
  116. // Create HTTP request.
  117. @@ -482,6 +501,14 @@
  118. $defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : ''));
  119. }
  120. + // If the proxy server required a username then attempt to authenticate with it
  121. + if (variable_get('proxy_username', '') != '') {
  122. + $username = variable_get('proxy_username', '');
  123. + $password = variable_get('proxy_password', '');
  124. + $auth_string = base64_encode($username . ($password != '' ? ':'. $password : ''));
  125. + $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n";
  126. + }
  127. +
  128. foreach ($headers as $header => $value) {
  129. $defaults[$header] = $header .': '. $value;
  130. }
  131. Index: modules/system/system.admin.inc
  132. --- modules/system/system.admin.inc.orig 2008-03-25 12:58:16 +0100
  133. +++ modules/system/system.admin.inc 2008-04-24 11:43:07 +0200
  134. @@ -1363,6 +1363,65 @@
  135. }
  136. /**
  137. + * Form builder; Configure the site proxy settings.
  138. + *
  139. + * @ingroup forms
  140. + * @see system_settings_form()
  141. + */
  142. +function system_proxy_settings() {
  143. +
  144. + $form['forward_proxy'] = array(
  145. + '#type' => 'fieldset',
  146. + '#title' => t('Forward proxy settings'),
  147. + '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
  148. + );
  149. + $form['forward_proxy']['proxy_server'] = array(
  150. + '#type' => 'textfield',
  151. + '#title' => t('Proxy host name'),
  152. + '#default_value' => variable_get('proxy_server', ''),
  153. + '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
  154. + );
  155. + $form['forward_proxy']['proxy_port'] = array(
  156. + '#type' => 'textfield',
  157. + '#title' => t('Proxy port number'),
  158. + '#default_value' => variable_get('proxy_port', 8080),
  159. + '#description' => t('The port number of the proxy server, eg. 8080'),
  160. + );
  161. + $form['forward_proxy']['proxy_username'] = array(
  162. + '#type' => 'textfield',
  163. + '#title' => t('Proxy username'),
  164. + '#default_value' => variable_get('proxy_username', ''),
  165. + '#description' => t('The username used to authenticate with the proxy server.'),
  166. + );
  167. + $form['forward_proxy']['proxy_password'] = array(
  168. + '#type' => 'textfield',
  169. + '#title' => t('Proxy password'),
  170. + '#default_value' => variable_get('proxy_password', ''),
  171. + '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
  172. + );
  173. + $form['#validate'][] = 'system_proxy_settings_validate';
  174. +
  175. + return system_settings_form($form);
  176. +}
  177. +
  178. +/**
  179. + * Validate the submitted proxy form.
  180. + */
  181. +function system_proxy_settings_validate($form, &$form_state) {
  182. + // Validate the proxy settings
  183. + $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
  184. + if ($form_state['values']['proxy_server'] != '') {
  185. + // TCP allows the port to be between 0 and 65536 inclusive
  186. + if (!is_numeric($form_state['values']['proxy_port'])) {
  187. + form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
  188. + }
  189. + elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) {
  190. + form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
  191. + }
  192. + }
  193. +}
  194. +
  195. +/**
  196. * Form builder; Configure the site file handling.
  197. *
  198. * @ingroup forms
  199. Index: modules/system/system.module
  200. --- modules/system/system.module.orig 2008-04-09 23:11:49 +0200
  201. +++ modules/system/system.module 2008-04-24 11:43:47 +0200
  202. @@ -55,7 +55,7 @@
  203. $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>';
  204. $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>';
  205. $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>';
  206. - $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>';
  207. + $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>';
  208. $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>';
  209. return $output;
  210. case 'admin':
  211. @@ -406,6 +406,14 @@
  212. 'access arguments' => array('administer site configuration'),
  213. 'file' => 'system.admin.inc',
  214. );
  215. + $items['admin/settings/proxy'] = array(
  216. + 'title' => 'Proxy server',
  217. + 'description' => 'Configure settings when the site is behind a proxy server.',
  218. + 'page callback' => 'drupal_get_form',
  219. + 'page arguments' => array('system_proxy_settings'),
  220. + 'access arguments' => array('administer site configuration'),
  221. + 'file' => 'system.admin.inc',
  222. + );
  223. $items['admin/settings/file-system'] = array(
  224. 'title' => 'File system',
  225. 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
  226. -----------------------------------------------------------------------------
  227. Properly activate Drupal support module in TinyMCE
  228. Index: sites/all/modules/tinymce/plugin_reg.php
  229. --- sites/all/modules/tinymce/plugin_reg.php.orig 2008-03-27 21:11:17 +0100
  230. +++ sites/all/modules/tinymce/plugin_reg.php 2008-05-02 20:56:56 +0200
  231. @@ -102,5 +102,9 @@
  232. $plugins['zoom'] = array();
  233. $plugins['zoom']['theme_advanced_buttons2'] = array('zoom');
  234. +$plugins['drupalimage'] = array();
  235. +$plugins['drupalimage']['theme_advanced_buttons1'] = array('drupalimage');
  236. +$plugins['drupalimage']['extended_valid_elements'] = array('img[class|src|border=0|alt|title|width|height|align|name]');
  237. +
  238. return $plugins;
  239. }
  240. -----------------------------------------------------------------------------
  241. Fix SQL in "remove" functionality of "img_assist" module.
  242. http://drupal.org/node/250128
  243. Index: sites/all/modules/img_assist/img_assist.module
  244. --- sites/all/modules/img_assist/img_assist.module.orig 2008-04-06 19:32:33 +0200
  245. +++ sites/all/modules/img_assist/img_assist.module 2008-05-02 21:00:24 +0200
  246. @@ -1239,7 +1239,7 @@
  247. }
  248. function _img_assist_remove($node, $size) {
  249. - $result = db_query("SELECT * FROM {files} f INNER JOIN {image} i WHERE f.fid = i.fid AND i.nid = %d AND f.filename = '%s'", $node->nid, $size['key']);
  250. + $result = db_query("SELECT * FROM {files} f INNER JOIN {image} ON f.fid = i.fid WHERE i.nid = %d AND f.filename = '%s'", $node->nid, $size['key']);
  251. while ($file = db_fetch_object($result)) {
  252. // Never delete original image.
  253. if ($file->filepath != $node->images[IMAGE_ORIGINAL]) {
  254. -----------------------------------------------------------------------------
  255. Optimize "img_assist" module by loading only when necessary.
  256. http://drupal.org/node/55101
  257. Index: sites/all/modules/img_assist/img_assist.js
  258. --- sites/all/modules/img_assist/img_assist.js.orig 2008-04-06 18:43:18 +0200
  259. +++ sites/all/modules/img_assist/img_assist.js 2008-05-02 21:05:56 +0200
  260. @@ -130,6 +130,24 @@
  261. var win = window.open(BASE_URL + 'index.php?q=img_assist/popup/' + nid, 'imagev', 'height='+oy+'-10,width='+ox+',top='+winy+',left='+winx+',scrollbars='+use_scrollbars+',resizable');
  262. }
  263. +function launch_popup(nid, mw, mh) {
  264. + var ox = mw;
  265. + var oy = mh;
  266. + if((ox>=screen.width) || (oy>=screen.height)){
  267. + var ox = screen.width-150;
  268. + var oy = screen.height-150;
  269. + var winx = (screen.width / 2)-(ox / 2);
  270. + var winy = (screen.height / 2)-(oy / 2);
  271. + var use_scrollbars = 1;
  272. + }
  273. + else{
  274. + var winx = (screen.width / 2)-(ox / 2);
  275. + var winy = (screen.height / 2)-(oy / 2);
  276. + var use_scrollbars = 0;
  277. + }
  278. + var win = window.open(BASE_URL + 'index.php?q=img_assist/popup/' + nid, 'imagev', 'height='+oy+'-10,width='+ox+',top='+winy+',left='+winx+',scrollbars='+use_scrollbars+',resizable');
  279. +}
  280. +
  281. function insertImage() {
  282. if (window.opener) {
  283. // Get variables from the fields on the properties frame
  284. Index: sites/all/modules/img_assist/img_assist.module
  285. --- sites/all/modules/img_assist/img_assist.module.orig 2008-05-02 21:04:49 +0200
  286. +++ sites/all/modules/img_assist/img_assist.module 2008-05-02 21:07:24 +0200
  287. @@ -126,7 +126,7 @@
  288. }
  289. // Assign base_path to insert in image source by javascript.
  290. drupal_add_js('var BASE_URL = "'. base_path() .'";', 'inline');
  291. - drupal_add_js($path .'/img_assist.js');
  292. + drupal_add_js($path .'/img_assist_popup.js');
  293. }
  294. /**
  295. @@ -150,6 +150,9 @@
  296. * Add image link underneath textareas.
  297. */
  298. function img_assist_textarea($element) {
  299. + $path = drupal_get_path('module', 'img_assist');
  300. + drupal_add_js($path .'/img_assist.js');
  301. +
  302. $link = variable_get('img_assist_link', 'icon');
  303. if (($link == 'icon') || ($link == 'text')) {
  304. if (_img_assist_textarea_match($element['#id']) && _img_assist_page_match() && !strstr($_GET['q'], 'img_assist')) {
  305. Index: sites/all/modules/img_assist/img_assist_popup.js
  306. --- /dev/null 2008-05-02 21:08:21 +0200
  307. +++ sites/all/modules/img_assist/img_assist_popup.js 2008-05-02 21:05:56 +0200
  308. @@ -0,0 +1,20 @@
  309. +/* $Id: drupal.patch,v 1.19 2008/05/29 11:13:43 rse Exp $ */
  310. +
  311. +function launch_popup(nid, mw, mh) {
  312. + var ox = mw;
  313. + var oy = mh;
  314. + if((ox>=screen.width) || (oy>=screen.height)){
  315. + var ox = screen.width-150;
  316. + var oy = screen.height-150;
  317. + var winx = (screen.width / 2)-(ox / 2);
  318. + var winy = (screen.height / 2)-(oy / 2);
  319. + var use_scrollbars = 1;
  320. + }
  321. + else{
  322. + var winx = (screen.width / 2)-(ox / 2);
  323. + var winy = (screen.height / 2)-(oy / 2);
  324. + var use_scrollbars = 0;
  325. + }
  326. + var win = window.open(BASE_URL + 'index.php?q=img_assist/popup/' + nid, 'imagev', 'height='+oy+'-10,width='+ox+',top='+winy+',left='+winx+',scrollbars='+use_scrollbars+',resizable');
  327. +}
  328. +
  329. -----------------------------------------------------------------------------
  330. Fix file permissions.
  331. http://drupal.org/node/247992
  332. Index: sites/all/modules/img_assist/img_assist.module
  333. --- sites/all/modules/img_assist/img_assist.module.orig 2008-05-02 21:11:15 +0200
  334. +++ sites/all/modules/img_assist/img_assist.module 2008-05-02 21:11:48 +0200
  335. @@ -1230,6 +1230,8 @@
  336. drupal_set_message(t('Unable to create %label image', array('%label' => $size['label'])), 'error');
  337. }
  338. else {
  339. + // Set standard file permissions for webserver-generated files
  340. + @chmod(file_create_path($destination), 0664);
  341. $node->images[$key] = $destination;
  342. _image_insert($node, $key, file_create_path($destination));
  343. }
  344. -----------------------------------------------------------------------------
  345. Activate the Drupal glue code for the FCKeditor filemanager.
  346. Index: sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php
  347. --- sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php.orig 2008-03-25 16:28:24 +0100
  348. +++ sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php 2008-05-02 23:02:23 +0200
  349. @@ -39,6 +39,9 @@
  350. // Attention: The above 'UserFilesPath' must point to the same directory.
  351. $Config['UserFilesAbsolutePath'] = '' ;
  352. +// activate Drupal glue code for filemanager
  353. +require_once "../../../../../filemanager.config.php";
  354. +
  355. // Due to security issues with Apache modules, it is recommended to leave the
  356. // following setting enabled.
  357. $Config['ForceSingleExtension'] = true ;
  358. -----------------------------------------------------------------------------
  359. Degrade the "Update notification" check from ERROR to WARNING severity
  360. as for a packaged Drupal as in OpenPKG the Update notification is less
  361. important and actually confusing anyway. With WARNING one at least still
  362. sees the issue, but under "Administer" one doesn't get the confusing red
  363. error message and longer.
  364. Index: modules/system/system.install
  365. --- modules/system/system.install.orig 2008-02-08 18:07:55 +0100
  366. +++ modules/system/system.install 2008-05-03 10:42:23 +0200
  367. @@ -273,7 +273,7 @@
  368. if (!module_exists('update')) {
  369. $requirements['update status'] = array(
  370. 'value' => $t('Not enabled'),
  371. - 'severity' => REQUIREMENT_ERROR,
  372. + 'severity' => REQUIREMENT_WARNING,
  373. 'description' => $t('Update notifications are not enabled. It is <strong>highly recommended</strong> that you enable the update status module from the <a href="@module">module administration page</a> in order to stay up-to-date on new releases. For more information please read the <a href="@update">Update status handbook page</a>.', array('@update' => 'http://drupal.org/handbook/modules/update', '@module' => url('admin/build/modules'))),
  374. );
  375. }
  376. -----------------------------------------------------------------------------
  377. Disable "Update notifications" check by default during installation.
  378. Index: install.php
  379. --- install.php.orig 2008-02-08 23:00:45 +0100
  380. +++ install.php 2008-05-09 13:18:09 +0200
  381. @@ -1069,7 +1069,7 @@
  382. '#type' => 'checkboxes',
  383. '#title' => st('Update notifications'),
  384. '#options' => array(1 => st('Check for updates automatically')),
  385. - '#default_value' => array(1),
  386. + '#default_value' => array(),
  387. '#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')),
  388. '#weight' => 15,
  389. );
  390. -----------------------------------------------------------------------------
  391. No need to always expand the "Menu settings" on node edit pages.
  392. Index: modules/menu/menu.module
  393. --- modules/menu/menu.module.orig 2008-04-09 23:11:48 +0200
  394. +++ modules/menu/menu.module 2008-05-16 20:03:48 +0200
  395. @@ -366,7 +366,7 @@
  396. '#title' => t('Menu settings'),
  397. '#access' => user_access('administer menu'),
  398. '#collapsible' => TRUE,
  399. - '#collapsed' => FALSE,
  400. + '#collapsed' => TRUE,
  401. '#tree' => TRUE,
  402. '#weight' => -2,
  403. '#attributes' => array('class' => 'menu-item-form'),
  404. -----------------------------------------------------------------------------
  405. Use a larger text-area on node edit pages.
  406. Index: modules/node/node.pages.inc
  407. --- modules/node/node.pages.inc.orig 2008-02-27 20:44:44 +0100
  408. +++ modules/node/node.pages.inc 2008-05-16 20:06:45 +0200
  409. @@ -287,7 +287,8 @@
  410. '#type' => 'textarea',
  411. '#title' => check_plain($label),
  412. '#default_value' => $include ? $node->body : ($node->teaser . $node->body),
  413. - '#rows' => 20,
  414. + '#rows' => 30,
  415. + '#cols' => 80,
  416. '#required' => ($word_count > 0),
  417. );
  418. -----------------------------------------------------------------------------
  419. Fix "Action" related administration dialog and corresponding run-time handling.
  420. Index: modules/system/system.module
  421. --- modules/system/system.module.orig 2008-04-09 23:11:49 +0200
  422. +++ modules/system/system.module 2008-05-23 10:41:26 +0200
  423. @@ -1431,7 +1439,7 @@
  424. if (is_numeric($action)) {
  425. $aid = $action;
  426. // Load stored parameter values from database.
  427. - $data = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", intval($aid)));
  428. + $data = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $aid));
  429. $edit['actions_description'] = $data->description;
  430. $edit['actions_type'] = $data->type;
  431. $function = $data->callback;
  432. Index: includes/actions.inc
  433. --- includes/actions.inc.orig 2007-12-31 15:51:04 +0100
  434. +++ includes/actions.inc 2008-05-23 11:22:17 +0200
  435. @@ -54,7 +54,7 @@
  436. $where_values = array();
  437. foreach ($action_ids as $action_id) {
  438. if (is_numeric($action_id)) {
  439. - $where[] = 'OR aid = %d';
  440. + $where[] = "OR aid = '%s'";
  441. $where_values[] = $action_id;
  442. }
  443. elseif (isset($available_actions[$action_id])) {
  444. @@ -93,7 +93,7 @@
  445. else {
  446. // If it's a configurable action, retrieve stored parameters.
  447. if (is_numeric($action_ids)) {
  448. - $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $action_ids));
  449. + $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $action_ids));
  450. $function = $action->callback;
  451. $context = array_merge($context, unserialize($action->parameters));
  452. $result[$action_ids] = $function($object, $context, $a1, $a2);
  453. @@ -325,7 +325,7 @@
  454. function actions_save($function, $type, $params, $desc, $aid = NULL) {
  455. $serialized = serialize($params);
  456. if ($aid) {
  457. - db_query("UPDATE {actions} SET callback = '%s', type = '%s', parameters = '%s', description = '%s' WHERE aid = %d", $function, $type, $serialized, $desc, $aid);
  458. + db_query("UPDATE {actions} SET callback = '%s', type = '%s', parameters = '%s', description = '%s' WHERE aid = '%s'", $function, $type, $serialized, $desc, $aid);
  459. watchdog('actions', 'Action %action saved.', array('%action' => $desc));
  460. }
  461. else {
  462. @@ -333,7 +333,7 @@
  463. // separate table for numeric aids.
  464. db_query('INSERT INTO {actions_aid} VALUES (default)');
  465. $aid = db_last_insert_id('actions_aid', 'aid');
  466. - db_query("INSERT INTO {actions} (aid, callback, type, parameters, description) VALUES (%d, '%s', '%s', '%s', '%s')", $aid, $function, $type, $serialized, $desc);
  467. + db_query("INSERT INTO {actions} (aid, callback, type, parameters, description) VALUES ('%s', '%s', '%s', '%s', '%s')", $aid, $function, $type, $serialized, $desc);
  468. watchdog('actions', 'Action %action created.', array('%action' => $desc));
  469. }
  470. @@ -350,7 +350,7 @@
  471. * The appropriate action row from the database as an object.
  472. */
  473. function actions_load($aid) {
  474. - return db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $aid));
  475. + return db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $aid));
  476. }
  477. /**
  478. @@ -360,6 +360,6 @@
  479. * integer The ID of the action to delete.
  480. */
  481. function actions_delete($aid) {
  482. - db_query("DELETE FROM {actions} WHERE aid = %d", $aid);
  483. + db_query("DELETE FROM {actions} WHERE aid = '%s'", $aid);
  484. module_invoke_all('actions_delete', $aid);
  485. }
  486. Index: modules/user/user.admin.inc
  487. --- modules/user/user.admin.inc.orig 2008-01-16 23:54:41 +0100
  488. +++ modules/user/user.admin.inc 2008-05-23 11:24:13 +0200
  489. @@ -737,13 +737,13 @@
  490. form_set_error('mask', t('You must enter a mask.'));
  491. }
  492. else {
  493. - db_query("UPDATE {access} SET mask = '%s', type = '%s', status = '%s' WHERE aid = %d", $edit['mask'], $edit['type'], $edit['status'], $aid);
  494. + db_query("UPDATE {access} SET mask = '%s', type = '%s', status = '%s' WHERE aid = '%s'", $edit['mask'], $edit['type'], $edit['status'], $aid);
  495. drupal_set_message(t('The access rule has been saved.'));
  496. drupal_goto('admin/user/rules');
  497. }
  498. }
  499. else {
  500. - $edit = db_fetch_array(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
  501. + $edit = db_fetch_array(db_query("SELECT aid, type, status, mask FROM {access} WHERE aid = '%s'", $aid));
  502. }
  503. return drupal_get_form('user_admin_access_edit_form', $edit, t('Save rule'));
  504. }
  505. @@ -859,7 +859,7 @@
  506. */
  507. function user_admin_access_delete_confirm($form_state, $aid = 0) {
  508. $access_types = array('user' => t('username'), 'mail' => t('e-mail'), 'host' => t('host'));
  509. - $edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
  510. + $edit = db_fetch_object(db_query("SELECT aid, type, status, mask FROM {access} WHERE aid = '%s'", $aid));
  511. $form = array();
  512. $form['aid'] = array('#type' => 'hidden', '#value' => $aid);
  513. @@ -873,7 +873,7 @@
  514. }
  515. function user_admin_access_delete_confirm_submit($form, &$form_state) {
  516. - db_query('DELETE FROM {access} WHERE aid = %d', $form_state['values']['aid']);
  517. + db_query("DELETE FROM {access} WHERE aid = '%s'", $form_state['values']['aid']);
  518. drupal_set_message(t('The access rule has been deleted.'));
  519. $form_state['redirect'] = 'admin/user/rules';
  520. return;
  521. -----------------------------------------------------------------------------
  522. 1. Fix content validation in "xmlcontent" module in case
  523. one has enabled multiple filters on a particular input format.
  524. 2. Additionally, allow absolute paths to support .xsd/.xsl files
  525. in arbitrary directories.
  526. 3. Finally, do not create a new DOM and output it as XML. Instead directly
  527. output the transformed XML in order to get rid of the <?xml...?> declaration.
  528. 4. Additionally, support an optional XML content template (mainly
  529. for loading ENTITY definitions which cannot be done via XSD and XSLT)
  530. Index: sites/all/modules/xmlcontent/xmlcontent.module
  531. --- sites/all/modules/xmlcontent/xmlcontent.module.orig 2007-03-14 22:59:59 +0100
  532. +++ sites/all/modules/xmlcontent/xmlcontent.module 2008-05-29 13:11:51 +0200
  533. @@ -39,7 +39,16 @@
  534. return t('Allows users to post XML node content and get it transformed through a configured XSLT script');
  535. case 'process':
  536. - $xslt_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_xslt_path_$format", '');
  537. + $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
  538. + if ($tpl_path) {
  539. + if (substr($tpl_path, 0, 1) != "/")
  540. + $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
  541. + $tpl = file_get_contents($tpl_path);
  542. + $text = preg_replace("/&template_body;/", $text, $tpl);
  543. + }
  544. + $xslt_path = variable_get("xmlcontent_xslt_path_$format", '');
  545. + if (substr($xslt_path, 0, 1) != "/")
  546. + $xslt_path = drupal_get_path('module', 'xmlcontent') . '/' . $xslt_path;
  547. return _xmlcontent_transform($text, $xslt_path);
  548. case 'settings':
  549. @@ -72,7 +81,7 @@
  550. }
  551. // Does the input format of this node use XML Content filter?
  552. $format = filter_resolve_format($node->format);
  553. - $module = db_result(db_query('SELECT module FROM {filters} WHERE format = %d', $format));
  554. + $module = db_result(db_query("SELECT module FROM {filters} WHERE format = %d AND module = 'xmlcontent'", $format));
  555. if ($module != 'xmlcontent') {
  556. return;
  557. }
  558. @@ -83,7 +92,10 @@
  559. return;
  560. }
  561. - $schema_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_schema_path_$format",'');
  562. + $schema_path = variable_get("xmlcontent_schema_path_$format", '');
  563. + if (substr($schema_path, 0, 1) != "/")
  564. + $schema_path = drupal_get_path('module', 'xmlcontent') . '/' . $schema_path;
  565. +
  566. if (!is_file($schema_path) && ($validation == 'xsd' or $validation == 'rng')) {
  567. $schema_path = null;
  568. watchdog( 'xmlcontent', t('Validation required but no schema file'), WATCHDOG_WARNING );
  569. @@ -93,7 +105,16 @@
  570. libxml_clear_errors();
  571. libxml_use_internal_errors(true);
  572. - if (!_xmlcontent_validate($node->body, $validation, $schema_path)) {
  573. + $text = $node->body;
  574. + $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
  575. + if ($tpl_path) {
  576. + if (substr($tpl_path, 0, 1) != "/")
  577. + $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
  578. + $tpl = file_get_contents($tpl_path);
  579. + $text = preg_replace("/&template_body;/", $text, $tpl);
  580. + }
  581. +
  582. + if (!_xmlcontent_validate($text, $validation, $schema_path)) {
  583. form_set_error('body', t('XML Content: Invalid XML') . libxml_errors_string());
  584. }
  585. @@ -156,6 +177,13 @@
  586. '#collapsible' => TRUE,
  587. '#collapsed' => FALSE,
  588. );
  589. + $form['xmlcontent']["xmlcontent_tpl_path_$format"] = array(
  590. + '#type' => 'textfield',
  591. + '#title' => t('Optional XML Template File Path'),
  592. + '#default_value' => variable_get("xmlcontent_tpl_path_$format", ''),
  593. + '#field_prefix' => drupal_get_path('module', 'xmlcontent'). '/',
  594. + '#description' => t('The file path to the optional XML template, wrapper around the XML content before processing.'),
  595. + );
  596. $form['xmlcontent']["xmlcontent_xslt_path_$format"] = array(
  597. '#type' => 'textfield',
  598. '#title' => t('XSLT Script File Path'),
  599. @@ -218,6 +246,8 @@
  600. // Load the XML document
  601. $dom = new DomDocument('1.0', 'UTF-8');
  602. + $dom->resolveExternals = true;
  603. + $dom->substituteEntities = true;
  604. $valid = $dom->loadXML($xml);
  605. if (!$valid) {
  606. watchdog('xmlcontent', "Invalid XML Content", WATCHDOG_WARNING);
  607. @@ -227,6 +257,8 @@
  608. // Load the XSLT script
  609. // TODO: is there a way to cache it, or not necessary
  610. $xsl = new DomDocument('1.0', 'UTF-8');
  611. + $xsl->resolveExternals = true;
  612. + $xsl->substituteEntities = true;
  613. $xsl->load($path_to_xslt);
  614. // Create the XSLT processor
  615. @@ -242,10 +274,8 @@
  616. }
  617. // Transform
  618. - $newdom = $proc->transformToDoc($dom);
  619. -
  620. - // Return the output as XML text (in fact subset of XHTML, depending on the XSLT script)
  621. - return $newdom->saveXML();
  622. + $xml = $proc->transformToXML($dom);
  623. + return $xml;
  624. }