<?php
// File: $Id: headerBB2.php,v 1.5 2004/09/25 19:21:23 carls Exp $ $Name:  $
// ----------------------------------------------------------------------
// PostNuke Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file:
// ----------------------------------------------------------------------

if (eregi("header.php", $_SERVER['PHP_SELF'])) {
    die ("You can't access this file directly...");
}

/**
 * Include some common header for HTML generation.
 *
 * XHTML Support by Matt Jarjoura. <mjarjo1@umbc.edu>
 */

$header = 1;

function head() {

    global $index,
        $artpage,
        $topic,
        $hlpfile,
        $hr,
        $theme,
        $bgcolor1,
        $bgcolor2,
        $bgcolor3,
        $bgcolor4,
        $bgcolor5,
        $textcolor1,
        $textcolor2,
        $textcolor3,
        $textcolor4,
        $forumpage,
        $thename,
        $postnuke_theme,
		//$pntheme,
// Begin PNphpBB2 Module
				$ModName,
				$phpbb_root_path,
				$phpbb_theme,
				$board_config,
				$page_title,
// End PNphpBB2 Module
        $themename,
        $themeimages,
        $additional_header,
        $themeOverrideCategory,
        $themeOverrideStory;
		
	// modification mouzaia .71
	$cWhereIsPerso = WHERE_IS_PERSO;
	if ( !(empty($cWhereIsPerso)) ) { 
		include("modules/NS-Multisites/head.inc.php"); 
	} else {
		$thistheme = pnVarPrepForOs(pnUserGetTheme());
		global $themesarein;
		if (@file(WHERE_IS_PERSO."themes/".$thistheme."/theme.php")) {
			$themesarein = WHERE_IS_PERSO;
		} else {
			$themesarein = "";
		}
	}

	if ( @!$GLOBALS['xanthia_theme'] || ($phpbb_theme['gen_simple_header']) ) {
		ob_start();
		echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
		echo "<html>\n<head>\n";

		if (defined("_CHARSET") && _CHARSET != "") {
				echo "<meta http-equiv=\"Content-Type\" ".
						 "content=\"text/html; charset="._CHARSET."\">\n";
		}
	
		if ($artpage==1) {
			/**
			 * article page output
			 */
			global $info, $hometext;
			echo "<title>$info[title] :: ".pnConfigGetVar('sitename').' :: '.pnConfigGetVar('slogan')."</title>\n";
			if (pnConfigGetVar('dyn_keywords') == 1) {
			   $htmlless = check_html($info['maintext'], $strip ='nohtml');
			   $symbolLess = trim(ereg_replace('("|\?|!|:|\.|\(|\)|;|\\\\)+', ' ', $htmlless));
			   $keywords = ereg_replace('( |'.CHR(10).'|'.CHR(13).')+', ',', $symbolLess);
			   $metatags = ereg_replace(",+", ",",$keywords);
			   echo "<meta http-equiv=\"Keywords\" content=\"$metatags\">\n";
			} else {
			   echo "<meta name=\"KEYWORDS\" content=\"".pnConfigGetVar('metakeywords')."\">\n";
			}
		} else {
			/**
			 * all other page output
			 */
			echo '<title>'.pnConfigGetVar('sitename').' :: '.$page_title."</title>\n";
			echo '<meta name="KEYWORDS" content="'.pnConfigGetVar('metakeywords')."\">\n";
		}
		echo '<meta name="DESCRIPTION" content="'.$page_title."\">\n";
		echo "<meta name=\"ROBOTS\" content=\"INDEX,FOLLOW\">\n";
		echo "<meta name=\"resource-type\" content=\"document\">\n";
		echo "<meta http-equiv=\"expires\" content=\"0\">\n";
		echo '<meta name="author" content="'.pnConfigGetVar('sitename')."\">\n";
		echo '<meta name="copyright" content="Copyright (c) 2003 by '.pnConfigGetVar('sitename')."\">\n";
		echo "<meta name=\"revisit-after\" content=\"1 days\">\n";
		echo "<meta name=\"distribution\" content=\"Global\">\n";
		echo '<meta name="generator" content="PostNuke '._PN_VERSION_NUM." - http://postnuke.com\">\n";
		echo "<meta name=\"rating\" content=\"General\">\n";
	
		global $themesarein;
	
		echo "<link rel=\"StyleSheet\" href=\"".$themesarein."themes/".$thistheme."/style/styleNN.css\" type=\"text/css\">\n";
		echo "<style type=\"text/css\">";
		echo "@import url(\"".$themesarein."themes/".$thistheme."/style/style.css\"); ";
// Begin PNphpBB2 Module - Batpuppy PNTheme
		if (is_dir($board_config['path_cellpics']))
		{
	 		 $cellpic1 = $board_config['path_cellpics'] . "/cellpic1.gif";
	 		 $cellpic2 = $board_config['path_cellpics'] . "/cellpic2.jpg";
	 		 $cellpic3 = $board_config['path_cellpics'] . "/cellpic3.gif";
	 		 $cellpic_bkg = $board_config['path_cellpics'] . "/cellpic_bkg.jpg";
			 $cellpic4 = $board_config['path_cellpics'] . "/cellpic4.gif";
		}
		else
		{
	 		 $cellpic1 = "";
	 		 $cellpic2 = "";
	 		 $cellpic3 = "";
	 		 $cellpic_bkg = "";
			 $cellpic4 = "";
		}

//		include($board_config['style_name']);

//		echo "<link rel=\"StyleSheet\" href=\"".$board_config['style_name']."\" type=\"text/css\">\n";
    
		echo "</style>\n";
		echo "<link rel=\"StyleSheet\" href=\"".$board_config['style_name']."\" type=\"text/css\">\n";
// End PNphpBB2 Module - Batpuppy PNTheme
	
		echo "<script type=\"text/javascript\" src=\"javascript/showimages.js\"></script>\n\n";
		echo "<script type=\"text/javascript\" src=\"javascript/openwindow.js\"></script>\n\n";
	 
		if(isset($additional_header)) {
			echo @implode("\n", $additional_header);
		}
	}
  
  if ( @$GLOBALS['xanthia_theme'] )
  {
    $GLOBALS['info']['title'] =     $page_title;
  }
  
// Begin PNphpBB2 Module - Batpuppy PNTheme
  if ( !$phpbb_theme['gen_simple_header'] ) 
  {
    themeheader();
  }
//  else
//  {
//    echo "</head>\n";
//  }
// End PNphpBB2 Module - Batpuppy PNTheme
}

pnThemeLoad(pnUserGetTheme());

/**
 * if you want to do overrides, set the global vars $themeOverrideCategory
 * and/or $themeOverrideStory before including header.php
 */

head();
?>
