drupal.patch 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  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. 1. 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. 2. Fix CSS Cache Building Procedure
  69. http://drupal.org/node/275381
  70. http://drupal.org/files/issues/drupal-css-cache-building.patch
  71. (created by RSE)
  72. Index: includes/common.inc
  73. --- includes/common.inc.orig 2008-04-09 23:11:44 +0200
  74. +++ includes/common.inc 2008-06-26 20:16:16 +0200
  75. @@ -439,13 +439,27 @@
  76. case 'http':
  77. $port = isset($uri['port']) ? $uri['port'] : 80;
  78. $host = $uri['host'] . ($port != 80 ? ':'. $port : '');
  79. - $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
  80. + if (variable_get('proxy_server', '') != '') {
  81. + $proxy_server = variable_get('proxy_server', '');
  82. + $proxy_port = variable_get('proxy_port', 8080);
  83. + $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
  84. + }
  85. + else {
  86. + $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
  87. + }
  88. break;
  89. case 'https':
  90. // Note: Only works for PHP 4.3 compiled with OpenSSL.
  91. $port = isset($uri['port']) ? $uri['port'] : 443;
  92. $host = $uri['host'] . ($port != 443 ? ':'. $port : '');
  93. - $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
  94. + if (variable_get('proxy_server', '') != '') {
  95. + $proxy_server = variable_get('proxy_server', '');
  96. + $proxy_port = variable_get('proxy_port', 8080);
  97. + $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
  98. + }
  99. + else {
  100. + $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
  101. + }
  102. break;
  103. default:
  104. $result->error = 'invalid schema '. $uri['scheme'];
  105. @@ -462,9 +476,14 @@
  106. }
  107. // Construct the path to act on.
  108. - $path = isset($uri['path']) ? $uri['path'] : '/';
  109. - if (isset($uri['query'])) {
  110. - $path .= '?'. $uri['query'];
  111. + if (variable_get('proxy_server', '') != '') {
  112. + $path = $url;
  113. + }
  114. + else {
  115. + $path = isset($uri['path']) ? $uri['path'] : '/';
  116. + if (isset($uri['query'])) {
  117. + $path .= '?'. $uri['query'];
  118. + }
  119. }
  120. // Create HTTP request.
  121. @@ -482,6 +501,14 @@
  122. $defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : ''));
  123. }
  124. + // If the proxy server required a username then attempt to authenticate with it
  125. + if (variable_get('proxy_username', '') != '') {
  126. + $username = variable_get('proxy_username', '');
  127. + $password = variable_get('proxy_password', '');
  128. + $auth_string = base64_encode($username . ($password != '' ? ':'. $password : ''));
  129. + $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n";
  130. + }
  131. +
  132. foreach ($headers as $header => $value) {
  133. $defaults[$header] = $header .': '. $value;
  134. }
  135. @@ -1805,7 +1832,7 @@
  136. $last = '';
  137. while ($path != $last) {
  138. $last = $path;
  139. - $path = preg_replace('`(^|/)(?!../)([^/]+)/../`', '$1', $path);
  140. + $path = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $path);
  141. }
  142. return 'url('. $path .')';
  143. }
  144. Index: modules/system/system.admin.inc
  145. --- modules/system/system.admin.inc.orig 2008-03-25 12:58:16 +0100
  146. +++ modules/system/system.admin.inc 2008-04-24 11:43:07 +0200
  147. @@ -1363,6 +1363,65 @@
  148. }
  149. /**
  150. + * Form builder; Configure the site proxy settings.
  151. + *
  152. + * @ingroup forms
  153. + * @see system_settings_form()
  154. + */
  155. +function system_proxy_settings() {
  156. +
  157. + $form['forward_proxy'] = array(
  158. + '#type' => 'fieldset',
  159. + '#title' => t('Forward proxy settings'),
  160. + '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
  161. + );
  162. + $form['forward_proxy']['proxy_server'] = array(
  163. + '#type' => 'textfield',
  164. + '#title' => t('Proxy host name'),
  165. + '#default_value' => variable_get('proxy_server', ''),
  166. + '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
  167. + );
  168. + $form['forward_proxy']['proxy_port'] = array(
  169. + '#type' => 'textfield',
  170. + '#title' => t('Proxy port number'),
  171. + '#default_value' => variable_get('proxy_port', 8080),
  172. + '#description' => t('The port number of the proxy server, eg. 8080'),
  173. + );
  174. + $form['forward_proxy']['proxy_username'] = array(
  175. + '#type' => 'textfield',
  176. + '#title' => t('Proxy username'),
  177. + '#default_value' => variable_get('proxy_username', ''),
  178. + '#description' => t('The username used to authenticate with the proxy server.'),
  179. + );
  180. + $form['forward_proxy']['proxy_password'] = array(
  181. + '#type' => 'textfield',
  182. + '#title' => t('Proxy password'),
  183. + '#default_value' => variable_get('proxy_password', ''),
  184. + '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
  185. + );
  186. + $form['#validate'][] = 'system_proxy_settings_validate';
  187. +
  188. + return system_settings_form($form);
  189. +}
  190. +
  191. +/**
  192. + * Validate the submitted proxy form.
  193. + */
  194. +function system_proxy_settings_validate($form, &$form_state) {
  195. + // Validate the proxy settings
  196. + $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
  197. + if ($form_state['values']['proxy_server'] != '') {
  198. + // TCP allows the port to be between 0 and 65536 inclusive
  199. + if (!is_numeric($form_state['values']['proxy_port'])) {
  200. + form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
  201. + }
  202. + elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) {
  203. + form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
  204. + }
  205. + }
  206. +}
  207. +
  208. +/**
  209. * Form builder; Configure the site file handling.
  210. *
  211. * @ingroup forms
  212. Index: modules/system/system.module
  213. --- modules/system/system.module.orig 2008-04-09 23:11:49 +0200
  214. +++ modules/system/system.module 2008-04-24 11:43:47 +0200
  215. @@ -55,7 +55,7 @@
  216. $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>';
  217. $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>';
  218. $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>';
  219. - $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>';
  220. + $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>';
  221. $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>';
  222. return $output;
  223. case 'admin':
  224. @@ -406,6 +406,14 @@
  225. 'access arguments' => array('administer site configuration'),
  226. 'file' => 'system.admin.inc',
  227. );
  228. + $items['admin/settings/proxy'] = array(
  229. + 'title' => 'Proxy server',
  230. + 'description' => 'Configure settings when the site is behind a proxy server.',
  231. + 'page callback' => 'drupal_get_form',
  232. + 'page arguments' => array('system_proxy_settings'),
  233. + 'access arguments' => array('administer site configuration'),
  234. + 'file' => 'system.admin.inc',
  235. + );
  236. $items['admin/settings/file-system'] = array(
  237. 'title' => 'File system',
  238. 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
  239. -----------------------------------------------------------------------------
  240. Properly activate Drupal support module in TinyMCE
  241. Index: sites/all/modules/tinymce/plugin_reg.php
  242. --- sites/all/modules/tinymce/plugin_reg.php.orig 2008-03-27 21:11:17 +0100
  243. +++ sites/all/modules/tinymce/plugin_reg.php 2008-05-02 20:56:56 +0200
  244. @@ -102,5 +102,9 @@
  245. $plugins['zoom'] = array();
  246. $plugins['zoom']['theme_advanced_buttons2'] = array('zoom');
  247. +$plugins['drupalimage'] = array();
  248. +$plugins['drupalimage']['theme_advanced_buttons1'] = array('drupalimage');
  249. +$plugins['drupalimage']['extended_valid_elements'] = array('img[class|src|border=0|alt|title|width|height|align|name]');
  250. +
  251. return $plugins;
  252. }
  253. -----------------------------------------------------------------------------
  254. Fix SQL in "remove" functionality of "img_assist" module.
  255. http://drupal.org/node/250128
  256. Index: sites/all/modules/img_assist/img_assist.module
  257. --- sites/all/modules/img_assist/img_assist.module.orig 2008-04-06 19:32:33 +0200
  258. +++ sites/all/modules/img_assist/img_assist.module 2008-05-02 21:00:24 +0200
  259. @@ -1239,7 +1239,7 @@
  260. }
  261. function _img_assist_remove($node, $size) {
  262. - $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']);
  263. + $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']);
  264. while ($file = db_fetch_object($result)) {
  265. // Never delete original image.
  266. if ($file->filepath != $node->images[IMAGE_ORIGINAL]) {
  267. -----------------------------------------------------------------------------
  268. Optimize "img_assist" module by loading only when necessary.
  269. http://drupal.org/node/55101
  270. Index: sites/all/modules/img_assist/img_assist.js
  271. --- sites/all/modules/img_assist/img_assist.js.orig 2008-04-06 18:43:18 +0200
  272. +++ sites/all/modules/img_assist/img_assist.js 2008-05-02 21:05:56 +0200
  273. @@ -130,6 +130,24 @@
  274. 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');
  275. }
  276. +function launch_popup(nid, mw, mh) {
  277. + var ox = mw;
  278. + var oy = mh;
  279. + if((ox>=screen.width) || (oy>=screen.height)){
  280. + var ox = screen.width-150;
  281. + var oy = screen.height-150;
  282. + var winx = (screen.width / 2)-(ox / 2);
  283. + var winy = (screen.height / 2)-(oy / 2);
  284. + var use_scrollbars = 1;
  285. + }
  286. + else{
  287. + var winx = (screen.width / 2)-(ox / 2);
  288. + var winy = (screen.height / 2)-(oy / 2);
  289. + var use_scrollbars = 0;
  290. + }
  291. + 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');
  292. +}
  293. +
  294. function insertImage() {
  295. if (window.opener) {
  296. // Get variables from the fields on the properties frame
  297. Index: sites/all/modules/img_assist/img_assist.module
  298. --- sites/all/modules/img_assist/img_assist.module.orig 2008-05-02 21:04:49 +0200
  299. +++ sites/all/modules/img_assist/img_assist.module 2008-05-02 21:07:24 +0200
  300. @@ -126,7 +126,7 @@
  301. }
  302. // Assign base_path to insert in image source by javascript.
  303. drupal_add_js('var BASE_URL = "'. base_path() .'";', 'inline');
  304. - drupal_add_js($path .'/img_assist.js');
  305. + drupal_add_js($path .'/img_assist_popup.js');
  306. }
  307. /**
  308. @@ -150,6 +150,9 @@
  309. * Add image link underneath textareas.
  310. */
  311. function img_assist_textarea($element) {
  312. + $path = drupal_get_path('module', 'img_assist');
  313. + drupal_add_js($path .'/img_assist.js');
  314. +
  315. $link = variable_get('img_assist_link', 'icon');
  316. if (($link == 'icon') || ($link == 'text')) {
  317. if (_img_assist_textarea_match($element['#id']) && _img_assist_page_match() && !strstr($_GET['q'], 'img_assist')) {
  318. Index: sites/all/modules/img_assist/img_assist_popup.js
  319. --- /dev/null 2008-05-02 21:08:21 +0200
  320. +++ sites/all/modules/img_assist/img_assist_popup.js 2008-05-02 21:05:56 +0200
  321. @@ -0,0 +1,20 @@
  322. +/* $Id: drupal.patch,v 1.27 2008/06/26 18:27:23 rse Exp $ */
  323. +
  324. +function launch_popup(nid, mw, mh) {
  325. + var ox = mw;
  326. + var oy = mh;
  327. + if((ox>=screen.width) || (oy>=screen.height)){
  328. + var ox = screen.width-150;
  329. + var oy = screen.height-150;
  330. + var winx = (screen.width / 2)-(ox / 2);
  331. + var winy = (screen.height / 2)-(oy / 2);
  332. + var use_scrollbars = 1;
  333. + }
  334. + else{
  335. + var winx = (screen.width / 2)-(ox / 2);
  336. + var winy = (screen.height / 2)-(oy / 2);
  337. + var use_scrollbars = 0;
  338. + }
  339. + 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');
  340. +}
  341. +
  342. -----------------------------------------------------------------------------
  343. Fix file permissions.
  344. http://drupal.org/node/247992
  345. Index: sites/all/modules/img_assist/img_assist.module
  346. --- sites/all/modules/img_assist/img_assist.module.orig 2008-05-02 21:11:15 +0200
  347. +++ sites/all/modules/img_assist/img_assist.module 2008-05-02 21:11:48 +0200
  348. @@ -1230,6 +1230,8 @@
  349. drupal_set_message(t('Unable to create %label image', array('%label' => $size['label'])), 'error');
  350. }
  351. else {
  352. + // Set standard file permissions for webserver-generated files
  353. + @chmod(file_create_path($destination), 0664);
  354. $node->images[$key] = $destination;
  355. _image_insert($node, $key, file_create_path($destination));
  356. }
  357. -----------------------------------------------------------------------------
  358. Activate the Drupal glue code for the FCKeditor filemanager.
  359. Index: sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php
  360. --- sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php.orig 2008-03-25 16:28:24 +0100
  361. +++ sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php 2008-05-02 23:02:23 +0200
  362. @@ -39,6 +39,9 @@
  363. // Attention: The above 'UserFilesPath' must point to the same directory.
  364. $Config['UserFilesAbsolutePath'] = '' ;
  365. +// activate Drupal glue code for filemanager
  366. +require_once "../../../../../filemanager.config.php";
  367. +
  368. // Due to security issues with Apache modules, it is recommended to leave the
  369. // following setting enabled.
  370. $Config['ForceSingleExtension'] = true ;
  371. -----------------------------------------------------------------------------
  372. Degrade the "Update notification" check from ERROR to WARNING severity
  373. as for a packaged Drupal as in OpenPKG the Update notification is less
  374. important and actually confusing anyway. With WARNING one at least still
  375. sees the issue, but under "Administer" one doesn't get the confusing red
  376. error message and longer.
  377. Index: modules/system/system.install
  378. --- modules/system/system.install.orig 2008-02-08 18:07:55 +0100
  379. +++ modules/system/system.install 2008-05-03 10:42:23 +0200
  380. @@ -273,7 +273,7 @@
  381. if (!module_exists('update')) {
  382. $requirements['update status'] = array(
  383. 'value' => $t('Not enabled'),
  384. - 'severity' => REQUIREMENT_ERROR,
  385. + 'severity' => REQUIREMENT_WARNING,
  386. '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'))),
  387. );
  388. }
  389. -----------------------------------------------------------------------------
  390. Disable "Update notifications" check by default during installation.
  391. Index: install.php
  392. --- install.php.orig 2008-02-08 23:00:45 +0100
  393. +++ install.php 2008-05-09 13:18:09 +0200
  394. @@ -1069,7 +1069,7 @@
  395. '#type' => 'checkboxes',
  396. '#title' => st('Update notifications'),
  397. '#options' => array(1 => st('Check for updates automatically')),
  398. - '#default_value' => array(1),
  399. + '#default_value' => array(),
  400. '#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')),
  401. '#weight' => 15,
  402. );
  403. -----------------------------------------------------------------------------
  404. No need to always expand the "Menu settings" on node edit pages.
  405. Index: modules/menu/menu.module
  406. --- modules/menu/menu.module.orig 2008-04-09 23:11:48 +0200
  407. +++ modules/menu/menu.module 2008-05-16 20:03:48 +0200
  408. @@ -366,7 +366,7 @@
  409. '#title' => t('Menu settings'),
  410. '#access' => user_access('administer menu'),
  411. '#collapsible' => TRUE,
  412. - '#collapsed' => FALSE,
  413. + '#collapsed' => TRUE,
  414. '#tree' => TRUE,
  415. '#weight' => -2,
  416. '#attributes' => array('class' => 'menu-item-form'),
  417. -----------------------------------------------------------------------------
  418. Use a larger text-area on node edit pages.
  419. Index: modules/node/node.pages.inc
  420. --- modules/node/node.pages.inc.orig 2008-02-27 20:44:44 +0100
  421. +++ modules/node/node.pages.inc 2008-05-16 20:06:45 +0200
  422. @@ -287,7 +287,8 @@
  423. '#type' => 'textarea',
  424. '#title' => check_plain($label),
  425. '#default_value' => $include ? $node->body : ($node->teaser . $node->body),
  426. - '#rows' => 20,
  427. + '#rows' => 30,
  428. + '#cols' => 80,
  429. '#required' => ($word_count > 0),
  430. );
  431. -----------------------------------------------------------------------------
  432. Fix "Action" related administration dialog and corresponding run-time handling.
  433. Index: modules/system/system.module
  434. --- modules/system/system.module.orig 2008-04-09 23:11:49 +0200
  435. +++ modules/system/system.module 2008-05-23 10:41:26 +0200
  436. @@ -1431,7 +1439,7 @@
  437. if (is_numeric($action)) {
  438. $aid = $action;
  439. // Load stored parameter values from database.
  440. - $data = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", intval($aid)));
  441. + $data = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $aid));
  442. $edit['actions_description'] = $data->description;
  443. $edit['actions_type'] = $data->type;
  444. $function = $data->callback;
  445. Index: includes/actions.inc
  446. --- includes/actions.inc.orig 2007-12-31 15:51:04 +0100
  447. +++ includes/actions.inc 2008-05-23 11:22:17 +0200
  448. @@ -54,7 +54,7 @@
  449. $where_values = array();
  450. foreach ($action_ids as $action_id) {
  451. if (is_numeric($action_id)) {
  452. - $where[] = 'OR aid = %d';
  453. + $where[] = "OR aid = '%s'";
  454. $where_values[] = $action_id;
  455. }
  456. elseif (isset($available_actions[$action_id])) {
  457. @@ -93,7 +93,7 @@
  458. else {
  459. // If it's a configurable action, retrieve stored parameters.
  460. if (is_numeric($action_ids)) {
  461. - $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $action_ids));
  462. + $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $action_ids));
  463. $function = $action->callback;
  464. $context = array_merge($context, unserialize($action->parameters));
  465. $result[$action_ids] = $function($object, $context, $a1, $a2);
  466. @@ -325,7 +325,7 @@
  467. function actions_save($function, $type, $params, $desc, $aid = NULL) {
  468. $serialized = serialize($params);
  469. if ($aid) {
  470. - db_query("UPDATE {actions} SET callback = '%s', type = '%s', parameters = '%s', description = '%s' WHERE aid = %d", $function, $type, $serialized, $desc, $aid);
  471. + db_query("UPDATE {actions} SET callback = '%s', type = '%s', parameters = '%s', description = '%s' WHERE aid = '%s'", $function, $type, $serialized, $desc, $aid);
  472. watchdog('actions', 'Action %action saved.', array('%action' => $desc));
  473. }
  474. else {
  475. @@ -333,7 +333,7 @@
  476. // separate table for numeric aids.
  477. db_query('INSERT INTO {actions_aid} VALUES (default)');
  478. $aid = db_last_insert_id('actions_aid', 'aid');
  479. - db_query("INSERT INTO {actions} (aid, callback, type, parameters, description) VALUES (%d, '%s', '%s', '%s', '%s')", $aid, $function, $type, $serialized, $desc);
  480. + db_query("INSERT INTO {actions} (aid, callback, type, parameters, description) VALUES ('%s', '%s', '%s', '%s', '%s')", $aid, $function, $type, $serialized, $desc);
  481. watchdog('actions', 'Action %action created.', array('%action' => $desc));
  482. }
  483. @@ -350,7 +350,7 @@
  484. * The appropriate action row from the database as an object.
  485. */
  486. function actions_load($aid) {
  487. - return db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $aid));
  488. + return db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $aid));
  489. }
  490. /**
  491. @@ -360,6 +360,6 @@
  492. * integer The ID of the action to delete.
  493. */
  494. function actions_delete($aid) {
  495. - db_query("DELETE FROM {actions} WHERE aid = %d", $aid);
  496. + db_query("DELETE FROM {actions} WHERE aid = '%s'", $aid);
  497. module_invoke_all('actions_delete', $aid);
  498. }
  499. Index: modules/user/user.admin.inc
  500. --- modules/user/user.admin.inc.orig 2008-01-16 23:54:41 +0100
  501. +++ modules/user/user.admin.inc 2008-05-23 11:24:13 +0200
  502. @@ -737,13 +737,13 @@
  503. form_set_error('mask', t('You must enter a mask.'));
  504. }
  505. else {
  506. - db_query("UPDATE {access} SET mask = '%s', type = '%s', status = '%s' WHERE aid = %d", $edit['mask'], $edit['type'], $edit['status'], $aid);
  507. + db_query("UPDATE {access} SET mask = '%s', type = '%s', status = '%s' WHERE aid = '%s'", $edit['mask'], $edit['type'], $edit['status'], $aid);
  508. drupal_set_message(t('The access rule has been saved.'));
  509. drupal_goto('admin/user/rules');
  510. }
  511. }
  512. else {
  513. - $edit = db_fetch_array(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
  514. + $edit = db_fetch_array(db_query("SELECT aid, type, status, mask FROM {access} WHERE aid = '%s'", $aid));
  515. }
  516. return drupal_get_form('user_admin_access_edit_form', $edit, t('Save rule'));
  517. }
  518. @@ -859,7 +859,7 @@
  519. */
  520. function user_admin_access_delete_confirm($form_state, $aid = 0) {
  521. $access_types = array('user' => t('username'), 'mail' => t('e-mail'), 'host' => t('host'));
  522. - $edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
  523. + $edit = db_fetch_object(db_query("SELECT aid, type, status, mask FROM {access} WHERE aid = '%s'", $aid));
  524. $form = array();
  525. $form['aid'] = array('#type' => 'hidden', '#value' => $aid);
  526. @@ -873,7 +873,7 @@
  527. }
  528. function user_admin_access_delete_confirm_submit($form, &$form_state) {
  529. - db_query('DELETE FROM {access} WHERE aid = %d', $form_state['values']['aid']);
  530. + db_query("DELETE FROM {access} WHERE aid = '%s'", $form_state['values']['aid']);
  531. drupal_set_message(t('The access rule has been deleted.'));
  532. $form_state['redirect'] = 'admin/user/rules';
  533. return;
  534. -----------------------------------------------------------------------------
  535. 1. Fix content validation in "xmlcontent" module in case
  536. one has enabled multiple filters on a particular input format.
  537. 2. Additionally, allow absolute paths to support .xsd/.xsl files
  538. in arbitrary directories.
  539. 3. Finally, do not create a new DOM and output it as XML. Instead directly
  540. output the transformed XML in order to get rid of the <?xml...?> declaration.
  541. 4. Additionally, support an optional XML content template (mainly
  542. for loading ENTITY definitions which cannot be done via XSD and XSLT)
  543. Index: sites/all/modules/xmlcontent/xmlcontent.module
  544. --- sites/all/modules/xmlcontent/xmlcontent.module.orig 2007-03-14 22:59:59 +0100
  545. +++ sites/all/modules/xmlcontent/xmlcontent.module 2008-05-30 21:13:16 +0200
  546. @@ -39,8 +39,22 @@
  547. return t('Allows users to post XML node content and get it transformed through a configured XSLT script');
  548. case 'process':
  549. - $xslt_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_xslt_path_$format", '');
  550. - return _xmlcontent_transform($text, $xslt_path);
  551. + $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
  552. + if ($tpl_path) {
  553. + if (substr($tpl_path, 0, 1) != "/")
  554. + $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
  555. + $tpl = file_get_contents($tpl_path);
  556. + $text = preg_replace("/&template_body;/", $text, $tpl);
  557. + $cwd = getcwd();
  558. + chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path));
  559. + }
  560. + $xslt_path = variable_get("xmlcontent_xslt_path_$format", '');
  561. + if (substr($xslt_path, 0, 1) != "/")
  562. + $xslt_path = drupal_get_path('module', 'xmlcontent') . '/' . $xslt_path;
  563. + $result = _xmlcontent_transform($text, $xslt_path);
  564. + if ($tpl_path)
  565. + chdir($cwd);
  566. + return $result;
  567. case 'settings':
  568. return _xmlcontent_filter_settings($format);
  569. @@ -72,7 +86,7 @@
  570. }
  571. // Does the input format of this node use XML Content filter?
  572. $format = filter_resolve_format($node->format);
  573. - $module = db_result(db_query('SELECT module FROM {filters} WHERE format = %d', $format));
  574. + $module = db_result(db_query("SELECT module FROM {filters} WHERE format = %d AND module = 'xmlcontent'", $format));
  575. if ($module != 'xmlcontent') {
  576. return;
  577. }
  578. @@ -83,7 +97,10 @@
  579. return;
  580. }
  581. - $schema_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_schema_path_$format",'');
  582. + $schema_path = variable_get("xmlcontent_schema_path_$format", '');
  583. + if (substr($schema_path, 0, 1) != "/")
  584. + $schema_path = drupal_get_path('module', 'xmlcontent') . '/' . $schema_path;
  585. +
  586. if (!is_file($schema_path) && ($validation == 'xsd' or $validation == 'rng')) {
  587. $schema_path = null;
  588. watchdog( 'xmlcontent', t('Validation required but no schema file'), WATCHDOG_WARNING );
  589. @@ -93,7 +110,23 @@
  590. libxml_clear_errors();
  591. libxml_use_internal_errors(true);
  592. - if (!_xmlcontent_validate($node->body, $validation, $schema_path)) {
  593. + $text = $node->body;
  594. + $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
  595. + if ($tpl_path) {
  596. + if (substr($tpl_path, 0, 1) != "/")
  597. + $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
  598. + $tpl = file_get_contents($tpl_path);
  599. + $text = preg_replace("/&template_body;/", $text, $tpl);
  600. + $cwd = getcwd();
  601. + chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path));
  602. + }
  603. +
  604. + $result = _xmlcontent_validate($text, $validation, $schema_path);
  605. +
  606. + if ($tpl_path)
  607. + chdir($cwd);
  608. +
  609. + if (!$result) {
  610. form_set_error('body', t('XML Content: Invalid XML') . libxml_errors_string());
  611. }
  612. @@ -156,6 +189,13 @@
  613. '#collapsible' => TRUE,
  614. '#collapsed' => FALSE,
  615. );
  616. + $form['xmlcontent']["xmlcontent_tpl_path_$format"] = array(
  617. + '#type' => 'textfield',
  618. + '#title' => t('Optional XML Template File Path'),
  619. + '#default_value' => variable_get("xmlcontent_tpl_path_$format", ''),
  620. + '#field_prefix' => drupal_get_path('module', 'xmlcontent'). '/',
  621. + '#description' => t('The file path to the optional XML template, wrapper around the XML content before processing.'),
  622. + );
  623. $form['xmlcontent']["xmlcontent_xslt_path_$format"] = array(
  624. '#type' => 'textfield',
  625. '#title' => t('XSLT Script File Path'),
  626. @@ -218,6 +258,8 @@
  627. // Load the XML document
  628. $dom = new DomDocument('1.0', 'UTF-8');
  629. + $dom->resolveExternals = true;
  630. + $dom->substituteEntities = true;
  631. $valid = $dom->loadXML($xml);
  632. if (!$valid) {
  633. watchdog('xmlcontent', "Invalid XML Content", WATCHDOG_WARNING);
  634. @@ -227,6 +269,8 @@
  635. // Load the XSLT script
  636. // TODO: is there a way to cache it, or not necessary
  637. $xsl = new DomDocument('1.0', 'UTF-8');
  638. + $xsl->resolveExternals = true;
  639. + $xsl->substituteEntities = true;
  640. $xsl->load($path_to_xslt);
  641. // Create the XSLT processor
  642. @@ -242,10 +286,8 @@
  643. }
  644. // Transform
  645. - $newdom = $proc->transformToDoc($dom);
  646. -
  647. - // Return the output as XML text (in fact subset of XHTML, depending on the XSLT script)
  648. - return $newdom->saveXML();
  649. + $xml = $proc->transformToXML($dom);
  650. + return $xml;
  651. }
  652. -----------------------------------------------------------------------------
  653. Fix upgrading in "simplefeed" module if PostgreSQL is used.
  654. Fix modules as Drupal 6.2 does not provide db_num_rows() anymore.
  655. Index: sites/all/modules/simplefeed/simplefeed.install
  656. --- sites/all/modules/simplefeed/simplefeed.install.orig 2008-06-11 07:22:28 +0200
  657. +++ sites/all/modules/simplefeed/simplefeed.install 2008-06-14 15:09:53 +0200
  658. @@ -31,8 +31,17 @@
  659. function simplefeed_update_2() {
  660. $ret = array();
  661. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url");
  662. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text");
  663. + switch ($GLOBALS['db_type']) {
  664. + case 'mysql':
  665. + case 'mysqli':
  666. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url");
  667. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text");
  668. + break;
  669. + case 'pgsql':
  670. + $ret[] = update_sql("DROP INDEX {simplefeed_feed}_url_idx");
  671. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed} ALTER COLUMN url TYPE text");
  672. + break;
  673. + }
  674. return $ret;
  675. }
  676. Index: sites/all/modules/simplefeed/simplefeed_item.install
  677. --- sites/all/modules/simplefeed/simplefeed_item.install.orig 2008-06-11 07:22:28 +0200
  678. +++ sites/all/modules/simplefeed/simplefeed_item.install 2008-06-14 16:23:01 +0200
  679. @@ -40,13 +40,15 @@
  680. // Fetch up to N feed items and update their iids to new schema
  681. $count = $_SESSION['simplefeed_item_update_2']['count'];
  682. $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);
  683. + $n = 0;
  684. while ($feed_item = db_fetch_object($feed_items)) {
  685. $iid = md5($feed_item->title . $feed_item->url);
  686. db_query("UPDATE {simplefeed_feed_item} SET iid = '%s' WHERE vid = %d", $iid, $feed_item->vid);
  687. $_SESSION['simplefeed_item_update_2']['vid'] = $feed_item->vid;
  688. + $n++;
  689. }
  690. - if (db_num_rows($feed_items) == $limit) {
  691. + if ($n == $limit) {
  692. $_SESSION['simplefeed_item_update_2']['count'] += $limit;
  693. // Return progress (never return 100% here to ensure clean-up is still run last).
  694. return array('#finished' => $_SESSION['simplefeed_item_update_2']['vid'] / ($_SESSION['simplefeed_item_update_2']['max'] + 1));
  695. @@ -60,8 +62,18 @@
  696. function simplefeed_item_update_3() {
  697. $ret = array();
  698. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text");
  699. - $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL");
  700. + switch ($GLOBALS['db_type']) {
  701. + case 'mysql':
  702. + case 'mysqli':
  703. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text");
  704. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL");
  705. + break;
  706. + case 'pgsql':
  707. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN url TYPE text");
  708. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid TYPE VARCHAR(32)");
  709. + $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid SET NOT NULL");
  710. + break;
  711. + }
  712. return $ret;
  713. }
  714. Index: sites/all/modules/autologout/autologout.module
  715. --- sites/all/modules/autologout/autologout.module.orig 2008-03-14 21:05:41 +0100
  716. +++ sites/all/modules/autologout/autologout.module 2008-06-14 15:57:27 +0200
  717. @@ -257,8 +257,8 @@
  718. if (_autologout_user_in_by_user_role($account)) {
  719. $account->autologout = 0;
  720. $r = db_query("SELECT setting FROM {autologout} WHERE uid = %d", $account->uid);
  721. - if (db_num_rows($r) > 0) {
  722. - $row = db_fetch_object($r);
  723. + $row = db_fetch_object($r);
  724. + if ($row) {
  725. $account->autologout = (int)$row->setting;
  726. }
  727. }
  728. -----------------------------------------------------------------------------
  729. Fix helpers module for PostgreSQL usage.
  730. Index: sites/all/modules/helpers/helpers_database.module
  731. --- sites/all/modules/helpers/helpers_database.module.orig 2008-04-23 04:38:34 +0200
  732. +++ sites/all/modules/helpers/helpers_database.module 2008-06-16 18:06:41 +0200
  733. @@ -16,7 +16,7 @@
  734. *
  735. * NOTE: This is open code - do not put a function declaration on it.
  736. */
  737. - $db_types = array('mysql', 'mysqli', 'postgres');
  738. + $db_types = array('mysql', 'mysqli', 'pgsql');
  739. $dbtype = $GLOBALS['db_type'];
  740. if (in_array($dbtype, $db_types)) {
  741. // Using include because the site may not be using this so we don't want a fatal error.
  742. Index: sites/all/modules/helpers/includes/dra_pgsql.inc
  743. --- sites/all/modules/helpers/includes/dra_pgsql.inc.orig 2008-06-16 17:49:43 +0200
  744. +++ sites/all/modules/helpers/includes/dra_pgsql.inc 2008-06-16 18:05:19 +0200
  745. @@ -0,0 +1,40 @@
  746. +<?php
  747. +/* $Id */
  748. + /**
  749. + * Return a result array from the previous query. PostgreSql version.
  750. + * This is very handy for building an option list for a form element.
  751. + *
  752. + * @param $result
  753. + * A database query result resource, as returned from db_query().
  754. + * @return
  755. + * The resulting array or FALSE.
  756. + * If the query contains -- the result array would be
  757. + * 0 columns (bool)FALSE
  758. + * 1 column value => value
  759. + * 2 columns 1st value => 2nd value
  760. + * 3 or more 1st value => array(2nd value, 3rd value, ...)
  761. + */
  762. +function db_result_array($result) {
  763. + $array = array();
  764. + while ($row = pg_fetch_array($result, NULL, PGSQL_NUM)) {
  765. + $y = count($row);
  766. + switch ($y) {
  767. + case 0:
  768. + drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error');
  769. + return false;
  770. +
  771. + case 1:
  772. + $array[$row[0]] = $row[0];
  773. + break;
  774. +
  775. + case 2:
  776. + $array[$row[0]] = $row[1];
  777. + break;
  778. +
  779. + default:
  780. + $array[$row[0]] = array_slice($row, 1);
  781. + break;
  782. + }
  783. + }
  784. + return $array;
  785. +}
  786. -----------------------------------------------------------------------------
  787. Fix PostgreSQL usage.
  788. Index: sites/all/modules/nodeupdates/nodeupdates.install
  789. --- sites/all/modules/nodeupdates/nodeupdates.install.orig 2007-12-31 15:11:57 +0100
  790. +++ sites/all/modules/nodeupdates/nodeupdates.install 2008-06-18 18:00:08 +0200
  791. @@ -15,10 +15,10 @@
  792. case 'pgsql':
  793. db_query("CREATE TABLE {nodeupdates} (
  794. - nid integer(10) NOT NULL default '0',
  795. + nid integer NOT NULL default '0',
  796. title varchar(128) NOT NULL default '',
  797. - message longtext NOT NULL default '',
  798. - timestamp integer(11) NOT NULL default '0'
  799. + message text NOT NULL default '',
  800. + timestamp integer NOT NULL default '0'
  801. )");
  802. break;
  803. }
  804. -----------------------------------------------------------------------------
  805. Avoid incorrect ordering of BLOG entries by removing the
  806. db_rewrite_sql() calls which seem to introduce a wrong ordering.
  807. Index: modules/blog/blog.module
  808. --- modules/blog/blog.module.orig 2008-04-09 23:11:45 +0200
  809. +++ modules/blog/blog.module 2008-06-26 17:20:15 +0200
  810. @@ -182,7 +182,7 @@
  811. * Helper function to determine if a user has blog posts already.
  812. */
  813. function _blog_post_exists($account) {
  814. - 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));
  815. + 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));
  816. }
  817. /**
  818. @@ -198,7 +198,7 @@
  819. }
  820. else if ($op == 'view') {
  821. if (user_access('access content')) {
  822. - $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);
  823. + $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);
  824. if ($node_title_list = node_title_list($result)) {
  825. $block['content'] = $node_title_list;
  826. $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.'));
  827. Index: modules/blog/blog.pages.inc
  828. --- modules/blog/blog.pages.inc.orig 2008-02-08 22:15:12 +0100
  829. +++ modules/blog/blog.pages.inc 2008-06-26 17:19:49 +0200
  830. @@ -25,7 +25,7 @@
  831. $output = theme('item_list', $items);
  832. - $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);
  833. + $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);
  834. $has_posts = FALSE;
  835. while ($node = db_fetch_object($result)) {
  836. @@ -64,7 +64,7 @@
  837. $output = theme('item_list', $items);
  838. - $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));
  839. + $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));
  840. $has_posts = FALSE;
  841. while ($node = db_fetch_object($result)) {
  842. @@ -87,7 +87,7 @@
  843. * Menu callback; displays an RSS feed containing recent blog entries of a given user.
  844. */
  845. function blog_feed_user($account) {
  846. - $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));
  847. + $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));
  848. $channel['title'] = $account->name ."'s blog";
  849. $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE));
  850. @@ -102,7 +102,7 @@
  851. * Menu callback; displays an RSS feed containing recent blog entries of all users.
  852. */
  853. function blog_feed_last() {
  854. - $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));
  855. + $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));
  856. $channel['title'] = variable_get('site_name', 'Drupal') .' blogs';
  857. $channel['link'] = url('blog', array('absolute' => TRUE));