Explorar o código

Ticket #2451 - Privacy in Profile based modules.

AntonLV %!s(int64=7) %!d(string=hai) anos
pai
achega
8ca5817fd6
Modificáronse 1 ficheiros con 16 adicións e 6 borrados
  1. 16 6
      modules/base/profile/classes/BxBaseModProfileFormEntry.php

+ 16 - 6
modules/base/profile/classes/BxBaseModProfileFormEntry.php

@@ -23,9 +23,6 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
 
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-        $this->_preparePrivacyField('POST');
-        $this->_preparePrivacyField('CONTACT');
-
         if (!empty($CNF['FIELD_PICTURE']) && isset($this->aInputs[$CNF['FIELD_PICTURE']])) {
             $this->_aImageFields[$CNF['FIELD_PICTURE']] = array (
                 'storage_object' => $CNF['OBJECT_STORAGE'],
@@ -71,9 +68,6 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
             $this->aInputs[$sField]['ghost_template'] = $this->_oModule->_oTemplate->parseHtmlByName('form_ghost_template.html', $this->_getProfilePhotoGhostTmplVars($sField, $aContentInfo));
         }
 
-        $this->_preloadPrivacyField('POST', $aValues);
-        $this->_preloadPrivacyField('CONTACT', $aValues);
-
         parent::initChecker($aValues, $aSpecificValues);
     }
 
@@ -228,6 +222,22 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
             return false;
         return CHECK_ACTION_RESULT_ALLOWED == $this->_oModule->checkAllowedEdit ($aDataEntry);        
     }
+
+    protected function _getPrivacyFields()
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $aFields = array(
+            'FIELD_ALLOW_VIEW_TO' => 'OBJECT_PRIVACY_VIEW',
+            'FIELD_ALLOW_POST_TO' => 'OBJECT_PRIVACY_POST',
+            'FIELD_ALLOW_CONTACT_TO' => 'OBJECT_PRIVACY_CONTACT'
+        );
+
+        if(isset($CNF['PRIVACY_FIELD_TO_OBJECT']) && is_array($CNF['PRIVACY_FIELD_TO_OBJECT']))
+            $aFields = $CNF['PRIVACY_FIELD_TO_OBJECT'];
+
+        return $aFields;
+    }
 }
 
 /** @} */