diff options
Diffstat (limited to 'apps/theming/lib')
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 11 | ||||
-rw-r--r-- | apps/theming/lib/Settings/Admin.php | 1 | ||||
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 14 |
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; } |