2015-03-26 13:44:34 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
|
|
|
* @author Florin Peter <github@florin-peter.de>
|
|
|
|
* @author Joas Schilling <nickvergessen@owncloud.com>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Robin Appelman <icewind@owncloud.com>
|
|
|
|
* @author Sam Tuke <mail@samtuke.com>
|
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
2013-05-07 18:17:38 +04:00
|
|
|
// Add CSS stylesheet
|
2013-05-30 01:13:45 +04:00
|
|
|
\OC_Util::addStyle('files_encryption', 'settings-personal');
|
|
|
|
|
|
|
|
$tmpl = new OCP\Template('files_encryption', 'settings-personal');
|
2012-08-02 12:39:30 +04:00
|
|
|
|
2013-05-01 21:18:31 +04:00
|
|
|
$user = \OCP\USER::getUser();
|
2014-05-12 18:30:39 +04:00
|
|
|
$view = new \OC\Files\View('/');
|
2014-12-03 18:52:44 +03:00
|
|
|
$util = new \OCA\Files_Encryption\Util($view, $user);
|
|
|
|
$session = new \OCA\Files_Encryption\Session($view);
|
2013-06-03 17:27:31 +04:00
|
|
|
|
2013-09-02 13:26:11 +04:00
|
|
|
$privateKeySet = $session->getPrivateKey() !== false;
|
2013-09-02 13:34:28 +04:00
|
|
|
// did we tried to initialize the keys for this session?
|
2013-09-02 13:26:11 +04:00
|
|
|
$initialized = $session->getInitialized();
|
2013-05-01 21:18:31 +04:00
|
|
|
|
2014-02-13 19:28:49 +04:00
|
|
|
$recoveryAdminEnabled = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryAdminEnabled');
|
2013-05-01 21:18:31 +04:00
|
|
|
$recoveryEnabledForUser = $util->recoveryEnabledForUser();
|
|
|
|
|
2013-06-05 15:51:28 +04:00
|
|
|
$result = false;
|
2013-05-01 21:18:31 +04:00
|
|
|
|
2013-06-05 15:51:28 +04:00
|
|
|
if ($recoveryAdminEnabled || !$privateKeySet) {
|
2012-08-02 12:39:30 +04:00
|
|
|
|
2013-06-05 15:51:28 +04:00
|
|
|
\OCP\Util::addscript('files_encryption', 'settings-personal');
|
|
|
|
|
|
|
|
$tmpl->assign('recoveryEnabled', $recoveryAdminEnabled);
|
|
|
|
$tmpl->assign('recoveryEnabledForUser', $recoveryEnabledForUser);
|
|
|
|
$tmpl->assign('privateKeySet', $privateKeySet);
|
2013-09-02 13:26:11 +04:00
|
|
|
$tmpl->assign('initialized', $initialized);
|
2013-06-05 15:51:28 +04:00
|
|
|
|
|
|
|
$result = $tmpl->fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
2012-08-02 12:39:30 +04:00
|
|
|
|