Alex Trofimov 11 лет назад
Родитель
Сommit
b5c944913c

+ 25 - 0
modules/base/text/classes/BxBaseModTextSearchResult.php

@@ -31,6 +31,31 @@ class BxBaseModTextSearchResult extends BxBaseModGeneralSearchResult
             $this->addContainerClass (array('bx-def-margin-sec-neg', 'bx-base-text-unit-gallery-wrapper'));
     }
 
+    protected function processReplaceableMarkers($oProfileAuthor) 
+    {
+        if ($oProfileAuthor) {
+            $this->addMarkers($oProfileAuthor->getInfo()); // profile info is replaceable
+            $this->addMarkers(array('profile_id' => $oProfileAuthor->id())); // profile id is replaceable
+            $this->addMarkers(array('display_name' => $oProfileAuthor->getDisplayName())); // profile display name is replaceable
+        }
+
+        $this->sBrowseUrl = $this->_replaceMarkers($this->sBrowseUrl);
+        $this->aCurrent['title'] = $this->_replaceMarkers($this->aCurrent['title']);
+    }
+
+    protected function addConditionsForPrivateContent($CNF, $oProfileAuthor) 
+    {
+        // add conditions for private content
+        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
+        $a = $oPrivacy ? $oPrivacy->getContentPublicAsCondition($oProfileAuthor ? $oProfileAuthor->id() : 0) : array();
+        if (isset($a['restriction']))
+            $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $a['restriction']);
+        if (isset($a['join']))
+            $this->aCurrent['join'] = array_merge($this->aCurrent['join'], $a['join']);
+
+        $this->setProcessPrivateContent(false);
+    }
+
     protected function getCurrentOnclick($aAdditionalParams = array(), $bReplacePagesParams = true) 
     {
         // always add UnitView as additional param

+ 2 - 18
modules/boonex/albums/classes/BxAlbumsSearchResult.php

@@ -97,25 +97,9 @@ class BxAlbumsSearchResult extends BxBaseModTextSearchResult
                 $this->isError = true;
         }
 
-        // add replaceable markers and replace them
-        if ($oProfileAuthor) {
-            $this->addMarkers($oProfileAuthor->getInfo()); // profile info is replaceable
-            $this->addMarkers(array('profile_id' => $oProfileAuthor->id())); // profile id is replaceable
-            $this->addMarkers(array('display_name' => $oProfileAuthor->getDisplayName())); // profile display name is replaceable
-        }
-
-        $this->sBrowseUrl = $this->_replaceMarkers($this->sBrowseUrl);
-        $this->aCurrent['title'] = $this->_replaceMarkers($this->aCurrent['title']);
-
-        // add conditions for private content
-        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
-        $a = $oPrivacy ? $oPrivacy->getContentPublicAsCondition($oProfileAuthor ? $oProfileAuthor->id() : 0) : array();
-        if (isset($a['restriction']))
-            $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $a['restriction']);
-        if (isset($a['join']))
-            $this->aCurrent['join'] = array_merge($this->aCurrent['join'], $a['join']);
+        $this->processReplaceableMarkers($oProfileAuthor);
 
-        $this->setProcessPrivateContent(false);
+        $this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
     }
 
     function displayResultBlock ()

+ 1 - 9
modules/boonex/albums/classes/BxAlbumsSearchResultMedia.php

@@ -116,15 +116,7 @@ class BxAlbumsSearchResultMedia extends BxBaseModTextSearchResult
         $this->sBrowseUrl = $this->_replaceMarkers($this->sBrowseUrl);
         $this->aCurrent['title'] = $this->_replaceMarkers($this->aCurrent['title']);
 
-        // add conditions for private content
-        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
-        $a = $oPrivacy ? $oPrivacy->getContentPublicAsCondition($oProfileAuthor ? $oProfileAuthor->id() : 0) : array();
-        if (isset($a['restriction']))
-            $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $a['restriction']);
-        if (isset($a['join']))
-            $this->aCurrent['join'] = array_merge($this->aCurrent['join'], $a['join']);
-
-        $this->setProcessPrivateContent(false);
+        $this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
     }
 
     function getAlterOrder()

+ 2 - 18
modules/boonex/posts/classes/BxPostsSearchResult.php

@@ -92,25 +92,9 @@ class BxPostsSearchResult extends BxBaseModTextSearchResult
                 $this->isError = true;
         }
 
-        // add replaceable markers and replace them
-        if ($oProfileAuthor) {
-            $this->addMarkers($oProfileAuthor->getInfo()); // profile info is replacable
-            $this->addMarkers(array('profile_id' => $oProfileAuthor->id())); // profile id is replacable
-            $this->addMarkers(array('display_name' => $oProfileAuthor->getDisplayName())); // profile display name is replacable
-        }
-
-        $this->sBrowseUrl = $this->_replaceMarkers($this->sBrowseUrl);
-        $this->aCurrent['title'] = $this->_replaceMarkers($this->aCurrent['title']);
-
-        // add conditions for private content
-        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
-        $a = $oPrivacy ? $oPrivacy->getContentPublicAsCondition($oProfileAuthor ? $oProfileAuthor->id() : 0) : array();
-        if (isset($a['restriction']))
-            $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $a['restriction']);
-        if (isset($a['join']))
-            $this->aCurrent['join'] = array_merge($this->aCurrent['join'], $a['join']);
+        $this->processReplaceableMarkers($oProfileAuthor);
 
-        $this->setProcessPrivateContent(false);
+        $this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
     }
 
     function getAlterOrder()