Blame Artworks/Webenv/Punbb/header.php

Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
/***********************************************************************
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
  Copyright (C) 2002-2008  PunBB
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
  This file is part of PunBB.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
  PunBB is free software; you can redistribute it and/or modify it
Alain Reguera Delgado 46de3c
  under the terms of the GNU General Public License as published
Alain Reguera Delgado 46de3c
  by the Free Software Foundation; either version 2 of the License,
Alain Reguera Delgado 46de3c
  or (at your option) any later version.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
  PunBB is distributed in the hope that it will be useful, but
Alain Reguera Delgado 46de3c
  WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 46de3c
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Alain Reguera Delgado 46de3c
  GNU General Public License for more details.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
  You should have received a copy of the GNU General Public License
Alain Reguera Delgado 46de3c
  along with this program; if not, write to the Free Software
Alain Reguera Delgado 46de3c
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
Alain Reguera Delgado 46de3c
  MA  02111-1307  USA
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
************************************************************************/
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// Make sure no one attempts to run this script "directly"
Alain Reguera Delgado 46de3c
if (!defined('PUN'))
Alain Reguera Delgado 46de3c
	exit;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// Send no-cache headers
Alain Reguera Delgado 46de3c
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');	// When yours truly first set eyes on this world! :)
Alain Reguera Delgado 46de3c
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
Alain Reguera Delgado 46de3c
header('Cache-Control: post-check=0, pre-check=0', false);
Alain Reguera Delgado 46de3c
header('Pragma: no-cache');		// For HTTP/1.0 compability
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// Load the template
Alain Reguera Delgado 46de3c
if (defined('PUN_ADMIN_CONSOLE'))
Alain Reguera Delgado 46de3c
	$tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl');
Alain Reguera Delgado 46de3c
else if (defined('PUN_HELP'))
Alain Reguera Delgado 46de3c
	$tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
Alain Reguera Delgado 46de3c
else
Alain Reguera Delgado 46de3c
	$tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_include "*">
Alain Reguera Delgado 46de3c
while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
Alain Reguera Delgado 46de3c
		error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template main.tpl. There is no such file in folder /include/user/');
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	ob_start();
Alain Reguera Delgado 46de3c
	include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
Alain Reguera Delgado 46de3c
	$tpl_temp = ob_get_contents();
Alain Reguera Delgado 46de3c
	$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
Alain Reguera Delgado 46de3c
    ob_end_clean();
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
// END SUBST - <pun_include "*">
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_content_direction>
Alain Reguera Delgado 46de3c
$tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
Alain Reguera Delgado 46de3c
// END SUBST - <pun_content_direction>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_char_encoding>
Alain Reguera Delgado 46de3c
$tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
Alain Reguera Delgado 46de3c
// END SUBST - <pun_char_encoding>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_head>
Alain Reguera Delgado 46de3c
ob_start();
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// Is this a page that we want search index spiders to index?
Alain Reguera Delgado 46de3c
if (!defined('PUN_ALLOW_INDEX'))
Alain Reguera Delgado 46de3c
	echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
?>
Alain Reguera Delgado 46de3c
<title></title>
Alain Reguera Delgado 46de3c
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
if (defined('PUN_ADMIN_CONSOLE'))
Alain Reguera Delgado 46de3c
	echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
if (isset($required_fields))
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	// Output JavaScript to validate form (make sure required fields are filled out)
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
?>
Alain Reguera Delgado 46de3c
<script type="text/javascript">
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function process_form(the_form)
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	var element_names = new Object()
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	// Output a JavaScript array with localised field names
Alain Reguera Delgado 46de3c
	while (list($elem_orig, $elem_trans) = @each($required_fields))
