From e68f7771860952e9eeaab8d47bd168595a7c5731 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 3 Apr 2017 17:24:51 +0200 Subject: Use PSR-4 naming for classes Signed-off-by: Christoph Wurst --- lib/Controller/PageController.php | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 lib/Controller/PageController.php (limited to 'lib/Controller') 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 @@ + + * @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]); + } + + +} -- cgit v1.2.3