punbb/edit.php
author Dan
Sun, 06 Apr 2008 00:28:50 -0400
changeset 7 98bbc533541c
permissions -rw-r--r--
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     1
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     2
/***********************************************************************
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     3
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     4
  Copyright (C) 2002-2008  PunBB.org
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     5
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     6
  This file is part of PunBB.
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     7
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     8
  PunBB is free software; you can redistribute it and/or modify it
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
     9
  under the terms of the GNU General Public License as published
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    10
  by the Free Software Foundation; either version 2 of the License,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    11
  or (at your option) any later version.
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    12
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    13
  PunBB is distributed in the hope that it will be useful, but
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    14
  WITHOUT ANY WARRANTY; without even the implied warranty of
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    16
  GNU General Public License for more details.
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    17
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    18
  You should have received a copy of the GNU General Public License
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    19
  along with this program; if not, write to the Free Software
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    20
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    21
  MA  02111-1307  USA
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    22
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    23
************************************************************************/
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    24
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    25
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    26
// if (!defined('PUN_ROOT'))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    27
// 	define('PUN_ROOT', './');
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    28
// require PUN_ROOT.'include/common.php';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    29
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    30
// import globals (I really hope this isn't dangerous)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    31
foreach ( $GLOBALS as $key => $_ )
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    32
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    33
  $$key =& $GLOBALS[$key];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    34
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    35
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    36
($hook = get_hook('ed_start')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    37
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    38
if ($pun_user['g_read_board'] == '0')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    39
	message($lang_common['No view']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    40
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    41
// Load the post.php/edit.php language file
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    42
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    43
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    44
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    45
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    46
if ($id < 1)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    47
	message($lang_common['Bad request']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    48
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    49
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    50
// Fetch some info about the post, the topic and the forum
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    51
$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    52
	'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.first_post_id, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    53
	'FROM'		=> 'posts AS p',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    54
	'JOINS'		=> array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    55
		array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    56
			'INNER JOIN'	=> 'topics AS t',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    57
			'ON'			=> 't.id=p.topic_id'
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    58
		),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    59
		array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    60
			'INNER JOIN'	=> 'forums AS f',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    61
			'ON'			=> 'f.id=t.forum_id'
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    62
		),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    63
		array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    64
			'LEFT JOIN'		=> 'forum_perms AS fp',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    65
			'ON'			=> '(fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].')'
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    66
		)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    67
	),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    68
	'WHERE'		=> '(fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    69
);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    70
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    71
($hook = get_hook('ed_qr_get_post_info')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    72
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    73
if (!$pun_db->num_rows($result))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    74
	message($lang_common['Bad request']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    75
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    76
$cur_post = $pun_db->fetch_assoc($result);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    77
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    78
// Sort out who the moderators are and if we are currently a moderator (or an admin)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    79
$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    80
$pun_user['is_admmod'] = ($session->user_level >= USER_LEVEL_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    81
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    82
$can_edit_subject = ($id == $cur_post['first_post_id'] && (($pun_user['g_edit_subjects_interval'] == '0' || (time() - $cur_post['posted']) < $pun_user['g_edit_subjects_interval']) || $pun_user['is_admmod'])) ? true : false;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    83
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    84
// Do we have permission to edit this post?
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    85
if (($pun_user['g_edit_posts'] == '0' ||
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    86
	$cur_post['poster_id'] != $pun_user['id'] ||
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    87
	$cur_post['closed'] == '1') &&
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    88
	!$pun_user['is_admmod'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    89
	message($lang_common['No permission']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    90
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    91
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    92
// Start with a clean slate
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    93
$errors = array();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    94
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    95
if (isset($_POST['form_sent']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    96
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    97
	($hook = get_hook('ed_form_submitted')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    98
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    99
	// If it is a topic it must contain a subject
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   100
	if ($can_edit_subject)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   101
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   102
		$subject = trim($_POST['req_subject']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   103
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   104
		if ($subject == '')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   105
			$errors[] = $lang_post['No subject'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   106
		else if (pun_strlen($subject) > 70)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   107
			$errors[] = $lang_post['Too long subject'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   108
		else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_user['is_admmod'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   109
			$subject = ucwords(strtolower($subject));
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   110
	}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   111
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   112
	// Clean up message from POST
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   113
	$message = pun_linebreaks(trim($_POST['req_message']));
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   114
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   115
	if ($message == '')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   116
		$errors[] = $lang_post['No message'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   117
	else if (strlen($message) > 65535)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   118
		$errors[] = $lang_post['Too long message'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   119
	else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_user['is_admmod'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   120
		$message = ucwords(strtolower($message));
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   121
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   122
	// Validate BBCode syntax
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   123
	if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   124
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   125
		require PUN_ROOT.'include/parser.php';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   126
		$message = preparse_bbcode($message, $errors);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   127
	}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   128
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   129
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   130
	$hide_smilies = isset($_POST['hide_smilies']) ? intval($_POST['hide_smilies']) : 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   131
	if ($hide_smilies != '1') $hide_smilies = '0';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   132
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   133
	// Did everything go according to plan?
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   134
	if (empty($errors) && !isset($_POST['preview']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   135
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   136
		($hook = get_hook('ed_pre_post_edited')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   137
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   138
		if ($db_type != 'mysql' && $db_type != 'mysqli')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   139
			require PUN_ROOT.'include/search_idx.php';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   140
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   141
		if ($can_edit_subject)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   142
		{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   143
			// Update the topic and any redirect topics
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   144
			$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   145
				'UPDATE'	=> 'topics',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   146
				'SET'		=> 'subject=\''.$pun_db->escape($subject).'\'',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   147
				'WHERE'		=> 'id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   148
			);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   149
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   150
			($hook = get_hook('ed_qr_update_subject')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   151
			$pun_db->query_build($query) or error(__FILE__, __LINE__);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   152
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   153
			// We changed the subject, so we need to take that into account when we update the search words
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   154
			if ($db_type != 'mysql' && $db_type != 'mysqli')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   155
				update_search_index('edit', $id, $message, $subject);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   156
		}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   157
		else if ($db_type != 'mysql' && $db_type != 'mysqli')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   158
			update_search_index('edit', $id, $message);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   159
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   160
		// Update the post
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   161
		$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   162
			'UPDATE'	=> 'posts',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   163
			'SET'		=> 'message=\''.$pun_db->escape($message).'\', hide_smilies=\''.$hide_smilies.'\'',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   164
			'WHERE'		=> 'id='.$id
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   165
		);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   166
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   167
		if (!isset($_POST['silent']) || !$pun_user['is_admmod'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   168
			$query['SET'] .= ', edited='.time().', edited_by=\''.$pun_db->escape($pun_user['username']).'\'';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   169
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   170
		($hook = get_hook('ed_qr_update_post')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   171
		$pun_db->query_build($query) or error(__FILE__, __LINE__);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   172
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   173
		pun_redirect(pun_link($pun_url['post'], $id), $lang_post['Edit redirect']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   174
	}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   175
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   176
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   177
// Setup error messages
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   178
if (!empty($errors))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   179
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   180
	$pun_page['errors'] = array();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   181
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   182
	while (list(, $cur_error) = each($errors))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   183
		$pun_page['errors'][] = '<li><span>'.$cur_error.'</span></li>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   184
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   185
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   186
// Setup form
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   187
$pun_page['set_count'] = $pun_page['fld_count'] = 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   188
$pun_page['form_action'] = pun_link($pun_url['edit'], $id);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   189
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   190
$pun_page['hidden_fields'][] = '<input type="hidden" name="form_sent" value="1" />';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   191
if ($pun_user['is_admmod'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   192
	$pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   193
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   194
// Setup help
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   195
$pun_page['main_head_options'] = array();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   196
if ($pun_config['p_message_bbcode'] == '1')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   197
	$pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'bbcode').'" title="'.sprintf($lang_common['Help page'], $lang_common['BBCode']).'">'.$lang_common['BBCode'].'</a>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   198
if ($pun_config['p_message_img_tag'] == '1')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   199
	$pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'img').'" title="'.sprintf($lang_common['Help page'], $lang_common['Images']).'">'.$lang_common['Images'].'</a>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   200
if ($pun_config['o_smilies'] == '1')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   201
	$pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'smilies').'" title="'.sprintf($lang_common['Help page'], $lang_common['Smilies']).'">'.$lang_common['Smilies'].'</a>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   202
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   203
// Setup main heading
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   204
$pun_page['main_head'] = sprintf($lang_post['Edit this'], (($id == $cur_post['first_post_id']) ? $lang_post['Topic'] : $lang_post['Reply']), $cur_post['poster']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   205
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   206
// Setup breadcrumbs
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   207
$pun_page['crumbs'] = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   208
	array($pun_config['o_board_title'], pun_link($pun_url['index'])),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   209
	array($cur_post['forum_name'], pun_link($pun_url['forum'], $cur_post['fid'])),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   210
	array($cur_post['subject'], pun_link($pun_url['topic'], $cur_post['tid'])),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   211
	$lang_post['Edit post']
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   212
);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   213
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   214
($hook = get_hook('ed_pre_header_load')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   215
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   216
define('PUN_PAGE', 'postedit');
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   217
require PUN_ROOT.'header.php';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   218
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   219
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   220
<div id="pun-main" class="main">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   221
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   222
	<h1><span><?php echo end($pun_page['crumbs']) ?></span></h1>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   223
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   224
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   225
// If preview selected and there are no errors
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   226
if (isset($_POST['preview']) && empty($pun_page['errors']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   227
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   228
	require_once PUN_ROOT.'include/parser.php';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   229
	$pun_page['preview_message'] = parse_message(trim($_POST['req_message']), $hide_smilies);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   230
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   231
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   232
	<div class="main-head">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   233
		<h2><span><?php echo $lang_post['Preview reply'] ?></span></h2>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   234
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   235
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   236
	<div id="post-preview" class="main-content topic">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   237
		<div class="post firstpost">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   238
			<div class="postmain">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   239
				<div class="posthead">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   240
					<h3><?php echo $lang_post['Preview info'] ?></h3>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   241
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   242
				<div class="postbody">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   243
					<div class="user">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   244
						<h4 class="user-ident"><strong class="username"><?php echo $cur_post['poster'] ?></strong></h4>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   245
					</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   246
					<div class="post-entry">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   247
						<div class="entry-content">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   248
						<?php echo $pun_page['preview_message']."\n" ?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   249
						</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   250
					</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   251
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   252
			</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   253
		</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   254
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   255
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   256
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   257
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   258
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   259
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   260
	<div class="main-head">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   261
		<h2><span><?php echo $pun_page['main_head'] ?></span></h2>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   262
<?php if (!empty($pun_page['main_head_options'])): ?>		<p class="main-options"><?php printf($lang_common['You may use'], implode(' ', $pun_page['main_head_options'])) ?></p>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   263
<?php endif; ?>	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   264
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   265
	<div class="main-content frm">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   266
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   267
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   268
// If there were any errors, show them
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   269
if (isset($pun_page['errors']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   270
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   271
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   272
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   273
		<div class="frm-error">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   274
			<h3 class="warn"><?php echo $lang_post['Post errors'] ?></h3>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   275
			<ul>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   276
				<?php echo implode("\n\t\t\t\t\t", $pun_page['errors'])."\n" ?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   277
			</ul>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   278
		</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   279
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   280
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   281
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   282
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   283
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   284
		<div id="req-msg" class="frm-warn">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   285
			<p class="important"><?php printf($lang_common['Required warn'], '<em class="req-text">'.$lang_common['Required'].'</em>') ?></p>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   286
		</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   287
		<form id="afocus" class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   288
			<div class="hidden">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   289
				<?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   290
			</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   291
<?php ($hook = get_hook('ed_pre_main_fieldset')) ? eval($hook) : null; ?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   292
			<fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   293
				<legend class="frm-legend"><strong><?php echo $lang_post['Edit post legend'] ?></strong></legend>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   294
<?php if ($can_edit_subject): ?>				<div class="frm-fld text longtext required">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   295
					<label for="fld<?php echo ++ $pun_page['fld_count'] ?>">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   296
						<span class="fld-label"><?php echo $lang_post['Topic subject'] ?></span><br />
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   297
						<span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="req_subject" size="80" maxlength="70" value="<?php echo htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /></span>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   298
						<em class="req-text"><?php echo $lang_common['Required'] ?></em>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   299
					</label>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   300
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   301
<?php endif; ($hook = get_hook('ed_pre_message_box')) ? eval($hook) : null; ?>				<div class="frm-fld text textarea required">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   302
					<label for="fld<?php echo ++ $pun_page['fld_count'] ?>">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   303
						<span class="fld-label"><?php echo $lang_post['Write message'] ?></span><br />
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   304
						<span class="fld-input"><textarea id="fld<?php echo $pun_page['fld_count'] ?>" name="req_message" rows="14" cols="95"><?php echo htmlspecialchars(isset($_POST['req_message']) ? $message : $cur_post['message']) ?></textarea></span>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   305
						<em class="req-text"><?php echo $lang_common['Required'] ?></em>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   306
					</label>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   307
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   308
			</fieldset>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   309
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   310
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   311
$pun_page['checkboxes'] = array();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   312
if ($pun_config['o_smilies'] == '1')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   313
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   314
	if (isset($_POST['hide_smilies']) || $cur_post['hide_smilies'] == '1')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   315
		$pun_page['checkboxes'][] = '<div class="radbox"><label for="fld'.(++$pun_page['fld_count']).'"><input type="checkbox" id="fld'.$pun_page['fld_count'].'" name="hide_smilies" value="1" checked="checked" /> '.$lang_post['Hide smilies'].'</label></div>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   316
	else
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   317
		$pun_page['checkboxes'][] = '<div class="radbox"><label for="fld'.(++$pun_page['fld_count']).'"><input type="checkbox" id="fld'.$pun_page['fld_count'].'" name="hide_smilies" value="1" /> '.$lang_post['Hide smilies'].'</label></div>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   318
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   319
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   320
if ($pun_user['is_admmod'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   321
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   322
	if ((isset($_POST['form_sent']) && isset($_POST['silent'])) || !isset($_POST['form_sent']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   323
		$pun_page['checkboxes'][] = '<div class="radbox"><label for="fld'.(++$pun_page['fld_count']).'"><input type="checkbox" id="fld'.$pun_page['fld_count'].'" name="silent" value="1" checked="checked" /> '.$lang_post['Silent edit'].'</label></div>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   324
	else
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   325
		$pun_page['checkboxes'][] = '<div class="radbox"><label for="fld'.(++$pun_page['fld_count']).'"><input type="checkbox" id="fld'.$pun_page['fld_count'].'" name="silent" value="1" /> '.$lang_post['Silent edit'].'</label></div>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   326
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   327
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   328
($hook = get_hook('ed_pre_checkbox_display')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   329
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   330
if (!empty($pun_page['checkboxes']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   331
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   332
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   333
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   334
			<fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   335
				<legend class="frm-legend"><strong><?php echo $lang_post['Optional legend'] ?></strong></legend>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   336
				<fieldset class="frm-group">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   337
					<legend><span><?php echo $lang_post['Post settings'] ?></span></legend>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   338
					<?php echo implode("\n\t\t\t\t\t\t", $pun_page['checkboxes'])."\n"; ?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   339
				</fieldset>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   340
			</fieldset>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   341
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   342
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   343
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   344
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   345
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   346
($hook = get_hook('ed_post_checkbox_display')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   347
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   348
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   349
			<div class="frm-buttons">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   350
				<span class="submit"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" title="<?php echo $lang_common['Submit title'] ?>" /></span>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   351
				<span class="submit"><input type="submit" name="preview" value="<?php echo $lang_common['Preview'] ?>" accesskey="p" title="<?php echo $lang_common['Preview title'] ?>" /></span>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   352
			</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   353
		</form>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   354
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   355
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   356
</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   357
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   358
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   359
($hook = get_hook('ed_end')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   360
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   361
require PUN_ROOT.'footer.php';