Procházet zdrojové kódy

#4148 Build-in API support: process 404 pages

Alex Trofimov před 3 roky
rodič
revize
542eeabb96
2 změnil soubory, kde provedl 4 přidání a 3 odebrání
  1. 3 2
      api.php
  2. 1 1
      template/scripts/BxBaseServicePages.php

+ 3 - 2
api.php

@@ -50,8 +50,9 @@ if (is_array($mixedRet) && isset($mixedRet['error'])) {
     header('HTTP/1.0 500 Internal Server Error');
     header('Status: 500 Internal Server Error');
     $a = [
-        'status' => 500, 
-        'error' => isset($mixedRet['desc']) ? $mixedRet['desc'] : $mixedRet['error']
+        'status' => isset($mixedRet['code']) ? $mixedRet['code'] : 500,
+        'error' => isset($mixedRet['desc']) ? $mixedRet['desc'] : $mixedRet['error'],
+        'all' => $mixedRet,
     ];
     if (isset($mixedRet['code']))
         $a['code'] = $mixedRet['code'];

+ 1 - 1
template/scripts/BxBaseServicePages.php

@@ -45,7 +45,7 @@ class BxBaseServicePages extends BxDol
             return $oPage->getPage();
         }
         else {
-            $aRes = ['error' => _t("_sys_request_page_not_found_cpt")];
+            $aRes = ['code' => 404, 'error' => _t("_sys_request_page_not_found_cpt")];
         }
         
         return $aRes;