Преглед изворни кода

#447 Some error on account switcher page when use isn't logged in

Alex Trofimov пре 10 година
родитељ
комит
905901dce8

+ 3 - 0
inc/classes/BxDolProfileQuery.php

@@ -47,6 +47,9 @@ class BxDolProfileQuery extends BxDolDb implements iBxDolSingleton
      */
     public function getProfilesByAccount ($iAccountId)
     {
+        if (!$iAccountId)
+            return array();
+
         $oAccountQuery = BxDolAccountQuery::getInstance();
         $aAccountInfo = $oAccountQuery->getInfoById($iAccountId);
 

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

@@ -438,7 +438,8 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolPro
      */
     public function checkAllowedAdd ($isPerformAction = false)
     {
-        if ($this->serviceActAsProfile() && BxDolAccount::getInstance()->isProfilesLimitReached())
+        $oAccount = BxDolAccount::getInstance();
+        if (!$oAccount || ($this->serviceActAsProfile() && $oAccount->isProfilesLimitReached()))
             return _t('_sys_txt_access_denied');
         return parent::checkAllowedAdd ($isPerformAction);
     }   

+ 2 - 1
template/scripts/BxBaseMenuProfileAdd.php

@@ -19,7 +19,8 @@ class BxBaseMenuProfileAdd extends BxTemplMenu
 
     public function getCode ()
     {
-        if (BxDolAccount::getInstance()->isProfilesLimitReached())
+        $oAccount = BxDolAccount::getInstance();
+        if ($oAccount && $oAccount->isProfilesLimitReached())
             return '';
 
         return parent::getCode ();

+ 7 - 0
template/scripts/BxBasePageAccount.php

@@ -72,6 +72,13 @@ class BxBasePageAccount extends BxTemplPage
 
     }
 
+    protected function _isVisiblePage ($a)
+    {
+        if (!isLogged())
+            return false;
+        return parent::_isVisiblePage ($a);
+    }
+    
 	protected function _addJsCss()
     {
     	parent::_addJsCss();