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
This commit is contained in:
Ingo Schommer 2009-11-21 02:00:19 +00:00
parent 61eb69f73b
commit 7f65395331
3 changed files with 7 additions and 7 deletions

View File

@ -56,13 +56,13 @@ class CommentAdmin extends LeftAndMain {
$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 @@ JS;
function deleteall() {
$numComments = 0;
$spam = DataObject::get('PageComment', '"PageComment"."IsSpam"');
$spam = DataObject::get('PageComment', '"PageComment"."IsSpam" = 1');
if($spam) {
$numComments = $spam->Count();

View File

@ -166,7 +166,7 @@ class PageComment extends DataObject {
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();

View File

@ -210,8 +210,8 @@ class PageCommentInterface extends RequestHandler {
$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)) {