From 821c6d2d17892ba4b4cfb7771e94953a1e3d5dac Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 6 Aug 2004 21:00:43 +0000 Subject: - Patch #9812 by Adrian: fixed some PostgreSQL/ANSI SQL compabitibility problems created by the new comment and node access permissions code. --- modules/node.module | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules/node.module') diff --git a/modules/node.module b/modules/node.module index 27d050d89..1a35d6c74 100644 --- a/modules/node.module +++ b/modules/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(''); @@ -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 ('; -- cgit v1.2.3