diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-04-03 17:24:51 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-04-03 20:41:14 +0200 |
commit | e68f7771860952e9eeaab8d47bd168595a7c5731 (patch) | |
tree | 535b5569875cf6bde7115499a811fded33385198 /lib/Controller | |
parent | 186eb31de2b2d9d39edd99a585faeee44849a317 (diff) |
Use PSR-4 naming for classes
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Controller')
-rw-r--r-- | lib/Controller/PageController.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php new file mode 100644 index 00000000..3ade020c --- /dev/null +++ b/lib/Controller/PageController.php @@ -0,0 +1,53 @@ +<?php +/** + * Nextcloud - contacts + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Hendrik Leppelsack <hendrik@leppelsack.de> + * @copyright Hendrik Leppelsack 2015 + */ + +namespace OCA\Contacts\Controller; + +use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Controller; + +class PageController extends Controller { + + + private $userId; + + public function __construct($AppName, IRequest $request, $UserId){ + parent::__construct($AppName, $request); + $this->userId = $UserId; + } + + /** + * CAUTION: the @Stuff turns off security checks; for this page no admin is + * required and no CSRF check. If you don't know what CSRF is, read + * it up in the docs or you might create a security hole. This is + * basically the only required method to add this exemption, don't + * add it to any other method if you don't exactly know what it does + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function index() { + $params = ['user' => $this->userId]; + return new TemplateResponse('contacts', 'main', $params); // templates/main.php + } + + /** + * Simply method that posts back the payload of the request + * @NoAdminRequired + */ + public function doEcho($echo) { + return new DataResponse(['echo' => $echo]); + } + + +} |