punbb/header.php
author Dan
Thu, 12 Jul 2007 01:04:01 -0400
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
child 3 c0c445d4a13e
permissions -rw-r--r--
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     1
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     2
/***********************************************************************
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     3
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     4
  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     5
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     6
  This file is part of PunBB.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     7
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     8
  PunBB is free software; you can redistribute it and/or modify it
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     9
  under the terms of the GNU General Public License as published
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    10
  by the Free Software Foundation; either version 2 of the License,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    11
  or (at your option) any later version.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    12
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    13
  PunBB is distributed in the hope that it will be useful, but
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    14
  WITHOUT ANY WARRANTY; without even the implied warranty of
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    16
  GNU General Public License for more details.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    17
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    18
  You should have received a copy of the GNU General Public License
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    19
  along with this program; if not, write to the Free Software
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    20
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    21
  MA  02111-1307  USA
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    22
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    23
************************************************************************/
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    24
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    25
// Import the Enano API
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    26
global $db, $session, $paths, $template, $plugins; // Common objects
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    27
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    28
// Make sure no one attempts to run this script "directly"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    29
if (!defined('PUN'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    30
	exit;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    32
$template->tpl_strings['PAGE_NAME'] = $page_title;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    33
$template->add_header('<pun_head>');
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    34
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    35
// Special case - many Enano themes have indented paragraphs
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    36
$template->add_header('<style type="text/css">
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    37
    div.pun p {
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    38
      margin-left: 0;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    39
    }
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    40
    div.pun a[href ^="http://"] {
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    41
      background-image: none;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    42
      padding-right: 0;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    43
    }
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    44
    div.inbox li {
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    45
      list-style-type: none !important;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    46
    }
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    47
    div.pun h2 {
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    48
      border-bottom-width: 0;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    49
    }
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    50
  </style>');
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    51
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
// Send no-cache headers
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');	// When yours truly first set eyes on this world! :)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
header('Cache-Control: post-check=0, pre-check=0', false);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
header('Pragma: no-cache');		// For HTTP/1.0 compability
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
// Load the template
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
if (defined('PUN_ADMIN_CONSOLE'))
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    60
{
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
	$tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl');
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    62
}
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
else if (defined('PUN_HELP'))
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    64
{
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
	$tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    66
}
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
else
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    68
{
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    69
	// $tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    70
  $inner = '<div id="punwrap">
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    71
<div id="pun<pun_page>" class="pun">
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    72
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    73
<div id="brdheader" class="block">
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    74
	<div class="box">
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    75
		<div id="brdtitle" class="inbox">
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    76
			<pun_title>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    77
			<pun_desc>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    78
		</div>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    79
		<pun_navlinks>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    80
		<pun_status>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    81
	</div>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    82
</div>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    83
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    84
<pun_announcement>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    85
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    86
<pun_main>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    87
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    88
<pun_footer>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    89
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    90
</div>
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    91
</div>';
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    92
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    93
  $tpl_main = $template->getHeader() . $inner . $template->getFooter();
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    94
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    95
}
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
// START SUBST - <pun_include "*">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
	if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
		error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template main.tpl. There is no such file in folder /include/user/');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
	ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
	include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
	$tpl_temp = ob_get_contents();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
	$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
    ob_end_clean();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
// END SUBST - <pun_include "*">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
// START SUBST - <pun_content_direction>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
$tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
// END SUBST - <pun_content_direction>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
// START SUBST - <pun_char_encoding>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
$tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
// END SUBST - <pun_char_encoding>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
// START SUBST - <pun_head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
// Is this a page that we want search index spiders to index?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
if (!defined('PUN_ALLOW_INDEX'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
	echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
?>
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   129
<link rel="stylesheet" type="text/css" href="<?php echo scriptPath; ?>/punbb/style/<?php echo $pun_user['style'].'.css' ?>" />
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
if (defined('PUN_ADMIN_CONSOLE'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
	echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
if (isset($required_fields))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
	// Output JavaScript to validate form (make sure required fields are filled out)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
<script type="text/javascript">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
<!--
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
function process_form(the_form)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
	var element_names = new Object()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
	// Output a JavaScript array with localised field names
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
	while (list($elem_orig, $elem_trans) = @each($required_fields))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
		echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace('&nbsp;', ' ', $elem_trans)).'"'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
	if (document.all || document.getElementById)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
		for (i = 0; i < the_form.length; ++i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
			var elem = the_form.elements[i]
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
			if (elem.name && elem.name.substring(0, 4) == "req_")
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
				if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
				{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
					alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>")
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
					elem.focus()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
					return false
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
				}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
	return true
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
// -->
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
</script>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
if (strpos($user_agent, 'msie') !== false && strpos($user_agent, 'windows') !== false && strpos($user_agent, 'opera') === false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
	echo '<script type="text/javascript" src="style/imports/minmax.js"></script>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
$tpl_temp = trim(ob_get_contents());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
$tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
ob_end_clean();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
// END SUBST - <pun_head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
// START SUBST - <body>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
if (isset($focus_element))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
	$tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus();', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
	$tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
// END SUBST - <body>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
// START SUBST - <pun_page>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
$tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main);
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   199
// END SUBST - <pun_page>
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
// START SUBST - <pun_title>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
$tpl_main = str_replace('<pun_title>', '<h1><span>'.pun_htmlspecialchars($pun_config['o_board_title']).'</span></h1>', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
// END SUBST - <pun_title>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
// START SUBST - <pun_desc>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
$tpl_main = str_replace('<pun_desc>', '<p><span>'.$pun_config['o_board_desc'].'</span></p>', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
// END SUBST - <pun_desc>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
// START SUBST - <pun_navlinks>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
$tpl_main = str_replace('<pun_navlinks>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
// END SUBST - <pun_navlinks>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
// START SUBST - <pun_status>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
if ($pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
	$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<p>'.$lang_common['Not logged in'].'</p>'."\n\t\t".'</div>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
	$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   224
	if ($pun_user['g_id'] >= USER_LEVEL_MEMBER)
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
	{
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   226
		$result_header = $pun_db->query('SELECT COUNT(id) FROM '.$pun_db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   228
		if ($pun_db->result($result_header))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
			$tpl_temp .= "\n\t\t\t\t".'<li class="reportlink"><strong><a href="admin_reports.php">There are new reports</a></strong></li>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
		if ($pun_config['o_maintenance'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
			$tpl_temp .= "\n\t\t\t\t".'<li class="maintenancelink"><strong><a href="admin_options.php#maintenance">Maintenance mode is enabled!</a></strong></li>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
	if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
		$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'."\n\t\t\t\t".'<li><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></li>'."\n\t\t\t\t".'<li><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
		$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
$tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
// END SUBST - <pun_status>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   243
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
// START SUBST - <pun_announcement>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
if ($pun_config['o_announcement'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
	ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   249
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   250
<div id="announce" class="block">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
	<h2><span><?php echo $lang_common['Announcement'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   253
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
			<div><?php echo $pun_config['o_announcement_message'] ?></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   260
	$tpl_temp = trim(ob_get_contents());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   261
	$tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   262
	ob_end_clean();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   263
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   264
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   265
	$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   266
// END SUBST - <pun_announcement>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   267
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   268
// START SUBST - <pun_main>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   269
ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   270
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   271
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   272
define('PUN_HEADER', 1);