Permalink
Browse files

BUGFIX Fixed PageComment boolean operators in WHERE SQL clauses that …

…break MSSQL (from r91444)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92468 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 61eb69f commit 7f653953310c9e8b16da6242c1e20516421e991b @chillu chillu committed Nov 21, 2009
Showing with 7 additions and 7 deletions.
  1. +4 −4 code/CommentAdmin.php
  2. +1 −1 code/sitefeatures/PageComment.php
  3. +2 −2 code/sitefeatures/PageCommentInterface.php
View
@@ -56,13 +56,13 @@ public function EditForm() {
$section = $this->Section();
if($section == 'approved') {
- $filter = "\"IsSpam\"=0 AND \"NeedsModeration\"=0";
+ $filter = "\"IsSpam\" = 0 AND \"NeedsModeration\" = 0";
$title = "<h2>". _t('CommentAdmin.APPROVEDCOMMENTS', 'Approved Comments')."</h2>";
} else if($section == 'unmoderated') {
- $filter = '"NeedsModeration"';
+ $filter = '"NeedsModeration" = 1';
$title = "<h2>"._t('CommentAdmin.COMMENTSAWAITINGMODERATION', 'Comments Awaiting Moderation')."</h2>";
} else {
- $filter = '"IsSpam"';
+ $filter = '"IsSpam" = 1';
$title = "<h2>"._t('CommentAdmin.SPAM', 'Spam')."</h2>";
}
@@ -147,7 +147,7 @@ function deletemarked() {
function deleteall() {
$numComments = 0;
- $spam = DataObject::get('PageComment', '"PageComment"."IsSpam"');
+ $spam = DataObject::get('PageComment', '"PageComment"."IsSpam" = 1');
if($spam) {
$numComments = $spam->Count();
@@ -166,7 +166,7 @@ public function onBeforeWrite() {
class PageComment_Controller extends Controller {
function rss() {
$parentcheck = isset($_REQUEST['pageid']) ? "\"ParentID\" = " . (int) $_REQUEST['pageid'] : "\"ParentID\" > 0";
- $unmoderatedfilter = Permission::check('ADMIN') ? '' : "AND NOT \"NeedsModeration\"";
+ $unmoderatedfilter = Permission::check('ADMIN') ? '' : "AND \"NeedsModeration\" = 0";
$comments = DataObject::get("PageComment", "$parentcheck AND \"IsSpam\" = 0 $unmoderatedfilter", "\"Created\" DESC", "", 10);
if(!isset($comments)) {
$comments = new DataObjectSet();
@@ -210,8 +210,8 @@ function Comments() {
$limit['start'] = isset($_GET['commentStart']) ? (int)$_GET['commentStart'] : 0;
$limit['limit'] = PageComment::$comments_per_page;
- $spamfilter = isset($_GET['showspam']) ? '' : "AND \"IsSpam\"=0";
- $unmoderatedfilter = Permission::check('ADMIN') ? '' : "AND \"NeedsModeration\"=0";
+ $spamfilter = isset($_GET['showspam']) ? '' : "AND \"IsSpam\" = 0";
+ $unmoderatedfilter = Permission::check('ADMIN') ? '' : "AND \"NeedsModeration\" = 0";
$comments = DataObject::get("PageComment", "\"ParentID\" = '" . Convert::raw2sql($this->page->ID) . "' $spamfilter $unmoderatedfilter", '"Created" DESC', "", $limit);
if(is_null($comments)) {

0 comments on commit 7f65395

Please sign in to comment.