Alex Trofimov 10 лет назад
Родитель
Сommit
a7a0ca249a
27 измененных файлов с 189 добавлено и 34 удалено
  1. 5 0
      modules/base/profile/classes/BxBaseModProfileFormEntry.php
  2. 5 0
      modules/base/profile/classes/BxBaseModProfileModule.php
  3. 21 0
      modules/base/profile/classes/BxBaseModProfilePageEntry.php
  4. 27 0
      modules/base/profile/classes/BxBaseModProfilePrivacy.php
  5. 1 1
      modules/base/profile/classes/BxBaseModProfileSearchResult.php
  6. 6 0
      modules/base/profile/classes/BxBaseModProfileTemplate.php
  7. 1 0
      modules/boonex/groups/classes/BxGroupsConfig.php
  8. 0 6
      modules/boonex/groups/classes/BxGroupsFormEntry.php
  9. 4 2
      modules/boonex/groups/classes/BxGroupsPageEntry.php
  10. 1 9
      modules/boonex/groups/classes/BxGroupsPrivacy.php
  11. 2 4
      modules/boonex/groups/classes/BxGroupsTemplate.php
  12. 3 0
      modules/boonex/organizations/classes/BxOrgsConfig.php
  13. 21 0
      modules/boonex/organizations/classes/BxOrgsPrivacy.php
  14. 1 1
      modules/boonex/organizations/classes/BxOrgsSearchResult.php
  15. 4 1
      modules/boonex/organizations/install/langs/en.xml
  16. 5 1
      modules/boonex/organizations/install/sql/disable.sql
  17. 14 0
      modules/boonex/organizations/install/sql/enable.sql
  18. 6 2
      modules/boonex/organizations/install/sql/install.sql
  19. 3 0
      modules/boonex/persons/classes/BxPersonsConfig.php
  20. 21 0
      modules/boonex/persons/classes/BxPersonsPrivacy.php
  21. 1 1
      modules/boonex/persons/classes/BxPersonsSearchResult.php
  22. 4 1
      modules/boonex/persons/install/langs/en.xml
  23. 5 1
      modules/boonex/persons/install/sql/disable.sql
  24. 14 0
      modules/boonex/persons/install/sql/enable.sql
  25. 6 2
      modules/boonex/persons/install/sql/install.sql
  26. 4 1
      modules/boonex/russian/data/langs/bx_organizations/ru.xml
  27. 4 1
      modules/boonex/russian/data/langs/bx_persons/ru.xml

+ 5 - 0
modules/base/profile/classes/BxBaseModProfileFormEntry.php

@@ -23,6 +23,11 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
 
         $CNF = &$this->_oModule->_oConfig->CNF;
 
+		if (isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]) && $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) {
+			$this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = $oPrivacy->getGroupChooser($CNF['OBJECT_PRIVACY_VIEW']);
+			$this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]['db']['pass'] = 'Xss';
+		}
+
         if (!empty($CNF['FIELD_PICTURE'])) {
             $this->_aImageFields[$CNF['FIELD_PICTURE']] = array (
                 'storage_object' => $CNF['OBJECT_STORAGE'],

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

@@ -51,6 +51,11 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolPro
 
     // ====== SERVICE METHODS
 
+	public function servicePrivateProfileMsg()
+    {
+        return MsgBox(_t('_sys_access_denied_to_private_content'));
+    }
+    
 	public function serviceGetContentInfoById($iContentId)
     {
         return $this->_oDb->getContentInfoById((int)$iContentId);

+ 21 - 0
modules/base/profile/classes/BxBaseModProfilePageEntry.php

@@ -81,6 +81,27 @@ class BxBaseModProfilePageEntry extends BxBaseModGeneralPageEntry
         $this->_oModule->_oTemplate->setCover($this->_aContentInfo);
     }
 
+    protected function _processPermissionsCheck ()
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        bx_import('BxDolPrivacy');
+
+        $mixedAllowView = $this->_oModule->checkAllowedView($this->_aContentInfo);
+        if ((BX_DOL_PG_HIDDEN == $this->_aContentInfo['allow_view_to'] || BX_DOL_PG_MEONLY == $this->_aContentInfo['allow_view_to']) && CHECK_ACTION_RESULT_ALLOWED !== $mixedAllowView) {
+            $this->_oTemplate->displayAccessDenied($mixedAllowView);
+            exit;
+        }
+        elseif ($CNF['OBJECT_PAGE_VIEW_ENTRY'] == $this->_sObject && CHECK_ACTION_RESULT_ALLOWED !== $mixedAllowView) {
+            // replace current page with different set of blocks
+            $aObject = BxDolPageQuery::getPageObject($CNF['OBJECT_PAGE_VIEW_ENTRY_CLOSED']);
+            $this->_sObject = $aObject['object'];
+            $this->_aObject = $aObject;
+            $this->_oQuery = new BxDolPageQuery($this->_aObject);
+        }
+
+        $this->_oModule->checkAllowedView($this->_aContentInfo, true);
+    }    
 }
 
 /** @} */

