Cause message subject to show in page title when message view is loaded in its own...
[squirrelmail.git] / functions / page_header.php
index 25638faa90cbadcb013a348a93795a730f134314..339035ea55f846458cae61d61964f3530794d91d 100644 (file)
@@ -181,6 +181,13 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
         if (!empty($output)) trigger_error('A plugin on the "generic_header" hook has attempted to output directly to the browser', E_USER_ERROR);
     }
 
+    // Add message subject to page title (should only have an effect when loaded in its own browser window/tab)
+    // TODO: For search page, could add " - Search: $what" or something like that
+    global $message;
+    if (!empty($message) && !empty($message->rfc822_header) && !empty($message->rfc822_header->subject))
+        // decodeHeader() should already encode the output, so no sm_encode_html_special_chars()
+        $title .= ' - ' . decodeHeader($message->rfc822_header->subject);
+
     $header_tags .= $xtra;
     $oTemplate->assign('page_title', $title);