You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings-personal.php 2.1KB

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