Просмотр исходного кода

Ticket #1581 - Fix for Notices and Warnings when Profile's data isn't available.

AntonLV 7 лет назад
Родитель
Сommit
5e183de910

+ 4 - 1
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -1339,7 +1339,10 @@ class BxBaseModGeneralModule extends BxDolModule
             $sFuncCheckAccess = $CNF['MENU_ITEM_TO_METHOD'][$sObject][$aItem['name']];
 
         // check custom visibility settings defined in module config class
-        if($sFuncCheckAccess && CHECK_ACTION_RESULT_ALLOWED !== call_user_func_array(array($this, $sFuncCheckAccess), isset($aContentInfo) ? array(&$aContentInfo) : array()))
+        if(!isset($aContentInfo))
+            $aContentInfo = array();
+
+        if($sFuncCheckAccess && CHECK_ACTION_RESULT_ALLOWED !== call_user_func_array(array($this, $sFuncCheckAccess), array(&$aContentInfo)))
             return false;
 
         return true;

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

@@ -1065,9 +1065,13 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
     {
         $CNF = &$this->_oConfig->CNF;
 
+        $sResult = _t('_sys_txt_access_denied');
+        if(empty($aDataEntry) || !is_array($aDataEntry))
+            return $sResult;
+
         $oProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$CNF['FIELD_ID']], $this->_aModule['name']);
         if(!$oProfile || ($oProfile->id() != $this->_iProfileId && $this->_oDb->getParam($CNF['PARAM_PUBLIC_SBSN']) != 'on' && $this->_oDb->getParam($CNF['PARAM_PUBLIC_SBSD']) != 'on'))
-            return _t('_sys_txt_access_denied');
+            return $sResult;
 
         return CHECK_ACTION_RESULT_ALLOWED;
     }