punbb/header.php
author Dan
Thu, 12 Jul 2007 15:00:35 -0400
changeset 3 c0c445d4a13e
parent 2 a8a21e1c7afa
permissions -rw-r--r--
Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
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
{
3
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    61
	$inner = '<div id="punwrap">
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    62
<div id="punadmin" class="pun">
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    63
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    64
<div id="brdheader" class="block">
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    65
	<div class="box">
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    66
		<div id="brdtitle" class="inbox">
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    67
			<pun_title>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    68
			<pun_desc>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    69
		</div>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    70
		<pun_navlinks>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    71
		<pun_status>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    72
	</div>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    73
</div>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    74
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    75
<pun_announcement>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    76
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    77
<pun_main>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    78
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    79
<pun_footer>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    80
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    81
</div>
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    82
</div>';
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    83
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
    84
  $tpl_main = $template->getHeader() . $inner . $template->getFooter();
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
    85
}
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
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
    87
{
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
	$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
    89
}
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
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
    91
{
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
	// $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
    93
  $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
    94
<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
    95
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
    96
<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
    97
	<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
    98
		<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
    99
			<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
   100
			<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
   101
		</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
   102
		<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
   103
		<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
   104
	</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
   105
</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
   106
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
   107
<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
   108
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
   109
<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
   110
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
   111
<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
   112
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
   113
</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
   114
</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
   115
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
   116
  $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
   117
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
   118
}
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
// START SUBST - <pun_include "*">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
	if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
		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
   126
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
	ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
	include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
	$tpl_temp = ob_get_contents();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
	$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
    ob_end_clean();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
// END SUBST - <pun_include "*">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
// START SUBST - <pun_content_direction>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
$tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
// END SUBST - <pun_content_direction>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
// START SUBST - <pun_char_encoding>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
$tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
// END SUBST - <pun_char_encoding>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
// START SUBST - <pun_head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
// Is this a page that we want search index spiders to index?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
if (!defined('PUN_ALLOW_INDEX'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
	echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
?>
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
   152
<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
   153
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
if (defined('PUN_ADMIN_CONSOLE'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
	echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
if (isset($required_fields))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
	// Output JavaScript to validate form (make sure required fields are filled out)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
<script type="text/javascript">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
<!--
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
function process_form(the_form)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
	var element_names = new Object()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
	// Output a JavaScript array with localised field names
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
	while (list($elem_orig, $elem_trans) = @each($required_fields))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
		echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace('&nbsp;', ' ', $elem_trans)).'"'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
	if (document.all || document.getElementById)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
		for (i = 0; i < the_form.length; ++i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
			var elem = the_form.elements[i]
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
			if (elem.name && elem.name.substring(0, 4) == "req_")
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
				if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
				{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
					alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>")
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
					elem.focus()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
					return false
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
				}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
	return true
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
// -->
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
</script>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
if (strpos($user_agent, 'msie') !== false && strpos($user_agent, 'windows') !== false && strpos($user_agent, 'opera') === false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
	echo '<script type="text/javascript" src="style/imports/minmax.js"></script>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
$tpl_temp = trim(ob_get_contents());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
$tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
ob_end_clean();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
// END SUBST - <pun_head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
// START SUBST - <body>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
if (isset($focus_element))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
	$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
   215
	$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
   216
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
// END SUBST - <body>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
// START SUBST - <pun_page>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
$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
   222
// END SUBST - <pun_page>
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
// START SUBST - <pun_title>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
$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
   227
// END SUBST - <pun_title>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
// START SUBST - <pun_desc>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
$tpl_main = str_replace('<pun_desc>', '<p><span>'.$pun_config['o_board_desc'].'</span></p>', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
// END SUBST - <pun_desc>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
// START SUBST - <pun_navlinks>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
$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
   237
// END SUBST - <pun_navlinks>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
// START SUBST - <pun_status>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
if ($pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
	$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
   243
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
	$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
   246
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
   247
	if ($pun_user['g_id'] >= USER_LEVEL_MEMBER)
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
	{
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
   249
		$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
   250
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
   251
		if ($pun_db->result($result_header))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
			$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
   253
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
		if ($pun_config['o_maintenance'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
			$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
   256
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
	if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259
		$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
   260
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   261
		$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
   262
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   263
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   264
$tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   265
// END SUBST - <pun_status>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   266
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   267
// START SUBST - <pun_announcement>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   268
if ($pun_config['o_announcement'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   269
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   270
	ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   271
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   272
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   273
<div id="announce" class="block">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   274
	<h2><span><?php echo $lang_common['Announcement'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   275
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   276
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   277
			<div><?php echo $pun_config['o_announcement_message'] ?></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   278
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   279
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   280
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   281
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   282
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   283
	$tpl_temp = trim(ob_get_contents());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   284
	$tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   285
	ob_end_clean();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   286
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   287
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   288
	$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   289
// END SUBST - <pun_announcement>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   290
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   291
// START SUBST - <pun_main>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   292
ob_start();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   293
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   294
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   295
define('PUN_HEADER', 1);