Przeglądaj źródła

Add favicon and ability for admins to use their own by setting in config_local.php (see documentation in config/config_local.php)

pdontthink 6 lat temu
rodzic
commit
da08b38ebd
3 zmienionych plików z 27 dodań i 2 usunięć
  1. 10 0
      config/config_local.example.php
  2. 3 0
      doc/ChangeLog
  3. 14 2
      functions/page_header.php

+ 10 - 0
config/config_local.example.php

@@ -136,4 +136,14 @@
  * sm_validate_security_token() (only relevant when
  * $use_expiring_security_tokens is enabled).
  * 
+ * $head_tag_extra can be used to add custom tags inside
+ * the <head> section of *ALL* pages.  The string
+ * "###SM BASEURI###" will be replaced with the base URI
+ * for this SquirrelMail installation.  This may be used,
+ * for example, to add custom favicon tags.  If this
+ * setting is empty here, SquirrelMail will add a favicon
+ * tag by default.  If you want to retain the default favicon
+ * while using this setting, you must include the following
+ * as part of this setting:
+ * $head_tag_extra = '<link rel="shortcut icon" href="###SM BASEURI###favicon.ico">...<YOUR CONTENT HERE>...';
  */

+ 3 - 0
doc/ChangeLog

@@ -420,6 +420,9 @@ Version 1.5.2 - SVN
   - Sanitize user-supplied attachment filenames (thanks to Florian
     Grunow for reporting this issue) [CVE-2018-8741]
   - Changed anti-CSRF security token lifetime to be session-based.
+  - Added favicon and ability for admins to use their own by setting
+    $head_tag_extra in config_local.php (see documentation in
+    config/config_local.php)
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------

+ 14 - 2
functions/page_header.php

@@ -37,7 +37,8 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
     }
     global $custom_css, $pageheader_sent, $theme, $theme_default, $text_direction,
         $default_fontset, $chosen_fontset, $default_fontsize, $chosen_fontsize, 
-        $chosen_theme, $chosen_theme_path, $user_themes, $user_theme_default;
+        $chosen_theme, $chosen_theme_path, $user_themes, $user_theme_default,
+        $head_tag_extra;
 
     // add no cache headers here
     //
@@ -79,7 +80,18 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
     $oTemplate->assign('frames', $frames);
     $oTemplate->assign('lang', $squirrelmail_language);
 
-    $header_tags .= "<meta name=\"robots\" content=\"noindex,nofollow\" />\n";
+    $header_tags .= "<meta name=\"robots\" content=\"noindex,nofollow\" />\n"
+
+    // For adding a favicon or anything else that should be inserted in *ALL* <head> for *ALL* documents,
+    // define $head_tag_extra in config/config_local.php
+    // The string "###SM BASEURI###" will be replaced with the base URI for this SquirrelMail installation.
+    // When not defined, a default is provided that displays the default favicon.ico.
+    // If you override this and still want to use the default favicon.ico, you'll have to include the following
+    // following in your $head_tag_extra string:
+    // $head_tag_extra = '<link rel="shortcut icon" href="###SM BASEURI###favicon.ico">...<YOUR CONTENT HERE>...';
+    //
+    . (empty($head_tag_extra) ? '<link rel="shortcut icon" href="' . sqm_baseuri() . 'favicon.ico">'
+    : str_replace('###SM BASEURI###', sqm_baseuri(), $head_tag_extra));
 
     $used_fontset = (!empty($chosen_fontset) ? $chosen_fontset : $default_fontset);
     $used_fontsize = (!empty($chosen_fontsize) ? $chosen_fontsize : $default_fontsize);