瀏覽代碼

Ticket #4558 - Build-in API support: Different.

AntonLV 2 年之前
父節點
當前提交
57451efa96
共有 3 個文件被更改,包括 18 次插入 和 1 次删除
  1. 5 1
      inc/classes/BxDolSearch.php
  2. 9 0
      inc/utils.inc.php
  3. 4 0
      modules/boonex/timeline/classes/BxTimelineTemplate.php

+ 5 - 1
inc/classes/BxDolSearch.php

@@ -562,7 +562,11 @@ class BxDolSearchResult implements iBxDolReplaceable
             'start' => $this->aCurrent['paginate']['start'],
             'type' => $this->_sMode,
         ];
-        
+
+        if (isset($this->_aParams['author'])){
+            $aParams['author'] = $this->_aParams['author'];
+        }
+
         if (isset($this->_aParams['category'])){
             $aParams['category'] = $this->_aParams['category'];
         }

+ 9 - 0
inc/utils.inc.php

@@ -2399,6 +2399,7 @@ function bx_api_check_access()
             exit;
         }
     }
+    /*
     elseif (getParam('sys_api_access_by_origin') && $sOriginHeader) {
 
         if (parse_url($sOriginHeader, PHP_URL_HOST) != parse_url(BX_DOL_URL_ROOT, PHP_URL_HOST)) {
@@ -2423,6 +2424,14 @@ function bx_api_check_access()
         header('HTTP/1.0 403 Forbidden');
         echo json_encode(['status' => 403, 'error' => _t("_Access denied")]);
         exit;
+    }
+     * 
+     */
+
+    if (isset($_GET['demo']) && $_GET['demo'] == 1 ){
+        bx_login(1);
+        check_logged();
+        
     }
 
     // TODO: Temporarily to use logged state

+ 4 - 0
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -3076,6 +3076,10 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                 $aResult['content']['images_attach'] = $oModule->getEventImages($aEvent['id']);
                 $aResult['content']['videos_attach'] = $oModule->getEventVideos($aEvent['id']);
                 $aResult['content']['files_attach'] = $oModule->getEventFiles($aEvent['id']);
+                if($this->_bIsApi) {
+                    $aResult['content']['videos_attach'] = array_values($aResult['content']['videos_attach']);
+                    $aResult['content']['files_attach'] = array_values($aResult['content']['files_attach']);
+                }
                 break;
 
             case BX_TIMELINE_PARSE_TYPE_REPOST: