diff --git a/inc/classes/BxDolGridRelatedMe.php b/inc/classes/BxDolGridRelatedMe.php index a2f8ff3f16..004d71d2de 100644 --- a/inc/classes/BxDolGridRelatedMe.php +++ b/inc/classes/BxDolGridRelatedMe.php @@ -84,6 +84,32 @@ protected function _getActionAdd($sType, $sKey, $a, $isSmall = false, $isDisable $a['attr']['onclick'] = "javascript: bx_menu_popup('sys_add_relation', window, {}, {profile_id: " . $aRow['id'] . "});"; return parent::_getActionDefault($sType, $sKey, $a, $isSmall, $isDisabled, $aRow); } + + protected function _getActionDelete ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array()) + { + if (!isLogged() || !$this->_bOwner) + return ''; + + return parent::_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow); + } + + protected function _delete ($mixedId) + { + list($iId, $iViewedId) = $this->_prepareIds(); + + if(!$this->_oConnection->isConnected($iId, $iViewedId)) + return true; + + return $this->_oConnection->removeConnection($iId, $iViewedId); + } + + protected function _getDataSql ($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage) + { + if(!$this->_bOwner) + $this->_aOptions['source'] .= " AND `c`.`mutual`='1'"; + + return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage); + } } /** @} */ diff --git a/inc/classes/BxDolGridRelations.php b/inc/classes/BxDolGridRelations.php index fc23f2dee9..721ed516da 100644 --- a/inc/classes/BxDolGridRelations.php +++ b/inc/classes/BxDolGridRelations.php @@ -27,6 +27,14 @@ protected function _getCellMutual($mixedValue, $sKey, $aField, $aRow) return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); } + + protected function _getDataSql ($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage) + { + if(!$this->_bOwner) + $this->_aOptions['source'] .= " AND `c`.`mutual`='1'"; + + return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage); + } } /** @} */ diff --git a/inc/classes/BxDolPrivacy.php b/inc/classes/BxDolPrivacy.php index f9712ac5ab..0b5d748d06 100644 --- a/inc/classes/BxDolPrivacy.php +++ b/inc/classes/BxDolPrivacy.php @@ -91,7 +91,7 @@ protected function __construct($aObject) $this->_aGroupsSettings = [ BX_DOL_PG_FRIENDS_SELECTED => [ - 'name' => 'friends', + 'name' => 'friends_selected', 'is_allowed' => '', 'connection' => 'sys_profiles_friends', 'js_method_create_group' => 'selectMembers', @@ -99,9 +99,14 @@ protected function __construct($aObject) 'db_field_item' => 'member_id', 'uri_get_items' => 'users_list', ], - BX_DOL_PG_RELATIONS_SELECTED => [ + BX_DOL_PG_RELATIONS => [ 'name' => 'relations', - 'is_allowed' => '', + 'is_allowed' => 'isAllowedRelations', + 'connection' => 'sys_profiles_relations', + ], + BX_DOL_PG_RELATIONS_SELECTED => [ + 'name' => 'relations_selected', + 'is_allowed' => 'isAllowedRelations', 'connection' => 'sys_profiles_relations', 'js_method_create_group' => 'selectMembers', 'db_table_items' => 'sys_privacy_groups_custom_members', @@ -109,7 +114,7 @@ protected function __construct($aObject) 'uri_get_items' => 'users_list', ], BX_DOL_PG_MEMBERSHIPS_SELECTED => [ - 'name' => 'memberships', + 'name' => 'memberships_selected', 'is_allowed' => 'isAllowedMemberships', 'connection' => '', 'js_method_create_group' => 'selectMemberships', @@ -780,6 +785,11 @@ protected function isSelectGroupCustomMemberships($aParams) return true; } + public function isAllowedRelations($iUserId) + { + return BxDolRelation::isEnabled(); + } + public function isAllowedMemberships($iUserId) { $aCheck = checkActionModule($iUserId, 'show membership levels in privacy groups', 'system', false); diff --git a/inc/classes/BxDolRelation.php b/inc/classes/BxDolRelation.php index b3d0674601..92dde0c37b 100644 --- a/inc/classes/BxDolRelation.php +++ b/inc/classes/BxDolRelation.php @@ -9,9 +9,10 @@ class BxDolRelation extends BxDolConnection { - protected $_sParamDivider; - protected $_sParamEnabled; + protected static $_sParamEnabled = 'sys_relations_enable'; + protected static $_sParamTypes = 'sys_relations'; + protected $_sParamDivider; protected $_sPreList; protected function __construct($aObject) @@ -21,10 +22,18 @@ protected function __construct($aObject) $this->_oQuery = new BxDolRelationQuery($aObject); $this->_sParamDivider = '_'; - $this->_sParamEnabled = 'sys_relations'; $this->_sPreList = 'sys_relations'; } + /** + * Whether the Relations feature is enabled globaly or not. + * @return boolean + */ + public static function isEnabled() + { + return getParam(self::$_sParamEnabled) == 'on'; + } + /** * Add new relation. * @param $mixedContent content to make relation with or an array with content and relation type @@ -268,7 +277,7 @@ public function getRelationTranslation($iValue, $sUseValues = BX_DATA_VALUES_DEF public function getRelationTypes() { - $sParam = getParam($this->_sParamEnabled); + $sParam = getParam(self::$_sParamTypes); if(empty($sParam)) return array(); diff --git a/inc/js/classes/BxDolPrivacy.js b/inc/js/classes/BxDolPrivacy.js index e0ce7da0cb..a1eaa60edb 100644 --- a/inc/js/classes/BxDolPrivacy.js +++ b/inc/js/classes/BxDolPrivacy.js @@ -81,7 +81,7 @@ BxDolPrivacy.prototype.selectGroup = function(oElement) $('#' + this._aHtmlIds['group_custom_element']).remove(); var iGroupId = parseInt($(oElement).val()); - if(!this._aGroupSettings[iGroupId]) + if(!this._aGroupSettings[iGroupId] || !this._aGroupSettings[iGroupId]['js_method_create_group']) return; var sMethodCreateGroup = 'selectMembers'; diff --git a/install/sql/system.sql b/install/sql/system.sql index 4dd0ab7732..2fd04630be 100644 --- a/install/sql/system.sql +++ b/install/sql/system.sql @@ -334,7 +334,8 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex (@iCategoryId, 'sys_search_keyword_min_len', '_adm_stg_cpt_option_sys_search_keyword_min_len', '1', 'digit', '', '', '', '', 80), -(@iCategoryId, 'sys_relations', '_adm_stg_cpt_option_sys_relations', '', 'list', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:21:"get_options_relations";s:6:"params";a:0:{}s:5:"class";s:13:"TemplServices";}', '', '', '', 90), +(@iCategoryId, 'sys_relations_enable', '_adm_stg_cpt_option_sys_relations_enable', 'on', 'checkbox', '', '', '', '', 90), +(@iCategoryId, 'sys_relations', '_adm_stg_cpt_option_sys_relations', '', 'list', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:21:"get_options_relations";s:6:"params";a:0:{}s:5:"class";s:13:"TemplServices";}', '', '', '', 91), (@iCategoryId, 'enable_gd', '_adm_stg_cpt_option_enable_gd', 'on', 'checkbox', '', '', '', '', 100), (@iCategoryId, 'sys_transcoder_queue_storage', '_adm_stg_cpt_option_sys_transcoder_queue_storage', '', 'checkbox', '', '', '', '', 105), @@ -5079,7 +5080,8 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon ('sys_grid_related_me', 'single', 'confirm', '_sys_confirm', 'check-circle', 1, 0, 1), ('sys_grid_related_me', 'single', 'decline', '_sys_decline', 'times-circle', 1, 1, 2), -('sys_grid_related_me', 'single', 'add', '_sys_add_relation', 'plus-circle', 1, 0, 3); +('sys_grid_related_me', 'single', 'add', '_sys_add_relation', 'plus-circle', 1, 0, 3), +('sys_grid_related_me', 'single', 'delete', '_Delete', 'remove', 1, 1, 4); -- GRID: queues INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `order_get_field`, `order_get_dir`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `filter_get`, `sorting_fields`, `sorting_fields_translatable`, `visible_for_levels`, `responsive`, `show_total_count`, `override_class_name`, `override_class_file`) VALUES diff --git a/modules/base/profile/classes/BxBaseModProfileModule.php b/modules/base/profile/classes/BxBaseModProfileModule.php index 7797dccb82..daae319609 100644 --- a/modules/base/profile/classes/BxBaseModProfileModule.php +++ b/modules/base/profile/classes/BxBaseModProfileModule.php @@ -1085,6 +1085,9 @@ public function serviceProfileSubscribedMe ($iContentId = 0) public function serviceProfileRelations ($iContentId = 0, $aParams = array()) { + if(!BxDolRelation::isEnabled()) + return false; + $mixedContent = $this->_getContent($iContentId); if($mixedContent === false) return false; @@ -1101,6 +1104,9 @@ public function serviceProfileRelations ($iContentId = 0, $aParams = array()) public function serviceProfileRelatedMe ($iContentId = 0) { + if(!BxDolRelation::isEnabled()) + return false; + $mixedContent = $this->_getContent($iContentId); if($mixedContent === false) return false; @@ -1126,6 +1132,9 @@ public function serviceIsEnableProfileActivationLetter() public function serviceIsEnableRelations() { + if(!BxDolRelation::isEnabled()) + return false; + $sModule = $this->_oConfig->getName(); $oRelations = BxDolConnection::getObjectInstance('sys_profiles_relations'); return $oRelations->isRelationAvailableWithProfile($sModule) || $oRelations->isRelationAvailableFromProfile($sModule); @@ -1696,7 +1705,11 @@ public function checkAllowedFriendRemove (&$aDataEntry, $isPerformAction = false */ public function checkAllowedRelationAdd (&$aDataEntry, $isPerformAction = false) { - if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->checkAllowedView($aDataEntry))) + $sResult = _t('_sys_txt_access_denied'); + if(!BxDolRelation::isEnabled()) + return $sResult; + + if(($sMsg = $this->checkAllowedView($aDataEntry)) !== CHECK_ACTION_RESULT_ALLOWED) return $sMsg; return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, 'sys_profiles_relations', false, false); @@ -1707,12 +1720,18 @@ public function checkAllowedRelationAdd (&$aDataEntry, $isPerformAction = false) */ public function checkAllowedRelationRemove (&$aDataEntry, $isPerformAction = false) { + $sResult = _t('_sys_txt_access_denied'); + if(!BxDolRelation::isEnabled()) + return $sResult; + return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, 'sys_profiles_relations', false, true); } public function checkAllowedRelationsView (&$aDataEntry, $isPerformAction = false) { $sResult = _t('_sys_txt_access_denied'); + if(!BxDolRelation::isEnabled()) + return $sResult; $sModule = $this->_oConfig->getName(); $oRelations = BxDolConnection::getObjectInstance('sys_profiles_relations'); diff --git a/modules/boonex/english/data/langs/system/en.xml b/modules/boonex/english/data/langs/system/en.xml index 517bc068d3..67c1ec64a5 100644 --- a/modules/boonex/english/data/langs/system/en.xml +++ b/modules/boonex/english/data/langs/system/en.xml @@ -1623,7 +1623,8 @@ - + + diff --git a/modules/boonex/organizations/install/sql/enable.sql b/modules/boonex/organizations/install/sql/enable.sql index 51d465aea9..e0da7d0f27 100644 --- a/modules/boonex/organizations/install/sql/enable.sql +++ b/modules/boonex/organizations/install/sql/enable.sql @@ -452,14 +452,14 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit -- MENU: profile stats SET @iNotifMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name` = 'sys_profile_stats' AND `active` = 1 LIMIT 1); -INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES -('sys_profile_stats', 'bx_organizations', 'profile-stats-friend-requests', '_bx_orgs_menu_item_title_system_friend_requests', '_bx_orgs_menu_item_title_friend_requests', 'page.php?i=organization-profile-friends&profile_id={member_id}', '', '', 'briefcase col-red2', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:31:"get_unconfirmed_connections_num";s:6:"params";a:1:{i:0;s:20:"sys_profiles_friends";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 1), -('sys_profile_stats', 'bx_organizations', 'profile-stats-manage-organizations', '_bx_orgs_menu_item_title_system_manage_my_organizations', '_bx_orgs_menu_item_title_manage_my_organizations', 'page.php?i=organizations-manage', '', '_self', 'briefcase col-red2', 'a:2:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:41:"get_menu_addon_manage_tools_profile_stats";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 2), -('sys_profile_stats', 'bx_organizations', 'profile-stats-favorite-organizations', '_bx_orgs_menu_item_title_system_favorites', '_bx_orgs_menu_item_title_favorites', 'page.php?i=organization-profile-favorites&profile_id={member_id}', '', '', 'star col-red2', 'a:2:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:38:"get_menu_addon_favorites_profile_stats";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 3), -('sys_profile_stats', 'bx_organizations', 'profile-stats-subscriptions', '_bx_orgs_menu_item_title_system_subscriptions', '_bx_orgs_menu_item_title_subscriptions', 'page.php?i=organization-profile-subscriptions&profile_id={member_id}#subscriptions', '', '_self', 'rss col-red2', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 4), -('sys_profile_stats', 'bx_organizations', 'profile-stats-subscribed-me', '_bx_orgs_menu_item_title_system_subscribed_me', '_bx_orgs_menu_item_title_subscribed_me', 'page.php?i=organization-profile-subscriptions&profile_id={member_id}#subscribers', '', '_self', 'rss col-red2', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 5), -('sys_profile_stats', 'bx_organizations', 'profile-stats-relations', '_bx_orgs_menu_item_title_system_relations', '_bx_orgs_menu_item_title_relations', 'page.php?i=organization-profile-relations&profile_id={member_id}#relations', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 6), -('sys_profile_stats', 'bx_organizations', 'profile-stats-related-me', '_bx_orgs_menu_item_title_system_related_me', '_bx_orgs_menu_item_title_related_me', 'page.php?i=organization-profile-relations&profile_id={member_id}#related-me', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 7); +INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `order`) VALUES +('sys_profile_stats', 'bx_organizations', 'profile-stats-friend-requests', '_bx_orgs_menu_item_title_system_friend_requests', '_bx_orgs_menu_item_title_friend_requests', 'page.php?i=organization-profile-friends&profile_id={member_id}', '', '', 'briefcase col-red2', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:31:"get_unconfirmed_connections_num";s:6:"params";a:1:{i:0;s:20:"sys_profiles_friends";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 1), +('sys_profile_stats', 'bx_organizations', 'profile-stats-manage-organizations', '_bx_orgs_menu_item_title_system_manage_my_organizations', '_bx_orgs_menu_item_title_manage_my_organizations', 'page.php?i=organizations-manage', '', '_self', 'briefcase col-red2', 'a:2:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:41:"get_menu_addon_manage_tools_profile_stats";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 2), +('sys_profile_stats', 'bx_organizations', 'profile-stats-favorite-organizations', '_bx_orgs_menu_item_title_system_favorites', '_bx_orgs_menu_item_title_favorites', 'page.php?i=organization-profile-favorites&profile_id={member_id}', '', '', 'star col-red2', 'a:2:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:38:"get_menu_addon_favorites_profile_stats";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 3), +('sys_profile_stats', 'bx_organizations', 'profile-stats-subscriptions', '_bx_orgs_menu_item_title_system_subscriptions', '_bx_orgs_menu_item_title_subscriptions', 'page.php?i=organization-profile-subscriptions&profile_id={member_id}#subscriptions', '', '_self', 'rss col-red2', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 4), +('sys_profile_stats', 'bx_organizations', 'profile-stats-subscribed-me', '_bx_orgs_menu_item_title_system_subscribed_me', '_bx_orgs_menu_item_title_subscribed_me', 'page.php?i=organization-profile-subscriptions&profile_id={member_id}#subscribers', '', '_self', 'rss col-red2', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 5), +('sys_profile_stats', 'bx_organizations', 'profile-stats-relations', '_bx_orgs_menu_item_title_system_relations', '_bx_orgs_menu_item_title_relations', 'page.php?i=organization-profile-relations&profile_id={member_id}#relations', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 'a:2:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:19:"is_enable_relations";}', 1, 0, @iNotifMenuOrder + 6), +('sys_profile_stats', 'bx_organizations', 'profile-stats-related-me', '_bx_orgs_menu_item_title_system_related_me', '_bx_orgs_menu_item_title_related_me', 'page.php?i=organization-profile-relations&profile_id={member_id}#related-me', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 'a:2:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:19:"is_enable_relations";}', 1, 0, @iNotifMenuOrder + 7); -- MENU: profile followings SET @iFollowingsMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name`='sys_profile_followings' LIMIT 1); diff --git a/modules/boonex/persons/install/sql/enable.sql b/modules/boonex/persons/install/sql/enable.sql index 0a77f06a82..1f5813d1da 100644 --- a/modules/boonex/persons/install/sql/enable.sql +++ b/modules/boonex/persons/install/sql/enable.sql @@ -369,14 +369,14 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit -- MENU: profile stats SET @iNotifMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name` = 'sys_profile_stats' AND `active` = 1 LIMIT 1); -INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES -('sys_profile_stats', 'bx_persons', 'profile-stats-friend-requests', '_bx_persons_menu_item_title_system_friend_requests', '_bx_persons_menu_item_title_friend_requests', 'page.php?i=persons-profile-friends&profile_id={member_id}', '', '', 'users col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:31:"get_unconfirmed_connections_num";s:6:"params";a:1:{i:0;s:20:"sys_profiles_friends";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 1), -('sys_profile_stats', 'bx_persons', 'profile-stats-manage-profiles', '_bx_persons_menu_item_title_system_manage_my_profiles', '_bx_persons_menu_item_title_manage_my_profiles', 'page.php?i=persons-manage', '', '_self', 'users col-blue3', 'a:2:{s:6:"module";s:10:"bx_persons";s:6:"method";s:41:"get_menu_addon_manage_tools_profile_stats";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 2), -('sys_profile_stats', 'bx_persons', 'profile-stats-favorite-persons', '_bx_persons_menu_item_title_system_favorites', '_bx_persons_menu_item_title_favorites', 'page.php?i=persons-profile-favorites&profile_id={member_id}', '', '', 'star col-blue3', 'a:2:{s:6:"module";s:10:"bx_persons";s:6:"method";s:38:"get_menu_addon_favorites_profile_stats";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 3), -('sys_profile_stats', 'bx_persons', 'profile-stats-subscriptions', '_bx_persons_menu_item_title_system_subscriptions', '_bx_persons_menu_item_title_subscriptions', 'page.php?i=persons-profile-subscriptions&profile_id={member_id}#subscriptions', '', '_self', 'rss col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 4), -('sys_profile_stats', 'bx_persons', 'profile-stats-subscribed-me', '_bx_persons_menu_item_title_system_subscribed_me', '_bx_persons_menu_item_title_subscribed_me', 'page.php?i=persons-profile-subscriptions&profile_id={member_id}#subscribers', '', '_self', 'rss col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 5), -('sys_profile_stats', 'bx_persons', 'profile-stats-relations', '_bx_persons_menu_item_title_system_relations', '_bx_persons_menu_item_title_relations', 'page.php?i=persons-profile-relations&profile_id={member_id}#relations', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 6), -('sys_profile_stats', 'bx_persons', 'profile-stats-related-me', '_bx_persons_menu_item_title_system_related_me', '_bx_persons_menu_item_title_related_me', 'page.php?i=persons-profile-relations&profile_id={member_id}#related-me', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 1, 0, @iNotifMenuOrder + 7); +INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `order`) VALUES +('sys_profile_stats', 'bx_persons', 'profile-stats-friend-requests', '_bx_persons_menu_item_title_system_friend_requests', '_bx_persons_menu_item_title_friend_requests', 'page.php?i=persons-profile-friends&profile_id={member_id}', '', '', 'users col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:31:"get_unconfirmed_connections_num";s:6:"params";a:1:{i:0;s:20:"sys_profiles_friends";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 1), +('sys_profile_stats', 'bx_persons', 'profile-stats-manage-profiles', '_bx_persons_menu_item_title_system_manage_my_profiles', '_bx_persons_menu_item_title_manage_my_profiles', 'page.php?i=persons-manage', '', '_self', 'users col-blue3', 'a:2:{s:6:"module";s:10:"bx_persons";s:6:"method";s:41:"get_menu_addon_manage_tools_profile_stats";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 2), +('sys_profile_stats', 'bx_persons', 'profile-stats-favorite-persons', '_bx_persons_menu_item_title_system_favorites', '_bx_persons_menu_item_title_favorites', 'page.php?i=persons-profile-favorites&profile_id={member_id}', '', '', 'star col-blue3', 'a:2:{s:6:"module";s:10:"bx_persons";s:6:"method";s:38:"get_menu_addon_favorites_profile_stats";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 3), +('sys_profile_stats', 'bx_persons', 'profile-stats-subscriptions', '_bx_persons_menu_item_title_system_subscriptions', '_bx_persons_menu_item_title_subscriptions', 'page.php?i=persons-profile-subscriptions&profile_id={member_id}#subscriptions', '', '_self', 'rss col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 4), +('sys_profile_stats', 'bx_persons', 'profile-stats-subscribed-me', '_bx_persons_menu_item_title_system_subscribed_me', '_bx_persons_menu_item_title_subscribed_me', 'page.php?i=persons-profile-subscriptions&profile_id={member_id}#subscribers', '', '_self', 'rss col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:1:{i:0;s:26:"sys_profiles_subscriptions";}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, '', 1, 0, @iNotifMenuOrder + 5), +('sys_profile_stats', 'bx_persons', 'profile-stats-relations', '_bx_persons_menu_item_title_system_relations', '_bx_persons_menu_item_title_relations', 'page.php?i=persons-profile-relations&profile_id={member_id}#relations', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"get_connected_content_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 'a:2:{s:6:"module";s:10:"bx_persons";s:6:"method";s:19:"is_enable_relations";}', 1, 0, @iNotifMenuOrder + 6), +('sys_profile_stats', 'bx_persons', 'profile-stats-related-me', '_bx_persons_menu_item_title_system_related_me', '_bx_persons_menu_item_title_related_me', 'page.php?i=persons-profile-relations&profile_id={member_id}#related-me', '', '_self', 'sync col-blue3', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"get_connected_initiators_num";s:6:"params";a:3:{i:0;s:22:"sys_profiles_relations";i:1;i:0;i:2;i:1;}s:5:"class";s:23:"TemplServiceConnections";}', '', 2147483646, 'a:2:{s:6:"module";s:10:"bx_persons";s:6:"method";s:19:"is_enable_relations";}', 1, 0, @iNotifMenuOrder + 7); -- MENU: profile followings SET @iFollowingsMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name`='sys_profile_followings' LIMIT 1); diff --git a/modules/boonex/russian/data/langs/system/ru.xml b/modules/boonex/russian/data/langs/system/ru.xml index 7d4fe5f637..8fad297198 100644 --- a/modules/boonex/russian/data/langs/system/ru.xml +++ b/modules/boonex/russian/data/langs/system/ru.xml @@ -1610,6 +1610,7 @@ + diff --git a/template/scripts/BxBaseMenuAddRelation.php b/template/scripts/BxBaseMenuAddRelation.php index 0bf88bae45..10427dcaa8 100644 --- a/template/scripts/BxBaseMenuAddRelation.php +++ b/template/scripts/BxBaseMenuAddRelation.php @@ -27,6 +27,14 @@ public function __construct ($aObject, $oTemplate) $this->_iContent = 0; } + public function getCode () + { + if(!BxDolRelation::isEnabled()) + return ''; + + return parent::getCode(); + } + public function getMenuItems () { $this->loadData(); diff --git a/template/scripts/BxBasePrivacy.php b/template/scripts/BxBasePrivacy.php index 6502e59e68..7d8f3f971e 100644 --- a/template/scripts/BxBasePrivacy.php +++ b/template/scripts/BxBasePrivacy.php @@ -182,8 +182,9 @@ protected function getSelectMemberships($aValues = array(), $aParams = array()) else { $this->_oDb->deleteGroupCustomMembership(array('group_id' => $iGroupCustomId)); - foreach($aMemberships as $iMembershipId) - $this->_oDb->insertGroupCustomMembership(array('group_id' => $iGroupCustomId, 'membership_id' => $iMembershipId)); + if(!empty($aMemberships) && is_array($aMemberships)) + foreach($aMemberships as $iMembershipId) + $this->_oDb->insertGroupCustomMembership(array('group_id' => $iGroupCustomId, 'membership_id' => $iMembershipId)); } return array('eval' => $sJsObject . '.onSelectMemberships(oData);', 'content' => $oForm->getElementGroupCustom(array( diff --git a/template/scripts/BxBasePrivacyFormGroupCustom.php b/template/scripts/BxBasePrivacyFormGroupCustom.php index 6ac03292b9..e851d01b3c 100644 --- a/template/scripts/BxBasePrivacyFormGroupCustom.php +++ b/template/scripts/BxBasePrivacyFormGroupCustom.php @@ -131,7 +131,7 @@ public function getElementGroupCustom($aParams = array()) ]); } - protected function getElementGroupCustomValueMemberships($sName, $aItems) + protected function getElementGroupCustomValueMembershipsSelected($sName, $aItems) { $oAcl = BxDolAcl::getInstance(); diff --git a/template/scripts/BxBaseServiceConnections.php b/template/scripts/BxBaseServiceConnections.php index c829b63bab..d9b1d020ef 100644 --- a/template/scripts/BxBaseServiceConnections.php +++ b/template/scripts/BxBaseServiceConnections.php @@ -210,6 +210,9 @@ public function serviceSubscribedMeTable ($iProfileId = 0) */ public function serviceRelationsTable ($iProfileId = 0) { + if(!BxDolRelation::isEnabled()) + return false; + if(!$iProfileId && bx_get('profile_id') !== false) $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT); @@ -240,6 +243,9 @@ public function serviceRelationsTable ($iProfileId = 0) */ public function serviceRelatedMeTable ($iProfileId = 0) { + if(!BxDolRelation::isEnabled()) + return false; + if(!$iProfileId && bx_get('profile_id') !== false) $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);