Alex Trofimov vor 13 Jahren
Ursprung
Commit
2321f9ac3f

+ 1 - 0
inc/classes/BxDol.php

@@ -46,6 +46,7 @@ interface iBxDolProfile {
     public function getUrl();
     public function getUrl();
     public function getUnit();
     public function getUnit();
     public function getThumb();
     public function getThumb();
+    public function isActive();
 }
 }
 
 
 /**
 /**

+ 2 - 2
inc/classes/BxDolProfile.php

@@ -108,8 +108,8 @@ class BxDolProfile extends BxDol implements iBxDolProfile {
      * Check if profile status is active
      * Check if profile status is active
      */
      */
     public function isActive($iProfileId = false) {
     public function isActive($iProfileId = false) {
-        $aInfo = $this->getStatus((int)$iProfileId ? $iProfileId : $this->_iProfileID);
-        return 'active' == $aInfo['status'];
+        $aInfo = $this->getStatus($iProfileId);
+        return BX_PROFILE_STATUS_ACTIVE == $aInfo['status'];
     }
     }
 
 
     /**
     /**

+ 6 - 0
inc/classes/BxDolProfileUndefined.php

@@ -87,6 +87,12 @@ class BxDolProfileUndefined extends BxDol implements iBxDolSingleton, iBxDolProf
         return '';
         return '';
     }
     }
 
 
+    /**
+     * Check if profile is active
+     */
+    public function isActive() {
+        return true;
+    }
 }
 }
 
 
 /** @} */
 /** @} */

+ 11 - 9
modules/boonex/notes/classes/BxNotesNoteForms.php

@@ -77,7 +77,7 @@ class BxNotesNoteForms extends BxDolProfileForms {
     public function editDataForm ($iContentId, $sDisplay = 'bx_notes_note_edit') {
     public function editDataForm ($iContentId, $sDisplay = 'bx_notes_note_edit') {
 
 
         // get content data and profile info
         // get content data and profile info
-        list ($oProfile, $aProfileInfo, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
+        list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
         if (!$aContentInfo)
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
 
 
@@ -99,7 +99,7 @@ class BxNotesNoteForms extends BxDolProfileForms {
         $aTrackTextFieldsChanges = null;
         $aTrackTextFieldsChanges = null;
 /* TODO: status
 /* TODO: status
         $isAutoApprove = getParam('bx_notes_autoapproval') ? true : false;
         $isAutoApprove = getParam('bx_notes_autoapproval') ? true : false;
-        if (!$isAutoApprove && BX_PROFILE_STATUS_ACTIVE == $aProfileInfo['status'])
+        if (!$isAutoApprove && $oProfile->isActive()))
             $aTrackTextFieldsChanges = array ();
             $aTrackTextFieldsChanges = array ();
 */
 */
         if (!$oForm->update ($aContentInfo['id'], array(), $aTrackTextFieldsChanges)) {
         if (!$oForm->update ($aContentInfo['id'], array(), $aTrackTextFieldsChanges)) {
@@ -110,7 +110,7 @@ class BxNotesNoteForms extends BxDolProfileForms {
         }
         }
 
 
         // change profile to 'pending' only if profile is 'active'
         // change profile to 'pending' only if profile is 'active'
-        if (/*!$isAutoApprove &&*/ BX_PROFILE_STATUS_ACTIVE == $aProfileInfo['status'] && !empty($aTrackTextFieldsChanges['changed_fields']))
+        if (/*!$isAutoApprove &&*/ $oProfile->isActive() && !empty($aTrackTextFieldsChanges['changed_fields']))
             $oProfile->disapprove(BX_PROFILE_ACTION_AUTO);
             $oProfile->disapprove(BX_PROFILE_ACTION_AUTO);
 
 
         // perform action
         // perform action
@@ -130,7 +130,7 @@ class BxNotesNoteForms extends BxDolProfileForms {
     public function deleteDataForm ($iContentId, $sDisplay = 'bx_notes_note_delete') {
     public function deleteDataForm ($iContentId, $sDisplay = 'bx_notes_note_delete') {
 
 
         // get content data and profile info
         // get content data and profile info
-        list ($oProfile, $aProfileInfo, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
+        list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
         if (!$aContentInfo)
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
 
 
@@ -172,7 +172,7 @@ class BxNotesNoteForms extends BxDolProfileForms {
     public function viewDataForm ($iContentId) {
     public function viewDataForm ($iContentId) {
 
 
         // get content data and profile info
         // get content data and profile info
-        list ($oProfile, $aProfileInfo, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
+        list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
         if (!$aContentInfo)
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
 
 
@@ -199,7 +199,7 @@ class BxNotesNoteForms extends BxDolProfileForms {
     public function viewDataText ($iContentId) {
     public function viewDataText ($iContentId) {
 
 
         // get content data and profile info
         // get content data and profile info
-        list ($oProfile, $aProfileInfo, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
+        list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
         if (!$aContentInfo)
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
             return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
 
 
@@ -218,7 +218,6 @@ class BxNotesNoteForms extends BxDolProfileForms {
     protected function _getProfileAndContentData ($iContentId) {
     protected function _getProfileAndContentData ($iContentId) {
     
     
         $aContentInfo = array();
         $aContentInfo = array();
-        $aProfileInfo = array();
         $oProfile = false;
         $oProfile = false;
         
         
         $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
         $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
@@ -226,9 +225,12 @@ class BxNotesNoteForms extends BxDolProfileForms {
             return array (false, false, false);
             return array (false, false, false);
 
 
         $oProfile = BxDolProfile::getInstance($aContentInfo['author']);
         $oProfile = BxDolProfile::getInstance($aContentInfo['author']);
-        $aProfileInfo = $oProfile->getInfo();
+        if (!$oProfile) {
+            bx_import('BxDolProfileUndefined');
+            $oProfile = BxDolProfileUndefined::getInstance();
+        }
 
 
-        return array ($oProfile, $aProfileInfo, $aContentInfo);
+        return array ($oProfile, $aContentInfo);
     }
     }
 
 
 }
 }