2001-02-17 08:37:32 +00:00
|
|
|
<?php
|
2001-04-17 07:14:50 +00:00
|
|
|
/***************************************************************************
|
2001-08-26 13:53:41 +00:00
|
|
|
* posting.php
|
2001-04-17 07:14:50 +00:00
|
|
|
* -------------------
|
|
|
|
* begin : Saturday, Feb 13, 2001
|
|
|
|
* copyright : (C) 2001 The phpBB Group
|
|
|
|
* email : support@phpbb.com
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2001-08-30 22:20:23 +00:00
|
|
|
/***************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
define('IN_PHPBB', true);
|
2001-07-13 16:14:37 +00:00
|
|
|
$phpbb_root_path = "./";
|
|
|
|
include($phpbb_root_path . 'extension.inc');
|
|
|
|
include($phpbb_root_path . 'common.'.$phpEx);
|
|
|
|
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
2002-03-18 13:35:43 +00:00
|
|
|
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
|
2001-04-17 07:14:50 +00:00
|
|
|
|
2001-10-16 11:12:32 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Check and set various parameters
|
|
|
|
//
|
|
|
|
$params = array('submit' => 'post', 'confirm' => 'confirm', 'preview' => 'preview', 'delete' => 'delete', 'poll_delete' => 'poll_delete', 'poll_add' => 'add_poll_option', 'poll_edit' => 'edit_poll_option', 'mode' => 'mode', 'forum_id' => POST_FORUM_URL, 'topic_id' => POST_TOPIC_URL, 'post_id' => POST_POST_URL);
|
2001-11-09 13:15:36 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
while( list($var, $param) = @each($params) )
|
2001-10-16 11:12:32 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) )
|
2001-10-16 11:12:32 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$$var = ( !empty($HTTP_POST_VARS[$param]) ) ? $HTTP_POST_VARS[$param] : $HTTP_GET_VARS[$param];
|
2002-01-27 22:13:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$$var = '';
|
2001-10-16 11:12:32 +00:00
|
|
|
}
|
|
|
|
}
|
2002-01-12 17:00:32 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$refresh = $preview || $poll_add || $poll_edit || $poll_delete;
|
2002-01-12 17:00:32 +00:00
|
|
|
|
2001-05-17 14:48:39 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Set topic type
|
|
|
|
//
|
2002-02-18 12:41:06 +00:00
|
|
|
$topic_type = ( !empty($HTTP_POST_VARS['topictype']) ) ? $HTTP_POST_VARS['topictype'] : POST_NORMAL;
|
2001-04-17 07:14:50 +00:00
|
|
|
|
2001-07-04 00:34:33 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// If the mode is set to topic review then output
|
|
|
|
// that review ...
|
2001-07-04 00:34:33 +00:00
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
if( $mode == 'topicreview' )
|
2001-07-10 22:32:39 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
topic_review($topic_id, false);
|
|
|
|
exit;
|
2001-07-10 22:32:39 +00:00
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else if( $mode == 'smilies' )
|
2001-07-10 22:32:39 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
generate_smilies("window", PAGE_POSTING);
|
|
|
|
exit;
|
2001-05-30 20:35:36 +00:00
|
|
|
}
|
2001-06-06 17:50:24 +00:00
|
|
|
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
2001-09-06 00:29:07 +00:00
|
|
|
// Was cancel pressed? If so then redirect to the appropriate
|
|
|
|
// page, no point in continuing with any further checks
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if( isset($HTTP_POST_VARS['cancel']) )
|
2001-08-10 22:00:12 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $post_id )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2001-10-14 18:22:32 +00:00
|
|
|
$redirect = "viewtopic.$phpEx?" . POST_POST_URL . "=$post_id";
|
|
|
|
$post_append = "#$post_id";
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
else if ( $topic_id )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2001-09-07 00:23:40 +00:00
|
|
|
$redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
|
2001-10-14 18:22:32 +00:00
|
|
|
$post_append = "";
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
else if ( $forum_id )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2001-09-07 00:23:40 +00:00
|
|
|
$redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id";
|
2001-10-14 18:22:32 +00:00
|
|
|
$post_append = "";
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-09-07 00:23:40 +00:00
|
|
|
$redirect = "index.$phpEx";
|
2001-10-14 18:22:32 +00:00
|
|
|
$post_append = "";
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-01-12 17:00:32 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
header('Location: ' . append_sid($redirect) . $post_append, true);
|
2001-12-16 18:13:34 +00:00
|
|
|
}
|
2001-08-10 22:00:12 +00:00
|
|
|
|
2002-01-12 17:00:32 +00:00
|
|
|
//
|
|
|
|
// Start session management
|
|
|
|
//
|
2002-01-28 18:47:41 +00:00
|
|
|
$userdata = session_pagestart($user_ip, PAGE_POSTING);
|
2002-01-12 17:00:32 +00:00
|
|
|
init_userprefs($userdata);
|
|
|
|
//
|
|
|
|
// End session management
|
|
|
|
//
|
|
|
|
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// What auth type do we need to check?
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
$is_auth = array();
|
|
|
|
switch( $mode )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
case 'newtopic':
|
|
|
|
if( $topic_type == POST_ANNOUNCE )
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_announce';
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
else if( $topic_type == POST_STICKY )
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_sticky';
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_post';
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'reply':
|
|
|
|
case 'quote':
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_reply';
|
2002-02-18 12:34:38 +00:00
|
|
|
break;
|
|
|
|
case 'editpost':
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_edit';
|
2002-02-18 12:34:38 +00:00
|
|
|
break;
|
|
|
|
case 'delete':
|
|
|
|
case 'poll_delete':
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_delete';
|
2002-02-18 12:34:38 +00:00
|
|
|
break;
|
|
|
|
case 'vote':
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_vote';
|
2002-02-18 12:34:38 +00:00
|
|
|
break;
|
|
|
|
case 'topicreview':
|
2002-03-18 13:35:43 +00:00
|
|
|
$is_auth_type = 'auth_read';
|
2002-02-18 12:34:38 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
message_die(GENERAL_MESSAGE, $lang['No_post_mode']);
|
|
|
|
break;
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
|
2001-07-10 22:32:39 +00:00
|
|
|
//
|
2001-08-30 22:20:23 +00:00
|
|
|
// Here we do various lookups to find topic_id, forum_id, post_id etc.
|
2001-08-10 22:00:12 +00:00
|
|
|
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
|
2001-07-10 22:32:39 +00:00
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
$error_msg = '';
|
2002-02-18 12:34:38 +00:00
|
|
|
$post_data = array();
|
|
|
|
switch ( $mode )
|
2001-07-10 22:32:39 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
case 'newtopic':
|
|
|
|
if ( empty($forum_id) )
|
2001-07-10 22:32:39 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
|
2001-07-10 22:32:39 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
|
|
FROM " . FORUMS_TABLE . "
|
|
|
|
WHERE forum_id = $forum_id";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'reply':
|
|
|
|
case 'vote':
|
|
|
|
if ( empty( $topic_id) )
|
2001-07-10 22:32:39 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
message_die(GENERAL_MESSAGE, $lang['No_topic_id']);
|
2001-07-10 22:32:39 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
$sql = "SELECT f.*, t.topic_status
|
|
|
|
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
|
|
|
|
WHERE t.topic_id = $topic_id
|
|
|
|
AND f.forum_id = t.forum_id";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'quote':
|
|
|
|
case 'editpost':
|
|
|
|
case 'delete':
|
|
|
|
case 'poll_delete':
|
|
|
|
if ( empty($post_id) )
|
2001-07-10 22:32:39 +00:00
|
|
|
{
|
|
|
|
message_die(GENERAL_MESSAGE, $lang['No_post_id']);
|
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
$select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig" : "";
|
|
|
|
$from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : "";
|
|
|
|
$where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : "";
|
|
|
|
|
|
|
|
$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . "
|
|
|
|
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
|
|
|
|
WHERE p.post_id = $post_id
|
|
|
|
AND t.topic_id = p.topic_id
|
|
|
|
AND f.forum_id = p.forum_id
|
|
|
|
$where_sql";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2001-07-10 22:32:39 +00:00
|
|
|
message_die(GENERAL_MESSAGE, $lang['No_valid_mode']);
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
2001-07-10 22:32:39 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $result = $db->sql_query($sql) )
|
|
|
|
{
|
|
|
|
$post_info = $db->sql_fetchrow($result);
|
2001-07-10 22:32:39 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$forum_id = $post_info['forum_id'];
|
|
|
|
$forum_name = $post_info['forum_name'];
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
|
2001-07-10 22:32:39 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod'])
|
|
|
|
{
|
|
|
|
message_die(GENERAL_MESSAGE, $lang['Forum_locked']);
|
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else if ( $mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
message_die(GENERAL_MESSAGE, $lang['Topic_locked']);
|
|
|
|
}
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$topic_id = $post_info['topic_id'];
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$post_data['poster_post'] = ( $post_info['poster_id'] == $userdata['user_id'] ) ? true : false;
|
|
|
|
$post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id ) ? true : false;
|
|
|
|
$post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id ) ? true : false;
|
|
|
|
$post_data['last_topic'] = ( $post_info['forum_last_post_id'] == $post_id ) ? true : false;
|
|
|
|
$post_data['has_poll'] = ( $post_info['topic_vote'] ) ? true : false;
|
|
|
|
$post_data['topic_type'] = $post_info['topic_type'];
|
2002-02-23 17:54:32 +00:00
|
|
|
$post_data['poster_id'] = $post_info['poster_id'];
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $post_data['first_post'] && $post_data['has_poll'] )
|
|
|
|
{
|
|
|
|
$sql = "SELECT *
|
|
|
|
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
|
|
|
|
WHERE vd.topic_id = $topic_id
|
|
|
|
AND vr.vote_id = vd.vote_id
|
|
|
|
ORDER BY vr.vote_option_id";
|
|
|
|
if ( !($result = $db->sql_query($sql)) )
|
|
|
|
{
|
|
|
|
message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
|
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$poll_options = array();
|
|
|
|
$poll_results_sum = 0;
|
|
|
|
if ( $row = $db->sql_fetchrow($result) )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$poll_title = $row['vote_text'];
|
|
|
|
$poll_id = $row['vote_id'];
|
|
|
|
$poll_length = $row['vote_length'] / 86400;
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
do
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$poll_options[$row['vote_option_id']] = $row['vote_option_text'];
|
|
|
|
$poll_results_sum += $row['vote_result'];
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
while ( $row = $db->sql_fetchrow($result) );
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
$post_data['edit_poll'] = ( ( !$poll_results_sum || $is_auth['auth_mod'] ) && $post_data['first_post'] ) ? true : 0;
|
2001-07-10 22:32:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$post_data['edit_poll'] = false;
|
2001-07-10 22:32:39 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Can this user edit/delete the post/poll?
|
|
|
|
//
|
|
|
|
if ( $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'] )
|
|
|
|
{
|
|
|
|
$message = ( $delete || $mode == "delete" ) ? $lang['Delete_own_posts'] : $lang['Edit_own_posts'];
|
|
|
|
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
message_die(GENERAL_MESSAGE, $message);
|
|
|
|
}
|
|
|
|
else if ( !$post_data['last_post'] && !$is_auth['auth_mod'] && ( $mode == "delete" || $delete ) )
|
|
|
|
{
|
|
|
|
message_die(GENERAL_MESSAGE, $lang['Cannot_delete_replied']);
|
|
|
|
}
|
|
|
|
else if ( !$post_data['edit_poll'] && !$is_auth['auth_mod'] && ( $mode == "poll_delete" || $poll_delete ) )
|
|
|
|
{
|
|
|
|
message_die(GENERAL_MESSAGE, $lang['Cannot_delete_poll']);
|
|
|
|
}
|
2001-07-24 17:51:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $mode == 'quote' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$topic_id = $post_info['topic_id'];
|
|
|
|
}
|
2001-05-30 20:35:36 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$post_data['first_post'] = ( $mode == 'newtopic' ) ? true : 0;
|
2002-02-18 12:34:38 +00:00
|
|
|
$post_data['last_post'] = false;
|
|
|
|
$post_data['has_poll'] = false;
|
|
|
|
$post_data['edit_poll'] = false;
|
2001-10-16 11:12:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
|
2001-10-16 11:12:32 +00:00
|
|
|
}
|
|
|
|
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
|
|
|
// The user is not authed, if they're not logged in then redirect
|
|
|
|
// them, else show them an error message
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( !$is_auth[$is_auth_type] )
|
2001-05-30 20:35:36 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $userdata['session_logged_in'] )
|
2001-07-20 00:26:56 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_' . $is_auth_type], $is_auth[$is_auth_type . "_type"]));
|
2001-07-20 00:26:56 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
switch( $mode )
|
2001-07-20 00:26:56 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
case 'newtopic':
|
|
|
|
$redirect = "mode=newtopic&" . POST_FORUM_URL . "=" . $forum_id;
|
|
|
|
break;
|
|
|
|
case 'reply':
|
|
|
|
case 'topicreview':
|
|
|
|
$redirect = "mode=reply&" . POST_TOPIC_URL . "=" . $topic_id;
|
|
|
|
break;
|
|
|
|
case 'quote':
|
|
|
|
case 'editpost':
|
|
|
|
$redirect = "mode=quote&" . POST_POST_URL ."=" . $post_id;
|
|
|
|
break;
|
2001-07-20 00:26:56 +00:00
|
|
|
}
|
2001-05-30 20:35:36 +00:00
|
|
|
|
2002-03-28 19:52:21 +00:00
|
|
|
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
|
2002-03-22 21:50:05 +00:00
|
|
|
header($header_location . append_sid("login.$phpEx?redirect=posting.$phpEx&" . $redirect, true));
|
2002-02-20 17:39:03 +00:00
|
|
|
exit;
|
2001-05-30 20:35:36 +00:00
|
|
|
}
|
2001-12-15 14:19:29 +00:00
|
|
|
|
2001-09-18 01:24:47 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Set toggles for various options
|
2001-09-18 01:24:47 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if( !$board_config['allow_html'] )
|
2001-09-18 01:24:47 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$html_on = 0;
|
2001-09-18 01:24:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
|
2001-09-18 01:24:47 +00:00
|
|
|
}
|
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( !$board_config['allow_bbcode'] )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$bbcode_on = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );
|
|
|
|
}
|
2002-01-28 18:47:41 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( !$board_config['allow_smilies'] )
|
|
|
|
{
|
|
|
|
$smilies_on = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );
|
|
|
|
}
|
2001-06-11 00:58:08 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $submit || $refresh )
|
|
|
|
{
|
|
|
|
$notify_user = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-20 14:56:11 +00:00
|
|
|
if ( $mode != 'newtopic' && $userdata['session_logged_in'] )
|
2002-01-28 18:47:41 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$sql = "SELECT topic_id
|
|
|
|
FROM " . TOPICS_WATCH_TABLE . "
|
|
|
|
WHERE topic_id = $topic_id
|
|
|
|
AND user_id = " . $userdata['user_id'];
|
|
|
|
if ( !($result = $db->sql_query($sql)) )
|
2001-05-26 00:25:50 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
message_die(GENERAL_ERROR, "Couldn't obtain topic watch information", "", __LINE__, __FILE__, $sql);
|
2001-05-26 00:25:50 +00:00
|
|
|
}
|
2002-01-28 18:47:41 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify'];
|
2001-05-26 00:25:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-20 14:56:11 +00:00
|
|
|
$notify_user = ( $userdata['session_logged_in'] ) ? $userdata['user_notify'] : 0;
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2001-05-26 00:25:50 +00:00
|
|
|
}
|
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] );
|
|
|
|
|
|
|
|
// --------------------
|
|
|
|
// What shall we do?
|
2001-07-06 01:09:42 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( ( $delete || $poll_delete || $mode == "delete" ) && !$confirm )
|
2001-05-26 00:25:50 +00:00
|
|
|
{
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Confirm deletion
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
$s_hidden_fields = '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
|
|
|
|
$s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input type="hidden" name="mode" value="delete" />' : '<input type="hidden" name="mode" value="poll_delete" />';
|
2002-01-12 17:00:32 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll'];
|
2001-09-06 00:29:07 +00:00
|
|
|
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Output confirmation page
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$template->set_filenames(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'confirm_body' => 'confirm_body.tpl')
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'MESSAGE_TITLE' => $lang['Information'],
|
|
|
|
'MESSAGE_TEXT' => $l_confirm,
|
2001-12-03 12:21:53 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
'L_YES' => $lang['Yes'],
|
|
|
|
'L_NO' => $lang['No'],
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
'S_CONFIRM_ACTION' => append_sid("posting.$phpEx"),
|
|
|
|
'S_HIDDEN_FIELDS' => $s_hidden_fields)
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->pparse('confirm_body');
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else if ( $mode == 'vote' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Vote in a poll
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( !empty($HTTP_POST_VARS['vote_id']) )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$vote_option_id = $HTTP_POST_VARS['vote_id'];
|
|
|
|
|
|
|
|
$sql = "SELECT vd.vote_id
|
|
|
|
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
|
|
|
|
WHERE vd.topic_id = $topic_id
|
|
|
|
AND vr.vote_id = vd.vote_id
|
|
|
|
AND vr.vote_option_id = $vote_option_id
|
|
|
|
GROUP BY vd.vote_id";
|
|
|
|
if ( !($result = $db->sql_query($sql)) )
|
|
|
|
{
|
|
|
|
message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
|
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $vote_info = $db->sql_fetchrow($result) )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$vote_id = $vote_info['vote_id'];
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$sql = "SELECT *
|
|
|
|
FROM " . VOTE_USERS_TABLE . "
|
|
|
|
WHERE vote_id = $vote_id
|
|
|
|
AND vote_user_id = " . $userdata['user_id'];
|
|
|
|
if ( !($result = $db->sql_query($sql)) )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
message_die(GENERAL_ERROR, "Couldn't obtain user vote data for this topic", "", __LINE__, __FILE__, $sql);
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( !($row = $db->sql_fetchrow($result)) )
|
|
|
|
{
|
|
|
|
$sql = "UPDATE " . VOTE_RESULTS_TABLE . "
|
|
|
|
SET vote_result = vote_result + 1
|
|
|
|
WHERE vote_id = $vote_id
|
|
|
|
AND vote_option_id = $vote_option_id";
|
|
|
|
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
|
|
|
|
{
|
|
|
|
message_die(GENERAL_ERROR, "Couldn't update poll result", "", __LINE__, __FILE__, $sql);
|
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip)
|
|
|
|
VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')";
|
|
|
|
if ( !$db->sql_query($sql, END_TRANSACTION) )
|
|
|
|
{
|
|
|
|
message_die(GENERAL_ERROR, "Couldn't insert user_id for poll", "", __LINE__, __FILE__, $sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
$message = $lang['Vote_cast'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message = $lang['Already_voted'];
|
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$message = $lang['No_vote_option'];
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">')
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
|
|
|
$message .= '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
|
|
|
|
message_die(GENERAL_MESSAGE, $message);
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
else if ( $submit || $confirm )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Submit post/vote (newtopic, edit, reply, etc.)
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
$return_message = '';
|
|
|
|
$return_meta = '';
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
switch ( $mode )
|
2001-07-11 00:02:24 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
case 'editpost':
|
|
|
|
case 'newtopic':
|
|
|
|
case 'reply':
|
2002-03-18 13:35:43 +00:00
|
|
|
$username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : '';
|
|
|
|
$subject = ( !empty($HTTP_POST_VARS['subject']) ) ? $HTTP_POST_VARS['subject'] : '';
|
|
|
|
$message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : '';
|
|
|
|
$poll_title = ( isset($HTTP_POST_VARS['poll_title']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_title'] : '';
|
|
|
|
$poll_options = ( isset($HTTP_POST_VARS['poll_option_text']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_option_text'] : '';
|
|
|
|
$poll_length = ( isset($HTTP_POST_VARS['poll_length']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_length'] : '';
|
|
|
|
$bbcode_uid = '';
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length);
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $error_msg == '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
|
2002-03-21 01:03:47 +00:00
|
|
|
if ( $error_msg == '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
user_notification($mode, $post_data, $forum_id, $topic_id, $post_id, $notify_user);
|
|
|
|
}
|
|
|
|
break;
|
2001-07-11 00:02:24 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
case 'delete':
|
|
|
|
case 'poll_delete':
|
|
|
|
delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);
|
|
|
|
break;
|
2001-07-11 00:02:24 +00:00
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $error_msg == '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
2002-03-21 01:03:47 +00:00
|
|
|
if ( $mode != 'editpost' )
|
|
|
|
{
|
|
|
|
$user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id'];
|
|
|
|
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
|
|
|
|
}
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $mode == 'newtopic' || $mode == 'reply' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$tracking_topics = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
|
|
|
|
$tracking_forums = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( count($tracking_topics) + count($tracking_forums) == 100 && empty($tracking_topics[$topic_id]) )
|
|
|
|
{
|
|
|
|
asort($tracking_topics);
|
|
|
|
unset($tracking_topics[key($tracking_topics)]);
|
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$tracking_topics[$topic_id] = time();
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$template->assign_vars(array(
|
|
|
|
"META" => $return_meta)
|
|
|
|
);
|
|
|
|
message_die(GENERAL_MESSAGE, $return_message);
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
2001-07-06 01:09:42 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$username = ( !empty($HTTP_POST_VARS['username']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['username']))) : '';
|
|
|
|
$subject = ( !empty($HTTP_POST_VARS['subject']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['subject']))) : '';
|
|
|
|
$message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
|
2001-06-04 00:14:26 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$poll_title = ( !empty($HTTP_POST_VARS['poll_title']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['poll_title']))) : '';
|
2002-02-18 12:34:38 +00:00
|
|
|
$poll_length = ( isset($HTTP_POST_VARS['poll_length']) ) ? max(0, intval($HTTP_POST_VARS['poll_length'])) : 0;
|
2001-08-10 23:13:41 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$poll_options = array();
|
|
|
|
if ( !empty($HTTP_POST_VARS['poll_option_text']) )
|
|
|
|
{
|
|
|
|
while( list($option_id, $option_text) = @each($HTTP_POST_VARS['poll_option_text']) )
|
|
|
|
{
|
|
|
|
if( isset($HTTP_POST_VARS['del_poll_option'][$option_id]) )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
unset($poll_options[$option_id]);
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
else if ( !empty($option_text) )
|
2001-12-11 08:55:17 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$poll_options[$option_id] = htmlspecialchars(trim(stripslashes($option_text)));
|
2001-12-11 08:55:17 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
}
|
2001-05-27 03:11:27 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( isset($poll_add) && !empty($HTTP_POST_VARS['add_poll_option_text']) )
|
|
|
|
{
|
|
|
|
$poll_options[] = htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['add_poll_option_text'])));
|
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $mode == 'newtopic' || $mode == 'reply')
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
else if ( $mode == 'editpost' )
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$user_sig = ( $post_info['user_sig'] != '' ) ? $post_info['user_sig'] : '';
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( $preview )
|
|
|
|
{
|
|
|
|
$orig_word = array();
|
|
|
|
$replacement_word = array();
|
|
|
|
obtain_word_list($orig_word, $replacement_word);
|
2001-06-16 14:29:49 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
|
|
|
|
$preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
|
2002-02-18 12:34:38 +00:00
|
|
|
$preview_subject = $subject;
|
|
|
|
$preview_username = $username;
|
2001-08-30 22:20:23 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
//
|
|
|
|
// Finalise processing as per viewtopic
|
|
|
|
//
|
|
|
|
if( !$html_on )
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
if( $user_sig != '' || !$userdata['user_allowhtml'] )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', '<\2>', $user_sig);
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
}
|
2001-05-26 00:25:50 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']);
|
|
|
|
}
|
2001-06-11 00:58:08 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( $bbcode_on )
|
|
|
|
{
|
|
|
|
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
|
|
|
|
}
|
2001-08-10 23:13:41 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( !empty($orig_word) )
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$preview_username = ( !empty($username) ) ? preg_replace($orig_word, $replacement_word, $preview_username) : '';
|
|
|
|
$preview_subject = ( !empty($subject) ) ? preg_replace($orig_word, $replacement_word, $preview_subject) : '';
|
|
|
|
$preview_message = ( !empty($preview_message) ) ? preg_replace($orig_word, $replacement_word, $preview_message) : '';
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
2001-07-15 15:45:09 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if( $user_sig != '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$user_sig = make_clickable($user_sig);
|
|
|
|
}
|
|
|
|
$preview_message = make_clickable($preview_message);
|
2001-07-04 00:34:33 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( $smilies_on )
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
if( $userdata['user_allowsmile'] && $user_sig != '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$user_sig = smilies_pass($user_sig);
|
|
|
|
}
|
2001-08-15 22:54:48 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$preview_message = smilies_pass($preview_message);
|
|
|
|
}
|
2001-08-15 22:54:48 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if( $attach_sig && $user_sig != '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig;
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$preview_message = str_replace("\n", '<br />', $preview_message);
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
$template->set_filenames(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'preview' => 'posting_preview.tpl')
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
2001-08-15 22:54:48 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'TOPIC_TITLE' => $preview_subject,
|
|
|
|
'POST_SUBJECT' => $preview_subject,
|
|
|
|
'POSTER_NAME' => $preview_username,
|
|
|
|
'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']),
|
|
|
|
'MESSAGE' => $preview_message,
|
|
|
|
|
|
|
|
'L_POST_SUBJECT' => $lang['Post_subject'],
|
|
|
|
'L_PREVIEW' => $lang['Preview'],
|
|
|
|
'L_POSTED' => $lang['Posted'])
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview');
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else if( $error_msg != '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$template->set_filenames(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'reg_header' => 'error_body.tpl')
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'ERROR_MESSAGE' => $error_msg)
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// User default entry point
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $mode == 'newtopic' )
|
2001-08-10 22:00:12 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
|
2001-08-10 22:00:12 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
|
|
|
|
$poll_title = '';
|
|
|
|
$poll_length = '';
|
|
|
|
$subject = '';
|
|
|
|
$message = '';
|
2001-08-10 23:13:41 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
else if ( $mode == 'reply' )
|
2001-08-09 22:21:55 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$username = ( $userdata['session_logged_in'] ) ? $userdata['username'] : '';
|
|
|
|
$subject = '';
|
|
|
|
$message = '';
|
2001-08-09 22:21:55 +00:00
|
|
|
|
2001-08-15 22:54:48 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
else if ( $mode == 'quote' || $mode == 'editpost' )
|
2001-08-09 22:21:55 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject'];
|
|
|
|
$message = $post_info['post_text'];
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $mode == 'editpost' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$attach_sig = ( $post_info['enable_sig'] && $post_info['user_sig'] != '' ) ? TRUE : 0;
|
2002-02-18 12:34:38 +00:00
|
|
|
$user_sig = $post_info['user_sig'];
|
2002-03-03 22:53:11 +00:00
|
|
|
|
|
|
|
$html_on = ( $post_info['enable_html'] ) ? true : false;
|
|
|
|
$bbcode_on = ( $post_info['enable_bbcode'] ) ? true : false;
|
|
|
|
$smilies_on = ( $post_info['enable_smilies'] ) ? true : false;
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$attach_sig = ( $userdata['user_attachsig'] ) ? TRUE : 0;
|
|
|
|
$user_sig = $userdata['user_sig'];
|
|
|
|
}
|
2001-08-10 22:00:12 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $post_info['bbcode_uid'] != '' )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$message = preg_replace('/\:(([a-z0-9]:)?)' . $post_info['bbcode_uid'] . '/s', '', $message);
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
|
|
|
|
$message = str_replace('<', '<', $message);
|
|
|
|
$message = str_replace('>', '>', $message);
|
|
|
|
$message = str_replace('<br />', "\n", $message);
|
2001-06-11 00:58:08 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $mode == 'quote' )
|
|
|
|
{
|
|
|
|
$orig_word = array();
|
|
|
|
$replacement_word = array();
|
|
|
|
obtain_word_list($orig_word, $replace_word);
|
2001-06-11 00:58:08 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
$msg_date = create_date($board_config['default_dateformat'], $postrow['post_time'], $board_config['board_timezone']);
|
2001-08-10 22:00:12 +00:00
|
|
|
|
2002-03-23 22:18:04 +00:00
|
|
|
$quote_username = ( !empty($post_info['post_username']) ) ? $post_info['post_username'] : $post_info['username'];
|
|
|
|
$message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
if ( !empty($orig_word) )
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$subject = ( !empty($subject) ) ? preg_replace($orig_word, $replace_word, $subject) : '';
|
|
|
|
$message = ( !empty($message) ) ? preg_replace($orig_word, $replace_word, $message) : '';
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 )
|
2002-02-18 12:34:38 +00:00
|
|
|
{
|
|
|
|
$subject = 'Re: ' . $subject;
|
|
|
|
}
|
|
|
|
|
|
|
|
$mode = 'reply';
|
|
|
|
}
|
2002-02-20 17:39:03 +00:00
|
|
|
else
|
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$username = ( $post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username']) ) ? $post_info['post_username'] : '';
|
2002-02-20 17:39:03 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-16 18:13:34 +00:00
|
|
|
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Signature toggle selection
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
2002-03-03 22:53:11 +00:00
|
|
|
if( $user_sig != '' )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('signature_checkbox', array());
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
2001-08-10 22:00:12 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// HTML toggle selection
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $board_config['allow_html'] )
|
2001-06-13 17:36:58 +00:00
|
|
|
{
|
2001-11-15 16:26:41 +00:00
|
|
|
$html_status = $lang['HTML_is_ON'];
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('html_checkbox', array());
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-15 16:26:41 +00:00
|
|
|
$html_status = $lang['HTML_is_OFF'];
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
|
|
|
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
|
|
|
// BBCode toggle selection
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $board_config['allow_bbcode'] )
|
2001-06-13 17:36:58 +00:00
|
|
|
{
|
2001-11-15 16:26:41 +00:00
|
|
|
$bbcode_status = $lang['BBCode_is_ON'];
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('bbcode_checkbox', array());
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-15 16:26:41 +00:00
|
|
|
$bbcode_status = $lang['BBCode_is_OFF'];
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
2001-05-27 16:41:33 +00:00
|
|
|
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
|
|
|
// Smilies toggle selection
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $board_config['allow_smilies'] )
|
2001-06-13 17:36:58 +00:00
|
|
|
{
|
2001-11-15 16:26:41 +00:00
|
|
|
$smilies_status = $lang['Smilies_are_ON'];
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('smilies_checkbox', array());
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
2001-07-23 16:43:10 +00:00
|
|
|
else
|
|
|
|
{
|
2001-11-15 16:26:41 +00:00
|
|
|
$smilies_status = $lang['Smilies_are_OFF'];
|
2001-07-23 16:43:10 +00:00
|
|
|
}
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) )
|
2001-06-13 17:36:58 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('username_select', array());
|
2001-08-10 22:00:12 +00:00
|
|
|
}
|
|
|
|
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
|
|
|
// Notify checkbox - only show if user is logged in
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $userdata['session_logged_in'] )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $mode != 'editpost' || ( $mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS ) )
|
2001-09-18 01:24:47 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('notify_checkbox', array());
|
2001-09-18 01:24:47 +00:00
|
|
|
}
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
|
|
|
// Delete selection
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if ( $mode == 'editpost' && ( ( $is_auth['auth_delete'] && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $is_auth['auth_mod'] ) )
|
2001-08-10 22:00:12 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('delete_checkbox', array());
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
|
|
|
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
|
|
|
// Topic type selection
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle = '';
|
|
|
|
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
|
2001-06-13 17:36:58 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('type_toggle', array());
|
2001-08-10 22:00:12 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( $is_auth['auth_sticky'] )
|
2001-06-13 17:36:58 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_STICKY . '"';
|
|
|
|
if ( $post_data['topic_type'] == POST_STICKY )
|
2001-05-25 00:56:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle .= ' checked="checked"';
|
2001-05-25 00:56:07 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle .= ' /> ' . $lang['Post_Sticky'] . ' ';
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
2001-05-27 03:11:27 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( $is_auth['auth_announce'] )
|
2001-06-13 17:36:58 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"';
|
|
|
|
if ( $post_data['topic_type'] == POST_ANNOUNCE )
|
2001-06-07 07:56:45 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle .= ' checked="checked"';
|
2001-06-07 07:56:45 +00:00
|
|
|
}
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle .= ' /> ' . $lang['Post_Announcement'] . ' ';
|
2001-07-04 00:34:33 +00:00
|
|
|
}
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $topic_type_toggle != '' )
|
2001-07-04 00:34:33 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
$topic_type_toggle = $lang['Post_topic_as'] . ': <input type="radio" name="topictype" value="' . POST_NORMAL .'"' . ( ( $post_data['topic_type'] == POST_NORMAL ) ? ' checked="checked"' : '' ) . ' /> ' . $lang['Post_Normal'] . ' ' . $topic_type_toggle;
|
2001-06-13 17:36:58 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-17 07:14:50 +00:00
|
|
|
|
2001-09-06 00:29:07 +00:00
|
|
|
$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
|
2001-06-13 17:36:58 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
switch( $mode )
|
2001-08-10 22:00:12 +00:00
|
|
|
{
|
2001-09-06 00:29:07 +00:00
|
|
|
case 'newtopic':
|
2002-02-18 12:34:38 +00:00
|
|
|
$page_title = $lang['Post_a_new_topic'];
|
2001-09-06 00:29:07 +00:00
|
|
|
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
|
|
|
|
break;
|
2001-08-09 22:21:55 +00:00
|
|
|
|
2001-09-06 00:29:07 +00:00
|
|
|
case 'reply':
|
2002-02-18 12:34:38 +00:00
|
|
|
$page_title = $lang['Post_a_reply'];
|
2001-09-06 00:29:07 +00:00
|
|
|
$hidden_form_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'editpost':
|
2002-02-18 12:34:38 +00:00
|
|
|
$page_title = $lang['Edit_Post'];
|
2001-09-06 00:29:07 +00:00
|
|
|
$hidden_form_fields .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
|
|
|
|
break;
|
2001-08-10 22:00:12 +00:00
|
|
|
}
|
2001-08-09 22:21:55 +00:00
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
// Generate smilies listing for page output
|
|
|
|
generate_smilies("inline", PAGE_POSTING);
|
|
|
|
|
2001-12-04 18:08:43 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
// Include page header
|
2001-12-04 18:08:43 +00:00
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
|
|
|
|
|
|
|
$template->set_filenames(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'body' => 'posting_body.tpl',
|
|
|
|
'pollbody' => 'posting_poll_body.tpl',
|
|
|
|
'jumpbox' => 'jumpbox.tpl',
|
|
|
|
'reviewbody' => 'posting_topic_review.tpl')
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$jumpbox = make_jumpbox();
|
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'L_GO' => $lang['Go'],
|
|
|
|
'L_JUMP_TO' => $lang['Jump_to'],
|
|
|
|
'L_SELECT_FORUM' => $lang['Select_forum'],
|
2002-02-18 12:34:38 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
'S_JUMPBOX_LIST' => $jumpbox,
|
|
|
|
'S_JUMPBOX_ACTION' => append_sid("viewforum.$phpEx"))
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_var_from_handle('JUMPBOX', 'jumpbox');
|
2002-02-18 12:34:38 +00:00
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'FORUM_NAME' => $forum_name,
|
|
|
|
'L_POST_A' => $page_title,
|
|
|
|
'L_POST_SUBJECT' => $lang['Post_subject'],
|
2002-02-18 12:34:38 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
|
2002-02-18 12:34:38 +00:00
|
|
|
);
|
2001-12-04 18:08:43 +00:00
|
|
|
|
2001-12-16 18:13:34 +00:00
|
|
|
//
|
|
|
|
// This enables the forum/topic title to be output for posting
|
|
|
|
// but not for privmsg (where it makes no sense)
|
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('switch_not_privmsg', array());
|
2001-12-16 18:13:34 +00:00
|
|
|
|
2001-08-10 22:00:12 +00:00
|
|
|
//
|
|
|
|
// Output the data to the template
|
|
|
|
//
|
2001-06-13 17:36:58 +00:00
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'USERNAME' => $username,
|
|
|
|
'SUBJECT' => $subject,
|
|
|
|
'MESSAGE' => $message,
|
|
|
|
'HTML_STATUS' => $html_status,
|
|
|
|
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
|
|
|
|
'SMILIES_STATUS' => $smilies_status,
|
|
|
|
|
|
|
|
'L_SUBJECT' => $lang['Subject'],
|
|
|
|
'L_MESSAGE_BODY' => $lang['Message_body'],
|
|
|
|
'L_OPTIONS' => $lang['Options'],
|
|
|
|
'L_PREVIEW' => $lang['Preview'],
|
|
|
|
'L_SPELLCHECK' => $lang['Spellcheck'],
|
|
|
|
'L_SUBMIT' => $lang['Submit'],
|
|
|
|
'L_CANCEL' => $lang['Cancel'],
|
|
|
|
'L_CONFIRM_DELETE' => $lang['Confirm_delete'],
|
|
|
|
'L_DISABLE_HTML' => $lang['Disable_HTML_post'],
|
|
|
|
'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'],
|
|
|
|
'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'],
|
|
|
|
'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
|
|
|
|
'L_NOTIFY_ON_REPLY' => $lang['Notify'],
|
|
|
|
'L_DELETE_POST' => $lang['Delete_post'],
|
|
|
|
|
|
|
|
'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],
|
|
|
|
'L_BBCODE_I_HELP' => $lang['bbcode_i_help'],
|
|
|
|
'L_BBCODE_U_HELP' => $lang['bbcode_u_help'],
|
|
|
|
'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'],
|
|
|
|
'L_BBCODE_C_HELP' => $lang['bbcode_c_help'],
|
|
|
|
'L_BBCODE_L_HELP' => $lang['bbcode_l_help'],
|
|
|
|
'L_BBCODE_O_HELP' => $lang['bbcode_o_help'],
|
|
|
|
'L_BBCODE_P_HELP' => $lang['bbcode_p_help'],
|
|
|
|
'L_BBCODE_W_HELP' => $lang['bbcode_w_help'],
|
|
|
|
'L_BBCODE_A_HELP' => $lang['bbcode_a_help'],
|
|
|
|
'L_BBCODE_S_HELP' => $lang['bbcode_s_help'],
|
|
|
|
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],
|
|
|
|
'L_EMPTY_MESSAGE' => $lang['Empty_message'],
|
|
|
|
|
|
|
|
'L_FONT_COLOR' => $lang['Font_color'],
|
|
|
|
'L_COLOR_DEFAULT' => $lang['color_default'],
|
|
|
|
'L_COLOR_DARK_RED' => $lang['color_dark_red'],
|
|
|
|
'L_COLOR_RED' => $lang['color_red'],
|
|
|
|
'L_COLOR_ORANGE' => $lang['color_orange'],
|
|
|
|
'L_COLOR_BROWN' => $lang['color_brown'],
|
|
|
|
'L_COLOR_YELLOW' => $lang['color_yellow'],
|
|
|
|
'L_COLOR_GREEN' => $lang['color_green'],
|
|
|
|
'L_COLOR_OLIVE' => $lang['color_olive'],
|
|
|
|
'L_COLOR_CYAN' => $lang['color_cyan'],
|
|
|
|
'L_COLOR_BLUE' => $lang['color_blue'],
|
|
|
|
'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'],
|
|
|
|
'L_COLOR_INDIGO' => $lang['color_indigo'],
|
|
|
|
'L_COLOR_VIOLET' => $lang['color_violet'],
|
|
|
|
'L_COLOR_WHITE' => $lang['color_white'],
|
|
|
|
'L_COLOR_BLACK' => $lang['color_black'],
|
|
|
|
|
|
|
|
'L_FONT_SIZE' => $lang['Font_size'],
|
|
|
|
'L_FONT_TINY' => $lang['font_tiny'],
|
|
|
|
'L_FONT_SMALL' => $lang['font_small'],
|
|
|
|
'L_FONT_NORMAL' => $lang['font_normal'],
|
|
|
|
'L_FONT_LARGE' => $lang['font_large'],
|
|
|
|
'L_FONT_HUGE' => $lang['font_huge'],
|
|
|
|
|
|
|
|
'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'],
|
|
|
|
'L_STYLES_TIP' => $lang['Styles_tip'],
|
|
|
|
|
|
|
|
'U_VIEWTOPIC' => ( $mode == 'reply' ) ? append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postorder=desc") : '',
|
|
|
|
'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? append_sid("posting.$phpEx?mode=topicreview&" . POST_TOPIC_URL . "=$topic_id") : '',
|
|
|
|
|
|
|
|
'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '',
|
|
|
|
'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '',
|
|
|
|
'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '',
|
|
|
|
'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '',
|
|
|
|
'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '',
|
|
|
|
'S_TYPE_TOGGLE' => $topic_type_toggle,
|
|
|
|
'S_TOPIC_ID' => $topic_id,
|
|
|
|
'S_POST_ACTION' => append_sid("posting.$phpEx"),
|
|
|
|
'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields)
|
2001-06-13 17:36:58 +00:00
|
|
|
);
|
|
|
|
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
|
|
|
// Poll entry switch/output
|
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $is_auth['auth_pollcreate'] )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
|
|
|
$template->assign_vars(array(
|
2002-03-18 13:35:43 +00:00
|
|
|
'L_ADD_A_POLL' => $lang['Add_poll'],
|
|
|
|
'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'],
|
|
|
|
'L_POLL_QUESTION' => $lang['Poll_question'],
|
|
|
|
'L_POLL_OPTION' => $lang['Poll_option'],
|
|
|
|
'L_ADD_OPTION' => $lang['Add_option'],
|
|
|
|
'L_UPDATE_OPTION' => $lang['Update'],
|
|
|
|
'L_DELETE_OPTION' => $lang['Delete'],
|
|
|
|
'L_POLL_LENGTH' => $lang['Poll_for'],
|
|
|
|
'L_DAYS' => $lang['Days'],
|
|
|
|
'L_POLL_LENGTH_EXPLAIN' => $lang['Poll_for_explain'],
|
|
|
|
'L_POLL_DELETE' => $lang['Delete_poll'],
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
'POLL_TITLE' => $poll_title,
|
|
|
|
'POLL_LENGTH' => $poll_length)
|
2001-09-06 00:29:07 +00:00
|
|
|
);
|
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( $mode == 'editpost' && $post_data['edit_poll'] )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('poll_delete_toggle', array());
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
if( !empty($poll_options) )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
while( list($option_id, $option_text) = each($poll_options) )
|
2001-09-06 00:29:07 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('poll_option_rows', array(
|
2002-03-26 13:13:06 +00:00
|
|
|
'POLL_OPTION' => str_replace("\"", """, $option_text),
|
2001-09-06 00:29:07 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
'S_POLL_OPTION_NUM' => $option_id)
|
2001-09-06 00:29:07 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_var_from_handle('POLLBOX', 'pollbody');
|
2001-09-06 00:29:07 +00:00
|
|
|
}
|
|
|
|
|
2001-10-16 11:12:32 +00:00
|
|
|
//
|
|
|
|
// Topic review
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
if( $mode == 'reply' )
|
2001-10-16 11:12:32 +00:00
|
|
|
{
|
2002-02-18 12:34:38 +00:00
|
|
|
require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
|
2001-10-16 11:12:32 +00:00
|
|
|
topic_review($topic_id, true);
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->assign_block_vars('switch_inline_mode', array());
|
|
|
|
$template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody');
|
2001-10-16 11:12:32 +00:00
|
|
|
}
|
|
|
|
|
2001-09-06 00:29:07 +00:00
|
|
|
//
|
|
|
|
// Parse and print the body
|
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
$template->pparse('body');
|
2001-06-13 17:36:58 +00:00
|
|
|
|
2001-07-13 16:14:37 +00:00
|
|
|
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
2001-06-13 17:36:58 +00:00
|
|
|
|
2002-03-28 19:52:21 +00:00
|
|
|
?>
|