[Pkg-owncloud-commits] [owncloud] 260/457: show federated cloud id in the personal settings

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:06:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 6e5ed810644efd92eec394be5e1f6f202efe74e0
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Mon Jun 1 10:22:42 2015 +0200

    show federated cloud id in the personal settings
---
 apps/files_sharing/appinfo/app.php                 |  1 +
 apps/files_sharing/lib/helper.php                  | 16 +++++++++++
 apps/files_sharing/settings-personal.php           | 32 ++++++++++++++++++++++
 apps/files_sharing/templates/settings-personal.php | 12 ++++++++
 4 files changed, 61 insertions(+)

diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index 19d3b6c..c54038f 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -49,6 +49,7 @@ $application->registerMountProviders();
 $application->setupPropagation();
 
 \OCP\App::registerAdmin('files_sharing', 'settings-admin');
+\OCP\App::registerPersonal('files_sharing', 'settings-personal');
 
 \OCA\Files_Sharing\Helper::registerHooks();
 
diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php
index 05b0352..c767048 100644
--- a/apps/files_sharing/lib/helper.php
+++ b/apps/files_sharing/lib/helper.php
@@ -306,4 +306,20 @@ class Helper {
 		\OC::$server->getConfig()->setSystemValue('share_folder', $shareFolder);
 	}
 
+	/**
+	 * remove protocol from URL
+	 *
+	 * @param string $url
+	 * @return string
+	 */
+	public static function removeProtocolFromUrl($url) {
+		if (strpos($url, 'https://') === 0) {
+			return substr($url, strlen('https://'));
+		} else if (strpos($url, 'http://') === 0) {
+			return substr($url, strlen('http://'));
+		}
+
+		return $url;
+	}
+
 }
diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php
new file mode 100644
index 0000000..b9ae791
--- /dev/null
+++ b/apps/files_sharing/settings-personal.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * @author Björn Schießle <schiessle at owncloud.com>
+ * @author Morris Jobke <hey at morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @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/>
+ *
+ */
+
+\OC_Util::checkLoggedIn();
+
+$uid = \OC::$server->getUserSession()->getUser()->getUID();
+$server = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
+$cloudID = $uid . '@' . \OCA\Files_Sharing\Helper::removeProtocolFromUrl($server);
+
+$tmpl = new OCP\Template('files_sharing', 'settings-personal');
+$tmpl->assign('cloudId', $cloudID);
+
+return $tmpl->fetchPage();
diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php
new file mode 100644
index 0000000..a045b5d
--- /dev/null
+++ b/apps/files_sharing/templates/settings-personal.php
@@ -0,0 +1,12 @@
+<?php
+/** @var OC_L10N $l */
+/** @var array $_ */
+?>
+<div id="fileSharingSettings" class="section">
+	<h2><?php p($l->t('Federated Cloud'));?></h2>
+
+	<p>
+		Your Federated Cloud Id: <?php p($_['cloudId']); ?>
+	</p>
+
+</div>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list