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