Quellcode durchsuchen

#1543 Privacy: default value from form builder isn't used in text based modules

Alex Trofimov vor 8 Jahren
Ursprung
Commit
fbff382006

+ 13 - 0
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -68,6 +68,19 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         if (isset($CNF['FIELD_LABELS']) && isset($this->aInputs[$CNF['FIELD_LABELS']])) {
         if (isset($CNF['FIELD_LABELS']) && isset($this->aInputs[$CNF['FIELD_LABELS']])) {
             $this->aInputs[$CNF['FIELD_LABELS']]['values'] = array_map('trim', getParam($CNF['PARAM_LABELS']) ? explode(',', getParam($CNF['PARAM_LABELS'])) : array());
             $this->aInputs[$CNF['FIELD_LABELS']]['values'] = array_map('trim', getParam($CNF['PARAM_LABELS']) ? explode(',', getParam($CNF['PARAM_LABELS'])) : array());
         }
         }
+
+        if (isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]) && $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) {
+
+            $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->getGroupChooser($CNF['OBJECT_PRIVACY_VIEW']);
+            
+            $this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = array_merge($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']], $aGroupChooser, $aSave);
+		}        
     }
     }
 
 
     function initChecker ($aValues = array (), $aSpecificValues = array())
     function initChecker ($aValues = array (), $aSpecificValues = array())

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

@@ -23,19 +23,6 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
 
 
         $CNF = &$this->_oModule->_oConfig->CNF;
         $CNF = &$this->_oModule->_oConfig->CNF;
 
 
-        if (isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]) && $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) {
-
-            $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->getGroupChooser($CNF['OBJECT_PRIVACY_VIEW']);
-            
-            $this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = array_merge($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']], $aGroupChooser, $aSave);
-		}
-
         if (!empty($CNF['FIELD_PICTURE']) && isset($this->aInputs[$CNF['FIELD_PICTURE']])) {
         if (!empty($CNF['FIELD_PICTURE']) && isset($this->aInputs[$CNF['FIELD_PICTURE']])) {
             $this->_aImageFields[$CNF['FIELD_PICTURE']] = array (
             $this->_aImageFields[$CNF['FIELD_PICTURE']] = array (
                 'storage_object' => $CNF['OBJECT_STORAGE'],
                 'storage_object' => $CNF['OBJECT_STORAGE'],

+ 0 - 5
modules/base/text/classes/BxBaseModTextFormEntry.php

@@ -17,11 +17,6 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
     public function __construct($aInfo, $oTemplate = false)
     public function __construct($aInfo, $oTemplate = false)
     {
     {
         parent::__construct($aInfo, $oTemplate);
         parent::__construct($aInfo, $oTemplate);
-
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        if (isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]))
-            $this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = array_merge($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']], BxDolPrivacy::getGroupChooser($CNF['OBJECT_PRIVACY_VIEW']));
     }
     }
 }
 }