Blame Identity/Models/Html/Punbb/header.php

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

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

', $tpl_main);
d6e8d8
// END SUBST - <pun_title>
d6e8d8
d6e8d8
d6e8d8
// START SUBST - <pun_desc>
d6e8d8
$tpl_main = str_replace('<pun_desc>', '

'.$pun_config['o_board_desc'].'

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

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

'."\n\t\t".'
';
d6e8d8
else
d6e8d8
{
d6e8d8
	$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']).'
  • ';
d6e8d8
d6e8d8
	if ($pun_user['g_id'] < PUN_GUEST)
d6e8d8
	{
d6e8d8
		$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());
d6e8d8
d6e8d8
		if ($db->result($result_header))
d6e8d8
			$tpl_temp .= "\n\t\t\t\t".'
  • There are new reports
  • ';
    d6e8d8
    d6e8d8
    		if ($pun_config['o_maintenance'] == '1')
    d6e8d8
    			$tpl_temp .= "\n\t\t\t\t".'
  • Maintenance mode is enabled!
  • ';
    d6e8d8
    	}
    d6e8d8
    d6e8d8
    	if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
    d6e8d8
    		$tpl_temp .= "\n\t\t\t".''."\n\t\t\t".''."\n\t\t\t".'
    '."\n\t\t".'';
    d6e8d8
    	else
    d6e8d8
    		$tpl_temp .= "\n\t\t\t".''."\n\t\t\t".'
    '."\n\t\t".'';
    d6e8d8
    }
    d6e8d8
    d6e8d8
    $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
    d6e8d8
    // END SUBST - <pun_status>
    d6e8d8
    d6e8d8
    d6e8d8
    // START SUBST - <pun_announcement>
    d6e8d8
    if ($pun_config['o_announcement'] == '1')
    d6e8d8
    {
    d6e8d8
    	ob_start();
    d6e8d8
    d6e8d8
    ?>
    d6e8d8
    d6e8d8
    	

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