diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-08-06 21:00:43 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-08-06 21:00:43 +0000 |
commit | 821c6d2d17892ba4b4cfb7771e94953a1e3d5dac (patch) | |
tree | 63c8c8ccb98eb3e11d4df0a58373ad7b4f7eb44e /modules/node/node.module | |
parent | 9e54dc27ff91c7bf2d8edb1bf07f9c893a3b1ae8 (diff) | |
download | brdo-821c6d2d17892ba4b4cfb7771e94953a1e3d5dac.tar.gz brdo-821c6d2d17892ba4b4cfb7771e94953a1e3d5dac.tar.bz2 |
- Patch #9812 by Adrian: fixed some PostgreSQL/ANSI SQL compabitibility
problems created by the new comment and node access permissions code.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r-- | modules/node/node.module | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 27d050d89..1a35d6c74 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1397,7 +1397,7 @@ function node_delete($edit) { * Generate a listing of promoted nodes. */ function node_page_default() { - $result = pager_query('SELECT DISTINCT(n.nid), n.type FROM {node} n '. node_access_join_sql() .' WHERE n.promote = 1 AND n.status = 1 AND '. node_access_where_sql() .' ORDER BY n.sticky DESC, n.created DESC', variable_get('default_nodes_main', 10)); + $result = pager_query('SELECT DISTINCT(n.nid), n.type, n.sticky, n.created FROM {node} n '. node_access_join_sql() .' WHERE n.promote = 1 AND n.status = 1 AND '. node_access_where_sql() .' ORDER BY n.sticky DESC, n.created DESC', variable_get('default_nodes_main', 10)); if (db_num_rows($result)) { drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS" href="'. url('node/feed', NULL, NULL, TRUE) .'" />'); @@ -1634,7 +1634,12 @@ function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') { */ function node_access_where_sql($op = 'view', $node_access_alias = 'na') { if (user_access('administer nodes')) { - return '1'; + /** + * This number is being used in a SQL query in a boolean nature. + * It is "'1'" instead of "1" for database compatibility, as both + * Postgres and Mysql treat it as boolean in this case. + */ + return "'1'"; } $sql = $node_access_alias .'.grant_'. $op .' = 1 AND CONCAT('. $node_access_alias .'.realm, '. $node_access_alias .'.gid) IN ('; |