1<?php 2############################################################################### 3# Gregarius - A PHP based RSS aggregator. 4# Copyright (C) 2003 - 2006 Marco Bonetti 5# 6############################################################################### 7# This program is free software and open source software; you can redistribute 8# it and/or modify it under the terms of the GNU General Public License as 9# published by the Free Software Foundation; either version 2 of the License, 10# or (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, but WITHOUT 13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15# more details. 16# 17# You should have received a copy of the GNU General Public License along 18# with this program; if not, write to the Free Software Foundation, Inc., 19# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit 20# http://www.gnu.org/licenses/gpl.html 21# 22############################################################################### 23# E-mail: mbonetti at gmail dot com 24# Web page: http://gregarius.net/ 25# 26############################################################################### 27 28///// HEADER WRAPPERS ///// 29function rss_header_charset() { 30 return (getConfig('rss.output.encoding') ? getConfig('rss.output.encoding') : DEFAULT_OUTPUT_ENCODING); 31} 32 33function rss_header_title($escaped=true) { 34 return ($escaped?$GLOBALS['rss']->header->docTitle:$GLOBALS['rss']->header->rawTitle); 35} 36 37function rss_header_robotmeta() { 38 return ((array_key_exists('expand', $_REQUEST) || 39 array_key_exists('collapse', $_REQUEST) || 40 array_key_exists('fcollapse', $_REQUEST) || 41 array_key_exists('fexpand', $_REQUEST) || 42 array_key_exists('dbg', $_REQUEST)) ? 'noindex,follow' : getConfig('rss.config.robotsmeta')); 43} 44 45function rss_header_autorefreshtime() { 46 return $GLOBALS['rss']->header->redirectTimeout; 47} 48 49function rss_header_autorefreshurl() { 50 return $GLOBALS['rss']->header->redirectUrl; 51} 52 53function rss_header_links() { 54 return $GLOBALS['rss']->header->links; 55} 56 57function rss_header_javascripts() { 58 return $GLOBALS['rss']->header->javascriptFiles; 59} 60 61function rss_header_onLoadAction() { 62 if (($action = $GLOBALS['rss']->header->onLoadAction) != "") { 63 return " onload=\"$action\" "; 64 } 65 return ""; 66} 67 68function rss_main_header() { 69 if(isset($GLOBALS['rss']->header)) { 70 71 $GLOBALS['rss']->header->render(); 72 } 73} 74 75function rss_main_div_id() { 76 if ($GLOBALS['rss']->mainDivId) { 77 return " id=\"".$GLOBALS['rss']->mainDivId ."\" "; 78 } 79 return null; 80} 81 82function rss_main_object() { 83 rss_plugin_hook("rss.plugins.before.mainobject",null); 84 foreach($GLOBALS['rss'] -> mainObject as $o) { 85 $o->render(); 86 } 87} 88 89function rss_main_feeds() { 90 switch ($GLOBALS['rss']->sideMenu->activeElement) { 91 92 case 'CatList': 93 rss_require('cls/categories.php'); 94 $v = new CatList(); 95 $v -> render(); 96 break; 97 98 case 'TagList': 99 rss_require('cls/taglist.php'); 100 $GLOBALS['rss']-> tagList = new TagList('item'); 101 $GLOBALS['rss']-> tagList -> render(); 102 break; 103 104 105 case 'FeedList': 106 default: 107 if ($GLOBALS['rss']-> feedList) { 108 $GLOBALS['rss']-> feedList-> render(); 109 } 110 break; 111 112 } 113 114} 115 116function rss_main_sidemenu($cntr) { 117 if ($GLOBALS['rss']-> sideMenu) { 118 $GLOBALS['rss'] -> sideMenu -> setContainer($cntr); 119 $GLOBALS['rss']-> sideMenu -> render(); 120 } 121} 122 123function rss_main_title() { 124 return makeTitle($GLOBALS['rss']->header->rawTitle); 125} 126 127function rss_main_footer() { 128 $f=$GLOBALS['rss']->getTemplateFile('footer.php'); 129 rss_require($f); 130} 131 132function rss_footer_last_modif() { 133 $ts = getLastModif(); 134 return ($ts ? rss_locale_date ("%c", $ts) : __('Never')); 135} 136 137function rss_header_logininfo($showLoginBox = true) { 138 139 $ret = "<div id=\"loginfo\">\n"; 140 141 if (rss_user_level() > RSS_USER_LEVEL_NOLEVEL) { 142 $ret .= sprintf(__('Logged in as <strong>%s</strong>'), rss_user_name()) 143 ." | <a href=\"".getPath()."?logout\">".__('Logout')."</a>\n"; 144 } else if(true == $showLoginBox) { 145 $ret .= __('Not logged in') 146 ." | <a href=\"#\" onclick=\"miniloginform(); return false;\">".__('Login')."</a>"; 147 $ret .= "<div style=\"display:none\" id=\"loginformcontainer\">" 148 . '<form ' . 'onsubmit="return loginHandler();" ' . 'method="post" action="'.getPath().'">' 149 . '<div style="display:inline"><input style=" width:50px;" name="username" id="username" type="text" /></div>' 150 . '<div style="display:inline"><input style=" width:50px;" name="password" id="password" type="password" /></div>' 151 . '<div style="display:inline"><input type="submit" value="'.__('Login').'" /></div>' 152 . '</form>' 153 ."</div>\n"; 154 } 155 $ret .= "</div>\n"; 156 return $ret; 157} 158 159function rss_header_doclang() { 160 return isset($GLOBALS['rssl10n']) && $GLOBALS['rssl10n']->getISOLang() ? $GLOBALS['rssl10n']->getISOLang():'en'; 161} 162?> 163