From 9777d3054451686e5d9493d336ad733bbb14438b 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/class_passwordRecovery.inc   |  1 +
 html/index.php                    |  1 +
 html/main.php                     |  1 -
 html/setup.php                    | 19 +++++--------------
 ihtml/themes/breezy/framework.tpl |  4 ++--
 ihtml/themes/breezy/headers.tpl   |  4 ++--
 6 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/html/class_passwordRecovery.inc b/html/class_passwordRecovery.inc
index 965dfeeca..d7bd3a5f3 100644
--- a/html/class_passwordRecovery.inc
+++ b/html/class_passwordRecovery.inc
@@ -354,6 +354,7 @@ class passwordRecovery extends standAlonePage {
     $lang = session::global_get('lang');
     $smarty->assign('lang', preg_replace('/_.*$/', '', $lang));
     $smarty->assign('rtl', Language::isRTL($lang));
+    $smarty->assign('title',        _('Password recovery'));
     $smarty->display(get_template_path('headers.tpl'));
 
     $smarty->assign('version',        FD_VERSION);
diff --git a/html/index.php b/html/index.php
index 1c1240d5a..38918fb6b 100644
--- a/html/index.php
+++ b/html/index.php
@@ -48,6 +48,7 @@ function displayLogin()
   $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)) {
diff --git a/html/main.php b/html/main.php
index d762e01ab..df88d5fb7 100644
--- a/html/main.php
+++ b/html/main.php
@@ -347,7 +347,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 7dd25566e..9167b8bee 100644
--- a/html/setup.php
+++ b/html/setup.php
@@ -104,29 +104,20 @@ $ui = new fake_userinfo();
 $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'));
-
-
-
-/* Set focus to the error button if we've an error message */
-$focus = "";
-if (session::is_set('errors') && session::get('errors') != "") {
-  $focus = '<script type="text/javascript">';
-  $focus .= 'document.forms[0].error_accept.focus();';
-  $focus .= '</script>';
-}
-
 $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 ba6b98d15..d3c3d2434 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 647391401..c41a3617a 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 $lang}lang="{$lang}" xml:lang="{$lang}"{/if} {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"/>
 
-- 
GitLab