AntonLV 6 سال پیش
والد
کامیت
1764abf530

+ 1 - 23
modules/base/files/classes/BxBaseModFilesFormEntry.php

@@ -17,35 +17,13 @@ class BxBaseModFilesFormEntry extends BxBaseModTextFormEntry
     public function __construct($aInfo, $oTemplate = false)
     {
         parent::__construct($aInfo, $oTemplate);
-        
+
         $CNF = &$this->_oModule->_oConfig->CNF;
         if (isset($CNF['FIELD_PHOTO']) && isset($this->aInputs[$CNF['FIELD_PHOTO']])) {
             $this->aInputs[$CNF['FIELD_PHOTO']]['upload_buttons_titles'] = _t($CNF['T']['form_entry_upload_single_for_update']);
             $this->aInputs[$CNF['FIELD_PHOTO']]['multiple'] = false;
         }
     }
-    
-    function initChecker ($aValues = array (), $aSpecificValues = array())
-    {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-        if (isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]) && $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) {
-
-            $oProfile = isset($aValues[$CNF['FIELD_AUTHOR']]) ? BxDolProfile::getInstance($aValues[$CNF['FIELD_AUTHOR']]) : false;
-            $oPrivacy->setCustomPrivacy($oProfile && BxDolService::call($oProfile->getModule(), 'is_group_profile') ? true : false);
-            
-            $aSave = array('db' => array('pass' => 'Xss'));
-            array_walk($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']], function ($a, $k, $aSave) {
-                if (in_array($k, array('info', 'caption', 'value')))
-                    $aSave[0][$k] = $a;
-            }, array(&$aSave));
-            
-            $aGroupChooser = $oPrivacy->getGroupChooserCustom($CNF['OBJECT_PRIVACY_VIEW'], $oPrivacy->isCustomPrivacy());
-            
-            $this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = array_merge($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']], $aGroupChooser, $aSave);
-        }
-        
-        return parent::initChecker ($aValues, $aSpecificValues);
-    }
 }
 
 /** @} */

+ 0 - 20
modules/base/files/classes/BxBaseModFilesFormUpload.php

@@ -19,26 +19,6 @@ class BxBaseModFilesFormUpload extends BxBaseModTextFormEntry
         parent::__construct($aInfo, $oTemplate);
 
         $this->_sGhostTemplate = 'form_ghost_template_upload.html';
-
-        if (isset($this->aInputs['profile_id']))
-            $this->aInputs['profile_id']['value'] = bx_get('profile_id');
-
-        $CNF = &$this->_oModule->_oConfig->CNF;
-        if (isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]) && $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) {
-
-            $oProfile = bx_get('profile_id') ? BxDolProfile::getInstance(bx_get('profile_id')) : false;
-            $oPrivacy->setCustomPrivacy(bx_get('profile_id') && $oProfile && BxDolService::call($oProfile->getModule(), 'is_group_profile') ? true : false);
-
-            $aSave = array('db' => array('pass' => 'Xss'));
-            array_walk($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']], function ($a, $k, $aSave) {
-                if (in_array($k, array('info', 'caption', 'value')))
-                    $aSave[0][$k] = $a;
-            }, array(&$aSave));
-            
-            $aGroupChooser = $oPrivacy->getGroupChooserCustom($CNF['OBJECT_PRIVACY_VIEW'], $oPrivacy->isCustomPrivacy());
-            
-            $this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = array_merge($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']], $aGroupChooser, $aSave);
-        }
     }
 
     public function insert ($aValsToAdd = array(), $isIgnore = false)

+ 1 - 54
modules/base/files/classes/BxBaseModFilesPrivacy.php

