summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-05-24 14:45:49 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-05-24 23:32:07 +0200
commit16c061818eceb2d5356030cfa620d256e7a8b284 (patch)
tree39fa6b40064eea212d62eae5eb482c6a89c36823 /apps/theming/lib
parenteefe256abc377ca9e6d43682d50fadebfcfed966 (diff)
downloadnextcloud-server-16c061818eceb2d5356030cfa620d256e7a8b284.tar.gz
nextcloud-server-16c061818eceb2d5356030cfa620d256e7a8b284.zip
also add a privacy link
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/Controller/ThemingController.php11
-rw-r--r--apps/theming/lib/Settings/Admin.php1
-rw-r--r--apps/theming/lib/ThemingDefaults.php37
3 files changed, 41 insertions, 8 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index dd7bf4bb04d..a834bb1c5ab 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -171,6 +171,16 @@ class ThemingController extends Controller {
]);
}
break;
+ case 'privacyUrl':
+ if (strlen($value) > 500) {
+ return new DataResponse([
+ 'data' => [
+ 'message' => $this->l10n->t('The given privacy policy address is too long'),
+ ],
+ 'status' => 'error'
+ ]);
+ }
+ break;
case 'slogan':
if (strlen($value) > 500) {
return new DataResponse([
@@ -419,6 +429,7 @@ class ThemingController extends Controller {
slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ',
color: ' . json_encode($this->themingDefaults->getColorPrimary()) . ',
imprintUrl: ' . json_encode($this->themingDefaults->getImprintUrl()) . ',
+ privacyUrl: ' . json_encode($this->themingDefaults->getPrivacyUrl()) . ',
inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())) . ',
cacheBuster: ' . json_encode($cacheBusterValue) . '
};
diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php
index ef296688ed2..6a95dd39d43 100644
--- a/apps/theming/lib/Settings/Admin.php
+++ b/apps/theming/lib/Settings/Admin.php
@@ -85,6 +85,7 @@ class Admin implements ISettings {
'iconDocs' => $this->urlGenerator->linkToDocs('admin-theming-icons'),
'images' => $this->imageManager->getCustomImages(),
'imprintUrl' => $this->themingDefaults->getImprintUrl(),
+ 'privacyUrl' => $this->themingDefaults->getPrivacyUrl(),
];
return new TemplateResponse('theming', 'settings-admin', $parameters, '');
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index d2f57471242..b61179b681e 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -145,20 +145,41 @@ class ThemingDefaults extends \OC_Defaults {
return $this->config->getAppValue('theming', 'imprintUrl', '');
}
+ public function getPrivacyUrl() {
+ return $this->config->getAppValue('theming', 'privacyUrl', '');
+ }
+
public function getShortFooter() {
$slogan = $this->getSlogan();
$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
' rel="noreferrer noopener">' .$this->getEntity() . '</a>'.
($slogan !== '' ? ' – ' . $slogan : '');
- $imprintUrl = (string)$this->getImprintUrl();
- if($imprintUrl !== ''
- && filter_var($imprintUrl, FILTER_VALIDATE_URL, [
- 'flags' => FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED
- ])
- ) {
- $footer .= '<br/><a href="' . $imprintUrl . '" class="legal" target="_blank"' .
- ' rel="noreferrer noopener">' . $this->l->t('Legal notice') . '</a>';
+ $links = [
+ [
+ 'text' => $this->l->t('Legal notice'),
+ 'url' => (string)$this->getImprintUrl()
+ ],
+ [
+ 'text' => $this->l->t('Privacy policy'),
+ 'url' => (string)$this->getPrivacyUrl()
+ ],
+ ];
+
+ $legalLinks = ''; $divider = '';
+ foreach($links as $link) {
+ if($link['url'] !== ''
+ && filter_var($link['url'], FILTER_VALIDATE_URL, [
+ 'flags' => FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED
+ ])
+ ) {
+ $legalLinks .= $divider . '<a href="' . $link['url'] . '" class="legal" target="_blank"' .
+ ' rel="noreferrer noopener">' . $link['text'] . '</a>';
+ $divider = ' · ';
+ }
+ }
+ if($legalLinks !== '' ) {
+ $footer .= '<br/>' . $legalLinks;
}
return $footer;