From 18befe37309fbc6f06899b44c4abeb01006af9a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Mon, 1 Oct 2018 13:45:44 +0200
Subject: [PATCH] :sparkles: feat(core) Set title tag to a meaningful value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It will be the same as headline when available. It’s also set in login
 and recovery pages.

issue #5898
---
 html/main.php                      | 1 -
 html/setup.php                     | 9 +++++----
 ihtml/themes/breezy/framework.tpl  | 4 ++--
 ihtml/themes/breezy/headers.tpl    | 4 ++--
 include/class_passwordRecovery.inc | 1 +
 include/login/class_LoginPost.inc  | 1 +
 6 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/html/main.php b/html/main.php
index fce474b9c..b24011e86 100644
--- a/html/main.php
+++ b/html/main.php
@@ -301,7 +301,6 @@ if (isset($_POST['_channel_'])) {
 } else {
   $smarty->assign("channel", "");
 }
-$smarty->assign ("title", "FusionDirectory");
 
 if (class_available('Game')) {
   $smarty->assign('game_screen', Game::run());
diff --git a/html/setup.php b/html/setup.php
index 62dd14c35..b3765be91 100644
--- a/html/setup.php
+++ b/html/setup.php
@@ -103,19 +103,20 @@ $ui = new userinfoNoAuth('setup');
 $display = "";
 require_once("../setup/main.inc");
 
-$smarty->assign("date", date("l, dS F Y H:i:s O"));
-$header = $smarty->fetch(get_template_path('headers.tpl'));
-
 $focus = '<script type="text/javascript">';
 $focus .= 'next_msg_dialog();';
 $focus .= '</script>';
 
 /* show web frontend */
 $setup = session::global_get('setup');
+
+$smarty->assign('date',           date('l, dS F Y H:i:s O'));
+$smarty->assign('headline',       $setup->get_header_text());
+$header = $smarty->fetch(get_template_path('headers.tpl'));
+
 $smarty->assign("contents",       $display.$setup->get_bottom_html());
 $smarty->assign("navigation",     $setup->get_navigation_html());
 $smarty->assign("headline_image", $setup->get_header_image());
-$smarty->assign("headline",       $setup->get_header_text());
 $smarty->assign("focus",          $focus);
 $smarty->assign('CSRFtoken',      CSRFProtection::getToken());
 $smarty->assign("msg_dialogs",    msg_dialog::get_dialogs());
diff --git a/ihtml/themes/breezy/framework.tpl b/ihtml/themes/breezy/framework.tpl
index 4230424f9..9234dbb91 100644
--- a/ihtml/themes/breezy/framework.tpl
+++ b/ihtml/themes/breezy/framework.tpl
@@ -14,11 +14,11 @@
           <img src="geticon.php?context=actions&amp;icon=application-exit&amp;size=22" alt="Sign out"/>&nbsp;{t}Sign out{/t}
         </a>
         <a class="plugtop">
-          <img src="{$headline_image|escape}" alt="{t}{$headline}{/t}"/>{t}{$headline}{/t}
+          <img src="{$headline_image|escape}" alt="{t}{$headline|escape}{/t}"/>{t}{$headline|escape}{/t}
         </a>
       </div>
       <div id="header-right">
-        <a><span class="optional">{t}Signed in:{/t} </span><b>{$username}</b></a>
+        <a><span class="optional">{t}Signed in:{/t} </span><b>{$username|escape}</b></a>
         {if ($sessionLifetime > 0)}
         <div class="logout-label">
           <canvas id="sTimeout" width="22" height="22" title="{$sessionLifetime}|{t}Session expires in %d!{/t}"></canvas>
diff --git a/ihtml/themes/breezy/headers.tpl b/ihtml/themes/breezy/headers.tpl
index 9753b1eae..77b10eb2f 100644
--- a/ihtml/themes/breezy/headers.tpl
+++ b/ihtml/themes/breezy/headers.tpl
@@ -2,11 +2,11 @@
 <html xmlns="http://www.w3.org/1999/xhtml" {if $rtl}dir="rtl" class="rtl"{else}class="ltr"{/if}>
 
 <head>
-  <title>{if isset($title)}{$title}{else}FusionDirectory{/if}</title>
+  <title>FusionDirectory{if isset($title)} - {$title|escape}{elseif isset($headline)} - {$headline|escape}{/if}</title>
 
   <meta charset="utf-8"/>
 
-  <meta name="description" content="FusionDirectory - Login"/>
+  <meta name="description" content="FusionDirectory - Your Infrastructure Manager"/>
   <meta name="author" lang="en" content="FusionDirectory Project"/>
   <meta name="viewport" content="width=device-width"/>
 
diff --git a/include/class_passwordRecovery.inc b/include/class_passwordRecovery.inc
index c6dcddd4d..4df57dee3 100644
--- a/include/class_passwordRecovery.inc
+++ b/include/class_passwordRecovery.inc
@@ -116,6 +116,7 @@ class passwordRecovery extends standAlonePage {
 
     $smarty->append('js_files',     'include/pwdStrength.js');
     $smarty->append('css_files',    get_template_path('login.css'));
+    $smarty->assign('title',        _('Password recovery'));
     $smarty->display(get_template_path('headers.tpl'));
 
     $smarty->assign('step',           $this->step);
diff --git a/include/login/class_LoginPost.inc b/include/login/class_LoginPost.inc
index e1d9ff8f4..970db4f19 100644
--- a/include/login/class_LoginPost.inc
+++ b/include/login/class_LoginPost.inc
@@ -83,6 +83,7 @@ class LoginPost extends LoginMethod
     $smarty->assign('revision',   FD_VERSION);
     $smarty->assign('year',       date('Y'));
     $smarty->append('css_files',  get_template_path('login.css'));
+    $smarty->assign('title',      _('Sign in'));
 
     /* Some error to display? */
     if (!isset($message)) {
-- 
GitLab