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