From: garvinhicking Date: Tue, 9 Aug 2005 16:45:38 +0000 (+0000) Subject: Fix "WHERE 1" condition to work in pgsql. X-Git-Tag: 0.9~223 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=26bc06143b2f8056f6371d3f6e8a70bc8aec40ea;p=s9y.git Fix "WHERE 1" condition to work in pgsql. --- diff --git a/include/admin/comments.inc.php b/include/admin/comments.inc.php index 74a9340..2777df7 100644 --- a/include/admin/comments.inc.php +++ b/include/admin/comments.inc.php @@ -140,7 +140,7 @@ if ($serendipity['GET']['filter']['type'] == 'TRACKBACK') { } /* Paging */ -$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments c WHERE 1 " . ($c_type !== null ? " AND c.type = '$c_type' " : '') . $and, true); +$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments c WHERE 1 = 1 " . ($c_type !== null ? " AND c.type = '$c_type' " : '') . $and, true); $totalComments = $sql['total']; $pages = ($commentsPerPage == COMMENTS_FILTER_ALL ? 1 : ceil($totalComments/(int)$commentsPerPage)); @@ -160,7 +160,7 @@ if ($commentsPerPage == COMMENTS_FILTER_ALL) { $sql = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}comments c LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id) - WHERE 1 " . ($c_type !== null ? " AND c.type = '$c_type' " : '') . $and + WHERE 1 = 1 " . ($c_type !== null ? " AND c.type = '$c_type' " : '') . $and . (!serendipity_checkPermission('adminEntriesMaintainOthers') ? 'AND e.authorid = ' . (int)$serendipity['authorid'] : '') . " ORDER BY c.id DESC $limit"); ?>