Posted on: 10/07/05 02:26pm
By: Anonymous (Stu)
Posted on: 10/07/05 03:41pm
By: beewee
Posted on: 10/07/05 04:23pm
By: drshakagee
function csstest_siteHeader( $what = 'menu', $pagetitle = '', $headercode = '' ) { global $_CONF, $_TABLES, $_USER, $LANG01, $LANG_BUTTONS, $LANG_CHARSET, $_IMAGE_TYPE, $topic, $_COM_VERBOSE; $centerblockid = 'centerblocks-noblocks'; $header = new Template( $_CONF['path_layout'] ); $header->set_file( array( 'header' => 'header.thtml', 'menuitem' => 'menuitem.thtml', 'menuitem_last' => 'menuitem_last.thtml', 'menuitem_none' => 'menuitem_none.thtml', 'leftblocks' => 'leftblocks.thtml', 'rightblocks' => 'rightblocks.thtml' )); // get topic if not on home page if( !isset( $_GET['topic'] )) { if( isset( $_GET['story'] )) { $sid = COM_applyFilter( $_GET['story'] ); } elseif( isset( $_GET['sid'] )) { $sid = COM_applyFilter( $_GET['sid'] ); } elseif( isset( $_POST['story'] )) { $sid = COM_applyFilter( $_POST['story'] ); } if( !empty( $sid )) { $topic = DB_getItem( $_TABLES['stories'], 'tid', "sid='$sid'" ); } } else { $topic = COM_applyFilter( $_GET['topic'] ); } $feed_url = ''; if( $_CONF['backend'] == 1 ) // add feed-link to header if applicable { $feedpath = $_CONF['rdf_file']; $pos = strrpos( $feedpath, '/' ); $feed = substr( $feedpath, 0, $pos + 1 ); $baseurl = substr_replace( $feed, $_CONF['site_url'], 0, strlen( $_CONF['path_html'] ) - 1 ); $sql = 'SELECT format, filename, title FROM ' . $_TABLES['syndication'] . " WHERE (header_tid = 'all')"; if( !empty( $topic )) { $sql .= " OR (header_tid = '" . addslashes( $topic ) . "')"; } $result = DB_query( $sql ); $numRows = DB_numRows( $result ); for( $i = 0; $i < $numRows; $i++ ) { $A = DB_fetchArray( $result ); if ( !empty( $A['filename'] )) { $format = explode( '-', $A['format'] ); $format_type = strtolower( $format[0] ); $format_name = ucwords( $format[0] ); $feed_url .= '<link rel="alternate" type="application/' . $format_type . '+xml" title="' . $format_name . ' Feed: ' . $A['title'] . '" href="' . $baseurl . $A['filename'] . '">' . LB; } } } $header->set_var( 'feed_url', $feed_url ); if( empty( $pagetitle ) && isset( $_CONF['pagetitle'] )) { $pagetitle = $_CONF['pagetitle']; } if( empty( $pagetitle )) { if( empty( $topic )) { $pagetitle = $_CONF['site_slogan']; } else { $pagetitle = stripslashes( DB_getItem( $_TABLES['topics'], 'topic', "tid = '$topic'" )); } } if( !empty( $pagetitle )) { $pagetitle = ' - ' . $pagetitle; } $header->set_var( 'page_title', $_CONF['site_name'] . $pagetitle ); if (isset ($_CONF['advanced_editor']) && ($_CONF['advanced_editor'] == 1) && file_exists ($_CONF['path_layout'] . 'advanced_editor_header.thtml')) { $header->set_file( 'editor' , 'advanced_editor_header.thtml'); $header->parse( 'advanced_editor', 'editor' ); } else { $header->set_var( 'advanced_editor', '' ); } $header->set_var( 'background_image', $_CONF['layout_url'] . '/images/bg.' . $_IMAGE_TYPE ); $header->set_var( 'site_url', $_CONF['site_url'] ); $header->set_var( 'layout_url', $_CONF['layout_url'] ); $header->set_var( 'site_mail', "mailto:{$_CONF['site_mail']}" ); $header->set_var( 'site_name', $_CONF['site_name'] ); $header->set_var( 'site_slogan', $_CONF['site_slogan'] ); $rdf = substr_replace( $_CONF['rdf_file'], $_CONF['site_url'], 0, strlen( $_CONF['path_html'] ) - 1 ); $header->set_var( 'rdf_file', $rdf ); $header->set_var( 'rss_url', $rdf ); $msg = $LANG01[67] . ' ' . $_CONF['site_name']; if( !empty( $_USER['username'] )) { $msg .= ', ' . $_USER['username']; } $curtime = COM_getUserDateTimeFormat(); $header->set_var( 'welcome_msg', $msg ); $header->set_var( 'datetime', $curtime[0] ); $header->set_var( 'site_logo', $_CONF['layout_url'] . '/images/logo.' . $_IMAGE_TYPE ); $header->set_var( 'css_url', $_CONF['layout_url'] . '/style.css' ); $header->set_var( 'layout_url', $_CONF['layout_url'] ); $header->set_var( 'theme', $_CONF['theme'] ); if( empty( $LANG_CHARSET )) { $charset = $_CONF['default_charset']; if( empty( $charset )) { $charset = 'iso-8859-1'; } } else { $charset = $LANG_CHARSET; } $header->set_var( 'charset', $charset ); // Now add variables for buttons like e.g. those used by the Yahoo theme $header->set_var( 'button_home', $LANG_BUTTONS[1] ); $header->set_var( 'button_contact', $LANG_BUTTONS[2] ); $header->set_var( 'button_contribute', $LANG_BUTTONS[3] ); $header->set_var( 'button_calendar', $LANG_BUTTONS[6] ); $header->set_var( 'button_sitestats', $LANG_BUTTONS[7] ); $header->set_var( 'button_personalize', $LANG_BUTTONS[8] ); $header->set_var( 'button_search', $LANG_BUTTONS[9] ); $header->set_var( 'button_advsearch', $LANG_BUTTONS[10] ); $header->set_var( 'button_directory', $LANG_BUTTONS[11] ); // Get plugin menu options $plugin_menu = PLG_getMenuItems(); if( $_COM_VERBOSE ) { COM_errorLog( 'num plugin menu items in header = ' . count( $plugin_menu ), 1 ); } // Now add nested template for menu items COM_renderMenu( $header, $plugin_menu ); if( count( $plugin_menu ) == 0 ) { $header->parse( 'plg_menu_elements', 'menuitem_none', true ); } else { for( $i = 1; $i <= count( $plugin_menu ); $i++ ) { $header->set_var( 'menuitem_url', current( $plugin_menu )); $header->set_var( 'menuitem_text', key( $plugin_menu )); if( $i == count( $plugin_menu )) { $header->parse( 'plg_menu_elements', 'menuitem_last', true ); } else { $header->parse( 'plg_menu_elements', 'menuitem', true ); } next( $plugin_menu ); } } if( $_CONF['left_blocks_in_footer'] == 1 ) { $header->set_var( 'geeklog_blocks', '' ); $header->set_var( 'left_blocks', '' ); } else { $lblocks = ''; /* Check if an array has been passed that includes the name of a plugin * function or custom function * This can be used to take control over what blocks are then displayed */ if( is_array( $what )) { $function = $what[0]; if( function_exists( $function )) { $lblocks = $function( $what[1], 'left' ); } } else if( $what <> 'none' ) { // Now show any blocks -- need to get the topic if not on home page $lblocks = COM_showBlocks( 'left', $topic ); } if( empty( $lblocks )) { $header->set_var( 'geeklog_blocks', '' ); $header->set_var( 'left_blocks', '' ); } else { $header->set_var( 'geeklog_blocks', $lblocks ); $header->parse( 'left_blocks', 'leftblocks', true ); $centerblockid = 'centerblocks-leftblocks'; } } //call the right blocks $clicked = "http://"; $clicked .= $_SERVER['HTTP_HOST']; $clicked .= $_SERVER['REQUEST_URI']; $siteurl = $_CONF['site_url']."/"; // add something unique in the url of pages you DON'T want the right blocks to appear on right blocks will be on every other page. For instance put 'article.php' to not show the right blocks on article pages, put "search.php?query=" if you want the blocks to show on the main search page but not on the results page. $address = array('admin', 'article.php', 'gus', 'comment.php', '/music/', 'inmemoriam'); //default vars $header->set_var( 'geeklog_blocks', '' ); $header->set_var( 'right_blocks', '' ); $header->set_var( 'centerblockid', $centerblockid ); // loads rightblocks if the url isn't in the array address if (!empty( $address )){ $rightblock = true; foreach ($address as $val){ if (eregi($val, $clicked)) { $showrightblocks = 'false'; }else if($showrightblocks != 'false') { $showrightblocks = 'true'; } } if( $rightblock && $showrightblocks=='true') { $rblocks = COM_showBlocks( 'right', $topic ); } if( $rightblock && !empty( $rblocks )) { if ($centerblockid == 'centerblocks-leftblocks'){ $centerblockid = 'centerblocks-bothblocks'; }else{ $centerblockid = 'centerblocks-rightblocks'; } $header->set_var( 'centerblockid', $centerblockid ); $rblocks = '<div id="rightblocks">' . $rblocks . '</div>'; $header->set_var( 'geeklog_blocks', $rblocks ); $header->parse( 'right_blocks', 'rightblocks', true); //break; } else { $header->set_var( 'geeklog_blocks', '' ); $header->set_var( 'right_blocks', '' ); } } // Call any plugin that may want to include extra Meta tags // or Javascript functions $header->set_var( 'plg_headercode', $headercode . PLG_getHeaderCode() ); // Call to plugins to set template variables in the header PLG_templateSetVars( 'header', $header ); // The following lines allow users to embed PHP in their templates. This // is almost a contradition to the reasons for using templates but this may // prove useful at times ... // Don't use PHP in templates if you can live without it! $tmp = $header->parse( 'index_header', 'header' ); ob_start(); eval( '?>' . $tmp ); $retval = ob_get_contents(); ob_end_clean(); return $retval; }
Posted on: 10/07/05 04:38pm
By: jetshack
Posted on: 10/07/05 04:52pm
By: Dirk
Posted on: 10/07/05 05:02pm
By: jetshack
Posted on: 10/07/05 05:30pm
By: drshakagee
Posted on: 10/07/05 05:52pm
By: Dirk
Posted on: 10/08/05 11:10pm
By: Anonymous (Stu)