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

#4558 - Build-in API support (Push counter for API, fix for anonimus profile)

roman.lesnikov@gmail.com 2 лет назад
Родитель
Сommit
17d122df5c
2 измененных файлов с 5 добавлено и 1 удалено
  1. 1 1
      inc/classes/BxDolProfileAnonymous.php
  2. 4 0
      inc/classes/BxDolPush.php

+ 1 - 1
inc/classes/BxDolProfileAnonymous.php

@@ -46,7 +46,7 @@ class BxDolProfileAnonymous extends BxDolProfileUndefined
      */
     public static function getInstance($mixedProfileId = false, $bClearCache = false)
     {
-        $oProfile = BxDolProfile::getInstance(abs($mixedProfileId));
+        $oProfile = $mixedProfileId ? BxDolProfile::getInstance(abs($mixedProfileId)) : null;
         if (!$oProfile)
             return BxDolProfileUndefined::getInstance();
 

+ 4 - 0
inc/classes/BxDolPush.php

@@ -88,6 +88,10 @@ class BxDolPush extends BxDolFactory implements iBxDolSingleton
      */
     public static function getNotificationsCount($iProfileId = 0, &$aBubbles = null)
     {    
+        if ('' != trim(getParam('sys_api_url_root_push'))) {
+             return bx_srv('bx_notifications', 'get_unread_notifications_num', [$iProfileId]);
+        }   
+        
         $iMemberIdCookie = null;
         $bLoggedMemberGlobals = null;
         if ($iProfileId && $iProfileId != bx_get_logged_profile_id()) {