PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/inc/html.php

https://github.com/eharmon/yelly
PHP | 187 lines | 125 code | 30 blank | 32 comment | 7 complexity | 03f7c30553f5e1e7a0baf5a9bc56c038 MD5 | raw file
  1. <?php
  2. /*
  3. lylina news aggregator
  4. Copyright (C) 2005 Andreas Gohr
  5. Copyright (C) 2006-2007 Eric Harmon
  6. Contains code from 'lilina':
  7. Copyright (C) 2004-2005 Panayotis Vryonis
  8. lylina is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12. lylina is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with lylina; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. define('NL',"\n");
  21. /**
  22. * Prints the global message array
  23. *
  24. * @author Andreas Gohr <andi@splitbrain.org>
  25. */
  26. function html_msgarea() {
  27. global $MSG;
  28. if(!isset($MSG)) return;
  29. foreach($MSG as $msg) {
  30. print '<div class="'.$msg['lvl'].'"><img src="img/information-trans.png" alt="" /> ';
  31. print $msg['msg'];
  32. print '</div>';
  33. }
  34. }
  35. function html_head($news_page, $hours = -1) {
  36. global $conf;
  37. global $lang;
  38. global $UID;
  39. print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  40. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.NL;
  41. ?>
  42. <html xmlns="http://www.w3.org/1999/xhtml">
  43. <head profile="http://gmpg.org/xfn/1">
  44. <title><? echo $conf['page_title']; ?></title>
  45. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['CHARSET']; ?>" />
  46. <meta http-equiv="Pragma" content="no-cache" />
  47. <meta http-equiv="Expires" content="-1" />
  48. <!--[if lt IE 7]>
  49. <script language="JavaScript" type="text/javascript" src="js/ie7-standard-p.js"></script>
  50. <![endif]-->
  51. <link rel="stylesheet" type="text/css" href="style/<?php echo $conf['page_style']; ?>" media="screen" />
  52. <link rel="stylesheet" type="text/css" href="style/mobile.css" media="handheld" />
  53. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
  54. <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.php/<?php echo md5($UID) . '/' . $UID . '.xml'; ?>" />
  55. <script language="JavaScript" type="text/javascript">
  56. <!--
  57. var showDetails = false;
  58. var markID = '' ;
  59. //-->
  60. </script>
  61. <script language="JavaScript" type="text/javascript" src="js/engine.js"></script>
  62. <?php if($news_page) { ?>
  63. <script language="JavaScript" type="text/javascript">
  64. <!--
  65. var feed = "rss.php/<?= md5($UID) . '/' . $UID . '.xml' ?>";
  66. var hours = <?php echo "$hours"; ?>;
  67. //-->
  68. </script>
  69. <!-- <script language="JavaScript" type="text/javascript" src="js/ajax.js"></script> -->
  70. <?php } ?>
  71. </head>
  72. <body onload="visible_mode(showDetails)">
  73. <?php
  74. html_navigation($news_page);
  75. html_msgarea();
  76. print '<div id="main">';
  77. }
  78. function html_foot() {
  79. global $lang;
  80. global $version;
  81. global $UID;
  82. print '</div>';
  83. // We're sure you'd love to remove the 'powered by' logo, but please consider leaving it here to support the project!
  84. print '<div id="footer">'.$lang['powered'].' <a href="http://lylina.sf.net"><img src="img/logo-trans.png" alt="lylina" /></a> v'.$version;
  85. print '<div class="feedico"><a href="rss.php/' . md5($UID) . '/' . $UID . '.xml'. '"><img src="img/feed-trans.png" alt="RSS feed" /></a> </div>';
  86. print '</div>';
  87. print '</body>';
  88. print '</html>';
  89. }
  90. function html_navigation($news_page) {
  91. global $conf;
  92. global $UID;
  93. global $lang;
  94. print '<div id="navigation">'.NL;
  95. print '<a href="index.php"><img src="'.$conf['page_logo'].'" alt="'.$conf['page_title'].'" /></a> ';
  96. print '<img src="img/spacer.gif" width="10" height="1" alt="" class="spacer" />';
  97. print '<img src="img/calendar-trans.png" alt="" /> ';
  98. print '<a href="index.php?hours=4">';
  99. print $lang['4hours'];
  100. print '</a>'.NL;
  101. print '<a href="index.php?hours=8">';
  102. print $lang['8hours'] . ' (' . $lang['default'] . ')';
  103. print '</a>'.NL;
  104. print '<a href="index.php?hours=16">';
  105. print $lang['16hours'];
  106. print '</a>'.NL;
  107. print '<a href="index.php?hours=24">';
  108. print $lang['1day'];
  109. print '</a>'.NL;
  110. print '<a href="index.php?hours=168">';
  111. print $lang['1week'];
  112. print '</a>'.NL;
  113. print '<a href="javascript:forceRefresh()">Refresh</a>';
  114. if($news_page == true) {
  115. print '<img src="img/spacer.gif" width="50" height="1" alt="" class="spacer" />';
  116. print '<img src="img/toggle-trans.png" alt="" /> ';
  117. print '<a href="javascript:visible_mode(true);">';
  118. print $lang['expand'];
  119. print '</a>'.NL;
  120. print '<a href="javascript:visible_mode(false);">';
  121. print $lang['collapse'];
  122. print '</a>'.NL;
  123. }
  124. if($UID) {
  125. print '<img src="img/spacer.gif" width="50" height="1" alt="" class="spacer" />';
  126. print '<img src="img/preferences-trans.png" alt="" /> ';
  127. print '<a href="edit.php">';
  128. print $lang['preferences'];
  129. print '</a>'.NL;
  130. print '<img src="img/spacer.gif" width="50" height="1" alt="" class="spacer" />';
  131. print '<img src="img/logout-trans.png" alt="" /> ';
  132. print '<a href="index.php?logout=1">';
  133. print $lang['logout'];
  134. print '</a>'.NL;
  135. }
  136. print '<img src="img/spacer.gif" width="50" height="1" alt="" class="spacer" />';
  137. if(!$UID) {
  138. print '<form method="post" action="index.php" class="login">'.NL;
  139. print '<img src="img/users-trans.png" alt="user" /> <input type="text" name="u" />'.NL;
  140. print '<img src="img/password-trans.png" alt="password" /> <input type="password" name="p" />'.NL;
  141. print '<input type="submit" value="'.$lang['login'].'" />'.NL;
  142. print '</form>'.NL;
  143. } else {
  144. print '<form method="get" action="search.php" class="login">'.NL;
  145. print '<img src="img/search-trans.png" alt="search" /> <input type="text" name="q" />'.NL;
  146. print '<input type="submit" value="'.$lang['search'].'" />'.NL;
  147. print '</form>'.NL;
  148. }
  149. print '</div>';
  150. }
  151. //Setup VIM: ex: et ts=4 enc=utf-8 :
  152. ?>