1
0

personal.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. * @author Lukas Reschke <lukas@owncloud.com>
  5. * @author Michael Gapczynski <GapczynskiM@gmail.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Vincent Petry <pvince81@owncloud.com>
  8. *
  9. * @copyright Copyright (c) 2015, ownCloud, Inc.
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program 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 Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. OCP\Util::addScript('files_external', 'settings');
  26. OCP\Util::addStyle('files_external', 'settings');
  27. $backends = OC_Mount_Config::getPersonalBackends();
  28. $mounts = OC_Mount_Config::getPersonalMountPoints();
  29. $hasId = true;
  30. foreach ($mounts as $mount) {
  31. if (!isset($mount['id'])) {
  32. // some mount points are missing ids
  33. $hasId = false;
  34. break;
  35. }
  36. }
  37. if (!$hasId) {
  38. $service = new \OCA\Files_external\Service\UserStoragesService(\OC::$server->getUserSession());
  39. // this will trigger the new storage code which will automatically
  40. // generate storage config ids
  41. $service->getAllStorages();
  42. // re-read updated config
  43. $mounts = OC_Mount_Config::getPersonalMountPoints();
  44. // TODO: use the new storage config format in the template
  45. }
  46. $tmpl = new OCP\Template('files_external', 'settings');
  47. $tmpl->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled());
  48. $tmpl->assign('isAdminPage', false);
  49. $tmpl->assign('mounts', $mounts);
  50. $tmpl->assign('dependencies', OC_Mount_Config::checkDependencies());
  51. $tmpl->assign('backends', $backends);
  52. return $tmpl->fetchPage();