punbb/edit.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
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
    26
//define('PUN_ROOT', './');
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
    27
//require PUN_ROOT.'include/common.php';
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
    28
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
    29
global $pun_db, $pun_user, $pun_config, $lang_common;
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
    30
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    32
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    33
if ($pun_user['g_read_board'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
	message($lang_common['No view']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
if ($id < 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
	message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
// Fetch some info about the post, the topic and the forum
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
    42
$result = $pun_db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$pun_db->prefix.'posts AS p INNER JOIN '.$pun_db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$pun_db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$pun_db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __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
    43
if (!$pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
	message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
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
    46
$cur_post = $pun_db->fetch_assoc($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
// Sort out who the moderators are and if we are currently a moderator (or an admin)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
// Determine whether this post is the "topic post" or not
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
    53
$result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'posts WHERE topic_id='.$cur_post['tid'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __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
    54
$topic_post_id = $pun_db->result($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
$can_edit_subject = ($id == $topic_post_id && (($pun_user['g_edit_subjects_interval'] == '0' || (time() - $cur_post['posted']) < $pun_user['g_edit_subjects_interval']) || $is_admmod)) ? true : false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
// Do we have permission to edit this post?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
if (($pun_user['g_edit_posts'] == '0' ||
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
	$cur_post['poster_id'] != $pun_user['id'] ||
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
	$cur_post['closed'] == '1') &&
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
	!$is_admmod)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
	message($lang_common['No permission']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
// Load the post.php/edit.php language file
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
// Start with a clean slate
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
$errors = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
if (isset($_POST['form_sent']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
	if ($is_admmod)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
		confirm_referrer('edit.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
	// If it is a topic it must contain a subject
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
	if ($can_edit_subject)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
		$subject = pun_trim($_POST['req_subject']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
		if ($subject == '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
			$errors[] = $lang_post['No subject'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
		else if (pun_strlen($subject) > 70)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
			$errors[] = $lang_post['Too long subject'];
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
    86
		else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && $pun_user['g_id'] < PUN_MOD)
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
			$subject = ucwords(strtolower($subject));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
	// Clean up message from POST
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
	$message = pun_linebreaks(pun_trim($_POST['req_message']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
	if ($message == '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
		$errors[] = $lang_post['No message'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
	else if (strlen($message) > 65535)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
		$errors[] = $lang_post['Too long message'];
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
    97
	else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && $pun_user['g_id'] < PUN_MOD)
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
		$message = ucwords(strtolower($message));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
	// Validate BBCode syntax
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
	if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
		require PUN_ROOT.'include/parser.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
		$message = preparse_bbcode($message, $errors);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
	$hide_smilies = isset($_POST['hide_smilies']) ? intval($_POST['hide_smilies']) : 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
	if ($hide_smilies != '1') $hide_smilies = '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
	// Did everything go according to plan?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
	if (empty($errors) && !isset($_POST['preview']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
	{
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
   114
		$edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? $edited_sql = ', edited='.time().', edited_by=\''.$pun_db->escape($pun_user['username']).'\'' : '';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
		require PUN_ROOT.'include/search_idx.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
		if ($can_edit_subject)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
			// Update the topic and any redirect topics
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
   121
			$pun_db->query('UPDATE '.$pun_db->prefix.'topics SET subject=\''.$pun_db->escape($subject).'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
			// We changed the subject, so we need to take that into account when we update the search words
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
			update_search_index('edit', $id, $message, $subject);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
			update_search_index('edit', $id, $message);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
		// Update the post
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
   130
		$pun_db->query('UPDATE '.$pun_db->prefix.'posts SET message=\''.$pun_db->escape($message).'\', hide_smilies=\''.$hide_smilies.'\''.$edited_sql.' WHERE id='.$id) or error('Unable to update post', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
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
		pun_redirect('viewtopic.php?pid='.$id.'#p'.$id, $lang_post['Edit redirect']);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_post['Edit post'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
$required_fields = array('req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
$focus_element = array('edit', 'req_message');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
$cur_index = 1;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
<div class="linkst">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
	<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
		<ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_post['subject']) ?></li></ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
// If there are errors, we display them
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
if (!empty($errors))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
<div id="posterror" class="block">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
	<h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
		<div class="inbox"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
			<p><?php echo $lang_post['Post errors info'] ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
			<ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
	while (list(, $cur_error) = each($errors))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
		echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
			</ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
else if (isset($_POST['preview']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
	require_once PUN_ROOT.'include/parser.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
	$preview_message = parse_message($message, $hide_smilies);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
<div id="postpreview" class="blockpost">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
	<h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
			<div class="postright">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
				<div class="postmsg">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
					<?php echo $preview_message."\n" ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
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
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
	<h2><?php echo $lang_post['Edit post'] ?></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
		<form id="edit" method="post" action="edit.php?id=<?php echo $id ?>&amp;action=edit" onsubmit="return process_form(this)">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
					<legend><?php echo $lang_post['Edit post legend'] ?></legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
					<input type="hidden" name="form_sent" value="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
					<div class="infldset txtarea">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
<?php if ($can_edit_subject): ?>						<label><?php echo $lang_common['Subject'] ?><br />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
						<input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
<?php endif; ?>						<label><?php echo $lang_common['Message'] ?><br />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
						<textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo pun_htmlspecialchars(isset($_POST['req_message']) ? $message : $cur_post['message']) ?></textarea><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
						<ul class="bblinks">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
							<li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
							<li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
							<li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
						</ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
$checkboxes = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
if ($pun_config['o_smilies'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
	if (isset($_POST['hide_smilies']) || $cur_post['hide_smilies'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
		$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" checked="checked" tabindex="'.($cur_index++).'" />&nbsp;'.$lang_post['Hide smilies'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
		$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'" />&nbsp;'.$lang_post['Hide smilies'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
if ($is_admmod)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
	if ((isset($_POST['form_sent']) && isset($_POST['silent'])) || !isset($_POST['form_sent']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
		$checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" checked="checked" />&nbsp;'.$lang_post['Silent edit'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
		$checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" />&nbsp;'.$lang_post['Silent edit'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
if (!empty($checkboxes))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   243
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
					<legend><?php echo $lang_common['Options'] ?></legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   249
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   250
						<div class="rbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
							<?php echo implode('</label>'."\n\t\t\t\t\t\t\t", $checkboxes).'</label>'."\n" ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   253
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   260
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   261
			<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   262
		</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   263
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   264
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   265
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   266
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   267
require PUN_ROOT.'footer.php';