@@ -13,66 +13,13 @@ class BxBaseModFilesPrivacy extends BxTemplPrivacy
 {
     protected $MODULE;
     protected $_oModule;
-    protected $_bCustomPrivacy = false;
-    
+
     public function __construct($aOptions, $oTemplate = false)
     {
         parent::__construct($aOptions, $oTemplate);
 
         $this->_oModule = BxDolModule::getInstance($this->MODULE);
     }
-
-    public function setCustomPrivacy($b)
-    {
-        $this->_bCustomPrivacy = $b;
-    }
-
-    public function isCustomPrivacy()
-    {
-        return $this->_bCustomPrivacy;
-    }
-
-    /**
-     * Check whethere viewer is a member of dynamic group.
-     *
-     * @param  mixed   $mixedGroupId   dynamic group ID.
-     * @param  integer $iObjectOwnerId object owner ID.
-     * @param  integer $iViewerId      viewer ID.
-     * @return boolean result of operation.
-     */
-    public function isDynamicGroupMember($mixedGroupId, $iObjectOwnerId, $iViewerId, $iObjectId)
-    {
-        $oGroupProfile = BxDolProfile::getInstance($iObjectOwnerId);
-        if (!$oGroupProfile || !BxDolService::call($oGroupProfile->getModule(), 'is_group_profile'))
-            return false;
-
-        if ('a' == $mixedGroupId)
-            return true;
-
-        if ('m' == $mixedGroupId)
-            return BxDolService::call($oGroupProfile->getModule(), 'is_fan', array($oGroupProfile->id(), $iViewerId));
-
-        return false;
-    }
-
-    static function getGroupChooserCustom ($sObject, $bCustomPrivacy)
-    {
-        $iOwnerId = bx_get_logged_profile_id();
-
-        $aParams = array();
-        if ($bCustomPrivacy)
-            $aParams['dynamic_groups'] = array(
-                array ('key' => 'a', 'value' => _t('_bx_files_privacy_public')),
-                array ('key' => 'm', 'value' => _t('_bx_files_privacy_participants')),
-            );
-
-        return parent::getGroupChooser($sObject, $iOwnerId, $aParams);
-    }
-
-    protected function getGroups()
-    {
-        return $this->_bCustomPrivacy ? array() : parent::getGroups();
-    }
 }
 
 /** @} */

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

@@ -19,7 +19,6 @@
 	<string name="_bx_files_form_entry_display_delete"><![CDATA[Delete File]]></string>
 	<string name="_bx_files_form_entry_display_view"><![CDATA[View File]]></string>
 	<string name="_bx_files_form_entry_input_author"><![CDATA[Author]]></string>
-	<string name="_bx_files_form_entry_input_sys_profile_id"><![CDATA[Profile ID]]></string>
 	<string name="_bx_files_form_entry_input_sys_do_submit"><![CDATA[Submit]]></string>
 	<string name="_bx_files_form_entry_input_do_submit"><![CDATA[Submit]]></string>
 	<string name="_bx_files_form_entry_input_sys_do_publish"><![CDATA[Publish]]></string>

+ 1 - 1
modules/boonex/files/install/sql/enable.sql

@@ -259,7 +259,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_files_my', 'bx_files', '_bx_files_menu_set_title_entries_my', 0);
 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
-('bx_files_my', 'bx_files', 'create-file', '_bx_files_menu_item_title_system_create_entry', '_bx_files_menu_item_title_create_entry', 'page.php?i=create-file&profile_id={profile_id}', '', '', 'plus', '', 2147483647, 1, 0, 0);
+('bx_files_my', 'bx_files', 'create-file', '_bx_files_menu_item_title_system_create_entry', '_bx_files_menu_item_title_create_entry', 'page.php?i=create-file', '', '', 'plus', '', 2147483647, 1, 0, 0);
 
 
 -- MENU: module sub-menu

+ 14 - 30
modules/boonex/files/install/sql/install.sql

