Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-05-17 22:16:03 +0300
committerGitHub <noreply@github.com>2018-05-17 22:16:03 +0300
commit9236c20a28dd9558d1577ebfd7c7ea9202ca70bb (patch)
treee6d84fdcbbde8af5bae264db7f58a5a833c7c78e /apps/theming/lib
parent8696651cfb0370bc6b1e4bcc70ffd4fa1d2b65bd (diff)
parentfeff9f5bd1f776ade18ec8e196553730ef408a54 (diff)
Merge pull request #9437 from nextcloud/feature/noid/imprint
allow to specify a link to a legal notice
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.php14
3 files changed, 26 insertions, 0 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index e4a8f0b5036..dd7bf4bb04d 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -161,6 +161,16 @@ class ThemingController extends Controller {
]);
}
break;
+ case 'imprintUrl':
+ if (strlen($value) > 500) {
+ return new DataResponse([
+ 'data' => [
+ 'message' => $this->l10n->t('The given legal notice address is too long'),
+ ],
+ 'status' => 'error'
+ ]);
+ }
+ break;
case 'slogan':
if (strlen($value) > 500) {
return new DataResponse([
@@ -408,6 +418,7 @@ class ThemingController extends Controller {
url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ',
slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ',
color: ' . json_encode($this->themingDefaults->getColorPrimary()) . ',
+ imprintUrl: ' . json_encode($this->themingDefaults->getImprintUrl()) . ',
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 7c937f19790..ef296688ed2 100644
--- a/apps/theming/lib/Settings/Admin.php
+++ b/apps/theming/lib/Settings/Admin.php
@@ -84,6 +84,7 @@ class Admin implements ISettings {
'canThemeIcons' => $this->themingDefaults->shouldReplaceIcons(),
'iconDocs' => $this->urlGenerator->linkToDocs('admin-theming-icons'),
'images' => $this->imageManager->getCustomImages(),
+ 'imprintUrl' => $this->themingDefaults->getImprintUrl(),
];
return new TemplateResponse('theming', 'settings-admin', $parameters, '');
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 2e6b667b1f6..d2f57471242 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -141,12 +141,26 @@ class ThemingDefaults extends \OC_Defaults {
return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan));
}
+ public function getImprintUrl() {
+ return $this->config->getAppValue('theming', 'imprintUrl', '');
+ }
+
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>';
+ }
+
return $footer;
}