settings-personal.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bjoern Schiessle <bjoern@schiessle.org>
  6. * @author Björn Schießle <bjoern@schiessle.org>
  7. * @author Jan-Christoph Borchardt <hey@jancborchardt.net>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. *
  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. use OCA\FederatedFileSharing\AppInfo\Application;
  26. \OC_Util::checkLoggedIn();
  27. $l = \OC::$server->getL10N('federatedfilesharing');
  28. $app = new Application();
  29. $federatedShareProvider = $app->getFederatedShareProvider();
  30. $isIE8 = false;
  31. preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
  32. if (count($matches) > 0 && $matches[1] <= 9) {
  33. $isIE8 = true;
  34. }
  35. $cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
  36. $url = 'https://nextcloud.com/federation#' . $cloudID;
  37. $logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
  38. $theme = \OC::$server->getThemingDefaults();
  39. $color = $theme->getMailHeaderColor();
  40. $textColor = "#ffffff";
  41. if(\OC::$server->getAppManager()->isEnabledForUser("theming")) {
  42. $logoPath = $theme->getLogo();
  43. try {
  44. $util = \OC::$server->query("\OCA\Theming\Util");
  45. if($util->invertTextColor($color)) {
  46. $textColor = "#000000";
  47. }
  48. } catch (OCP\AppFramework\QueryException $e) {
  49. }
  50. }
  51. $tmpl = new OCP\Template('federatedfilesharing', 'settings-personal');
  52. $tmpl->assign('outgoingServer2serverShareEnabled', $federatedShareProvider->isOutgoingServer2serverShareEnabled());
  53. $tmpl->assign('message_with_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]));
  54. $tmpl->assign('message_without_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]));
  55. $tmpl->assign('logoPath', $logoPath);
  56. $tmpl->assign('reference', $url);
  57. $tmpl->assign('cloudId', $cloudID);
  58. $tmpl->assign('showShareIT', !$isIE8);
  59. $tmpl->assign('color', $color);
  60. $tmpl->assign('textColor', $textColor);
  61. return $tmpl->fetchPage();