|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Nextcloud - passman |
|
4
|
|
|
* |
|
5
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
6
|
|
|
* later. See the COPYING file. |
|
7
|
|
|
* |
|
8
|
|
|
* @author Sander Brand <[email protected]> |
|
9
|
|
|
* @copyright Sander Brand 2016 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace OCA\Passman\Controller; |
|
13
|
|
|
|
|
14
|
|
|
use OCP\IRequest; |
|
15
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
|
16
|
|
|
use OCP\AppFramework\Http\DataResponse; |
|
17
|
|
|
use OCP\AppFramework\Controller; |
|
18
|
|
|
|
|
19
|
|
|
class PageController extends Controller { |
|
20
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
private $userId; |
|
23
|
|
|
|
|
24
|
|
|
public function __construct($AppName, IRequest $request, $UserId){ |
|
25
|
|
|
parent::__construct($AppName, $request); |
|
26
|
|
|
$this->userId = $UserId; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* CAUTION: the @Stuff turns off security checks; for this page no admin is |
|
31
|
|
|
* required and no CSRF check. If you don't know what CSRF is, read |
|
32
|
|
|
* it up in the docs or you might create a security hole. This is |
|
33
|
|
|
* basically the only required method to add this exemption, don't |
|
34
|
|
|
* add it to any other method if you don't exactly know what it does |
|
35
|
|
|
* |
|
36
|
|
|
* @NoAdminRequired |
|
37
|
|
|
* @NoCSRFRequired |
|
38
|
|
|
*/ |
|
39
|
1 |
|
public function index() { |
|
40
|
1 |
|
$params = ['user' => $this->userId]; |
|
41
|
1 |
|
return new TemplateResponse('passman', 'main', $params); // templates/main.php |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @NoAdminRequired |
|
47
|
|
|
* @NoCSRFRequired |
|
48
|
|
|
*/ |
|
49
|
1 |
|
public function bookmarklet($url='',$title='') { |
|
50
|
1 |
|
$params = array('url' => $url, 'title' => $title); |
|
51
|
1 |
|
return new TemplateResponse('passman', 'bookmarklet', $params); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @NoAdminRequired |
|
56
|
|
|
* @NoCSRFRequired |
|
57
|
|
|
* @PublicPage |
|
58
|
|
|
*/ |
|
59
|
1 |
|
public function publicSharePage() { |
|
60
|
1 |
|
return new TemplateResponse('passman', 'public_share'); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
} |