settings-personal.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Sam Tuke <samtuke@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. // Add CSS stylesheet
  9. \OC_Util::addStyle('files_encryption', 'settings-personal');
  10. $tmpl = new OCP\Template('files_encryption', 'settings-personal');
  11. $user = \OCP\USER::getUser();
  12. $view = new \OC_FilesystemView('/');
  13. $util = new \OCA\Encryption\Util($view, $user);
  14. $session = new \OCA\Encryption\Session($view);
  15. $privateKeySet = ($session->getPrivateKey() !== false) ? true : false;
  16. $recoveryAdminEnabled = OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
  17. $recoveryEnabledForUser = $util->recoveryEnabledForUser();
  18. $result = false;
  19. if ($recoveryAdminEnabled || !$privateKeySet) {
  20. \OCP\Util::addscript('files_encryption', 'settings-personal');
  21. \OCP\Util::addScript('settings', 'personal');
  22. $tmpl->assign('recoveryEnabled', $recoveryAdminEnabled);
  23. $tmpl->assign('recoveryEnabledForUser', $recoveryEnabledForUser);
  24. $tmpl->assign('privateKeySet', $privateKeySet);
  25. $result = $tmpl->fetchPage();
  26. }
  27. return $result;