2012-08-02 08:39:30 +00:00
|
|
|
<?php
|
2012-08-02 11:55:23 +00:00
|
|
|
/**
|
2013-02-05 17:06:15 +00:00
|
|
|
* Copyright (c) 2013 Sam Tuke <samtuke@owncloud.com>
|
2012-08-02 11:55:23 +00:00
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
2012-08-02 08:39:30 +00:00
|
|
|
|
2013-05-07 14:17:38 +00:00
|
|
|
// Add CSS stylesheet
|
2013-05-29 21:13:45 +00:00
|
|
|
\OC_Util::addStyle('files_encryption', 'settings-personal');
|
|
|
|
|
|
|
|
$tmpl = new OCP\Template('files_encryption', 'settings-personal');
|
2012-08-02 08:39:30 +00:00
|
|
|
|
2013-05-01 17:18:31 +00:00
|
|
|
$user = \OCP\USER::getUser();
|
2013-05-29 21:13:45 +00:00
|
|
|
$view = new \OC_FilesystemView('/');
|
|
|
|
$util = new \OCA\Encryption\Util($view, $user);
|
2013-06-03 13:27:31 +00:00
|
|
|
$session = new \OCA\Encryption\Session($view);
|
|
|
|
|
|
|
|
$privateKeySet = ($session->getPrivateKey() !== false) ? true : false;
|
2013-05-01 17:18:31 +00:00
|
|
|
|
2013-05-29 21:13:45 +00:00
|
|
|
$recoveryAdminEnabled = OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
|
2013-05-01 17:18:31 +00:00
|
|
|
$recoveryEnabledForUser = $util->recoveryEnabledForUser();
|
|
|
|
|
2013-06-05 11:51:28 +00:00
|
|
|
$result = false;
|
2013-05-01 17:18:31 +00:00
|
|
|
|
2013-06-05 11:51:28 +00:00
|
|
|
if ($recoveryAdminEnabled || !$privateKeySet) {
|
2012-08-02 08:39:30 +00:00
|
|
|
|
2013-06-05 11:51:28 +00:00
|
|
|
\OCP\Util::addscript('files_encryption', 'settings-personal');
|
|
|
|
\OCP\Util::addScript('settings', 'personal');
|
|
|
|
|
|
|
|
$tmpl->assign('recoveryEnabled', $recoveryAdminEnabled);
|
|
|
|
$tmpl->assign('recoveryEnabledForUser', $recoveryEnabledForUser);
|
|
|
|
$tmpl->assign('privateKeySet', $privateKeySet);
|
|
|
|
|
|
|
|
$result = $tmpl->fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
2012-08-02 08:39:30 +00:00
|
|
|
|