Quellcode durchsuchen

Merge branch 'master' of https://github.com/unaio/una

RomanL vor 4 Jahren
Ursprung
Commit
b239f85fb1

+ 7 - 4
inc/classes/BxDolMenu.php

@@ -333,12 +333,15 @@ class BxDolMenu extends BxDolFactory implements iBxDolFactoryObject, iBxDolRepla
      */
     protected function _isVisible ($a)
     {
-        if (!BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']))
+        if(isset($a['visible_for_levels']) && !BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']))
+            return false;
+
+        if(!empty($a['visibility_custom']) && !BxDolService::callSerialized($a['visibility_custom'], $this->_aMarkers))
+            return false;
+
+        if($this->_iPageType && !empty($a['hidden_on_pt']) && ((1 << ($this->_iPageType - 2)) & (int)$a['hidden_on_pt']))
             return false;
 
-        if (!empty($a['visibility_custom']))
-            return BxDolService::callSerialized($a['visibility_custom'], $this->_aMarkers);
-        
         return true;
     }
     

+ 3 - 0
modules/base/general/classes/BxBaseModGeneralMenuView.php

@@ -40,6 +40,9 @@ class BxBaseModGeneralMenuView extends BxTemplMenu
      */
     protected function _isVisible ($a)
     {
+        if(!parent::_isVisible($a))
+            return false;
+
         return $this->_oModule->isMenuItemVisible($this->_sObject, $a, $this->_aContentInfo);
     }
 

+ 3 - 0
modules/base/general/classes/BxBaseModGeneralMenuViewActions.php

@@ -86,6 +86,9 @@ class BxBaseModGeneralMenuViewActions extends BxTemplMenuCustom
      */
     protected function _isVisible($a)
     {
+        if(!parent::_isVisible($a))
+            return false;
+
         return $this->_oModule->isMenuItemVisible($this->_sObject, $a, $this->_aContentInfo);
     }
 

+ 6 - 1
modules/base/groups/classes/BxBaseModGroupsPrivacyNotifications.php

@@ -24,7 +24,12 @@ class BxBaseModGroupsPrivacyNotifications extends BxBaseModGroupsPrivacy
         if (!($aEvent = BxDolService::call('bx_notifications', 'get_event_by_id', array($iObjectId))))
             return false;
 
-        return $this->_oModule->_oDb->isAdmin($aEvent['object_owner_id'], $iViewerId ? $iViewerId : bx_get_logged_profile_id());
+        return $this->checkGroupMember($aEvent['object_owner_id'], $iViewerId ? $iViewerId : bx_get_logged_profile_id());
+    }
+
+    public function checkGroupMember($iGroupProfileId, $iViewerId)
+    {
+        return $this->_oModule->_oDb->isAdmin($iGroupProfileId, $iViewerId);
     }
 }
 

+ 3 - 0
modules/base/profile/classes/BxBaseModProfileMenuView.php

@@ -68,6 +68,9 @@ class BxBaseModProfileMenuView extends BxTemplMenuMoreAuto
      */
     protected function _isVisible ($a)
     {
+        if(!parent::_isVisible($a))
+            return false;
+
         return $this->_oModule->isMenuItemVisible($this->_sObject, $a, $this->_aContentInfo);
     }
 }

+ 6 - 6
modules/boonex/notifications/classes/BxNtfsConfig.php

@@ -233,21 +233,21 @@ class BxNtfsConfig extends BxBaseModNotificationsConfig
 
     protected function _getProfileBasedModulesData() 
     {
-        $this->_aModulesProfiles = array();
-        $this->_aModulesContexts = array();
+        $this->_aModulesProfiles = [];
+        $this->_aModulesContexts = [];
 
-        $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules'));
+        $aModules = BxDolModuleQuery::getInstance()->getModulesBy(['type' => 'modules']);
         foreach($aModules as $aModule) {
-            if(!BxDolRequest::serviceExists($aModule['name'], 'act_as_profile'))
+            if(!bx_is_srv($aModule['name'], 'act_as_profile'))
                 continue;
 
-            if(BxDolService::call($aModule['name'], 'act_as_profile'))
+            if(bx_srv($aModule['name'], 'act_as_profile'))
                 $this->_aModulesProfiles[] = $aModule['name'];
             else
                 $this->_aModulesContexts[] = $aModule['name'];
         }
 
-        return array($this->_aModulesProfiles, $this->_aModulesContexts);        
+        return [$this->_aModulesProfiles, $this->_aModulesContexts];
     }
 }
 

+ 1 - 0
modules/boonex/organizations/classes/BxOrgsConfig.php

@@ -237,6 +237,7 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
                 'txt_N_fans' => '_bx_orgs_txt_N_friends',
                 'txt_ntfs_join_invitation' => '_bx_orgs_txt_ntfs_join_invitation',
             	'txt_ntfs_join_request' => '_bx_orgs_txt_ntfs_join_request',
+                'txt_ntfs_join_request_for_owner' => '_bx_orgs_txt_ntfs_join_request_for_owner',
                 'txt_ntfs_fan_added' => '_bx_orgs_txt_ntfs_fan_added',
             	'txt_ntfs_timeline_post_common' => '_bx_orgs_txt_ntfs_timeline_post_common',
                 'option_members_mode_multi_roles' => '_bx_orgs_option_members_mode_multi_roles',

+ 20 - 0
modules/boonex/organizations/classes/BxOrgsModule.php

