Beispiel #1
0
 protected function _generateControllerResponse(XenForo_Controller $controller, OAuth2\Response $response)
 {
     if ($response->isRedirection()) {
         return $controller->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $response->getHttpHeader('Location'));
     }
     $params = $response->getParameters();
     $params['_statusCode'] = $response->getStatusCode();
     $params['_headers'] = $response->getHttpHeaders();
     if ($controller instanceof bdApi_ControllerApi_Abstract) {
         return $controller->responseData('bdApi_ViewApi_OAuth', $params);
     } else {
         if ($response->isClientError()) {
             return $controller->responseError($response->getParameter('error_description'), $response->getStatusCode());
         } else {
             $controller->getRouteMatch()->setResponseType('json');
             return $controller->responseView('bdApi_ViewPublic_OAuth', '', $params);
         }
     }
 }