diff options
author | Simon Rettberg | 2017-05-09 14:30:30 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-05-09 14:30:30 +0200 |
commit | 16dc9cfeea4bc060982f0b364ddaac98095ef654 (patch) | |
tree | e5c5eaa88f17840ee86371780a9550193ceb8a4a /inc | |
parent | [locationinfo] Fix more undefined offset access (diff) | |
download | slx-admin-16dc9cfeea4bc060982f0b364ddaac98095ef654.tar.gz slx-admin-16dc9cfeea4bc060982f0b364ddaac98095ef654.tar.xz slx-admin-16dc9cfeea4bc060982f0b364ddaac98095ef654.zip |
[webinterface] Allow customizing page title prefix and logo bgcolor
Diffstat (limited to 'inc')
-rw-r--r-- | inc/render.inc.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/inc/render.inc.php b/inc/render.inc.php index 5515c659..c34c285a 100644 --- a/inc/render.inc.php +++ b/inc/render.inc.php @@ -40,6 +40,11 @@ class Render self::$mustache = new Mustache_Engine($options); } + private static function cssEsc($str) + { + return str_replace(array('"', '&', '<', '>'), array('\\000022', '\\000026', '\\00003c', '\\00003e'), $str); + } + /** * Output the buffered, generated page */ @@ -47,12 +52,24 @@ class Render { Header('Content-Type: text/html; charset=utf-8'); $modules = array_reverse(Module::getActivated()); + $title = Property::get('page-title-prefix', ''); + $bgcolor = Property::get('logo-background', ''); + if (!empty($bgcolor) || !empty($title)) { + self::$header .= '<style type="text/css">' . "\n"; + if (!empty($bgcolor)) { + self::$header .= ".navbar-header { background-color: $bgcolor; }"; + } + if (!empty($title)) { + self::$header .= '#navbar-sub:after { content: "' . self::cssEsc($title) . '";margin:0 }'; + } + self::$header .= "\n</style>"; + } ob_start('ob_gzhandler'); echo '<!DOCTYPE html> <html> <head> - <title>', self::$title, RENDER_DEFAULT_TITLE, '</title> + <title>', $title, self::$title, RENDER_DEFAULT_TITLE, '</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> |