@@ -246,44 +246,28 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_files_upload', 'bx_files', 'attachments', 'a:1:{i:0;s:14:"bx_files_html5";}', 'a:2:{s:15:"bx_files_simple";s:26:"_sys_uploader_simple_title";s:14:"bx_files_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_files_form_entry_input_sys_attachments', '_bx_files_form_entry_input_attachments', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_files_form_entry_input_attachments', '', '', 1, 0),
 ('bx_files_upload', 'bx_files', 'cat', '', '#!bx_files_cats', 0, 'select', '_bx_files_form_entry_input_sys_cat', '_bx_files_form_entry_input_cat', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_files_form_entry_input_cat_err', 'Xss', '', 1, 0),
 ('bx_files_upload', 'bx_files', 'allow_view_to', '', '', 0, 'custom', '_bx_files_form_entry_input_sys_allow_view_to', '_bx_files_form_entry_input_allow_view_to', '', 1, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
-('bx_files_upload', 'bx_files', 'do_submit', '_bx_files_form_entry_input_do_submit', '', 0, 'submit', '_bx_files_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
-('bx_files_upload', 'bx_files', 'profile_id', '0', '', 0, 'hidden', '_bx_files_form_entry_input_sys_profile_id', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
-
+('bx_files_upload', 'bx_files', 'do_submit', '_bx_files_form_entry_input_do_submit', '', 0, 'submit', '_bx_files_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
 
 INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES 
-('bx_files_entry_delete', 'cat', 2147483647, 0, 0),
-('bx_files_entry_delete', 'attachments', 2147483647, 0, 0),
-('bx_files_entry_delete', 'desc', 2147483647, 0, 0),
-('bx_files_entry_delete', 'do_publish', 2147483647, 0, 0),
-('bx_files_entry_delete', 'title', 2147483647, 0, 0),
-('bx_files_entry_delete', 'allow_view_to', 2147483647, 0, 0),
 ('bx_files_entry_delete', 'delete_confirm', 2147483647, 1, 1),
 ('bx_files_entry_delete', 'do_submit', 2147483647, 1, 2),
-('bx_files_entry_edit', 'do_publish', 2147483647, 0, 1),
-('bx_files_entry_edit', 'delete_confirm', 2147483647, 0, 2),
-('bx_files_entry_edit', 'title', 2147483647, 1, 3),
-('bx_files_entry_edit', 'cat', 2147483647, 1, 4),
-('bx_files_entry_edit', 'desc', 2147483647, 1, 5),
-('bx_files_entry_edit', 'data', 0, 1, 6),
-('bx_files_entry_edit', 'attachments', 2147483647, 1, 7),
-('bx_files_entry_edit', 'allow_view_to', 2147483647, 1, 8),
-('bx_files_entry_edit', 'do_submit', 2147483647, 1, 9),
-('bx_files_entry_view', 'attachments', 2147483647, 0, 0),
-('bx_files_entry_view', 'delete_confirm', 2147483647, 0, 0),
-('bx_files_entry_view', 'desc', 2147483647, 0, 0),
-('bx_files_entry_view', 'do_publish', 2147483647, 0, 0),
-('bx_files_entry_view', 'title', 2147483647, 0, 0),
-('bx_files_entry_view', 'do_submit', 2147483647, 0, 0),
-('bx_files_entry_view', 'allow_view_to', 2147483647, 0, 0),
+
+('bx_files_entry_edit', 'title', 2147483647, 1, 1),
+('bx_files_entry_edit', 'cat', 2147483647, 1, 2),
+('bx_files_entry_edit', 'desc', 2147483647, 1, 3),
+('bx_files_entry_edit', 'data', 0, 1, 4),
+('bx_files_entry_edit', 'attachments', 2147483647, 1, 5),
+('bx_files_entry_edit', 'allow_view_to', 2147483647, 1, 6),
+('bx_files_entry_edit', 'do_submit', 2147483647, 1, 7),
+
 ('bx_files_entry_view', 'cat', 2147483647, 1, 1),
 ('bx_files_entry_view', 'added', 2147483647, 1, 2),
 ('bx_files_entry_view', 'changed', 2147483647, 1, 3),
 
-('bx_files_entry_upload', 'profile_id', 2147483647, 1, 1),
-('bx_files_entry_upload', 'attachments', 2147483647, 1, 2),
-('bx_files_entry_upload', 'cat', 2147483647, 1, 3),
-('bx_files_entry_upload', 'allow_view_to', 2147483647, 1, 4),
-('bx_files_entry_upload', 'do_submit', 2147483647, 1, 5);
+('bx_files_entry_upload', 'attachments', 2147483647, 1, 1),
+('bx_files_entry_upload', 'cat', 2147483647, 1, 2),
+('bx_files_entry_upload', 'allow_view_to', 2147483647, 1, 3),
+('bx_files_entry_upload', 'do_submit', 2147483647, 1, 4);
 
 -- PRE-VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES

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

@@ -19,7 +19,6 @@
 	<string name="_bx_files_form_entry_display_delete"><![CDATA[Удаление файла]]></string>
 	<string name="_bx_files_form_entry_display_view"><![CDATA[Просмотр файла]]></string>
 	<string name="_bx_files_form_entry_input_author"><![CDATA[Автор]]></string>
-	<string name="_bx_files_form_entry_input_sys_profile_id"><![CDATA[ID профайла]]></string>
 	<string name="_bx_files_form_entry_input_sys_do_submit"><![CDATA[Опубликовать]]></string>
 	<string name="_bx_files_form_entry_input_do_submit"><![CDATA[Опубликовать]]></string>
 	<string name="_bx_files_form_entry_input_sys_do_publish"><![CDATA[Опубликовать]]></string>