Преглед изворни кода

Ticket #622 - Base functionality.

AntonLV пре 9 година
родитељ
комит
5e78e1b87b

+ 11 - 0
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -606,6 +606,17 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolPro
         return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, 'sys_profiles_subscriptions', false, true);
         return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, 'sys_profiles_subscriptions', false, true);
     }
     }
 
 
+    public function checkAllowedSubscriptionsView (&$aDataEntry, $isPerformAction = false)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $oProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$CNF['FIELD_ID']], $this->_aModule['name']);
+        if(!$oProfile || ($oProfile->id() != $this->_iProfileId && (int)$aDataEntry[$CNF['FIELD_PUB_SBSN']] == 0 && (int)$aDataEntry[$CNF['FIELD_PUB_SBSD']] == 0))
+            return _t('_sys_txt_access_denied');
+
+        return CHECK_ACTION_RESULT_ALLOWED;
+    }
+
     public function checkMyself($iContentId)
     public function checkMyself($iContentId)
     {
     {
 		$iLogged = (int)bx_get_logged_profile_id();
 		$iLogged = (int)bx_get_logged_profile_id();

+ 22 - 0
template/scripts/BxBaseServiceConnections.php

@@ -106,6 +106,17 @@ class BxBaseServiceConnections extends BxDol
      */
      */
     public function serviceSubscriptionsTable ()
     public function serviceSubscriptionsTable ()
     {
     {
+        $aProfile = BxDolProfile::getInstance(bx_process_input(bx_get('profile_id'), BX_DATA_INT))->getInfo();
+        if(empty($aProfile) || !is_array($aProfile))
+            return false;
+
+        $aProfileInfo = BxDolService::call($aProfile['type'], 'get_content_info_by_id', array($aProfile['content_id']));
+        if(empty($aProfileInfo) || !is_array($aProfileInfo))
+            return false;
+
+        if((int)$aProfileInfo['public_subscriptions'] == 0 && $aProfile['id'] != bx_get_logged_profile_id())
+            return false;
+
         $oGrid = BxDolGrid::getObjectInstance('sys_grid_subscriptions');
         $oGrid = BxDolGrid::getObjectInstance('sys_grid_subscriptions');
         if (!$oGrid)
         if (!$oGrid)
             return false;
             return false;
@@ -118,6 +129,17 @@ class BxBaseServiceConnections extends BxDol
      */
      */
     public function serviceSubscribedMeTable ()
     public function serviceSubscribedMeTable ()
     {
     {
+        $aProfile = BxDolProfile::getInstance(bx_process_input(bx_get('profile_id'), BX_DATA_INT))->getInfo();
+        if(empty($aProfile) || !is_array($aProfile))
+            return false;
+
+        $aProfileInfo = BxDolService::call($aProfile['type'], 'get_content_info_by_id', array($aProfile['content_id']));
+        if(empty($aProfileInfo) || !is_array($aProfileInfo))
+            return false;
+
+        if((int)$aProfileInfo['public_subscribed_me'] == 0 && $aProfile['id'] != bx_get_logged_profile_id())
+            return false;
+
         $oGrid = BxDolGrid::getObjectInstance('sys_grid_subscribed_me');
         $oGrid = BxDolGrid::getObjectInstance('sys_grid_subscribed_me');
         if (!$oGrid)
         if (!$oGrid)
             return false;
             return false;