page_header.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. ** page_header.php
  4. **
  5. ** Prints the page header (duh)
  6. **
  7. ** $Id$
  8. **/
  9. if (defined('page_header_php'))
  10. return;
  11. define('page_header_php', true);
  12. include('../src/validate.php');
  13. include("../functions/prefs.php");
  14. include("../functions/i18n.php");
  15. include("../functions/plugin.php");
  16. // Check to see if gettext is installed
  17. $headers_sent=set_up_language(getPref($data_dir, $username, "language"));
  18. // This is done to ensure that the character set is correct.
  19. // But first checks whether we have already sent headers
  20. // with charset when we were setting up the user language.
  21. // Otherwise user ends up with the default charset overriding
  22. // his selected one.
  23. if (!$headers_sent && $default_charset != "")
  24. header ("Content-Type: text/html; charset=$default_charset");
  25. function displayHtmlHeader ($title="SquirrelMail") {
  26. global $theme_css;
  27. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
  28. echo "\n\n";
  29. echo "<HTML>\n";
  30. echo "<HEAD>\n";
  31. if ($theme_css != "") {
  32. printf ('<LINK REL="stylesheet" TYPE="text/css" HREF="%s">',
  33. $theme_css);
  34. echo "\n";
  35. }
  36. do_hook ("generic_header");
  37. echo "<TITLE>$title</TITLE>\n";
  38. echo "</HEAD>\n\n";
  39. }
  40. function displayInternalLink ($path, $text, $target="") {
  41. global $base_uri;
  42. if ($target != "")
  43. $target = " target=\"$target\"";
  44. echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
  45. }
  46. function displayPageHeader($color, $mailbox) {
  47. displayHtmlHeader ();
  48. printf('<BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
  49. $color[8], $color[4], $color[7], $color[7], $color[7]);
  50. echo "\n\n";
  51. /** Here is the header and wrapping table **/
  52. $shortBoxName = readShortMailboxName($mailbox, ".");
  53. echo "<A NAME=pagetop></A>\n";
  54. echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n";
  55. echo " <TR BGCOLOR=\"$color[9]\">\n";
  56. echo " <TD ALIGN=left WIDTH=\"30%\"><b>\n";
  57. displayInternalLink ("src/signout.php", _("Sign Out"), "_top");
  58. echo " </b></TD><TD ALIGN=right WIDTH=\"70%\">\n";
  59. echo " <div align=right>" . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B></div>\n";
  60. echo " </TD>\n";
  61. echo " </TR>\n";
  62. echo "</TABLE>\n\n";
  63. echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n";
  64. echo " <TR>\n";
  65. echo " <TD ALIGN=left WIDTH=\"99%\">\n";
  66. $urlMailbox = urlencode($mailbox);
  67. displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), "right");
  68. echo "&nbsp;&nbsp;\n";
  69. displayInternalLink ("src/addressbook.php", _("Addresses"), "right");
  70. echo "&nbsp;&nbsp;\n";
  71. displayInternalLink ("src/folders.php", _("Folders"), "right");
  72. echo "&nbsp;&nbsp;\n";
  73. displayInternalLink ("src/options.php", _("Options"), "right");
  74. echo "&nbsp;&nbsp;\n";
  75. displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), "right");
  76. echo "&nbsp;&nbsp;\n";
  77. displayInternalLink ("src/help.php", _("Help"), "right");
  78. echo "&nbsp;&nbsp;\n";
  79. do_hook("menuline");
  80. echo " </TD><TD ALIGN=right nowrap WIDTH=\"1%\">\n";
  81. echo " <A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n";
  82. echo " </TD>\n";
  83. echo " </TR>\n";
  84. echo "</TABLE>\n\n";
  85. }
  86. ?>