drupal.patch 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  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.26 2008/06/26 15:52:26 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-30 21:13:16 +0200
  533. @@ -39,8 +39,22 @@
  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. - return _xmlcontent_transform($text, $xslt_path);
  538. + $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
  539. + if ($tpl_path) {
  540. + if (substr($tpl_path, 0, 1) != "/")
  541. + $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
  542. + $tpl = file_get_contents($tpl_path);
  543. + $text = preg_replace("/&template_body;/", $text, $tpl);
  544. + $cwd = getcwd();
  545. + chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path));
  546. + }
  547. + $xslt_path = variable_get("xmlcontent_xslt_path_$format", '');
  548. + if (substr($xslt_path, 0, 1) != "/")
  549. + $xslt_path = drupal_get_path('module', 'xmlcontent') . '/' . $xslt_path;
  550. + $result = _xmlcontent_transform($text, $xslt_path);
  551. + if ($tpl_path)
  552. + chdir($cwd);
  553. + return $result;
  554. case 'settings':
  555. return _xmlcontent_filter_settings($format);
  556. @@ -72,7 +86,7 @@
  557. }
  558. // Does the input format of this node use XML Content filter?
  559. $format = filter_resolve_format($node->format);
  560. - $module = db_result(db_query('SELECT module FROM {filters} WHERE format = %d', $format));
  561. + $module = db_result(db_query("SELECT module FROM {filters} WHERE format = %d AND module = 'xmlcontent'", $format));
  562. if ($module != 'xmlcontent') {
  563. return;
  564. }
  565. @@ -83,7 +97,10 @@
  566. return;
  567. }
  568. - $schema_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_schema_path_$format",'');
  569. + $schema_path = variable_get("xmlcontent_schema_path_$format", '');
  570. + if (substr($schema_path, 0, 1) != "/")
  571. + $schema_path = drupal_get_path('module', 'xmlcontent') . '/' . $schema_path;
  572. +
  573. if (!is_file($schema_path) && ($validation == 'xsd' or $validation == 'rng')) {
  574. $schema_path = null;
  575. watchdog( 'xmlcontent', t('Validation required but no schema file'), WATCHDOG_WARNING );
  576. @@ -93,7 +110,23 @@
  577. libxml_clear_errors();
  578. libxml_use_internal_errors(true);
  579. - if (!_xmlcontent_validate($node->body, $validation, $schema_path)) {
  580. + $text = $node->body;
  581. + $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
  582. + if ($tpl_path) {
  583. + if (substr($tpl_path, 0, 1) != "/")
  584. + $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
  585. + $tpl = file_get_contents($tpl_path);
  586. + $text = preg_replace("/&template_body;/", $text, $tpl);
  587. + $cwd = getcwd();
  588. + chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path));
  589. + }
  590. +
  591. + $result = _xmlcontent_validate($text, $validation, $schema_path);
  592. +
  593. + if ($tpl_path)
  594. + chdir($cwd);
  595. +
  596. + if (!$result) {
  597. form_set_error('body', t('XML Content: Invalid XML') . libxml_errors_string());
  598. }
  599. @@ -156,6 +189,13 @@
  600. '#collapsible' => TRUE,
  601. '#collapsed' => FALSE,
  602. );
  603. + $form['xmlcontent']["xmlcontent_tpl_path_$format"] = array(
  604. + '#type' => 'textfield',
  605. + '#title' => t('Optional XML Template File Path'),
  606. + '#default_value' => variable_get("xmlcontent_tpl_path_$format", ''),
  607. + '#field_prefix' => drupal_get_path('module', 'xmlcontent'). '/',
  608. + '#description' => t('The file path to the optional XML template, wrapper around the XML content before processing.'),
  609. + );
  610. $form['xmlcontent']["xmlcontent_xslt_path_$format"] = array(
  611. '#type' => 'textfield',
  612. '#title' => t('XSLT Script File Path'),
  613. @@ -218,6 +258,8 @@
  614. // Load the XML document
  615. $dom = new DomDocument('1.0', 'UTF-8');
  616. + $dom->resolveExternals = true;
  617. + $dom->substituteEntities = true;
  618. $valid = $dom->loadXML($xml);
  619. if (!$valid) {
  620. watchdog('xmlcontent', "Invalid XML Content", WATCHDOG_WARNING);
  621. @@ -227,6 +269,8 @@
  622. // Load the XSLT script
  623. // TODO: is there a way to cache it, or not necessary
  624. $xsl = new DomDocument('1.0', 'UTF-8');
  625. + $xsl->resolveExternals = true;
  626. + $xsl->substituteEntities = true;
  627. $xsl->load($path_to_xslt);
  628. // Create the XSLT processor
  629. @@ -242,10 +286,8 @@
  630. }
  631. // Transform
  632. - $newdom = $proc->transformToDoc($dom);
  633. -
  634. - // Return the output as XML text (in fact subset of XHTML, depending on the XSLT script)
  635. - return $newdom->saveXML();
  636. + $xml = $proc->transformToXML($dom);
  637. + return $xml;
  638. }
  639. -----------------------------------------------------------------------------
  640. Fix upgrading in "simplefeed" module if PostgreSQL is used.
  641. Fix modules as Drupal 6.2 does not provide db_num_rows() anymore.
  642. Index: sites/all/modules/simplefeed/simplefeed.install
  643. --- sites/all/modules/simplefeed/simplefeed.install.orig 2008-06-11 07:22:28 +0200
  644. +++ sites/all/modules/simplefeed/simplefeed.install 2008-06-14 15:09:53 +0200
  645. @@ -31,8 +31,17 @@
  646. function simplefeed_update_2() {
  647. $ret = array();
  648. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url");
  649. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text");
  650. + switch ($GLOBALS['db_type']) {
  651. + case 'mysql':
  652. + case 'mysqli':
  653. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url");
  654. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text");
  655. + break;
  656. + case 'pgsql':
  657. + $ret[] = update_sql("DROP INDEX {simplefeed_feed}_url_idx");
  658. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed} ALTER COLUMN url TYPE text");
  659. + break;
  660. + }
  661. return $ret;
  662. }
  663. Index: sites/all/modules/simplefeed/simplefeed_item.install
  664. --- sites/all/modules/simplefeed/simplefeed_item.install.orig 2008-06-11 07:22:28 +0200
  665. +++ sites/all/modules/simplefeed/simplefeed_item.install 2008-06-14 16:23:01 +0200
  666. @@ -40,13 +40,15 @@
  667. // Fetch up to N feed items and update their iids to new schema
  668. $count = $_SESSION['simplefeed_item_update_2']['count'];
  669. $feed_items = db_query_range('SELECT r.vid, r.title, s.url FROM {node_revisions} r JOIN {simplefeed_feed_item} s ON r.vid = s.vid ORDER BY r.vid ASC', $count, $limit);
  670. + $n = 0;
  671. while ($feed_item = db_fetch_object($feed_items)) {
  672. $iid = md5($feed_item->title . $feed_item->url);
  673. db_query("UPDATE {simplefeed_feed_item} SET iid = '%s' WHERE vid = %d", $iid, $feed_item->vid);
  674. $_SESSION['simplefeed_item_update_2']['vid'] = $feed_item->vid;
  675. + $n++;
  676. }
  677. - if (db_num_rows($feed_items) == $limit) {
  678. + if ($n == $limit) {
  679. $_SESSION['simplefeed_item_update_2']['count'] += $limit;
  680. // Return progress (never return 100% here to ensure clean-up is still run last).
  681. return array('#finished' => $_SESSION['simplefeed_item_update_2']['vid'] / ($_SESSION['simplefeed_item_update_2']['max'] + 1));
  682. @@ -60,8 +62,18 @@
  683. function simplefeed_item_update_3() {
  684. $ret = array();
  685. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text");
  686. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL");
  687. + switch ($GLOBALS['db_type']) {
  688. + case 'mysql':
  689. + case 'mysqli':
  690. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text");
  691. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL");
  692. + break;
  693. + case 'pgsql':
  694. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN url TYPE text");
  695. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid TYPE VARCHAR(32)");
  696. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid SET NOT NULL");
  697. + break;
  698. + }
  699. return $ret;
  700. }
  701. Index: sites/all/modules/autologout/autologout.module
  702. --- sites/all/modules/autologout/autologout.module.orig 2008-03-14 21:05:41 +0100
  703. +++ sites/all/modules/autologout/autologout.module 2008-06-14 15:57:27 +0200
  704. @@ -257,8 +257,8 @@
  705. if (_autologout_user_in_by_user_role($account)) {
  706. $account->autologout = 0;
  707. $r = db_query("SELECT setting FROM {autologout} WHERE uid = %d", $account->uid);
  708. - if (db_num_rows($r) > 0) {
  709. - $row = db_fetch_object($r);
  710. + $row = db_fetch_object($r);
  711. + if ($row) {
  712. $account->autologout = (int)$row->setting;
  713. }
  714. }
  715. -----------------------------------------------------------------------------
  716. Fix helpers module for PostgreSQL usage.
  717. Index: sites/all/modules/helpers/helpers_database.module
  718. --- sites/all/modules/helpers/helpers_database.module.orig 2008-04-23 04:38:34 +0200
  719. +++ sites/all/modules/helpers/helpers_database.module 2008-06-16 18:06:41 +0200
  720. @@ -16,7 +16,7 @@
  721. *
  722. * NOTE: This is open code - do not put a function declaration on it.
  723. */
  724. - $db_types = array('mysql', 'mysqli', 'postgres');
  725. + $db_types = array('mysql', 'mysqli', 'pgsql');
  726. $dbtype = $GLOBALS['db_type'];
  727. if (in_array($dbtype, $db_types)) {
  728. // Using include because the site may not be using this so we don't want a fatal error.
  729. Index: sites/all/modules/helpers/includes/dra_pgsql.inc
  730. --- sites/all/modules/helpers/includes/dra_pgsql.inc.orig 2008-06-16 17:49:43 +0200
  731. +++ sites/all/modules/helpers/includes/dra_pgsql.inc 2008-06-16 18:05:19 +0200
  732. @@ -0,0 +1,40 @@
  733. +<?php
  734. +/* $Id */
  735. + /**
  736. + * Return a result array from the previous query. PostgreSql version.
  737. + * This is very handy for building an option list for a form element.
  738. + *
  739. + * @param $result
  740. + * A database query result resource, as returned from db_query().
  741. + * @return
  742. + * The resulting array or FALSE.
  743. + * If the query contains -- the result array would be
  744. + * 0 columns (bool)FALSE
  745. + * 1 column value => value
  746. + * 2 columns 1st value => 2nd value
  747. + * 3 or more 1st value => array(2nd value, 3rd value, ...)
  748. + */
  749. +function db_result_array($result) {
  750. + $array = array();
  751. + while ($row = pg_fetch_array($result, NULL, PGSQL_NUM)) {
  752. + $y = count($row);
  753. + switch ($y) {
  754. + case 0:
  755. + drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error');
  756. + return false;
  757. +
  758. + case 1:
  759. + $array[$row[0]] = $row[0];
  760. + break;
  761. +
  762. + case 2:
  763. + $array[$row[0]] = $row[1];
  764. + break;
  765. +
  766. + default:
  767. + $array[$row[0]] = array_slice($row, 1);
  768. + break;
  769. + }
  770. + }
  771. + return $array;
  772. +}
  773. -----------------------------------------------------------------------------
  774. Fix PostgreSQL usage.
  775. Index: sites/all/modules/nodeupdates/nodeupdates.install
  776. --- sites/all/modules/nodeupdates/nodeupdates.install.orig 2007-12-31 15:11:57 +0100
  777. +++ sites/all/modules/nodeupdates/nodeupdates.install 2008-06-18 18:00:08 +0200
  778. @@ -15,10 +15,10 @@
  779. case 'pgsql':
  780. db_query("CREATE TABLE {nodeupdates} (
  781. - nid integer(10) NOT NULL default '0',
  782. + nid integer NOT NULL default '0',
  783. title varchar(128) NOT NULL default '',
  784. - message longtext NOT NULL default '',
  785. - timestamp integer(11) NOT NULL default '0'
  786. + message text NOT NULL default '',
  787. + timestamp integer NOT NULL default '0'
  788. )");
  789. break;
  790. }
  791. -----------------------------------------------------------------------------
  792. Avoid incorrect ordering of BLOG entries by removing the
  793. db_rewrite_sql() calls which seem to introduce a wrong ordering.
  794. Index: modules/blog/blog.module
  795. --- modules/blog/blog.module.orig 2008-04-09 23:11:45 +0200
  796. +++ modules/blog/blog.module 2008-06-26 17:20:15 +0200
  797. @@ -182,7 +182,7 @@
  798. * Helper function to determine if a user has blog posts already.
  799. */
  800. function _blog_post_exists($account) {
  801. - 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));
  802. + 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));
  803. }
  804. /**
  805. @@ -198,7 +198,7 @@
  806. }
  807. else if ($op == 'view') {
  808. if (user_access('access content')) {
  809. - $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);
  810. + $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, 10);
  811. if ($node_title_list = node_title_list($result)) {
  812. $block['content'] = $node_title_list;
  813. $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.'));
  814. Index: modules/blog/blog.pages.inc
  815. --- modules/blog/blog.pages.inc.orig 2008-02-08 22:15:12 +0100
  816. +++ modules/blog/blog.pages.inc 2008-06-26 17:19:49 +0200
  817. @@ -25,7 +25,7 @@
  818. $output = theme('item_list', $items);
  819. - $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);
  820. + $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);
  821. $has_posts = FALSE;
  822. while ($node = db_fetch_object($result)) {
  823. @@ -64,7 +64,7 @@
  824. $output = theme('item_list', $items);
  825. - $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));
  826. + $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));
  827. $has_posts = FALSE;
  828. while ($node = db_fetch_object($result)) {
  829. @@ -87,7 +87,7 @@
  830. * Menu callback; displays an RSS feed containing recent blog entries of a given user.
  831. */
  832. function blog_feed_user($account) {
  833. - $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));
  834. + $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));
  835. $channel['title'] = $account->name ."'s blog";
  836. $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE));
  837. @@ -102,7 +102,7 @@
  838. * Menu callback; displays an RSS feed containing recent blog entries of all users.
  839. */
  840. function blog_feed_last() {
  841. - $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));
  842. + $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));
  843. $channel['title'] = variable_get('site_name', 'Drupal') .' blogs';
  844. $channel['link'] = url('blog', array('absolute' => TRUE));