+ 27 - 0
modules/base/profile/classes/BxBaseModProfilePrivacy.php

@@ -0,0 +1,27 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseProfile Base classes for profile modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxBaseModProfilePrivacy extends BxTemplPrivacy
+{
+	protected $MODULE;
+	protected $_oModule;
+
+    function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+
+    	$this->_oModule = BxDolModule::getInstance($this->MODULE);
+    	if(!$oTemplate)
+			$oTemplate = $this->_oModule->_oTemplate;
+    }
+}
+
+/** @} */

+ 1 - 1
modules/base/profile/classes/BxBaseModProfileSearchResult.php

@@ -3,7 +3,7 @@
  * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  *
- * @defgroup    BaseText Base classes for text modules
+ * @defgroup    BaseProfile Base classes for profile modules
  * @ingroup     TridentModules
  *
  * @{

+ 6 - 0
modules/base/profile/classes/BxBaseModProfileTemplate.php

@@ -56,6 +56,12 @@ class BxBaseModProfileTemplate extends BxBaseModGeneralTemplate
     {
         $CNF = &$this->_oConfig->CNF;
 
+        if (CHECK_ACTION_RESULT_ALLOWED !== $this->getModule()->checkAllowedView($aData)) {
+            $CNF = &$this->_oConfig->CNF;
+            $aData[$CNF['FIELD_COVER']] = 0;
+            $aData[$CNF['FIELD_PICTURE']] = 0;
+        }
+        
         $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
 
         $sUrlPicture = $this->urlPicture ($aData);

+ 1 - 0
modules/boonex/groups/classes/BxGroupsConfig.php

@@ -94,6 +94,7 @@ class BxGroupsConfig extends BxBaseModProfileConfig
             'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'groups-home', // first item in view entry submenu from main module submenu
             'OBJECT_MENU_MANAGE_TOOLS' => 'bx_groups_menu_manage_tools', //manage menu in content administration tools
             'OBJECT_PAGE_VIEW_ENTRY' => 'bx_groups_view_profile',
+            'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_groups_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_groups_allow_view_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_groups_administration',
         	'OBJECT_GRID_COMMON' => 'bx_groups_common',

+ 0 - 6
modules/boonex/groups/classes/BxGroupsFormEntry.php

@@ -21,12 +21,6 @@ class BxGroupsFormEntry extends BxBaseModProfileFormEntry
 
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-		if(isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']])) {
-            bx_import('Privacy', $this->MODULE);
-			$this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = BxGroupsPrivacy::getGroupChooser($CNF['OBJECT_PRIVACY_VIEW']);
-			$this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]['db']['pass'] = 'Xss';
-		}
-
         if (isset($this->aInputs['initial_members']) && !isset($this->aInputs['initial_members']['value'])) {
             $this->aInputs['initial_members']['value'] = array(bx_get_logged_profile_id());
         }

+ 4 - 2
modules/boonex/groups/classes/BxGroupsPageEntry.php

@@ -22,14 +22,16 @@ class BxGroupsPageEntry extends BxBaseModProfilePageEntry
 
     protected function _processPermissionsCheck ()
     {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+        
         $mixedAllowView = $this->_oModule->checkAllowedView($this->_aContentInfo);
         if ('c' != $this->_aContentInfo['allow_view_to'] && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $mixedAllowView)) {
             $this->_oTemplate->displayAccessDenied($sMsg);
             exit;
         }
-        elseif ('c' == $this->_aContentInfo['allow_view_to'] && 'bx_groups_view_profile' == $this->_sObject && CHECK_ACTION_RESULT_ALLOWED !== $mixedAllowView) {
+        elseif ('c' == $this->_aContentInfo['allow_view_to'] && $CNF['OBJECT_PAGE_VIEW_ENTRY'] == $this->_sObject && CHECK_ACTION_RESULT_ALLOWED !== $mixedAllowView) {
             // replace current page with different set of blocks
-            $aObject = BxDolPageQuery::getPageObject('bx_groups_view_profile_closed');
+            $aObject = BxDolPageQuery::getPageObject($CNF['OBJECT_PAGE_VIEW_ENTRY_CLOSED']);
             $this->_sObject = $aObject['object'];
             $this->_aObject = $aObject;
             $this->_oQuery = new BxDolPageQuery($this->_aObject);

+ 1 - 9
modules/boonex/groups/classes/BxGroupsPrivacy.php

@@ -9,19 +9,11 @@
  * @{
  */
 
-class BxGroupsPrivacy extends BxTemplPrivacy
+class BxGroupsPrivacy extends BxBaseModProfilePrivacy
 {
-	protected $MODULE;
-	protected $_oModule;
-
     function __construct($aOptions, $oTemplate = false)
     {
     	$this->MODULE = 'bx_groups';
-
-    	$this->_oModule = BxDolModule::getInstance($this->MODULE);
-    	if(!$oTemplate)
-			$oTemplate = $this->_oModule->_oTemplate;
-
         parent::__construct($aOptions, $oTemplate);
     }
 

+ 2 - 4
modules/boonex/groups/classes/BxGroupsTemplate.php

@@ -52,10 +52,8 @@ class BxGroupsTemplate extends BxBaseModProfileTemplate
     }
 
     function setCover ($aData, $sTemplateName = 'cover.html')
-    {
-        $oModule = BxDolModule::getInstance($this->MODULE);
-    
-        if ('c' != $aData['allow_view_to'] && CHECK_ACTION_RESULT_ALLOWED !== $oModule->checkAllowedView($aData)) {
+    {    
+        if ('c' != $aData['allow_view_to'] && CHECK_ACTION_RESULT_ALLOWED !== $this->getModule()->checkAllowedView($aData)) {
             $CNF = &$this->_oConfig->CNF;
             $aData[$CNF['FIELD_COVER']] = 0;
             $aData[$CNF['FIELD_PICTURE']] = 0;

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

@@ -46,6 +46,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'FIELD_PICTURE_PREVIEW' => 'picture_preview',
             'FIELD_COVER' => 'cover',
             'FIELD_COVER_PREVIEW' => 'cover_preview',
+            'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
             'FIELDS_QUICK_SEARCH' => array('org_name'),
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
@@ -90,6 +91,8 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'organizations-home', // first item in view entry submenu from main module submenu
             'OBJECT_MENU_MANAGE_TOOLS' => 'bx_organizations_menu_manage_tools', //manage menu in content administration tools
             'OBJECT_PAGE_VIEW_ENTRY' => 'bx_organizations_view_profile',
+            'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_organizations_view_profile_closed',
+            'OBJECT_PRIVACY_VIEW' => 'bx_organizations_allow_view_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_organizations_administration',
         	'OBJECT_GRID_COMMON' => 'bx_organizations_common',
 

+ 21 - 0
modules/boonex/organizations/classes/BxOrgsPrivacy.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    Organizations Organizations
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxBaseModProfilePrivacy extends BxTemplPrivacy
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+    	$this->MODULE = 'bx_orgs';
+        parent::__construct($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 1 - 1
modules/boonex/organizations/classes/BxOrgsSearchResult.php

@@ -37,7 +37,7 @@ class BxOrgsSearchResult extends BxBaseModProfileSearchResult
                     'table' => 'bx_organizations_data',
                     'mainField' => 'content_id',
                     'onField' => 'id',
-                    'joinFields' => array('id', 'org_name', 'picture', 'added'),
+                    'joinFields' => array('id', 'org_name', 'picture', 'added', 'author', 'allow_view_to'),
                 ),
                 'account' => array(
                     'type' => 'INNER',

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

@@ -14,7 +14,9 @@
 	<string name="_bx_orgs_form_profile_display_edit_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_orgs_form_profile_display_delete"><![CDATA[Delete Organization]]></string>
 	<string name="_bx_orgs_form_profile_display_view"><![CDATA[View Organization]]></string>
-	<string name="_bx_orgs_form_profile_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_orgs_form_profile_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_orgs_form_profile_input_sys_allow_view_to"><![CDATA[Privacy]]></string>
+    <string name="_bx_orgs_form_profile_input_allow_view_to"><![CDATA[Privacy]]></string>
     <string name="_bx_orgs_form_profile_input_sys_org_name"><![CDATA[Organization Name]]></string>
     <string name="_bx_orgs_form_profile_input_org_name"><![CDATA[Organization Name]]></string>
     <string name="_bx_orgs_form_profile_input_org_name_err"><![CDATA[This information is essential. Please, fill in this field.]]></string>
@@ -72,6 +74,7 @@
 	<string name="_bx_orgs_page_title_sys_online"><![CDATA[Online Organizations]]></string>
 	<string name="_bx_orgs_page_title_online"><![CDATA[Online Organizations]]></string>
 
+    <string name="_bx_orgs_page_block_title_profile_private"><![CDATA[Private Profile]]></string>
 	<string name="_bx_orgs_page_block_title_create_profile"><![CDATA[Create Organization's Profile]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile"><![CDATA[Edit Profile]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>

+ 5 - 1
modules/boonex/organizations/install/sql/disable.sql

@@ -10,7 +10,7 @@ DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 -- PAGES
 
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_organizations';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_organizations' OR `object` IN('bx_organizations_create_profile', 'bx_organizations_delete_profile', 'bx_organizations_edit_profile', 'bx_organizations_edit_profile_cover', 'bx_organizations_view_profile', 'bx_organizations_profile_info', 'bx_organizations_profile_friends', 'bx_organizations_home');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_organizations' OR `object` IN('bx_organizations_create_profile', 'bx_organizations_delete_profile', 'bx_organizations_edit_profile', 'bx_organizations_edit_profile_cover', 'bx_organizations_view_profile', 'bx_organizations_view_profile_closed', 'bx_organizations_profile_info', 'bx_organizations_profile_friends', 'bx_organizations_home');
 
 -- MENU
 
@@ -38,3 +38,7 @@ DELETE FROM `sys_objects_search` WHERE `ObjectName` = 'bx_organizations';
 DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_organizations_administration', 'bx_organizations_moderation', 'bx_organizations_common');
 DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_organizations_administration', 'bx_organizations_moderation', 'bx_organizations_common');
 DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_organizations_administration', 'bx_organizations_moderation', 'bx_organizations_common');
+
+-- PRIVACY 
+DELETE FROM `sys_objects_privacy` WHERE `object` IN('bx_organizations_allow_view_to');
+

+ 14 - 0
modules/boonex/organizations/install/sql/enable.sql

@@ -36,6 +36,14 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_organizations_view_profile', 2, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_membership', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:18:\"profile_membership\";}', 0, 0, 1, 1),
 ('bx_organizations_view_profile', 3, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_friends', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:15:\"profile_friends\";}', 0, 0, 1, 0);
 
+-- PAGE: view closed profile 
+
+INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_organizations_view_profile_closed', 'view-organization-profile-closed', '_bx_orgs_page_title_sys_view_profile_closed', '_bx_orgs_page_title_view_profile', 'bx_organizations', 10, 2147483647, 1, 'page.php?i=view-organization-profile', '', '', '', 0, 1, 0, 'BxOrgsPageEntry', 'modules/boonex/organizations/classes/BxOrgsPageEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
+('bx_organizations_view_profile_closed', 1, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_private', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:19:\"private_profile_msg\";}', 0, 1, 1, 0);
+
 -- PAGE: edit profile
 
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
@@ -341,3 +349,9 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_organizations_common', 'bulk', 'delete', '_bx_orgs_grid_action_title_adm_delete', '', 0, 1, 1),
 ('bx_organizations_common', 'bulk', 'delete_with_content', '_bx_orgs_grid_action_title_adm_delete_with_content', '', 0, 1, 2),
 ('bx_organizations_common', 'single', 'settings', '_bx_orgs_grid_action_title_adm_more_actions', 'cog', 1, 0, 1);
+
+-- PRIVACY 
+
+INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
+('bx_organizations_allow_view_to', 'bx_organizations', 'view', '_bx_orgs_form_profile_input_allow_view_to', '3', 'bx_organizations_data', 'id', 'author', '', '');
+

+ 6 - 2
modules/boonex/organizations/install/sql/install.sql

@@ -11,6 +11,7 @@ CREATE TABLE IF NOT EXISTS `bx_organizations_data` (
   `org_cat` int(11) NOT NULL,
   `org_desc` text NOT NULL,
   `views` int(11) NOT NULL default '0',
+  `allow_view_to` int(11) NOT NULL DEFAULT '3',
   PRIMARY KEY (`id`),
   FULLTEXT KEY `org_name` (`org_name`)
 );
@@ -100,6 +101,7 @@ INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`,
 ('bx_organization', 'bx_organization_view', 'bx_organizations', 1, '_bx_orgs_form_profile_display_view');
 
 INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES 
+('bx_organization', 'bx_organization', 'allow_view_to', 3, '', 0, 'custom', '_bx_orgs_form_profile_input_sys_allow_view_to', '_bx_orgs_form_profile_input_allow_view_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
 ('bx_organization', 'bx_organizations', 'cover', '', '', 0, 'file', '_bx_orgs_form_profile_input_sys_cover', '_bx_orgs_form_profile_input_cover', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
 ('bx_organization', 'bx_organizations', 'cover_preview', '', '', 0, 'custom', '_bx_orgs_form_profile_input_sys_cover_preview', '_bx_orgs_form_profile_input_cover_preview', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_organization', 'bx_organizations', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_orgs_form_profile_input_sys_delete_confirm', '_bx_orgs_form_profile_input_delete_confirm', '_bx_orgs_form_profile_input_delete_confirm_info', 1, 0, 0, '', '', '', 'avail', '', '_bx_orgs_form_profile_input_delete_confirm_error', '', '', 1, 0),
@@ -119,7 +121,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_add', 'org_name', 2147483647, 1, 6),
 ('bx_organization_add', 'org_cat', 2147483647, 1, 7),
 ('bx_organization_add', 'org_desc', 2147483647, 1, 8),
-('bx_organization_add', 'do_submit', 2147483647, 1, 9),
+('bx_organization_add', 'allow_view_to', 2147483647, 1, 9),
+('bx_organization_add', 'do_submit', 2147483647, 1, 10),
 ('bx_organization_delete', 'cover_preview', 2147483647, 0, 0),
 ('bx_organization_delete', 'picture', 2147483647, 0, 0),
 ('bx_organization_delete', 'delete_confirm', 2147483647, 1, 0),
@@ -136,7 +139,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_edit', 'org_name', 2147483647, 1, 6),
 ('bx_organization_edit', 'org_cat', 2147483647, 1, 7),
 ('bx_organization_edit', 'org_desc', 2147483647, 1, 8),
-('bx_organization_edit', 'do_submit', 2147483647, 1, 9),
+('bx_organization_edit', 'allow_view_to', 2147483647, 1, 9),
+('bx_organization_edit', 'do_submit', 2147483647, 1, 10),
 ('bx_organization_edit_cover', 'delete_confirm', 2147483647, 0, 1),
 ('bx_organization_edit_cover', 'org_name', 2147483647, 0, 2),
 ('bx_organization_edit_cover', 'picture', 2147483647, 0, 3),

+ 3 - 0
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -46,6 +46,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'FIELD_PICTURE_PREVIEW' => 'picture_preview',
             'FIELD_COVER' => 'cover',
             'FIELD_COVER_PREVIEW' => 'cover_preview',
+            'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
             'FIELDS_QUICK_SEARCH' => array('fullname'),
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
@@ -90,6 +91,8 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'persons-home', // first item in view entry submenu from main module submenu
             'OBJECT_MENU_MANAGE_TOOLS' => 'bx_persons_menu_manage_tools', //manage menu in content administration tools
             'OBJECT_PAGE_VIEW_ENTRY' => 'bx_persons_view_profile',
+            'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_persons_view_profile_closed',
+            'OBJECT_PRIVACY_VIEW' => 'bx_persons_allow_view_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_persons_administration',
         	'OBJECT_GRID_COMMON' => 'bx_persons_common',
 

+ 21 - 0
modules/boonex/persons/classes/BxPersonsPrivacy.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    Organizations Organizations
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxPersonsPrivacy extends BxTemplPrivacy
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+    	$this->MODULE = 'bx_persons';
+        parent::__construct($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 1 - 1
modules/boonex/persons/classes/BxPersonsSearchResult.php

@@ -37,7 +37,7 @@ class BxPersonsSearchResult extends BxBaseModProfileSearchResult
                     'table' => 'bx_persons_data',
                     'mainField' => 'content_id',
                     'onField' => 'id',
-                    'joinFields' => array('id', 'fullname', 'picture', 'added'),
+                    'joinFields' => array('id', 'fullname', 'picture', 'added', 'author', 'allow_view_to'),
                 ),
                 'account' => array(
                     'type' => 'INNER',

+ 4 - 1
modules/boonex/persons/install/langs/en.xml

@@ -14,7 +14,9 @@
 	<string name="_bx_persons_form_profile_display_edit_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_persons_form_profile_display_delete"><![CDATA[Delete Person]]></string>
 	<string name="_bx_persons_form_profile_display_view"><![CDATA[View Person]]></string>
-	<string name="_bx_persons_form_profile_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_persons_form_profile_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_persons_form_profile_input_sys_allow_view_to"><![CDATA[Privacy]]></string>
+    <string name="_bx_persons_form_profile_input_allow_view_to"><![CDATA[Privacy]]></string>
 	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Full Name]]></string>
 	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Full Name]]></string>
 	<string name="_bx_persons_form_profile_input_fullname_err"><![CDATA[This information is essential. Please, fill in this field.]]></string>
@@ -69,6 +71,7 @@
 	<string name="_bx_persons_page_title_sys_online"><![CDATA[Online People]]></string>
 	<string name="_bx_persons_page_title_online"><![CDATA[Online People]]></string>
 
+	<string name="_bx_persons_page_block_title_profile_private"><![CDATA[Private Profile]]></string>
 	<string name="_bx_persons_page_block_title_create_profile"><![CDATA[Create Person's Profile]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile"><![CDATA[Edit Profile]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>

+ 5 - 1
modules/boonex/persons/install/sql/disable.sql

@@ -10,7 +10,7 @@ DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 -- PAGES
 
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_persons';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_persons' OR `object` IN('bx_persons_create_profile', 'bx_persons_delete_profile', 'bx_persons_edit_profile', 'bx_persons_edit_profile_cover', 'bx_persons_view_profile', 'bx_persons_profile_info', 'bx_persons_profile_friends', 'bx_persons_home');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_persons' OR `object` IN('bx_persons_create_profile', 'bx_persons_delete_profile', 'bx_persons_edit_profile', 'bx_persons_edit_profile_cover', 'bx_persons_view_profile', 'bx_persons_view_profile_closed', 'bx_persons_profile_info', 'bx_persons_profile_friends', 'bx_persons_home');
 
 -- MENU
 
@@ -35,3 +35,7 @@ DELETE FROM `sys_objects_search` WHERE `ObjectName` = 'bx_persons';
 DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_persons_administration', 'bx_persons_common');
 DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_persons_administration', 'bx_persons_common');
 DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_persons_administration', 'bx_persons_common');
+
+-- PRIVACY 
+DELETE FROM `sys_objects_privacy` WHERE `object` IN('bx_persons_allow_view_to');
+

+ 14 - 0
modules/boonex/persons/install/sql/enable.sql

@@ -36,6 +36,14 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_persons_view_profile', 2, 'bx_persons', '', '_bx_persons_page_block_title_profile_membership', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:18:\"profile_membership\";}', 0, 0, 1, 1),
 ('bx_persons_view_profile', 3, 'bx_persons', '', '_bx_persons_page_block_title_profile_friends', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:15:\"profile_friends\";}', 0, 0, 1, 0);
 
+-- PAGE: view closed profile 
+
+INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_persons_view_profile_closed', 'view-person-profile-closed', '_bx_persons_page_title_sys_view_profile_closed', '_bx_persons_page_title_view_profile', 'bx_persons', 10, 2147483647, 1, 'page.php?i=view-person-profile', '', '', '', 0, 1, 0, 'BxPersonsPageEntry', 'modules/boonex/persons/classes/BxPersonsPageEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
+('bx_persons_view_profile_closed', 1, 'bx_persons', '', '_bx_persons_page_block_title_profile_private', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:19:\"private_profile_msg\";}', 0, 1, 1, 0);
+
 -- PAGE: edit profile
 
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
@@ -332,3 +340,9 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_persons_common', 'bulk', 'delete', '_bx_persons_grid_action_title_adm_delete', '', 0, 1, 1),
 ('bx_persons_common', 'bulk', 'delete_with_content', '_bx_persons_grid_action_title_adm_delete_with_content', '', 0, 1, 2),
 ('bx_persons_common', 'single', 'settings', '_bx_persons_grid_action_title_adm_more_actions', 'cog', 1, 0, 1);
+
+-- PRIVACY 
+
+INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
+('bx_persons_allow_view_to', 'bx_persons', 'view', '_bx_persons_form_profile_input_allow_view_to', '3', 'bx_persons_data', 'id', 'author', '', '');
+

+ 6 - 2
modules/boonex/persons/install/sql/install.sql

@@ -10,6 +10,7 @@ CREATE TABLE IF NOT EXISTS `bx_persons_data` (
   `fullname` varchar(255) NOT NULL,
   `description` text NOT NULL,
   `views` int(11) NOT NULL default '0',
+  `allow_view_to` int(11) NOT NULL DEFAULT '3',
   PRIMARY KEY (`id`),
   FULLTEXT KEY `fullname` (`fullname`)
 );
@@ -100,6 +101,7 @@ INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`,
 ('bx_person', 'bx_person_view', 'bx_persons', 1, '_bx_persons_form_profile_display_view');
 
 INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES 
+('bx_person', 'bx_persons', 'allow_view_to', 3, '', 0, 'custom', '_bx_persons_form_profile_input_sys_allow_view_to', '_bx_persons_form_profile_input_allow_view_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
 ('bx_person', 'bx_persons', 'cover', '', '', 0, 'file', '_bx_persons_form_profile_input_sys_cover', '_bx_persons_form_profile_input_cover', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
 ('bx_person', 'bx_persons', 'cover_preview', '', '', 0, 'custom', '_bx_persons_form_profile_input_sys_cover_preview', '_bx_persons_form_profile_input_cover_preview', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_person', 'bx_persons', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_persons_form_profile_input_sys_delete_confirm', '_bx_persons_form_profile_input_delete_confirm', '_bx_persons_form_profile_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_persons_form_profile_input_delete_confirm_error', '', '', 1, 0),
@@ -117,7 +119,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_add', 'picture', 2147483647, 1, 5),
 ('bx_person_add', 'fullname', 2147483647, 1, 6),
 ('bx_person_add', 'description', 2147483647, 1, 8),
-('bx_person_add', 'do_submit', 2147483647, 1, 9),
+('bx_person_add', 'allow_view_to', 2147483647, 1, 9),
+('bx_person_add', 'do_submit', 2147483647, 1, 10),
 ('bx_person_delete', 'cover', 2147483647, 0, 0),
 ('bx_person_delete', 'cover_preview', 2147483647, 0, 0),
 ('bx_person_delete', 'picture', 2147483647, 0, 0),
@@ -132,7 +135,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_edit', 'picture', 2147483647, 1, 5),
 ('bx_person_edit', 'fullname', 2147483647, 1, 6),
 ('bx_person_edit', 'description', 2147483647, 1, 7),
-('bx_person_edit', 'do_submit', 2147483647, 1, 8),
+('bx_person_edit', 'allow_view_to', 2147483647, 1, 8),
+('bx_person_edit', 'do_submit', 2147483647, 1, 9),
 ('bx_person_edit_cover', 'delete_confirm', 2147483647, 0, 1),
 ('bx_person_edit_cover', 'fullname', 2147483647, 0, 2),
 ('bx_person_edit_cover', 'picture', 2147483647, 0, 3),

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

@@ -14,7 +14,9 @@
 	<string name="_bx_orgs_form_profile_display_edit_cover"><![CDATA[Редактировать обложку]]></string>
 	<string name="_bx_orgs_form_profile_display_delete"><![CDATA[Удалить организацию]]></string>
 	<string name="_bx_orgs_form_profile_display_view"><![CDATA[Просмотреть организацию]]></string>
-	<string name="_bx_orgs_form_profile_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_orgs_form_profile_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_orgs_form_profile_input_sys_allow_view_to"><![CDATA[Конфиденциальность]]></string>
+    <string name="_bx_orgs_form_profile_input_allow_view_to"><![CDATA[Конфиденциальность]]></string>
     <string name="_bx_orgs_form_profile_input_sys_org_name"><![CDATA[Название организации]]></string>
     <string name="_bx_orgs_form_profile_input_org_name"><![CDATA[Название организации]]></string>
     <string name="_bx_orgs_form_profile_input_org_name_err"><![CDATA[Эта информация необходима. Пожалуйста, заполните это поле.]]></string>
@@ -72,6 +74,7 @@
 	<string name="_bx_orgs_page_title_sys_online"><![CDATA[Онлайн Организации]]></string>
 	<string name="_bx_orgs_page_title_online"><![CDATA[Онлайн Организации]]></string>
 
+    <string name="_bx_orgs_page_block_title_profile_private"><![CDATA[Приватный профиль]]></string>
 	<string name="_bx_orgs_page_block_title_create_profile"><![CDATA[Создать профиль организации]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile"><![CDATA[Редактировать профиль]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>

+ 4 - 1
modules/boonex/russian/data/langs/bx_persons/ru.xml

@@ -14,7 +14,9 @@
 	<string name="_bx_persons_form_profile_display_edit_cover"><![CDATA[Редактировать обложку]]></string>
 	<string name="_bx_persons_form_profile_display_delete"><![CDATA[Удалить персону]]></string>
 	<string name="_bx_persons_form_profile_display_view"><![CDATA[Просмотреть персону]]></string>
-	<string name="_bx_persons_form_profile_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_persons_form_profile_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_persons_form_profile_input_sys_allow_view_to"><![CDATA[Конфиденциальность]]></string>
+    <string name="_bx_persons_form_profile_input_allow_view_to"><![CDATA[Конфиденциальность]]></string>
 	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Полное имя]]></string>
 	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Полное имя]]></string>
 	<string name="_bx_persons_form_profile_input_fullname_err"><![CDATA[Эта информация необходима. Пожалуйста, заполните это поле.]]></string>
@@ -69,6 +71,7 @@
 	<string name="_bx_persons_page_title_sys_online"><![CDATA[Онлайн Пользователи]]></string>
 	<string name="_bx_persons_page_title_online"><![CDATA[Онлайн Пользователи]]></string>
 
+    <string name="_bx_persons_page_block_title_profile_private"><![CDATA[Приватный профиль]]></string>
 	<string name="_bx_persons_page_block_title_create_profile"><![CDATA[Создать персональный профиль]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile"><![CDATA[Редактировать профиль]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>