2016-09-09 23:36:35 +08:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Nextcloud - passman
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later. See the COPYING file.
|
|
|
|
*
|
|
|
|
* @author Sander Brand <brantje@gmail.com>
|
|
|
|
* @copyright Sander Brand 2016
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\Passman\Controller;
|
|
|
|
|
|
|
|
use OCP\IRequest;
|
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
|
|
|
use OCP\AppFramework\Http\DataResponse;
|
2016-09-10 01:05:18 +08:00
|
|
|
use OCP\AppFramework\Controller;
|
2016-09-09 23:36:35 +08:00
|
|
|
|
2016-09-10 01:05:18 +08:00
|
|
|
class PageController extends Controller {
|
2016-09-09 23:36:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
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('passman', 'main', $params); // templates/main.php
|
|
|
|
}
|
2016-09-10 01:05:18 +08:00
|
|
|
|
|
|
|
|
2016-10-01 23:21:24 +08:00
|
|
|
/**
|
|
|
|
* @NoAdminRequired
|
|
|
|
* @NoCSRFRequired
|
|
|
|
*/
|
|
|
|
public function bookmarklet($url='',$title='') {
|
|
|
|
$params = array('url' => $url, 'label' => $title);
|
2016-10-02 01:26:58 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @NoAdminRequired
|
|
|
|
* @NoCSRFRequired
|
|
|
|
* @PublicPage
|
|
|
|
*/
|
|
|
|
public function publicSharePage($shareKey) {
|
|
|
|
return new TemplateResponse('passman', 'public_share');
|
2016-10-01 23:21:24 +08:00
|
|
|
}
|
2016-09-10 01:05:18 +08:00
|
|
|
|
2016-09-09 23:36:35 +08:00
|
|
|
}
|