punbb/include/cache.php
author Dan
Thu, 12 Jul 2007 01:04:01 -0400
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    25
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    26
// Make sure no one attempts to run this script "directly"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    27
if (!defined('PUN'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    28
	exit;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    29
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    30
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    32
// If we are running pre PHP 4.2.0, we add our own implementation of var_export
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    33
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
if (!function_exists('var_export'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
	function var_export()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
		$args = func_get_args();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
		$indent = (isset($args[2])) ? $args[2] : '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
		if (is_array($args[0]))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
			$output = 'array ('."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
			foreach ($args[0] as $k => $v)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
				if (is_numeric($k))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
					$output .= $indent.'  '.$k.' => ';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
				else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
					$output .= $indent.'  \''.str_replace('\'', '\\\'', str_replace('\\', '\\\\', $k)).'\' => ';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
				if (is_array($v))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
					$output .= var_export($v, true, $indent.'  ');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
				else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
				{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
					if (gettype($v) != 'string' && !empty($v))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
						$output .= $v.','."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
					else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
						$output .= '\''.str_replace('\'', '\\\'', str_replace('\\', '\\\\', $v)).'\','."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
				}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
			$output .= ($indent != '') ? $indent.'),'."\n" : ')';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
			$output = $args[0];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
		if ($args[1] == true)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
			return $output;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
			echo $output;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
// Generate the config cache PHP script
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
function generate_config_cache()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
{
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
    81
	global $pun_db;
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
	// Get the forum config from the DB
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
    84
	$result = $pun_db->query('SELECT * FROM '.$pun_db->prefix.'config', true) or error('Unable to fetch forum config', __FILE__, __LINE__, $pun_db->error());
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
	while ($cur_config_item = $pun_db->fetch_row($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
		$output[$cur_config_item[0]] = $cur_config_item[1];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
	// Output config as PHP code
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
	$fh = @fopen(PUN_ROOT.'cache/cache_config.php', 'wb');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
	if (!$fh)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
		error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
	fwrite($fh, '<?php'."\n\n".'define(\'PUN_CONFIG_LOADED\', 1);'."\n\n".'$pun_config = '.var_export($output, true).';'."\n\n".'?>');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
	fclose($fh);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
// Generate the bans cache PHP script
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
function generate_bans_cache()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
{
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
   104
	global $pun_db;
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
	// Get the ban list from the DB
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
   107
	$result = $pun_db->query('SELECT * FROM '.$pun_db->prefix.'bans', true) or error('Unable to fetch ban list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
	$output = array();
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
   110
	while ($cur_ban = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
		$output[] = $cur_ban;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
	// Output ban list as PHP code
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
	$fh = @fopen(PUN_ROOT.'cache/cache_bans.php', 'wb');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
	if (!$fh)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
		error('Unable to write bans cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
	fwrite($fh, '<?php'."\n\n".'define(\'PUN_BANS_LOADED\', 1);'."\n\n".'$pun_bans = '.var_export($output, true).';'."\n\n".'?>');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
	fclose($fh);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
// Generate the ranks cache PHP script
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
function generate_ranks_cache()
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
	global $pun_db;
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
	// Get the rank list from the DB
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
   132
	$result = $pun_db->query('SELECT * FROM '.$pun_db->prefix.'ranks ORDER BY min_posts', true) or error('Unable to fetch rank list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
	$output = array();
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
   135
	while ($cur_rank = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
		$output[] = $cur_rank;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
	// Output ranks list as PHP code
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
	$fh = @fopen(PUN_ROOT.'cache/cache_ranks.php', 'wb');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
	if (!$fh)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
		error('Unable to write ranks cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
	fwrite($fh, '<?php'."\n\n".'define(\'PUN_RANKS_LOADED\', 1);'."\n\n".'$pun_ranks = '.var_export($output, true).';'."\n\n".'?>');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
	fclose($fh);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
// Generate quickjump cache PHP scripts
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
function generate_quickjump_cache($group_id = false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
{
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
   154
	global $pun_db, $lang_common, $pun_user;
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
	// If a group_id was supplied, we generate the quickjump cache for that group only
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
	if ($group_id !== false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
		$groups[0] = $group_id;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
		// A group_id was now supplied, so we generate the quickjump cache for all groups
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
   162
		$result = $pun_db->query('SELECT g_id FROM '.$pun_db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $pun_db->error());
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
   163
		$num_groups = $pun_db->num_rows($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
		for ($i = 0; $i < $num_groups; ++$i)
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
   166
			$groups[] = $pun_db->result($result, $i);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
	// Loop through the groups in $groups and output the cache for each of them
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
	while (list(, $group_id) = @each($groups))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
		// Output quickjump as PHP code
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
		$fh = @fopen(PUN_ROOT.'cache/cache_quickjump_'.$group_id.'.php', 'wb');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
		if (!$fh)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
			error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
		$output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
		$output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><?php echo $lang_common[\'Jump to\'] ?>'."\n\n\t\t\t\t\t".'<br /><select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
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
   181
		$result = $pun_db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$pun_db->prefix.'categories AS c INNER JOIN '.$pun_db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$pun_db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$group_id.') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
		$cur_category = 0;
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
   184
		while ($cur_forum = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
			if ($cur_forum['cid'] != $cur_category)	// A new category since last iteration?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
				if ($cur_category)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
					$output .= "\t\t\t\t\t\t".'</optgroup>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
				$output .= "\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
				$cur_category = $cur_forum['cid'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
			$redirect_tag = ($cur_forum['redirect_url'] != '') ? ' &gt;&gt;&gt;' : '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
			$output .= "\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'"<?php echo ($forum_id == '.$cur_forum['fid'].') ? \' selected="selected"\' : \'\' ?>>'.pun_htmlspecialchars($cur_forum['forum_name']).$redirect_tag.'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
		$output .= "\t\t\t\t\t".'</optgroup>'."\n\t\t\t\t\t".'</select>'."\n\t\t\t\t\t".'<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />'."\n\t\t\t\t\t".'</label></div>'."\n\t\t\t\t".'</form>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
		fwrite($fh, $output);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
		fclose($fh);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
}