فهرست منبع

Merge branch 'master' of https://github.com/unaio/una

AntonLV 4 سال پیش
والد
کامیت
54b8cf6023

+ 11 - 0
inc/classes/BxDolAccount.php

@@ -726,6 +726,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
             return MsgBox($aCheck[CHECK_ACTION_MESSAGE]);
         return CHECK_ACTION_RESULT_ALLOWED;
     }
+    
+    static public function isAllowedCreateMultiple ($iProfileId, $isPerformAction = false)
+    {
+        $bResult = false;
+        if ((int)getParam('sys_account_limit_profiles_number') != 1)
+            $bResult = true;
+        
+        bx_alert('profile', 'allow_create_another_profile', $iProfileId, 0, array('override_result' => &$bResult));
+        
+        return $bResult;
+    }
 
     /**
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.

+ 1 - 1
modules/boonex/artificer/data/template/system/scripts/BxTemplFunctions.php

@@ -163,7 +163,7 @@ class BxTemplFunctions extends BxBaseFunctions
             'menu_notifications' => BxDolMenu::getObjectInstance('sys_account_notifications')->getCode(),
             'profile_switcher' => $sSwitcher,
             'bx_if:multiple_profiles_mode' => [
-                'condition' => (int)getParam('sys_account_limit_profiles_number') != 1,
+                'condition' => BxDolAccount::isAllowedCreateMultiple($oProfile->id()),
                 'content' => [
                     'url_switch_profile' => BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher')
         	]

+ 1 - 1
template/scripts/BxBaseMenuAccountPopup.php

@@ -30,7 +30,7 @@ class BxBaseMenuAccountPopup extends BxTemplMenu
         $aVars['active_profile'] = $oProfile->getUnit();
         $aVars['menu_notifications'] = BxDolMenu::getObjectInstance('sys_account_notifications')->getCode();
         $aVars['bx_if:multiple_profiles_mode'] = array(
-            'condition' => 1 != (int)getParam('sys_account_limit_profiles_number'),
+            'condition' => BxDolAccount::isAllowedCreateMultiple($oProfile->id()),
             'content' => array(
 				'url_switch_profile' => BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher')
         	),

+ 1 - 1
template/scripts/BxBaseServiceProfiles.php

@@ -54,7 +54,7 @@ class BxBaseServiceProfiles extends BxDol
             $sSwitcher = BxTemplFunctions::getInstance()->transBox('bx-profile-switcher', $oTemplate->parseHtmlByName('profile_avatar_switcher.html', array(
                 'profile_switcher' => $aSwitcher['content'],
                 'bx_if:multiple_profiles_mode' => array(
-                    'condition' => empty($aSwitcher['content']) || (int)getParam('sys_account_limit_profiles_number') != 1,
+                    'condition' => empty($aSwitcher['content']) || BxDolAccount::isAllowedCreateMultiple($oProfile->id()),
                     'content' => array(
                         'url_switch_profile' => BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher')
                     )