Alain Reguera Delgado 46de3c
		echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace(' ', ' ', $elem_trans)).'"'."\n";
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
?>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	if (document.all || document.getElementById)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		for (i = 0; i < the_form.length; ++i)
Alain Reguera Delgado 46de3c
		{
Alain Reguera Delgado 46de3c
			var elem = the_form.elements[i]
Alain Reguera Delgado 46de3c
			if (elem.name && elem.name.substring(0, 4) == "req_")
Alain Reguera Delgado 46de3c
			{
Alain Reguera Delgado 46de3c
				if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
Alain Reguera Delgado 46de3c
				{
Alain Reguera Delgado 46de3c
					alert("\"" + element_names[elem.name] + "\" ")
Alain Reguera Delgado 46de3c
					elem.focus()
Alain Reguera Delgado 46de3c
					return false
Alain Reguera Delgado 46de3c
				}
Alain Reguera Delgado 46de3c
			}
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	return true
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
// -->
Alain Reguera Delgado 46de3c
</script>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
Alain Reguera Delgado 46de3c
if (strpos($user_agent, 'msie') !== false && strpos($user_agent, 'windows') !== false && strpos($user_agent, 'opera') === false)
Alain Reguera Delgado 46de3c
	echo '<script type="text/javascript" src="style/imports/minmax.js"></script>';
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
$tpl_temp = trim(ob_get_contents());
Alain Reguera Delgado 46de3c
$tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main);
Alain Reguera Delgado 46de3c
ob_end_clean();
Alain Reguera Delgado 46de3c
// END SUBST - <pun_head>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <body>
Alain Reguera Delgado 46de3c
if (isset($focus_element))
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	$tpl_main = str_replace('
Alain Reguera Delgado 46de3c
	$tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main);
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
// END SUBST - <body>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_page>
Alain Reguera Delgado 46de3c
$tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main);
Alain Reguera Delgado 46de3c
// END SUBST - <pun_page>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_title>
Alain Reguera Delgado 46de3c
$tpl_main = str_replace('<pun_title>', ''.pun_htmlspecialchars($pun_config['o_board_title']).'

'.pun_htmlspecialchars($pun_config['o_board_title']).'

', $tpl_main);
Alain Reguera Delgado 46de3c
// END SUBST - <pun_title>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_desc>
Alain Reguera Delgado 46de3c
$tpl_main = str_replace('<pun_desc>', '

'.$pun_config['o_board_desc'].'

', $tpl_main);
Alain Reguera Delgado 46de3c
// END SUBST - <pun_desc>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_navlinks>
Alain Reguera Delgado 46de3c
$tpl_main = str_replace('<pun_navlinks>','
'."\n\t\t\t". generate_navlinks()."\n\t\t".'
', $tpl_main);
Alain Reguera Delgado 46de3c
// END SUBST - <pun_navlinks>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
// START SUBST - <pun_status>
Alain Reguera Delgado 46de3c
if ($pun_user['is_guest'])
Alain Reguera Delgado 46de3c
	$tpl_temp = '
'."\n\t\t\t".'

'.$lang_common['Not logged in'].'

'."\n\t\t".'
';
Alain Reguera Delgado 46de3c
else
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	$tpl_temp = '
'."\n\t\t\t".'
    '."\n\t\t\t\t".'
  • '.$lang_common['Logged in as'].' '.pun_htmlspecialchars($pun_user['username']).'
  • '."\n\t\t\t\t".'
  • '.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'
  • ';
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	if ($pun_user['g_id'] < PUN_GUEST)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		$result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		if ($db->result($result_header))
Alain Reguera Delgado 46de3c
			$tpl_temp .= "\n\t\t\t\t".'
  • There are new reports
  • ';
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    		if ($pun_config['o_maintenance'] == '1')
    Alain Reguera Delgado 46de3c
    			$tpl_temp .= "\n\t\t\t\t".'
  • Maintenance mode is enabled!
  • ';
    Alain Reguera Delgado 46de3c
    	}
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    	if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
    Alain Reguera Delgado 46de3c
    		$tpl_temp .= "\n\t\t\t".''."\n\t\t\t".''."\n\t\t\t".'
    '."\n\t\t".'';
    Alain Reguera Delgado 46de3c
    	else
    Alain Reguera Delgado 46de3c
    		$tpl_temp .= "\n\t\t\t".''."\n\t\t\t".'
    '."\n\t\t".'';
    Alain Reguera Delgado 46de3c
    }
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
    Alain Reguera Delgado 46de3c
    // END SUBST - <pun_status>
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    // START SUBST - <pun_announcement>
    Alain Reguera Delgado 46de3c
    if ($pun_config['o_announcement'] == '1')
    Alain Reguera Delgado 46de3c
    {
    Alain Reguera Delgado 46de3c
    	ob_start();
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    ?>
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    	

    Alain Reguera Delgado 46de3c
    	
    Alain Reguera Delgado 46de3c
    		
    Alain Reguera Delgado 46de3c
    			
    Alain Reguera Delgado 46de3c
    		
    Alain Reguera Delgado 46de3c
    	
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    	$tpl_temp = trim(ob_get_contents());
    Alain Reguera Delgado 46de3c
    	$tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
    Alain Reguera Delgado 46de3c
    	ob_end_clean();
    Alain Reguera Delgado 46de3c
    }
    Alain Reguera Delgado 46de3c
    else
    Alain Reguera Delgado 46de3c
    	$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
    Alain Reguera Delgado 46de3c
    // END SUBST - <pun_announcement>
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    // START SUBST - <pun_main>
    Alain Reguera Delgado 46de3c
    ob_start();
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    Alain Reguera Delgado 46de3c
    define('PUN_HEADER', 1);