1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* sysPass |
4
|
|
|
* |
5
|
|
|
* @author nuxsmin |
6
|
|
|
* @link https://syspass.org |
7
|
|
|
* @copyright 2012-2020, Rubén Domínguez nuxsmin@$syspass.org |
8
|
|
|
* |
9
|
|
|
* This file is part of sysPass. |
10
|
|
|
* |
11
|
|
|
* sysPass is free software: you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU General Public License as published by |
13
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
14
|
|
|
* (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* sysPass is distributed in the hope that it will be useful, |
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19
|
|
|
* GNU General Public License for more details. |
20
|
|
|
* |
21
|
|
|
* You should have received a copy of the GNU General Public License |
22
|
|
|
* along with sysPass. If not, see <http://www.gnu.org/licenses/>. |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace SP\Util; |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
use SP\Bootstrap; |
29
|
|
|
use SP\Config\ConfigData; |
30
|
|
|
use SP\Core\Acl\Acl; |
31
|
|
|
use SP\Http\Uri; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Class Link |
35
|
|
|
* |
36
|
|
|
* @package SP\Util |
37
|
|
|
*/ |
38
|
|
|
final class Link |
39
|
|
|
{ |
40
|
|
|
/** |
41
|
|
|
* @param int $itemId |
42
|
|
|
* @param int $actionId |
43
|
|
|
* @param ConfigData $configData |
44
|
|
|
* |
45
|
|
|
* @param bool $useUI |
46
|
|
|
* |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
|
|
public static function getDeepLink(int $itemId, int $actionId, ConfigData $configData, bool $useUI = false) |
50
|
|
|
{ |
51
|
|
|
$route = Acl::getActionRoute($actionId) . '/' . $itemId; |
52
|
|
|
|
53
|
|
|
if ($useUI) { |
54
|
|
|
$baseUrl = ($configData->getApplicationUrl() ?: Bootstrap::$WEBURI) . '/index.php'; |
55
|
|
|
} else { |
56
|
|
|
$baseUrl = ($configData->getApplicationUrl() ?: Bootstrap::$WEBURI) . Bootstrap::$SUBURI; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
$uri = new Uri($baseUrl); |
60
|
|
|
$uri->addParam('r', $route); |
61
|
|
|
|
62
|
|
|
return $uri->getUriSigned($configData->getPasswordSalt()); |
63
|
|
|
} |
64
|
|
|
} |