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