You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
9.0 KiB

  1. <?php
  2. // Project: Web Reference Database (refbase) <http://www.refbase.net>
  3. // Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
  4. // original author(s).
  5. //
  6. // This code is distributed in the hope that it will be useful,
  7. // but WITHOUT ANY WARRANTY. Please see the GNU General Public
  8. // License for more details.
  9. //
  10. // File: ./includes/header.inc.php
  11. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/includes/header.inc.php $
  12. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  13. //
  14. // Created: 28-Jul-02, 11:21
  15. // Modified: $Date: 2015-01-08 01:10:31 +0000 (Thu, 08 Jan 2015) $
  16. // $Author: karnesky $
  17. // $Revision: 1404 $
  18. // This is the header include file.
  19. // It contains functions that provide the HTML header
  20. // as well as the visible header that gets displayed on every page.
  21. // --------------------------------------------------------------------
  22. // Inserts the HTML <head>...</head> block as well as the initial <body> tag:
  23. //
  24. // TODO: include OpenSearch elements in HTML header
  25. // (see examples at <http://www.opensearch.org/Specifications/OpenSearch/1.1#Response_metadata_in_HTML.2FXHTML>)
  26. function displayHTMLhead($pageTitle, $metaRobots, $metaDescription, $additionalMeta, $includeJavaScript, $includeJavaScriptFile, $viewType, $rssURLArray)
  27. {
  28. global $officialDatabaseName; // these variables are defined in 'ini.inc.php'
  29. global $contentTypeCharset;
  30. global $defaultStyleSheet;
  31. global $printStyleSheet;
  32. global $mobileStyleSheet;
  33. global $useVisualEffects;
  34. global $databaseBaseURL;
  35. global $databaseKeywords;
  36. global $defaultFeedFormat;
  37. ?>
  38. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  39. "http://www.w3.org/TR/html4/loose.dtd">
  40. <html>
  41. <head profile="http://a9.com/-/spec/opensearch/1.1/">
  42. <title><?php echo $pageTitle; ?></title>
  43. <meta name="date" content="<?php echo date('d-M-y'); ?>">
  44. <meta name="robots" content="<?php echo $metaRobots; ?>">
  45. <meta name="description" lang="en" content="<?php echo $metaDescription; ?>">
  46. <meta name="keywords" lang="en" content="<?php echo $databaseKeywords; ?>"><?php
  47. if (!empty($additionalMeta))
  48. echo $additionalMeta;
  49. ?>
  50. <meta http-equiv="content-language" content="<?php echo getUserLanguage(); ?>">
  51. <meta http-equiv="content-type" content="text/html; charset=<?php echo $contentTypeCharset; ?>">
  52. <meta http-equiv="Content-Style-Type" content="text/css"><?php
  53. if (preg_match("/^Print$/i", $viewType))
  54. {
  55. ?>
  56. <link rel="stylesheet" href="<?php echo $printStyleSheet; ?>" type="text/css" title="CSS Definition"><?php
  57. }
  58. elseif (preg_match("/^Mobile$/i", $viewType))
  59. {
  60. ?>
  61. <link rel="stylesheet" href="<?php echo $mobileStyleSheet; ?>" type="text/css" title="CSS Definition"><?php
  62. }
  63. else
  64. {
  65. ?>
  66. <link rel="stylesheet" href="<?php echo $defaultStyleSheet; ?>" type="text/css" title="CSS Definition"><?php
  67. }
  68. if (!empty($rssURLArray) AND isset($_SESSION['user_permissions']) AND preg_match("/allow_rss_feeds/", $_SESSION['user_permissions'])) // if some RSS URLs were specified AND the 'user_permissions' session variable contains 'allow_rss_feeds'...
  69. {
  70. foreach ($rssURLArray as $rssURL)
  71. {
  72. if ($defaultFeedFormat == "Atom XML")
  73. $feedContentType = "application/atom+xml";
  74. else // RSS XML
  75. $feedContentType = "application/rss+xml";
  76. // ...include a link tag pointing to a dynamic RSS feed for the current query:
  77. ?>
  78. <link rel="alternate" type="<?php echo $feedContentType; ?>" href="<?php echo $databaseBaseURL . $rssURL['href']; ?>" title="<?php echo $rssURL['title']; ?>"><?php
  79. }
  80. }
  81. ?>
  82. <link rel="unapi-server" type="application/xml" title="unAPI" href="<?php echo $databaseBaseURL; ?>unapi.php">
  83. <link rel="search" type="application/opensearchdescription+xml" title="<?php echo encodeHTML($officialDatabaseName); ?>" href="<?php echo $databaseBaseURL; ?>opensearch.php?operation=explain"><?php
  84. if ($includeJavaScript OR (isset($_SESSION['userAutoCompletions']) AND ($_SESSION['userAutoCompletions'] == "yes")) OR ($useVisualEffects == "yes"))
  85. {
  86. // ...include common refbase JavaScript functions:
  87. ?>
  88. <script language="JavaScript" type="text/javascript" src="javascript/common.js"></script><?php
  89. }
  90. if ((isset($_SESSION['userAutoCompletions']) AND ($_SESSION['userAutoCompletions'] == "yes")) OR ($useVisualEffects == "yes"))
  91. {
  92. // ...include the Prototype & script.aculo.us JavaScript frameworks:
  93. ?>
  94. <script language="JavaScript" type="text/javascript" src="javascript/prototype.js"></script>
  95. <script language="JavaScript" type="text/javascript" src="javascript/scriptaculous.js?load=effects,controls"></script><?php
  96. }
  97. if (!empty($includeJavaScriptFile))
  98. {
  99. // ...include additional JavaScript functions:
  100. ?>
  101. <script language="JavaScript" type="text/javascript" src="<?php echo $includeJavaScriptFile; ?>"></script><?php
  102. }
  103. ?>
  104. </head>
  105. <body><?php
  106. }
  107. // --------------------------------------------------------------------
  108. // Displays the visible header:
  109. function showPageHeader($HeaderString)
  110. {
  111. global $officialDatabaseName; // these variables are defined in 'ini.inc.php'
  112. global $hostInstitutionAbbrevName;
  113. global $hostInstitutionName;
  114. global $hostInstitutionURL;
  115. global $helpResourcesURL;
  116. global $logoImageURL;
  117. global $logoImageWidth;
  118. global $logoImageHeight;
  119. global $loginWelcomeMsg; // these variables are globally defined in function 'showLogin()' in 'include.inc.php'
  120. global $loginStatus;
  121. global $loginLinks;
  122. global $displayType;
  123. global $query;
  124. global $queryURL;
  125. global $showQuery;
  126. global $showLinks;
  127. global $showRows;
  128. global $citeStyle;
  129. global $citeOrder;
  130. global $loc; // '$loc' is made globally available in 'core.php'
  131. ?>
  132. <table class="pageheader" align="center" border="0" cellpadding="0" cellspacing="10" width="95%" summary="This holds the title logo and info">
  133. <tr>
  134. <td valign="bottom" rowspan="2" align="left" width="<?php echo $logoImageWidth + 26; ?>"><a href="<?php echo $hostInstitutionURL; ?>"><img src="<?php echo $logoImageURL; ?>" border="0" alt="<?php echo encodeHTML($hostInstitutionAbbrevName); ?> Home" title="<?php echo encodeHTML($hostInstitutionName); ?>" width="<?php echo $logoImageWidth; ?>" height="<?php echo $logoImageHeight; ?>"></a></td>
  135. <td>
  136. <h2><?php echo encodeHTML($officialDatabaseName); ?></h2>
  137. <span class="smallup">
  138. <a href="index.php"<?php echo addAccessKey("attribute", "home"); ?> title="<?php echo $loc["LinkTitle_Home"] . addAccessKey("title", "home"); ?>"><?php echo $loc["Home"]; ?></a>&nbsp;|&nbsp;
  139. <a href="show.php?records=all"<?php echo addAccessKey("attribute", "show_all"); ?> title="<?php echo $loc["LinkTitle_ShowAll"] . addAccessKey("title", "show_all"); ?>"><?php echo $loc["ShowAll"]; ?></a>&nbsp;|&nbsp;
  140. <a href="simple_search.php"<?php echo addAccessKey("attribute", "search"); ?> title="<?php echo $loc["LinkTitle_SimpleSearch"] . addAccessKey("title", "search"); ?>"><?php echo $loc["SimpleSearch"]; ?></a>&nbsp;|&nbsp;
  141. <a href="advanced_search.php"<?php echo addAccessKey("attribute", "adv_search"); ?> title="<?php echo $loc["LinkTitle_AdvancedSearch"] . addAccessKey("title", "adv_search"); ?>"><?php echo $loc["AdvancedSearch"]; ?></a><?php
  142. // -------------------------------------------------------
  143. if (isset($_SESSION['user_permissions']) AND preg_match("/allow_add/", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains 'allow_add'...
  144. {
  145. // ... include a link to 'record.php?recordAction=add...':
  146. ?>
  147. &nbsp;|&nbsp;<a href="record.php?recordAction=add"<?php echo addAccessKey("attribute", "add"); ?> title="<?php echo $loc["LinkTitle_AddRecord"] . addAccessKey("title", "add"); ?>"><?php echo $loc["AddRecord"]; ?></a><?php
  148. }
  149. // -------------------------------------------------------
  150. if (isset($_SESSION['user_permissions']) AND preg_match("/allow_import|allow_batch_import/", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains either 'allow_import' or 'allow_batch_import'...
  151. {
  152. // ... include a link to 'import.php':
  153. ?>
  154. &nbsp;|&nbsp;<a href="import.php"<?php echo addAccessKey("attribute", "import"); ?> title="<?php echo $loc["LinkTitle_Import"] . addAccessKey("title", "import"); ?>"><?php echo $loc["Import"]; ?></a><?php
  155. }
  156. // -------------------------------------------------------
  157. ?>
  158. </span>
  159. </td>
  160. <td class="small" valign="bottom" rowspan="2" align="right">
  161. <div id="loginInfo">
  162. <div id="loginStatus"><?php echo $loginStatus; ?></div>
  163. <div id="loginName"><?php echo $loginWelcomeMsg; ?></div>
  164. <div id="loginLinks"><?php echo $loginLinks; ?></div>
  165. </div>
  166. <div id="queryrefs">
  167. <?php echo buildQuickSearchElements($query, $queryURL, $showQuery, $showLinks, $showRows, $citeStyle, $citeOrder, $displayType); ?>
  168. </div>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td><?php echo encodeHTML($HeaderString); ?></td>
  173. </tr>
  174. </table>
  175. <hr class="pageheader" align="center" width="95%"><?php
  176. }
  177. // --------------------------------------------------------------------
  178. ?>