@@ -91,6 +91,26 @@ class BxOrgsModule extends BxBaseModGroupsModule
     	return BxBaseModProfileModule::serviceGetTimelineData();
     }
 
+    public function serviceGetNotificationsInsertData($oAlert, $aHandler, $aDataItems)
+    {
+        if($oAlert->sAction != 'join_request' || empty($aDataItems) || !is_array($aDataItems))
+            return $aDataItems;
+
+        $aDataItem = reset($aDataItems);
+        $aDataItem['owner_id'] = $oAlert->aExtras['performer_id'];
+
+        $aDataItems[] = $aDataItem;
+        return $aDataItems;
+    }
+
+    public function serviceGetNotificationsJoinRequest($aEvent)
+    {
+        if($aEvent['owner_id'] == $aEvent['object_owner_id'])
+            return parent::serviceGetNotificationsJoinRequest($aEvent);
+
+        return $this->_serviceGetNotification($aEvent, $this->_oConfig->CNF['T']['txt_ntfs_join_request_for_owner']);
+    }
+
     public function onFanRemovedFromAdmins($iGroupProfileId, $iProfileId)
     {
         if (!($oProfile = BxDolProfile::getInstance($iProfileId)))

+ 5 - 2
modules/boonex/organizations/classes/BxOrgsPrivacyNotifications.php

@@ -17,9 +17,12 @@ class BxOrgsPrivacyNotifications extends BxBaseModGroupsPrivacyNotifications
         parent::__construct($aOptions, $oTemplate);
     }
 
-    protected function getObjectInfo($sAction, $iObjectId)
+    public function checkGroupMember($iGroupProfileId, $iViewerId)
     {
-        return BxBaseModProfilePrivacy::getObjectInfo($sAction, $iObjectId);
+        if($iGroupProfileId == $iViewerId)
+            return true;
+
+        return parent::checkGroupMember($iGroupProfileId, $iViewerId);
     }
 }
 

+ 1 - 0
modules/boonex/organizations/install/langs/en.xml

@@ -481,6 +481,7 @@
     <string name="_bx_orgs_txt_ntfs_fan_added"><![CDATA[Organization <b class="bx-ntfs-content-profile">{owner_name}</b> has got a member <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
     <string name="_bx_orgs_txt_ntfs_join_invitation"><![CDATA[<b class="bx-ntfs-content-profile">{owner_name}</b> organization's representative invites <b class="bx-ntfs-content-entry">{subentry_sample}</b> to join organization]]></string>
     <string name="_bx_orgs_txt_ntfs_join_request"><![CDATA[Organization <b class="bx-ntfs-content-profile">{owner_name}</b> has a join request from <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
+    <string name="_bx_orgs_txt_ntfs_join_request_for_owner"><![CDATA[<b class="bx-ntfs-content-entry">{subentry_sample}</b> sent a join request to your organization]]></string>
     <string name="_bx_orgs_txt_ntfs_timeline_post_common"><![CDATA[New post <b class="bx-ntfs-content-entry">{subentry_sample}</b> in <b class="bx-ntfs-content-profile">{owner_name}</b> organization timeline]]></string>
 
     <string name="_bx_orgs_txt_sample_single"><![CDATA[organization]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/bx_organizations/ru.xml

@@ -476,6 +476,7 @@
     <string name="_bx_orgs_txt_ntfs_fan_added"><![CDATA[В организацию <b class="bx-ntfs-content-profile">{owner_name}</b> вступил <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
     <string name="_bx_orgs_txt_ntfs_join_invitation"><![CDATA[Представитель организации <b class="bx-ntfs-content-profile">{owner_name}</b> пригласил <b class="bx-ntfs-content-entry">{subentry_sample}</b> вступить в организацию]]></string>
     <string name="_bx_orgs_txt_ntfs_join_request"><![CDATA[В организацию <b class="bx-ntfs-content-profile">{owner_name}</b> хочет вступить <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
+    <string name="_bx_orgs_txt_ntfs_join_request_for_owner"><![CDATA[<b class="bx-ntfs-content-entry">{subentry_sample}</b> хочет вступить в вашу организацию]]></string>
     <string name="_bx_orgs_txt_ntfs_timeline_post_common"><![CDATA[В организации <b class="bx-ntfs-content-profile">{owner_name}</b> новая публикация <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
 
     <string name="_bx_orgs_txt_sample_single"><![CDATA[Организация]]></string>

+ 1 - 4
template/scripts/BxBaseMenu.php

@@ -153,10 +153,7 @@ class BxBaseMenu extends BxDolMenu
         if (isset($a['active']) && !$a['active'])
             return false;
 
-        if (isset($a['visible_for_levels']) && !$this->_isVisible($a))
-            return false;
-
-        if($this->_iPageType && !empty($a['hidden_on_pt']) && ((1 << ($this->_iPageType - 2)) & (int)$a['hidden_on_pt']))
+        if (!$this->_isVisible($a))
             return false;
 
         $a['title'] = _t($a['title']);

+ 1 - 1
template/scripts/BxBaseMenuCustom.php

@@ -69,7 +69,7 @@ class BxBaseMenuCustom extends BxTemplMenuMoreAuto
     	if (isset($aItem['active']) && !$aItem['active'])
             return false;
 
-        if (isset($aItem['visible_for_levels']) && !$this->_isVisible($aItem))
+        if (!$this->_isVisible($aItem))
             return false;
 
     	$sMethod = '_getMenuItem' . str_replace(' ', '', ucwords(str_replace('-', ' ', $aItem['name'])));