summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib/ThemingDefaults.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/lib/ThemingDefaults.php')
-rw-r--r--apps/theming/lib/ThemingDefaults.php35
1 files changed, 34 insertions, 1 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 7b846919db3..0314b06b849 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -28,6 +28,7 @@ namespace OCA\Theming;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
+use OCP\Files\IRootFolder;
class ThemingDefaults extends \OC_Defaults {
@@ -38,6 +39,8 @@ class ThemingDefaults extends \OC_Defaults {
private $l;
/** @var IURLGenerator */
private $urlGenerator;
+ /** @var IRootFolder */
+ private $rootFolder;
/** @var string */
private $name;
/** @var string */
@@ -58,12 +61,14 @@ class ThemingDefaults extends \OC_Defaults {
public function __construct(IConfig $config,
IL10N $l,
IURLGenerator $urlGenerator,
- \OC_Defaults $defaults
+ \OC_Defaults $defaults,
+ IRootFolder $rootFolder
) {
parent::__construct();
$this->config = $config;
$this->l = $l;
$this->urlGenerator = $urlGenerator;
+ $this->rootFolder = $rootFolder;
$this->name = $defaults->getName();
$this->url = $defaults->getBaseUrl();
@@ -114,6 +119,34 @@ class ThemingDefaults extends \OC_Defaults {
}
/**
+ * Themed logo url
+ *
+ * @return string
+ */
+ public function getLogo() {
+ $logo = $this->config->getAppValue('theming', 'logoMime');
+ if(!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) {
+ return $this->urlGenerator->imagePath('core','logo.svg');
+ } else {
+ return $this->urlGenerator->linkToRoute('theming.Theming.getLogo');
+ }
+ }
+
+ /**
+ * Themed background image url
+ *
+ * @return string
+ */
+ public function getBackground() {
+ $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime');
+ if(!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) {
+ return $this->urlGenerator->imagePath('core','background.jpg');
+ } else {
+ return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground');
+ }
+ }
+
+ /**
* Increases the cache buster key
*/
private function increaseCacheBuster() {