2015-06-01 11:22:42 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
|
|
|
* @author Bjoern Schiessle <bjoern@schiessle.org>
|
2016-05-26 20:56:05 +03:00
|
|
|
* @author Björn Schießle <bjoern@schiessle.org>
|
2015-06-25 12:43:55 +03:00
|
|
|
* @author Jan-Christoph Borchardt <hey@jancborchardt.net>
|
2015-10-05 21:54:56 +03:00
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
2015-06-01 11:22:42 +03:00
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-04-18 19:17:08 +03:00
|
|
|
use OCA\FederatedFileSharing\AppInfo\Application;
|
|
|
|
|
2015-06-01 11:22:42 +03:00
|
|
|
\OC_Util::checkLoggedIn();
|
|
|
|
|
2016-04-18 19:17:08 +03:00
|
|
|
$l = \OC::$server->getL10N('federatedfilesharing');
|
|
|
|
|
2016-07-13 13:39:20 +03:00
|
|
|
$app = new Application();
|
2016-04-18 19:17:08 +03:00
|
|
|
$federatedShareProvider = $app->getFederatedShareProvider();
|
2015-06-02 15:12:47 +03:00
|
|
|
|
2015-08-25 17:05:57 +03:00
|
|
|
$isIE8 = false;
|
|
|
|
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
|
|
|
|
if (count($matches) > 0 && $matches[1] <= 9) {
|
|
|
|
$isIE8 = true;
|
|
|
|
}
|
|
|
|
|
2015-11-30 15:57:54 +03:00
|
|
|
$cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
|
2016-06-20 13:08:23 +03:00
|
|
|
$url = 'https://nextcloud.com/federation#' . $cloudID;
|
2016-08-25 13:54:31 +03:00
|
|
|
$logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
|
2017-04-07 23:42:43 +03:00
|
|
|
/** @var \OCP\Defaults $theme */
|
|
|
|
$theme = \OC::$server->query(\OCP\Defaults::class);
|
2017-03-28 02:37:47 +03:00
|
|
|
$color = $theme->getColorPrimary();
|
2016-08-25 13:54:31 +03:00
|
|
|
$textColor = "#ffffff";
|
|
|
|
if(\OC::$server->getAppManager()->isEnabledForUser("theming")) {
|
|
|
|
$logoPath = $theme->getLogo();
|
|
|
|
try {
|
|
|
|
$util = \OC::$server->query("\OCA\Theming\Util");
|
|
|
|
if($util->invertTextColor($color)) {
|
|
|
|
$textColor = "#000000";
|
|
|
|
}
|
|
|
|
} catch (OCP\AppFramework\QueryException $e) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-01 11:22:42 +03:00
|
|
|
|
2016-04-18 19:17:08 +03:00
|
|
|
$tmpl = new OCP\Template('federatedfilesharing', 'settings-personal');
|
|
|
|
$tmpl->assign('outgoingServer2serverShareEnabled', $federatedShareProvider->isOutgoingServer2serverShareEnabled());
|
2016-06-20 13:08:23 +03:00
|
|
|
$tmpl->assign('message_with_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]));
|
|
|
|
$tmpl->assign('message_without_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]));
|
2016-08-25 13:54:31 +03:00
|
|
|
$tmpl->assign('logoPath', $logoPath);
|
2015-06-02 15:12:47 +03:00
|
|
|
$tmpl->assign('reference', $url);
|
2015-06-01 11:22:42 +03:00
|
|
|
$tmpl->assign('cloudId', $cloudID);
|
2015-08-25 17:05:57 +03:00
|
|
|
$tmpl->assign('showShareIT', !$isIE8);
|
2016-08-25 13:54:31 +03:00
|
|
|
$tmpl->assign('color', $color);
|
|
|
|
$tmpl->assign('textColor', $textColor);
|
2015-06-01 11:22:42 +03:00
|
|
|
|
|
|
|
return $tmpl->fetchPage();
|