punbb/post.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('po_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 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
$tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    46
$fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    47
if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    48
	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
    49
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    50
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    51
// Fetch some info about the topic and/or the forum
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    52
if ($tid)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    53
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    54
	$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    55
		'SELECT'	=> 'f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed, s.user_id AS is_subscribed',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    56
		'FROM'		=> '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
		'JOINS'		=> array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    58
			array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    59
				'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
    60
				'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
    61
			),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    62
			array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    63
				'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
    64
				'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
    65
			),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    66
			array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    67
				'LEFT JOIN'		=> 'subscriptions AS s',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    68
				'ON'			=> '(t.id=s.topic_id AND s.user_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
    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
		'WHERE'		=> '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    72
	);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    73
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    74
else
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
	$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    77
		'SELECT'	=> 'f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    78
		'FROM'		=> 'forums AS f',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    79
		'JOINS'		=> array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    80
			array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    81
				'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
    82
				'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
    83
			)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    84
		),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    85
		'WHERE'		=> '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    86
	);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    87
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    88
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    89
($hook = get_hook('po_qr_get_forum_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
    90
$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
    91
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    92
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
    93
	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
    94
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    95
$cur_posting = $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
    96
$is_subscribed = $tid && $cur_posting['is_subscribed'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
    97
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
// Is someone trying to post into a redirect forum?
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   100
if ($cur_posting['redirect_url'] != '')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   101
	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
   102
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   103
// 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
   104
$mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   105
// $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
   106
$pun_user['is_admmod'] = $session->user_level >= USER_LEVEL_MOD || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array));
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   107
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   108
// Do we have permission to post?
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   109
if ((($tid && (($cur_posting['post_replies'] == '' && $pun_user['g_post_replies'] == '0') || $cur_posting['post_replies'] == '0')) ||
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   110
	($fid && (($cur_posting['post_topics'] == '' && $pun_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) ||
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   111
	(isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) &&
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   112
	!$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
   113
	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
   114
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   115
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   116
// 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
   117
$errors = array();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   118
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   119
// Did someone just hit "Submit" or "Preview"?
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   120
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
   121
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   122
	($hook = get_hook('po_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
   123
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   124
	// Make sure form_user is correct
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   125
	if (($pun_user['is_guest'] && $_POST['form_user'] != 'Guest') || (!$pun_user['is_guest'] && $_POST['form_user'] != $pun_user['username']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   126
		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
   127
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   128
	// Flood protection
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   129
	if (!$pun_user['is_guest'] && !isset($_POST['preview']) && $pun_user['last_post'] != '' && (time() - $pun_user['last_post']) < $pun_user['g_post_flood'] && (time() - $pun_user['last_post']) >= 0)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   130
		$errors[] = sprintf($lang_post['Flood'], $pun_user['g_post_flood']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   131
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   132
	// If it's a new topic
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   133
	if ($fid)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   134
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   135
		$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
   136
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   137
		if ($subject == '')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   138
			$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
   139
		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
   140
			$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
   141
		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
   142
			$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
   143
	}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   144
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   145
	// If the user is logged in we get the username and e-mail from $pun_user
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   146
	if (!$pun_user['is_guest'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   147
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   148
		$username = $pun_user['username'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   149
		$email = $pun_user['email'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   150
	}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   151
	// Otherwise it should be in $_POST
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   152
	else
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   153
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   154
		$username = trim($_POST['req_username']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   155
		$email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email']));
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
		// Load the profile.php language file
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   158
		require PUN_ROOT.'lang/'.$pun_user['language'].'/profile.php';
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
		// It's a guest, so we have to validate the username
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   161
		$errors = array_merge($errors, validate_username($username));
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   162
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   163
		if ($pun_config['p_force_guest_email'] == '1' || $email != '')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   164
		{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   165
			require PUN_ROOT.'include/email.php';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   166
			if (!is_valid_email($email))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   167
				$errors[] = $lang_common['Invalid e-mail'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   168
		}
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
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   171
	// If we're an administrator or moderator, make sure the CSRF token in $_POST is valid
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   172
	if (($session->user_level >= USER_LEVEL_ADMIN || $pun_user['g_moderator'] == '1') && $_POST['csrf_token'] !== generate_form_token(get_current_url()))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   173
		$errors[] = $lang_post['CSRF token mismatch'];
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
	// 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
   176
	$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
   177
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   178
	if ($message == '')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   179
		$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
   180
	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
   181
		$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
   182
	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
   183
		$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
   184
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   185
	// Validate BBCode syntax
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   186
	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
   187
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   188
		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
   189
		$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
   190
	}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   191
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   192
	$hide_smilies = isset($_POST['hide_smilies']) ? 1 : 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   193
	$subscribe = isset($_POST['subscribe']) ? 1 : 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   194
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   195
	$now = time();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   196
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   197
	// 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
   198
	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
   199
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   200
		($hook = get_hook('po_pre_post_added')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   201
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   202
		// If it's a reply
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   203
		if ($tid)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   204
		{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   205
			add_post(array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   206
					'is_guest'		=>	$pun_user['is_guest'],
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   207
					'poster'		=>	$username,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   208
					'poster_id'		=>	$pun_user['id'],	// Always 1 for guest posts
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   209
					'poster_email'	=>	($pun_user['is_guest'] && $email != '') ? $email : null,	// Always null for non-guest posts
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   210
					'subject'		=>	$cur_posting['subject'],
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   211
					'message'		=>	$message,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   212
					'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
   213
					'posted'		=>	$now,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   214
					'subscr_action'	=>	($pun_config['o_subscriptions'] == '1' && $subscribe && !$is_subscribed) ? 1 : (($pun_config['o_subscriptions'] == '1' && !$subscribe && $is_subscribed) ? 2 : 0),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   215
					'topic_id'		=>	$tid,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   216
					'forum_id'		=>	$cur_posting['id']
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   217
				),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   218
				$new_pid	// By ref
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
		}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   221
		// If it's a new topic
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   222
		else if ($fid)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   223
		{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   224
			add_topic(array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   225
				'is_guest'		=>	$pun_user['is_guest'],
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   226
				'poster'		=>	$username,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   227
				'poster_id'		=>	$pun_user['id'],	// Always 1 for guest posts
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   228
				'poster_email'	=>	($pun_user['is_guest'] && $email != '') ? $email : null,	// Always null for non-guest posts
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   229
				'subject'		=>	$subject,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   230
				'message'		=>	$message,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   231
				'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
   232
				'posted'		=>	$now,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   233
				'subscribe'		=>	($pun_config['o_subscriptions'] == '1' && (isset($_POST['subscribe']) && $_POST['subscribe'] == '1')),
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   234
				'forum_id'		=>	$fid
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
				$new_tid,	// By ref
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   237
				$new_pid	// By ref
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   238
			);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   239
		}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   240
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   241
		if (!$pun_user['is_guest'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   242
		{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   243
			// If the posting user is logged in, increment his/her post count
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   244
			$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   245
				'UPDATE'	=> 'users',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   246
				'SET'		=> 'num_posts=num_posts+1, last_post='.$now,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   247
				'WHERE'		=> '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
   248
				'PARAMS'	=> array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   249
					'LOW_PRIORITY'	=> 1	// MySQL only
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   250
				)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   251
			);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   252
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   253
			($hook = get_hook('po_qr_increment_num_posts')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   254
			$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
   255
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   256
			// Add/update the topic in our list of tracked topics
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   257
			$tracked_topics = get_tracked_topics();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   258
			$tracked_topics['topics'][$tid ? $tid : $new_tid] = time();
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   259
			set_tracked_topics($tracked_topics);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   260
		}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   261
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   262
		pun_redirect(pun_link($pun_url['post'], $new_pid), $lang_post['Post redirect']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   263
	}
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
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   266
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   267
// Are we quoting someone?
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   268
if ($tid && isset($_GET['qid']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   269
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   270
	$qid = intval($_GET['qid']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   271
	if ($qid < 1)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   272
		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
   273
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   274
	// Get the quote and quote poster
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   275
	$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   276
		'SELECT'	=> 'p.poster, p.message',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   277
		'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
   278
		'WHERE'		=> 'id='.$qid.' AND topic_id='.$tid
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   279
	);
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
	($hook = get_hook('po_qr_get_quote')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   282
	$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
   283
	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
   284
		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
   285
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   286
	list($q_poster, $q_message) = $pun_db->fetch_row($result);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   287
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   288
	$q_message = str_replace('[img]', '[url]', $q_message);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   289
	$q_message = str_replace('[/img]', '[/url]', $q_message);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   290
	$q_message = htmlspecialchars($q_message);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   291
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   292
	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
   293
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   294
		// If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   295
		if (strpos($q_poster, '[') !== false || strpos($q_poster, ']') !== false)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   296
		{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   297
			if (strpos($q_poster, '\'') !== false)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   298
				$q_poster = '"'.$q_poster.'"';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   299
			else
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   300
				$q_poster = '\''.$q_poster.'\'';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   301
		}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   302
		else
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   303
		{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   304
			// Get the characters at the start and end of $q_poster
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   305
			$ends = substr($q_poster, 0, 1).substr($q_poster, -1, 1);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   306
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   307
			// Deal with quoting "Username" or 'Username' (becomes '"Username"' or "'Username'")
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   308
			if ($ends == '\'\'')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   309
				$q_poster = '"'.$q_poster.'"';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   310
			else if ($ends == '""')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   311
				$q_poster = '\''.$q_poster.'\'';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   312
		}
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
		$pun_page['quote'] = '[quote='.$q_poster.']'.$q_message.'[/quote]'."\n";
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   315
	}
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['quote'] = '> '.sprintf($lang_common['User wrote'], $q_poster).':'."\n\n".'> '.$q_message."\n";
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
// Setup error messages
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   321
if (!empty($errors))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   322
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   323
	$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
   324
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   325
	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
   326
		$pun_page['errors'][] = '<li class="warn"><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
   327
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   328
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   329
// Setup form
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   330
$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
   331
$pun_page['form_action'] = ($tid ? pun_link($pun_url['new_reply'], $tid) : pun_link($pun_url['new_topic'], $fid));
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
$pun_page['hidden_fields'] = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   334
	'<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
   335
	'<input type="hidden" name="form_user" value="'.((!$pun_user['is_guest']) ? htmlspecialchars($pun_user['username']) : 'Guest').'" />'
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   336
);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   337
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
   338
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   339
	$pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token(get_current_url()).'" />';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   340
}
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
// Setup help
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   343
$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
   344
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
   345
	$pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'bbcode').'" title="'.sprintf($lang_common['Help page'], $lang_common['BBCode']).'"><span>'.$lang_common['BBCode'].'</span></a>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   346
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
   347
	$pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'img').'" title="'.sprintf($lang_common['Help page'], $lang_common['Images']).'"><span>'.$lang_common['Images'].'</span></a>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   348
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
   349
	$pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'smilies').'" title="'.sprintf($lang_common['Help page'], $lang_common['Smilies']).'"><span>'.$lang_common['Smilies'].'</span></a>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   350
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   351
// Setup breadcrumbs
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   352
$pun_page['crumbs'][] = 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
   353
$pun_page['crumbs'][] = array($cur_posting['forum_name'], pun_link($pun_url['forum'], $cur_posting['id']));
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   354
if ($tid) $pun_page['crumbs'][] = array($cur_posting['subject'], pun_link($pun_url['topic'], $tid));
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   355
$pun_page['crumbs'][] = $tid ? $lang_post['Post reply'] : $lang_post['Post new topic'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   356
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   357
($hook = get_hook('po_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
   358
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   359
define('PUN_PAGE', 'post');
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   360
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
   361
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   362
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   363
<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
   364
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   365
	<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
   366
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   367
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   368
// 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
   369
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
   370
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   371
	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
   372
	$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
   373
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   374
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   375
	<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
   376
		<h2><span><?php echo $tid ? $lang_post['Preview reply'] : $lang_post['Preview new topic']; ?></span></h2>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   377
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   378
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   379
	<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
   380
		<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
   381
			<div class="postmain">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   382
				<div class="posthead">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   383
					<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
   384
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   385
				<div class="postbody">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   386
					<div class="user">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   387
						<h4 class="user-ident"><strong class="username"><?php echo $pun_user['username'] ?></strong></h4>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   388
					</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   389
					<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
   390
						<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
   391
						<?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
   392
						</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   393
					</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   394
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   395
			</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   396
		</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   397
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   398
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   399
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   400
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   401
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   402
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   403
	<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
   404
		<h2><span><?php echo $lang_post['Compose your'].' '.($tid ? $lang_post['New reply'] : $lang_post['New topic']) ?></span></h2>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   405
<?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
   406
<?php endif; ?>	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   407
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   408
	<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
   409
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   410
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   411
// 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
   412
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
   413
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   414
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   415
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   416
		<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
   417
			<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
   418
			<ul>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   419
				<?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
   420
			</ul>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   421
		</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   422
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   423
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   424
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   425
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   426
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   427
		<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
   428
			<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
   429
		</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   430
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   431
		<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
   432
			<div class="hidden">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   433
				<?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
   434
			</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   435
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   436
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   437
($hook = get_hook('po_pre_guest_info_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
   438
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   439
if ($pun_user['is_guest'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   440
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   441
	$pun_page['email_form_name'] = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   442
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   443
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   444
			<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
   445
				<legend class="frm-legend"><strong><?php echo $lang_post['Guest 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
   446
<?php ($hook = get_hook('po_guest_info_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
   447
				<div class="frm-fld text required">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   448
					<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
   449
						<span class="fld-label"><?php echo $lang_post['Guest name'] ?></span><br />
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   450
						<span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_username" value="<?php if (isset($_POST['req_username'])) echo htmlspecialchars($username); ?>" size="35" maxlength="25" /></span>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   451
						<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
   452
					</label>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   453
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   454
<?php ($hook = get_hook('po_post_guest_name_div')) ? eval($hook) : null; ?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   455
				<div class="frm-fld text<?php if ($pun_config['p_force_guest_email'] == '1') echo ' required' ?>">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   456
					<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
   457
						<span class="fld-label"><?php echo $lang_post['Guest e-mail'] ?></span><br />
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   458
						<span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="<?php echo $pun_page['email_form_name'] ?>" value="<?php if (isset($_POST[$pun_page['email_form_name']])) echo htmlspecialchars($email); ?>" size="35" maxlength="80" /></span>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   459
						<?php if ($pun_config['p_force_guest_email'] == '1') echo '<em class="req-text">'.$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
   460
					</label>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   461
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   462
<?php ($hook = get_hook('po_guest_info_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
   463
			</fieldset>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   464
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   465
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   466
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   467
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   468
($hook = get_hook('po_pre_req_info_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
   469
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   470
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   471
			<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
   472
				<legend class="frm-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   473
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   474
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   475
($hook = get_hook('po_req_info_fieldset_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
   476
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   477
if ($fid)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   478
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   479
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   480
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   481
				<div class="frm-fld text required longtext">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   482
					<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
   483
						<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
   484
						<span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo htmlspecialchars($subject); ?>" size="80" maxlength="70" /></span>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   485
						<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
   486
					</label>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   487
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   488
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   489
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   490
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   491
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   492
($hook = get_hook('po_pre_post_contents')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   493
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   494
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   495
				<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
   496
					<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
   497
						<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
   498
						<span class="fld-input"><textarea id="fld<?php echo $pun_page['fld_count'] ?>" name="req_message" rows="14" cols="95"><?php echo isset($_POST['req_message']) ? htmlspecialchars($message) : (isset($pun_page['quote']) ? $pun_page['quote'] : ''); ?></textarea></span><br />
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   499
						<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
   500
					</label>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   501
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   502
			</fieldset>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   503
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   504
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   505
$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
   506
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
   507
	$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"'.(isset($_POST['hide_smilies']) ? ' 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
   508
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   509
// Check/uncheck the checkbox for subscriptions depending on scenario
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   510
if (!$pun_user['is_guest'] && $pun_config['o_subscriptions'] == '1')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   511
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   512
	$subscr_checked = false;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   513
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   514
	// If it's a preview
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   515
	if (isset($_POST['preview']))
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   516
		$subscr_checked = isset($_POST['subscribe']) ? true : false;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   517
	// If auto subscribed
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   518
	else if ($pun_user['auto_notify'])
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   519
		$subscr_checked = true;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   520
	// If already subscribed to the topic
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   521
	else if ($is_subscribed)
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   522
		$subscr_checked = true;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   523
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   524
	$pun_page['checkboxes'][] = '<div class="radbox"><label for="fld'.(++$pun_page['fld_count']).'"><input type="checkbox" id="fld'.$pun_page['fld_count'].'" name="subscribe" value="1"'.($subscr_checked ? ' checked="checked"' : '').' /> '.($is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']).'</label></div>';
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   525
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   526
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   527
($hook = get_hook('po_pre_optional_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
   528
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   529
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
   530
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   531
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   532
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   533
			<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
   534
				<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
   535
				<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
   536
					<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
   537
					<?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
   538
				</fieldset>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   539
			</fieldset>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   540
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   541
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   542
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   543
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   544
($hook = get_hook('po_post_optional_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
   545
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   546
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   547
			<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
   548
				<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
   549
				<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
   550
			</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   551
		</form>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   552
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   553
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   554
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   555
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   556
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   557
// Check if the topic review is to be displayed
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   558
if ($tid && $pun_config['o_topic_review'] != '0')
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   559
{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   560
	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
   561
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   562
	// Get posts to display in topic review
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   563
	$query = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   564
		'SELECT'	=> 'p.id, p.poster, p.message, p.hide_smilies, p.posted',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   565
		'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
   566
		'WHERE'		=> 'topic_id='.$tid,
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   567
		'ORDER BY'	=>	'id DESC',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   568
		'LIMIT'		=>	$pun_config['o_topic_review']
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   569
	);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   570
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   571
	($hook = get_hook('po_qr_get_topic_review_posts')) ? eval($hook) : null;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   572
	$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
   573
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   574
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   575
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   576
	<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
   577
		<h2><span><?php echo $lang_post['Topic review'] ?></span></h2>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   578
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   579
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   580
	<div 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
   581
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   582
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   583
	$pun_page['item_count'] = 0;
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   584
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   585
	while ($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
   586
	{
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   587
		++$pun_page['item_count'];
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   588
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   589
		$pun_page['item_head'] = array(
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   590
			'<strong>'.$pun_page['item_count'].'</strong>',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   591
			'<cite class="author">'.$lang_common['Posted by'].' '.htmlspecialchars($cur_post['poster']).'</cite>',
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   592
			'<a class="permalink" rel="bookmark" title="'.$lang_post['Permalink post'].'" href="'.pun_link($pun_url['post'], $cur_post['id']).'">'.format_time($cur_post['posted']).'</a>'
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   593
		);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   594
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   595
		$pun_page['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   596
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   597
		($hook = get_hook('po_topic_review_row_pre_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
   598
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   599
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   600
		<div class="post<?php echo ($pun_page['item_count'] == 1) ? ' firstpost' : '' ?>">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   601
			<div class="postmain">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   602
				<div class="posthead">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   603
					<h3><?php echo implode(' ', $pun_page['item_head']) ?></h3>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   604
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   605
				<div class="postbody">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   606
					<div class="user">
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   607
						<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
   608
					</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   609
					<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
   610
						<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
   611
						<?php echo $pun_page['message']."\n" ?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   612
						</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   613
					</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   614
				</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   615
			</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   616
		</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   617
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   618
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   619
	}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   620
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   621
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   622
	</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   623
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   624
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   625
}
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   626
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   627
?>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   628
</div>
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   629
<?php
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   630
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   631
($hook = get_hook('po_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
   632
98bbc533541c Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
diff changeset
   633
require PUN_ROOT.'footer.php';