page_header.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. ** page_header.php
  4. **
  5. ** Prints the page header (duh)
  6. **
  7. **/
  8. session_start();
  9. $page_header_php = true;
  10. if (!isset($prefs_php))
  11. include ("../functions/prefs.php");
  12. if (!isset($i18n_php))
  13. include ("../functions/i18n.php");
  14. if (!isset($plugin_php))
  15. include ("../functions/plugin.php");
  16. // Check to see if gettext is installed
  17. if (function_exists("_")) {
  18. // Setting the language to use for gettext if it is not English
  19. // (the default language) or empty.
  20. $squirrelmail_language = getPref ($data_dir, $username, "language");
  21. if ($squirrelmail_language != "en" && $squirrelmail_language != "") {
  22. putenv("LC_ALL=$squirrelmail_language");
  23. bindtextdomain("squirrelmail", "../locale/");
  24. textdomain("squirrelmail");
  25. $default_charset = $languages[$squirrelmail_language]["CHARSET"];
  26. }
  27. } else {
  28. function _($string) {
  29. return $string;
  30. }
  31. }
  32. // This is done to ensure that the character set is correct.
  33. if ($default_charset != "")
  34. header ("Content-Type: text/html; charset=$default_charset");
  35. function displayHtmlHeader ($title="SquirrelMail") {
  36. global $theme_css;
  37. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
  38. echo "\n\n";
  39. echo "<HTML>\n";
  40. echo "<HEAD>\n";
  41. if ($theme_css != "") {
  42. printf ('<LINK REL="stylesheet" TYPE="text/css" HREF="%s">',
  43. $theme_css);
  44. echo "\n";
  45. }
  46. do_hook ("generic_header");
  47. echo "<TITLE>$title</TITLE>\n";
  48. echo "</HEAD>\n\n";
  49. }
  50. function displayInternalLink ($path, $text, $target="") {
  51. global $base_uri;
  52. if ($target != "")
  53. $target = " target=\"$target\"";
  54. echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
  55. }
  56. function displayPageHeader($color, $mailbox) {
  57. displayHtmlHeader ($color);
  58. printf('<BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
  59. $color[8], $color[4], $color[7], $color[7], $color[7]);
  60. echo "\n\n";
  61. /** Here is the header and wrapping table **/
  62. $shortBoxName = readShortMailboxName($mailbox, ".");
  63. $shortBoxName = sqStripSlashes($shortBoxName);
  64. echo "<A NAME=pagetop></A>\n";
  65. echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n";
  66. echo " <TR BGCOLOR=\"$color[9]\">\n";
  67. echo " <TD ALIGN=left WIDTH=\"30%\"><b>\n";
  68. displayInternalLink ("src/signout.php", _("Sign Out"), "_top");
  69. echo " </b></TD><TD ALIGN=right WIDTH=\"70%\">\n";
  70. echo " <div align=right>" . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B></div>\n";
  71. echo " </TD>\n";
  72. echo " </TR>\n";
  73. echo "</TABLE>\n\n";
  74. echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n";
  75. echo " <TR>\n";
  76. echo " <TD ALIGN=left WIDTH=\"99%\">\n";
  77. $urlMailbox = urlencode($mailbox);
  78. displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), "right");
  79. echo "&nbsp;&nbsp;\n";
  80. displayInternalLink ("src/addressbook.php", _("Addresses"), "right");
  81. echo "&nbsp;&nbsp;\n";
  82. displayInternalLink ("src/folders.php", _("Folders"), "right");
  83. echo "&nbsp;&nbsp;\n";
  84. displayInternalLink ("src/options.php", _("Options"), "right");
  85. echo "&nbsp;&nbsp;\n";
  86. displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), "right");
  87. echo "&nbsp;&nbsp;\n";
  88. displayInternalLink ("src/help.php", _("Help"), "right");
  89. echo "&nbsp;&nbsp;\n";
  90. do_hook("menuline");
  91. echo " </TD><TD ALIGN=right nowrap WIDTH=\"1%\">\n";
  92. echo " <A HREF=\"http://www.squirrelmail.org/index.php3?from=1\" TARGET=\"_top\">SquirrelMail</A>\n";
  93. echo " </TD>\n";
  94. echo " </TR>\n";
  95. echo "</TABLE>\n\n";
  96. }
  97. ?>