Explorar o código

Ticket #1430 - Mature-audience content filter (PG, PG13, R): Disable for Notes.

AntonLV %!s(int64=4) %!d(string=hai) anos
pai
achega
0576dcc0cd
Modificáronse 3 ficheiros con 20 adicións e 6 borrados
  1. 12 0
      inc/classes/BxDolCmts.php
  2. 5 0
      inc/classes/BxDolCmtsNotes.php
  3. 3 6
      inc/classes/BxDolCmtsQuery.php

+ 12 - 0
inc/classes/BxDolCmts.php

@@ -727,6 +727,18 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return BX_DOL_PG_ALL;
     }
 
+    /*
+     * Gets Content Filter object.
+     */
+    public function getObjectContentFilter ()
+    {
+        $oCf = BxDolContentFilter::getInstance();
+        if(!$oCf->isEnabledForComments())
+            return false;
+
+        return $oCf;
+    }
+
     public function getCommentsCountAll ($iObjectId = 0, $bForceCalculate = false)
     {
         return $this->_oQuery->getCommentsCountAll ($iObjectId ? $iObjectId : $this->getId(), $bForceCalculate);

+ 5 - 0
inc/classes/BxDolCmtsNotes.php

@@ -21,6 +21,11 @@ class BxDolCmtsNotes extends BxTemplCmts
     {
         return BX_DOL_PG_HIDDEN;
     }
+    
+    public function getObjectContentFilter ()
+    {
+        return false;
+    }
 }
 
 /** @} */

+ 3 - 6
inc/classes/BxDolCmtsQuery.php

@@ -267,8 +267,7 @@ class BxDolCmtsQuery extends BxDolDb
                 break;
         }
 
-        $oCf = BxDolContentFilter::getInstance();
-        if($oCf->isEnabledForComments())
+        if(($oCf = $this->_oMain->getObjectContentFilter()) !== false)
             $sWhereClause .= $oCf->getSQLParts($this->_sTable, 'cmt_cf');
 
         $sQuery = "SELECT COUNT(*) FROM `{$this->_sTable}` $sJoinClause WHERE `{$this->_sTable}`.`cmt_object_id` = :cmt_object_id" . $sWhereClause;
@@ -360,8 +359,7 @@ class BxDolCmtsQuery extends BxDolDb
         }
 
         $sWhereCf = '';
-        $oCf = BxDolContentFilter::getInstance();
-        if($oCf->isEnabledForComments())
+        if(($oCf = $this->_oMain->getObjectContentFilter()) !== false)
             $sWhereCf = $oCf->getSQLParts($this->_sTable, 'cmt_cf');
 
         $sOrder = " ORDER BY `{$this->_sTable}`.`cmt_pinned` DESC, `{$this->_sTable}`.`cmt_time` ASC";
@@ -529,8 +527,7 @@ class BxDolCmtsQuery extends BxDolDb
                     $sWhereConditions .= " AND `{$this->_sTable}`.`" . $sSearchParam . "`" . $sSearchValue;
                 }
 
-                $oCf = BxDolContentFilter::getInstance();
-                if($oCf->isEnabledForComments())
+                if(($oCf = $this->_oMain->getObjectContentFilter()) !== false)
                     $sWhereConditions .= $oCf->getSQLParts($this->_sTable, 'cmt_cf');
 
                 $sWhereClause .= " AND (" . $sWhereConditions . ")";