diff options
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/AppFramework/ApiController.php | 100 | ||||
-rw-r--r-- | lib/public/AppFramework/Controller.php | 2 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/DataDisplayResponse.php | 2 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/DataResponse.php | 2 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/Response.php | 4 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/TemplateResponse.php | 2 | ||||
-rw-r--r-- | lib/public/Share.php | 2 |
7 files changed, 57 insertions, 57 deletions
diff --git a/lib/public/AppFramework/ApiController.php b/lib/public/AppFramework/ApiController.php index 2ebe219444a..e8ecf61c921 100644 --- a/lib/public/AppFramework/ApiController.php +++ b/lib/public/AppFramework/ApiController.php @@ -39,60 +39,60 @@ use OCP\IRequest; */ abstract class ApiController extends Controller { - private $corsMethods; - private $corsAllowedHeaders; - private $corsMaxAge; + private $corsMethods; + private $corsAllowedHeaders; + private $corsMaxAge; - /** - * constructor of the controller - * @param string $appName the name of the app - * @param IRequest $request an instance of the request - * @param string $corsMethods comma separated string of HTTP verbs which - * should be allowed for websites or webapps when calling your API, defaults to - * 'PUT, POST, GET, DELETE, PATCH' - * @param string $corsAllowedHeaders comma separated string of HTTP headers - * which should be allowed for websites or webapps when calling your API, - * defaults to 'Authorization, Content-Type, Accept' - * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS - * request should be cached, defaults to 1728000 seconds - * @since 7.0.0 - */ - public function __construct($appName, - IRequest $request, - $corsMethods='PUT, POST, GET, DELETE, PATCH', - $corsAllowedHeaders='Authorization, Content-Type, Accept', - $corsMaxAge=1728000){ - parent::__construct($appName, $request); - $this->corsMethods = $corsMethods; - $this->corsAllowedHeaders = $corsAllowedHeaders; - $this->corsMaxAge = $corsMaxAge; - } + /** + * constructor of the controller + * @param string $appName the name of the app + * @param IRequest $request an instance of the request + * @param string $corsMethods comma separated string of HTTP verbs which + * should be allowed for websites or webapps when calling your API, defaults to + * 'PUT, POST, GET, DELETE, PATCH' + * @param string $corsAllowedHeaders comma separated string of HTTP headers + * which should be allowed for websites or webapps when calling your API, + * defaults to 'Authorization, Content-Type, Accept' + * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS + * request should be cached, defaults to 1728000 seconds + * @since 7.0.0 + */ + public function __construct($appName, + IRequest $request, + $corsMethods='PUT, POST, GET, DELETE, PATCH', + $corsAllowedHeaders='Authorization, Content-Type, Accept', + $corsMaxAge=1728000){ + parent::__construct($appName, $request); + $this->corsMethods = $corsMethods; + $this->corsAllowedHeaders = $corsAllowedHeaders; + $this->corsMaxAge = $corsMaxAge; + } - /** - * This method implements a preflighted cors response for you that you can - * link to for the options request - * - * @NoAdminRequired - * @NoCSRFRequired - * @PublicPage - * @since 7.0.0 - */ - public function preflightedCors() { - if(isset($this->request->server['HTTP_ORIGIN'])) { - $origin = $this->request->server['HTTP_ORIGIN']; - } else { - $origin = '*'; - } + /** + * This method implements a preflighted cors response for you that you can + * link to for the options request + * + * @NoAdminRequired + * @NoCSRFRequired + * @PublicPage + * @since 7.0.0 + */ + public function preflightedCors() { + if(isset($this->request->server['HTTP_ORIGIN'])) { + $origin = $this->request->server['HTTP_ORIGIN']; + } else { + $origin = '*'; + } - $response = new Response(); - $response->addHeader('Access-Control-Allow-Origin', $origin); - $response->addHeader('Access-Control-Allow-Methods', $this->corsMethods); - $response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge); - $response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders); - $response->addHeader('Access-Control-Allow-Credentials', 'false'); - return $response; - } + $response = new Response(); + $response->addHeader('Access-Control-Allow-Origin', $origin); + $response->addHeader('Access-Control-Allow-Methods', $this->corsMethods); + $response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge); + $response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders); + $response->addHeader('Access-Control-Allow-Credentials', 'false'); + return $response; + } } diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index 2e442c49768..487b6a854fe 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -73,7 +73,7 @@ abstract class Controller { * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0 */ public function __construct($appName, - IRequest $request) { + IRequest $request) { $this->appName = $appName; $this->request = $request; diff --git a/lib/public/AppFramework/Http/DataDisplayResponse.php b/lib/public/AppFramework/Http/DataDisplayResponse.php index 512e52ee9fc..4b31bc7dc0d 100644 --- a/lib/public/AppFramework/Http/DataDisplayResponse.php +++ b/lib/public/AppFramework/Http/DataDisplayResponse.php @@ -48,7 +48,7 @@ class DataDisplayResponse extends Response { * @since 8.1.0 */ public function __construct($data='', $statusCode=Http::STATUS_OK, - $headers=[]) { + $headers=[]) { parent::__construct(); $this->data = $data; diff --git a/lib/public/AppFramework/Http/DataResponse.php b/lib/public/AppFramework/Http/DataResponse.php index 700fe1f418b..7efbb58d8c7 100644 --- a/lib/public/AppFramework/Http/DataResponse.php +++ b/lib/public/AppFramework/Http/DataResponse.php @@ -53,7 +53,7 @@ class DataResponse extends Response { * @since 8.0.0 */ public function __construct($data=[], $statusCode=Http::STATUS_OK, - array $headers=[]) { + array $headers=[]) { parent::__construct(); $this->data = $data; diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 2fc985aabfb..0aacc2f3a58 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -198,8 +198,8 @@ class Response { */ public function addHeader($name, $value) { $name = trim($name); // always remove leading and trailing whitespace - // to be able to reliably check for security - // headers + // to be able to reliably check for security + // headers if(is_null($value)) { unset($this->headers[$name]); diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index 4a77d4844ed..99219d6eb0e 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -77,7 +77,7 @@ class TemplateResponse extends Response { * @since 6.0.0 - parameters $params and $renderAs were added in 7.0.0 */ public function __construct($appName, $templateName, array $params=[], - $renderAs='user') { + $renderAs='user') { parent::__construct(); $this->templateName = $templateName; diff --git a/lib/public/Share.php b/lib/public/Share.php index 25e255f35ba..622a6718924 100644 --- a/lib/public/Share.php +++ b/lib/public/Share.php @@ -121,7 +121,7 @@ class Share extends \OC\Share\Constants { * @deprecated 17.0.0 */ public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, - $parameters = null, $includeCollections = false) { + $parameters = null, $includeCollections = false) { return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections); } |