@@ -38,50 +38,50 @@ |
||
38 | 38 | * @since 8.1.0 |
39 | 39 | */ |
40 | 40 | class ContentSecurityPolicy extends EmptyContentSecurityPolicy { |
41 | - /** @var bool Whether inline JS snippets are allowed */ |
|
42 | - protected $inlineScriptAllowed = false; |
|
43 | - /** |
|
44 | - * @var bool Whether eval in JS scripts is allowed |
|
45 | - * TODO: Disallow per default |
|
46 | - * @link https://github.com/owncloud/core/issues/11925 |
|
47 | - */ |
|
48 | - protected $evalScriptAllowed = true; |
|
49 | - /** @var array Domains from which scripts can get loaded */ |
|
50 | - protected $allowedScriptDomains = [ |
|
51 | - '\'self\'', |
|
52 | - ]; |
|
53 | - /** |
|
54 | - * @var bool Whether inline CSS is allowed |
|
55 | - * TODO: Disallow per default |
|
56 | - * @link https://github.com/owncloud/core/issues/13458 |
|
57 | - */ |
|
58 | - protected $inlineStyleAllowed = true; |
|
59 | - /** @var array Domains from which CSS can get loaded */ |
|
60 | - protected $allowedStyleDomains = [ |
|
61 | - '\'self\'', |
|
62 | - ]; |
|
63 | - /** @var array Domains from which images can get loaded */ |
|
64 | - protected $allowedImageDomains = [ |
|
65 | - '\'self\'', |
|
66 | - 'data:', |
|
67 | - 'blob:', |
|
68 | - ]; |
|
69 | - /** @var array Domains to which connections can be done */ |
|
70 | - protected $allowedConnectDomains = [ |
|
71 | - '\'self\'', |
|
72 | - ]; |
|
73 | - /** @var array Domains from which media elements can be loaded */ |
|
74 | - protected $allowedMediaDomains = [ |
|
75 | - '\'self\'', |
|
76 | - ]; |
|
77 | - /** @var array Domains from which object elements can be loaded */ |
|
78 | - protected $allowedObjectDomains = []; |
|
79 | - /** @var array Domains from which iframes can be loaded */ |
|
80 | - protected $allowedFrameDomains = []; |
|
81 | - /** @var array Domains from which fonts can be loaded */ |
|
82 | - protected $allowedFontDomains = [ |
|
83 | - '\'self\'', |
|
84 | - ]; |
|
85 | - /** @var array Domains from which web-workers and nested browsing content can load elements */ |
|
86 | - protected $allowedChildSrcDomains = []; |
|
41 | + /** @var bool Whether inline JS snippets are allowed */ |
|
42 | + protected $inlineScriptAllowed = false; |
|
43 | + /** |
|
44 | + * @var bool Whether eval in JS scripts is allowed |
|
45 | + * TODO: Disallow per default |
|
46 | + * @link https://github.com/owncloud/core/issues/11925 |
|
47 | + */ |
|
48 | + protected $evalScriptAllowed = true; |
|
49 | + /** @var array Domains from which scripts can get loaded */ |
|
50 | + protected $allowedScriptDomains = [ |
|
51 | + '\'self\'', |
|
52 | + ]; |
|
53 | + /** |
|
54 | + * @var bool Whether inline CSS is allowed |
|
55 | + * TODO: Disallow per default |
|
56 | + * @link https://github.com/owncloud/core/issues/13458 |
|
57 | + */ |
|
58 | + protected $inlineStyleAllowed = true; |
|
59 | + /** @var array Domains from which CSS can get loaded */ |
|
60 | + protected $allowedStyleDomains = [ |
|
61 | + '\'self\'', |
|
62 | + ]; |
|
63 | + /** @var array Domains from which images can get loaded */ |
|
64 | + protected $allowedImageDomains = [ |
|
65 | + '\'self\'', |
|
66 | + 'data:', |
|
67 | + 'blob:', |
|
68 | + ]; |
|
69 | + /** @var array Domains to which connections can be done */ |
|
70 | + protected $allowedConnectDomains = [ |
|
71 | + '\'self\'', |
|
72 | + ]; |
|
73 | + /** @var array Domains from which media elements can be loaded */ |
|
74 | + protected $allowedMediaDomains = [ |
|
75 | + '\'self\'', |
|
76 | + ]; |
|
77 | + /** @var array Domains from which object elements can be loaded */ |
|
78 | + protected $allowedObjectDomains = []; |
|
79 | + /** @var array Domains from which iframes can be loaded */ |
|
80 | + protected $allowedFrameDomains = []; |
|
81 | + /** @var array Domains from which fonts can be loaded */ |
|
82 | + protected $allowedFontDomains = [ |
|
83 | + '\'self\'', |
|
84 | + ]; |
|
85 | + /** @var array Domains from which web-workers and nested browsing content can load elements */ |
|
86 | + protected $allowedChildSrcDomains = []; |
|
87 | 87 | } |
@@ -32,48 +32,48 @@ |
||
32 | 32 | */ |
33 | 33 | interface IOutput { |
34 | 34 | |
35 | - /** |
|
36 | - * @param string $out |
|
37 | - * @since 8.1.0 |
|
38 | - */ |
|
39 | - public function setOutput($out); |
|
35 | + /** |
|
36 | + * @param string $out |
|
37 | + * @since 8.1.0 |
|
38 | + */ |
|
39 | + public function setOutput($out); |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param string|resource $path or file handle |
|
43 | - * |
|
44 | - * @return bool false if an error occurred |
|
45 | - * @since 8.1.0 |
|
46 | - */ |
|
47 | - public function setReadfile($path); |
|
41 | + /** |
|
42 | + * @param string|resource $path or file handle |
|
43 | + * |
|
44 | + * @return bool false if an error occurred |
|
45 | + * @since 8.1.0 |
|
46 | + */ |
|
47 | + public function setReadfile($path); |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param string $header |
|
51 | - * @since 8.1.0 |
|
52 | - */ |
|
53 | - public function setHeader($header); |
|
49 | + /** |
|
50 | + * @param string $header |
|
51 | + * @since 8.1.0 |
|
52 | + */ |
|
53 | + public function setHeader($header); |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return int returns the current http response code |
|
57 | - * @since 8.1.0 |
|
58 | - */ |
|
59 | - public function getHttpResponseCode(); |
|
55 | + /** |
|
56 | + * @return int returns the current http response code |
|
57 | + * @since 8.1.0 |
|
58 | + */ |
|
59 | + public function getHttpResponseCode(); |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param int $code sets the http status code |
|
63 | - * @since 8.1.0 |
|
64 | - */ |
|
65 | - public function setHttpResponseCode($code); |
|
61 | + /** |
|
62 | + * @param int $code sets the http status code |
|
63 | + * @since 8.1.0 |
|
64 | + */ |
|
65 | + public function setHttpResponseCode($code); |
|
66 | 66 | |
67 | - /** |
|
68 | - * @param string $name |
|
69 | - * @param string $value |
|
70 | - * @param int $expire |
|
71 | - * @param string $path |
|
72 | - * @param string $domain |
|
73 | - * @param bool $secure |
|
74 | - * @param bool $httpOnly |
|
75 | - * @since 8.1.0 |
|
76 | - */ |
|
77 | - public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); |
|
67 | + /** |
|
68 | + * @param string $name |
|
69 | + * @param string $value |
|
70 | + * @param int $expire |
|
71 | + * @param string $path |
|
72 | + * @param string $domain |
|
73 | + * @param bool $secure |
|
74 | + * @param bool $httpOnly |
|
75 | + * @since 8.1.0 |
|
76 | + */ |
|
77 | + public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); |
|
78 | 78 | |
79 | 79 | } |
@@ -33,33 +33,33 @@ |
||
33 | 33 | * @since 8.1.0 |
34 | 34 | */ |
35 | 35 | class StreamResponse extends Response implements ICallbackResponse { |
36 | - /** @var string */ |
|
37 | - private $filePath; |
|
36 | + /** @var string */ |
|
37 | + private $filePath; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string|resource $filePath the path to the file or a file handle which should be streamed |
|
41 | - * @since 8.1.0 |
|
42 | - */ |
|
43 | - public function __construct ($filePath) { |
|
44 | - $this->filePath = $filePath; |
|
45 | - } |
|
39 | + /** |
|
40 | + * @param string|resource $filePath the path to the file or a file handle which should be streamed |
|
41 | + * @since 8.1.0 |
|
42 | + */ |
|
43 | + public function __construct ($filePath) { |
|
44 | + $this->filePath = $filePath; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * Streams the file using readfile |
|
50 | - * |
|
51 | - * @param IOutput $output a small wrapper that handles output |
|
52 | - * @since 8.1.0 |
|
53 | - */ |
|
54 | - public function callback (IOutput $output) { |
|
55 | - // handle caching |
|
56 | - if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { |
|
57 | - if (!(is_resource($this->filePath) || file_exists($this->filePath))) { |
|
58 | - $output->setHttpResponseCode(Http::STATUS_NOT_FOUND); |
|
59 | - } elseif ($output->setReadfile($this->filePath) === false) { |
|
60 | - $output->setHttpResponseCode(Http::STATUS_BAD_REQUEST); |
|
61 | - } |
|
62 | - } |
|
63 | - } |
|
48 | + /** |
|
49 | + * Streams the file using readfile |
|
50 | + * |
|
51 | + * @param IOutput $output a small wrapper that handles output |
|
52 | + * @since 8.1.0 |
|
53 | + */ |
|
54 | + public function callback (IOutput $output) { |
|
55 | + // handle caching |
|
56 | + if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { |
|
57 | + if (!(is_resource($this->filePath) || file_exists($this->filePath))) { |
|
58 | + $output->setHttpResponseCode(Http::STATUS_NOT_FOUND); |
|
59 | + } elseif ($output->setReadfile($this->filePath) === false) { |
|
60 | + $output->setHttpResponseCode(Http::STATUS_BAD_REQUEST); |
|
61 | + } |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | } |
@@ -32,22 +32,22 @@ |
||
32 | 32 | */ |
33 | 33 | class DownloadResponse extends \OCP\AppFramework\Http\Response { |
34 | 34 | |
35 | - private $filename; |
|
36 | - private $contentType; |
|
37 | - |
|
38 | - /** |
|
39 | - * Creates a response that prompts the user to download the file |
|
40 | - * @param string $filename the name that the downloaded file should have |
|
41 | - * @param string $contentType the mimetype that the downloaded file should have |
|
42 | - * @since 7.0.0 |
|
43 | - */ |
|
44 | - public function __construct($filename, $contentType) { |
|
45 | - $this->filename = $filename; |
|
46 | - $this->contentType = $contentType; |
|
47 | - |
|
48 | - $this->addHeader('Content-Disposition', 'attachment; filename="' . $filename . '"'); |
|
49 | - $this->addHeader('Content-Type', $contentType); |
|
50 | - } |
|
35 | + private $filename; |
|
36 | + private $contentType; |
|
37 | + |
|
38 | + /** |
|
39 | + * Creates a response that prompts the user to download the file |
|
40 | + * @param string $filename the name that the downloaded file should have |
|
41 | + * @param string $contentType the mimetype that the downloaded file should have |
|
42 | + * @since 7.0.0 |
|
43 | + */ |
|
44 | + public function __construct($filename, $contentType) { |
|
45 | + $this->filename = $filename; |
|
46 | + $this->contentType = $contentType; |
|
47 | + |
|
48 | + $this->addHeader('Content-Disposition', 'attachment; filename="' . $filename . '"'); |
|
49 | + $this->addHeader('Content-Type', $contentType); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | 53 | } |
@@ -45,94 +45,94 @@ |
||
45 | 45 | class App { |
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * Turns an app id into a namespace by convetion. The id is split at the |
|
50 | - * underscores, all parts are camelcased and reassembled. e.g.: |
|
51 | - * some_app_id -> OCA\SomeAppId |
|
52 | - * @param string $appId the app id |
|
53 | - * @param string $topNamespace the namespace which should be prepended to |
|
54 | - * the transformed app id, defaults to OCA\ |
|
55 | - * @return string the starting namespace for the app |
|
56 | - * @since 8.0.0 |
|
57 | - */ |
|
58 | - public static function buildAppNamespace($appId, $topNamespace='OCA\\') { |
|
59 | - return \OC\AppFramework\App::buildAppNamespace($appId, $topNamespace); |
|
60 | - } |
|
48 | + /** |
|
49 | + * Turns an app id into a namespace by convetion. The id is split at the |
|
50 | + * underscores, all parts are camelcased and reassembled. e.g.: |
|
51 | + * some_app_id -> OCA\SomeAppId |
|
52 | + * @param string $appId the app id |
|
53 | + * @param string $topNamespace the namespace which should be prepended to |
|
54 | + * the transformed app id, defaults to OCA\ |
|
55 | + * @return string the starting namespace for the app |
|
56 | + * @since 8.0.0 |
|
57 | + */ |
|
58 | + public static function buildAppNamespace($appId, $topNamespace='OCA\\') { |
|
59 | + return \OC\AppFramework\App::buildAppNamespace($appId, $topNamespace); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * @param array $urlParams an array with variables extracted from the routes |
|
65 | - * @since 6.0.0 |
|
66 | - */ |
|
67 | - public function __construct($appName, $urlParams = array()) { |
|
68 | - $this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams); |
|
69 | - } |
|
63 | + /** |
|
64 | + * @param array $urlParams an array with variables extracted from the routes |
|
65 | + * @since 6.0.0 |
|
66 | + */ |
|
67 | + public function __construct($appName, $urlParams = array()) { |
|
68 | + $this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams); |
|
69 | + } |
|
70 | 70 | |
71 | - private $container; |
|
71 | + private $container; |
|
72 | 72 | |
73 | - /** |
|
74 | - * @return IAppContainer |
|
75 | - * @since 6.0.0 |
|
76 | - */ |
|
77 | - public function getContainer() { |
|
78 | - return $this->container; |
|
79 | - } |
|
73 | + /** |
|
74 | + * @return IAppContainer |
|
75 | + * @since 6.0.0 |
|
76 | + */ |
|
77 | + public function getContainer() { |
|
78 | + return $this->container; |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * This function is to be called to create single routes and restful routes based on the given $routes array. |
|
83 | - * |
|
84 | - * Example code in routes.php of tasks app (it will register two restful resources): |
|
85 | - * $routes = array( |
|
86 | - * 'resources' => array( |
|
87 | - * 'lists' => array('url' => '/tasklists'), |
|
88 | - * 'tasks' => array('url' => '/tasklists/{listId}/tasks') |
|
89 | - * ) |
|
90 | - * ); |
|
91 | - * |
|
92 | - * $a = new TasksApp(); |
|
93 | - * $a->registerRoutes($this, $routes); |
|
94 | - * |
|
95 | - * @param \OCP\Route\IRouter $router |
|
96 | - * @param array $routes |
|
97 | - * @since 6.0.0 |
|
98 | - */ |
|
99 | - public function registerRoutes($router, $routes) { |
|
100 | - $routeConfig = new RouteConfig($this->container, $router, $routes); |
|
101 | - $routeConfig->register(); |
|
102 | - } |
|
81 | + /** |
|
82 | + * This function is to be called to create single routes and restful routes based on the given $routes array. |
|
83 | + * |
|
84 | + * Example code in routes.php of tasks app (it will register two restful resources): |
|
85 | + * $routes = array( |
|
86 | + * 'resources' => array( |
|
87 | + * 'lists' => array('url' => '/tasklists'), |
|
88 | + * 'tasks' => array('url' => '/tasklists/{listId}/tasks') |
|
89 | + * ) |
|
90 | + * ); |
|
91 | + * |
|
92 | + * $a = new TasksApp(); |
|
93 | + * $a->registerRoutes($this, $routes); |
|
94 | + * |
|
95 | + * @param \OCP\Route\IRouter $router |
|
96 | + * @param array $routes |
|
97 | + * @since 6.0.0 |
|
98 | + */ |
|
99 | + public function registerRoutes($router, $routes) { |
|
100 | + $routeConfig = new RouteConfig($this->container, $router, $routes); |
|
101 | + $routeConfig->register(); |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * This function is called by the routing component to fire up the frameworks dispatch mechanism. |
|
106 | - * |
|
107 | - * Example code in routes.php of the task app: |
|
108 | - * $this->create('tasks_index', '/')->get()->action( |
|
109 | - * function($params){ |
|
110 | - * $app = new TaskApp($params); |
|
111 | - * $app->dispatch('PageController', 'index'); |
|
112 | - * } |
|
113 | - * ); |
|
114 | - * |
|
115 | - * |
|
116 | - * Example for for TaskApp implementation: |
|
117 | - * class TaskApp extends \OCP\AppFramework\App { |
|
118 | - * |
|
119 | - * public function __construct($params){ |
|
120 | - * parent::__construct('tasks', $params); |
|
121 | - * |
|
122 | - * $this->getContainer()->registerService('PageController', function(IAppContainer $c){ |
|
123 | - * $a = $c->query('API'); |
|
124 | - * $r = $c->query('Request'); |
|
125 | - * return new PageController($a, $r); |
|
126 | - * }); |
|
127 | - * } |
|
128 | - * } |
|
129 | - * |
|
130 | - * @param string $controllerName the name of the controller under which it is |
|
131 | - * stored in the DI container |
|
132 | - * @param string $methodName the method that you want to call |
|
133 | - * @since 6.0.0 |
|
134 | - */ |
|
135 | - public function dispatch($controllerName, $methodName) { |
|
136 | - \OC\AppFramework\App::main($controllerName, $methodName, $this->container); |
|
137 | - } |
|
104 | + /** |
|
105 | + * This function is called by the routing component to fire up the frameworks dispatch mechanism. |
|
106 | + * |
|
107 | + * Example code in routes.php of the task app: |
|
108 | + * $this->create('tasks_index', '/')->get()->action( |
|
109 | + * function($params){ |
|
110 | + * $app = new TaskApp($params); |
|
111 | + * $app->dispatch('PageController', 'index'); |
|
112 | + * } |
|
113 | + * ); |
|
114 | + * |
|
115 | + * |
|
116 | + * Example for for TaskApp implementation: |
|
117 | + * class TaskApp extends \OCP\AppFramework\App { |
|
118 | + * |
|
119 | + * public function __construct($params){ |
|
120 | + * parent::__construct('tasks', $params); |
|
121 | + * |
|
122 | + * $this->getContainer()->registerService('PageController', function(IAppContainer $c){ |
|
123 | + * $a = $c->query('API'); |
|
124 | + * $r = $c->query('Request'); |
|
125 | + * return new PageController($a, $r); |
|
126 | + * }); |
|
127 | + * } |
|
128 | + * } |
|
129 | + * |
|
130 | + * @param string $controllerName the name of the controller under which it is |
|
131 | + * stored in the DI container |
|
132 | + * @param string $methodName the method that you want to call |
|
133 | + * @since 6.0.0 |
|
134 | + */ |
|
135 | + public function dispatch($controllerName, $methodName) { |
|
136 | + \OC\AppFramework\App::main($controllerName, $methodName, $this->container); |
|
137 | + } |
|
138 | 138 | } |
@@ -44,69 +44,69 @@ |
||
44 | 44 | abstract class Middleware { |
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * This is being run in normal order before the controller is being |
|
49 | - * called which allows several modifications and checks |
|
50 | - * |
|
51 | - * @param Controller $controller the controller that is being called |
|
52 | - * @param string $methodName the name of the method that will be called on |
|
53 | - * the controller |
|
54 | - * @since 6.0.0 |
|
55 | - */ |
|
56 | - public function beforeController($controller, $methodName){ |
|
47 | + /** |
|
48 | + * This is being run in normal order before the controller is being |
|
49 | + * called which allows several modifications and checks |
|
50 | + * |
|
51 | + * @param Controller $controller the controller that is being called |
|
52 | + * @param string $methodName the name of the method that will be called on |
|
53 | + * the controller |
|
54 | + * @since 6.0.0 |
|
55 | + */ |
|
56 | + public function beforeController($controller, $methodName){ |
|
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * This is being run when either the beforeController method or the |
|
63 | - * controller method itself is throwing an exception. The middleware is |
|
64 | - * asked in reverse order to handle the exception and to return a response. |
|
65 | - * If the response is null, it is assumed that the exception could not be |
|
66 | - * handled and the error will be thrown again |
|
67 | - * |
|
68 | - * @param Controller $controller the controller that is being called |
|
69 | - * @param string $methodName the name of the method that will be called on |
|
70 | - * the controller |
|
71 | - * @param \Exception $exception the thrown exception |
|
72 | - * @throws \Exception the passed in exception if it can't handle it |
|
73 | - * @return Response a Response object in case that the exception was handled |
|
74 | - * @since 6.0.0 |
|
75 | - */ |
|
76 | - public function afterException($controller, $methodName, \Exception $exception){ |
|
77 | - throw $exception; |
|
78 | - } |
|
61 | + /** |
|
62 | + * This is being run when either the beforeController method or the |
|
63 | + * controller method itself is throwing an exception. The middleware is |
|
64 | + * asked in reverse order to handle the exception and to return a response. |
|
65 | + * If the response is null, it is assumed that the exception could not be |
|
66 | + * handled and the error will be thrown again |
|
67 | + * |
|
68 | + * @param Controller $controller the controller that is being called |
|
69 | + * @param string $methodName the name of the method that will be called on |
|
70 | + * the controller |
|
71 | + * @param \Exception $exception the thrown exception |
|
72 | + * @throws \Exception the passed in exception if it can't handle it |
|
73 | + * @return Response a Response object in case that the exception was handled |
|
74 | + * @since 6.0.0 |
|
75 | + */ |
|
76 | + public function afterException($controller, $methodName, \Exception $exception){ |
|
77 | + throw $exception; |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * This is being run after a successful controllermethod call and allows |
|
83 | - * the manipulation of a Response object. The middleware is run in reverse order |
|
84 | - * |
|
85 | - * @param Controller $controller the controller that is being called |
|
86 | - * @param string $methodName the name of the method that will be called on |
|
87 | - * the controller |
|
88 | - * @param Response $response the generated response from the controller |
|
89 | - * @return Response a Response object |
|
90 | - * @since 6.0.0 |
|
91 | - */ |
|
92 | - public function afterController($controller, $methodName, Response $response){ |
|
93 | - return $response; |
|
94 | - } |
|
81 | + /** |
|
82 | + * This is being run after a successful controllermethod call and allows |
|
83 | + * the manipulation of a Response object. The middleware is run in reverse order |
|
84 | + * |
|
85 | + * @param Controller $controller the controller that is being called |
|
86 | + * @param string $methodName the name of the method that will be called on |
|
87 | + * the controller |
|
88 | + * @param Response $response the generated response from the controller |
|
89 | + * @return Response a Response object |
|
90 | + * @since 6.0.0 |
|
91 | + */ |
|
92 | + public function afterController($controller, $methodName, Response $response){ |
|
93 | + return $response; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | - /** |
|
98 | - * This is being run after the response object has been rendered and |
|
99 | - * allows the manipulation of the output. The middleware is run in reverse order |
|
100 | - * |
|
101 | - * @param Controller $controller the controller that is being called |
|
102 | - * @param string $methodName the name of the method that will be called on |
|
103 | - * the controller |
|
104 | - * @param string $output the generated output from a response |
|
105 | - * @return string the output that should be printed |
|
106 | - * @since 6.0.0 |
|
107 | - */ |
|
108 | - public function beforeOutput($controller, $methodName, $output){ |
|
109 | - return $output; |
|
110 | - } |
|
97 | + /** |
|
98 | + * This is being run after the response object has been rendered and |
|
99 | + * allows the manipulation of the output. The middleware is run in reverse order |
|
100 | + * |
|
101 | + * @param Controller $controller the controller that is being called |
|
102 | + * @param string $methodName the name of the method that will be called on |
|
103 | + * the controller |
|
104 | + * @param string $output the generated output from a response |
|
105 | + * @return string the output that should be printed |
|
106 | + * @since 6.0.0 |
|
107 | + */ |
|
108 | + public function beforeOutput($controller, $methodName, $output){ |
|
109 | + return $output; |
|
110 | + } |
|
111 | 111 | |
112 | 112 | } |
@@ -35,63 +35,63 @@ |
||
35 | 35 | */ |
36 | 36 | class Http { |
37 | 37 | |
38 | - const STATUS_CONTINUE = 100; |
|
39 | - const STATUS_SWITCHING_PROTOCOLS = 101; |
|
40 | - const STATUS_PROCESSING = 102; |
|
41 | - const STATUS_OK = 200; |
|
42 | - const STATUS_CREATED = 201; |
|
43 | - const STATUS_ACCEPTED = 202; |
|
44 | - const STATUS_NON_AUTHORATIVE_INFORMATION = 203; |
|
45 | - const STATUS_NO_CONTENT = 204; |
|
46 | - const STATUS_RESET_CONTENT = 205; |
|
47 | - const STATUS_PARTIAL_CONTENT = 206; |
|
48 | - const STATUS_MULTI_STATUS = 207; |
|
49 | - const STATUS_ALREADY_REPORTED = 208; |
|
50 | - const STATUS_IM_USED = 226; |
|
51 | - const STATUS_MULTIPLE_CHOICES = 300; |
|
52 | - const STATUS_MOVED_PERMANENTLY = 301; |
|
53 | - const STATUS_FOUND = 302; |
|
54 | - const STATUS_SEE_OTHER = 303; |
|
55 | - const STATUS_NOT_MODIFIED = 304; |
|
56 | - const STATUS_USE_PROXY = 305; |
|
57 | - const STATUS_RESERVED = 306; |
|
58 | - const STATUS_TEMPORARY_REDIRECT = 307; |
|
59 | - const STATUS_BAD_REQUEST = 400; |
|
60 | - const STATUS_UNAUTHORIZED = 401; |
|
61 | - const STATUS_PAYMENT_REQUIRED = 402; |
|
62 | - const STATUS_FORBIDDEN = 403; |
|
63 | - const STATUS_NOT_FOUND = 404; |
|
64 | - const STATUS_METHOD_NOT_ALLOWED = 405; |
|
65 | - const STATUS_NOT_ACCEPTABLE = 406; |
|
66 | - const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407; |
|
67 | - const STATUS_REQUEST_TIMEOUT = 408; |
|
68 | - const STATUS_CONFLICT = 409; |
|
69 | - const STATUS_GONE = 410; |
|
70 | - const STATUS_LENGTH_REQUIRED = 411; |
|
71 | - const STATUS_PRECONDITION_FAILED = 412; |
|
72 | - const STATUS_REQUEST_ENTITY_TOO_LARGE = 413; |
|
73 | - const STATUS_REQUEST_URI_TOO_LONG = 414; |
|
74 | - const STATUS_UNSUPPORTED_MEDIA_TYPE = 415; |
|
75 | - const STATUS_REQUEST_RANGE_NOT_SATISFIABLE = 416; |
|
76 | - const STATUS_EXPECTATION_FAILED = 417; |
|
77 | - const STATUS_IM_A_TEAPOT = 418; |
|
78 | - const STATUS_UNPROCESSABLE_ENTITY = 422; |
|
79 | - const STATUS_LOCKED = 423; |
|
80 | - const STATUS_FAILED_DEPENDENCY = 424; |
|
81 | - const STATUS_UPGRADE_REQUIRED = 426; |
|
82 | - const STATUS_PRECONDITION_REQUIRED = 428; |
|
83 | - const STATUS_TOO_MANY_REQUESTS = 429; |
|
84 | - const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; |
|
85 | - const STATUS_INTERNAL_SERVER_ERROR = 500; |
|
86 | - const STATUS_NOT_IMPLEMENTED = 501; |
|
87 | - const STATUS_BAD_GATEWAY = 502; |
|
88 | - const STATUS_SERVICE_UNAVAILABLE = 503; |
|
89 | - const STATUS_GATEWAY_TIMEOUT = 504; |
|
90 | - const STATUS_HTTP_VERSION_NOT_SUPPORTED = 505; |
|
91 | - const STATUS_VARIANT_ALSO_NEGOTIATES = 506; |
|
92 | - const STATUS_INSUFFICIENT_STORAGE = 507; |
|
93 | - const STATUS_LOOP_DETECTED = 508; |
|
94 | - const STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509; |
|
95 | - const STATUS_NOT_EXTENDED = 510; |
|
96 | - const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511; |
|
38 | + const STATUS_CONTINUE = 100; |
|
39 | + const STATUS_SWITCHING_PROTOCOLS = 101; |
|
40 | + const STATUS_PROCESSING = 102; |
|
41 | + const STATUS_OK = 200; |
|
42 | + const STATUS_CREATED = 201; |
|
43 | + const STATUS_ACCEPTED = 202; |
|
44 | + const STATUS_NON_AUTHORATIVE_INFORMATION = 203; |
|
45 | + const STATUS_NO_CONTENT = 204; |
|
46 | + const STATUS_RESET_CONTENT = 205; |
|
47 | + const STATUS_PARTIAL_CONTENT = 206; |
|
48 | + const STATUS_MULTI_STATUS = 207; |
|
49 | + const STATUS_ALREADY_REPORTED = 208; |
|
50 | + const STATUS_IM_USED = 226; |
|
51 | + const STATUS_MULTIPLE_CHOICES = 300; |
|
52 | + const STATUS_MOVED_PERMANENTLY = 301; |
|
53 | + const STATUS_FOUND = 302; |
|
54 | + const STATUS_SEE_OTHER = 303; |
|
55 | + const STATUS_NOT_MODIFIED = 304; |
|
56 | + const STATUS_USE_PROXY = 305; |
|
57 | + const STATUS_RESERVED = 306; |
|
58 | + const STATUS_TEMPORARY_REDIRECT = 307; |
|
59 | + const STATUS_BAD_REQUEST = 400; |
|
60 | + const STATUS_UNAUTHORIZED = 401; |
|
61 | + const STATUS_PAYMENT_REQUIRED = 402; |
|
62 | + const STATUS_FORBIDDEN = 403; |
|
63 | + const STATUS_NOT_FOUND = 404; |
|
64 | + const STATUS_METHOD_NOT_ALLOWED = 405; |
|
65 | + const STATUS_NOT_ACCEPTABLE = 406; |
|
66 | + const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407; |
|
67 | + const STATUS_REQUEST_TIMEOUT = 408; |
|
68 | + const STATUS_CONFLICT = 409; |
|
69 | + const STATUS_GONE = 410; |
|
70 | + const STATUS_LENGTH_REQUIRED = 411; |
|
71 | + const STATUS_PRECONDITION_FAILED = 412; |
|
72 | + const STATUS_REQUEST_ENTITY_TOO_LARGE = 413; |
|
73 | + const STATUS_REQUEST_URI_TOO_LONG = 414; |
|
74 | + const STATUS_UNSUPPORTED_MEDIA_TYPE = 415; |
|
75 | + const STATUS_REQUEST_RANGE_NOT_SATISFIABLE = 416; |
|
76 | + const STATUS_EXPECTATION_FAILED = 417; |
|
77 | + const STATUS_IM_A_TEAPOT = 418; |
|
78 | + const STATUS_UNPROCESSABLE_ENTITY = 422; |
|
79 | + const STATUS_LOCKED = 423; |
|
80 | + const STATUS_FAILED_DEPENDENCY = 424; |
|
81 | + const STATUS_UPGRADE_REQUIRED = 426; |
|
82 | + const STATUS_PRECONDITION_REQUIRED = 428; |
|
83 | + const STATUS_TOO_MANY_REQUESTS = 429; |
|
84 | + const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; |
|
85 | + const STATUS_INTERNAL_SERVER_ERROR = 500; |
|
86 | + const STATUS_NOT_IMPLEMENTED = 501; |
|
87 | + const STATUS_BAD_GATEWAY = 502; |
|
88 | + const STATUS_SERVICE_UNAVAILABLE = 503; |
|
89 | + const STATUS_GATEWAY_TIMEOUT = 504; |
|
90 | + const STATUS_HTTP_VERSION_NOT_SUPPORTED = 505; |
|
91 | + const STATUS_VARIANT_ALSO_NEGOTIATES = 506; |
|
92 | + const STATUS_INSUFFICIENT_STORAGE = 507; |
|
93 | + const STATUS_LOOP_DETECTED = 508; |
|
94 | + const STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509; |
|
95 | + const STATUS_NOT_EXTENDED = 510; |
|
96 | + const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511; |
|
97 | 97 | } |
@@ -1,6 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - |
|
4 | 3 | * |
5 | 4 | * @author Roeland Jago Douma <[email protected]> |
6 | 5 | * |
@@ -32,14 +31,14 @@ discard block |
||
32 | 31 | * @since 9.1.0 |
33 | 32 | */ |
34 | 33 | class OCSForbiddenException extends OCSException { |
35 | - /** |
|
36 | - * OCSForbiddenException constructor. |
|
37 | - * |
|
38 | - * @param string $message |
|
39 | - * @param Exception|null $previous |
|
40 | - * @since 9.1.0 |
|
41 | - */ |
|
42 | - public function __construct($message = '', Exception $previous = null) { |
|
43 | - parent::__construct($message, Http::STATUS_FORBIDDEN, $previous); |
|
44 | - } |
|
34 | + /** |
|
35 | + * OCSForbiddenException constructor. |
|
36 | + * |
|
37 | + * @param string $message |
|
38 | + * @param Exception|null $previous |
|
39 | + * @since 9.1.0 |
|
40 | + */ |
|
41 | + public function __construct($message = '', Exception $previous = null) { |
|
42 | + parent::__construct($message, Http::STATUS_FORBIDDEN, $previous); |
|
43 | + } |
|
45 | 44 | } |
@@ -1,6 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - |
|
4 | 3 | * |
5 | 4 | * @author Roeland Jago Douma <[email protected]> |
6 | 5 | * |
@@ -32,15 +31,15 @@ discard block |
||
32 | 31 | * @since 9.1.0 |
33 | 32 | */ |
34 | 33 | class OCSBadRequestException extends OCSException { |
35 | - /** |
|
36 | - * OCSBadRequestException constructor. |
|
37 | - * |
|
38 | - * @param string $message |
|
39 | - * @param Exception|null $previous |
|
40 | - * @since 9.1.0 |
|
41 | - */ |
|
42 | - public function __construct($message = '', Exception $previous = null) { |
|
43 | - parent::__construct($message, Http::STATUS_BAD_REQUEST, $previous); |
|
44 | - } |
|
34 | + /** |
|
35 | + * OCSBadRequestException constructor. |
|
36 | + * |
|
37 | + * @param string $message |
|
38 | + * @param Exception|null $previous |
|
39 | + * @since 9.1.0 |
|
40 | + */ |
|
41 | + public function __construct($message = '', Exception $previous = null) { |
|
42 | + parent::__construct($message, Http::STATUS_BAD_REQUEST, $previous); |
|
43 | + } |
|
45 | 44 | |
46 | 45 | } |