case 'reply':
// CrackerTracker v5.x
if ($ctracker_config->settings['vconfirm_guest'] == 1 && !$userdata['session_logged_in'])
{
define('CRACKER_TRACKER_VCONFIRM', true);
define('POST_CONFIRM_CHECK', true);
include_once(IP_ROOT_PATH . 'ctracker/engines/ct_visual_confirm.' . PHP_EXT);
}
// CrackerTracker v5.x
$username = (!empty($_POST['username'])) ? $_POST['username'] : '';
$subject = (!empty($_POST['subject'])) ? trim($_POST['subject']) : '';
$topic_desc = (!empty($_POST['topic_desc'])) ? trim($_POST['topic_desc']) : '';
$message = (!empty($_POST['message'])) ? trim($_POST['message']) : '';
$topic_calendar_time = ($topic_calendar_time != $post_data['topic_calendar_time'] && !$is_auth['auth_cal']) ? $post_data['topic_calendar_time'] : $topic_calendar_time;
if (empty($topic_calendar_time)) $topic_calendar_time = 0;
$topic_calendar_duration = ($topic_calendar_duration != $post_data['topic_calendar_duration'] && !$is_auth['auth_cal']) ? $post_data['topic_calendar_duration'] : $topic_calendar_duration;
if (!empty($topic_calendar_duration))
{
$topic_calendar_duration--;
}
if (empty($topic_calendar_time) || empty($topic_calendar_duration))
{
$topic_calendar_duration = 0;
}
$poll_title = (isset($_POST['poll_title']) && $is_auth['auth_pollcreate']) ? $_POST['poll_title'] : '';
$poll_options = (isset($_POST['poll_option_text']) && $is_auth['auth_pollcreate']) ? $_POST['poll_option_text'] : '';
$poll_length = (isset($_POST['poll_length']) && $is_auth['auth_pollcreate']) ? $_POST['poll_length'] : '';
// Event Registration - BEGIN
$reg_active = (isset($_POST['start_registration']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['start_registration'] : '';
$reg_reset = (isset($_POST['reset_registration']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reset_registration'] : '';
$reg_max_option1 = (!empty($_POST['reg_max_option1']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_max_option1'] : '';
$reg_max_option2 = (!empty($_POST['reg_max_option2']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_max_option2'] : '';
$reg_max_option3 = (!empty($_POST['reg_max_option3']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_max_option3'] : '';
$reg_length = (isset($_POST['reg_length']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_length'] : '';
// Event Registration - END
$notes = empty($_POST['notes']) ? '' : trim(stripslashes($_POST['notes']));
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length, $reg_active, $reg_reset, $reg_max_option1, $reg_max_option2, $reg_max_option3, $reg_length, $topic_desc, $topic_calendar_time, $topic_calendar_duration);
// MG Drafts - BEGIN
if (($board_config['allow_drafts'] == true) && $draft && $draft_confirm && $userdata['session_logged_in'] && (($mode == 'reply') || ($mode == 'newtopic')))
{
save_draft($draft_id, $userdata['user_id'], $forum_id, $topic_id, ip_addslashes(strip_tags($subject)), ip_addslashes($message));
//save_draft($draft_id, $userdata['user_id'], $forum_id, $topic_id, str_replace("\'", "''", strip_tags($subject)), str_replace("\'", "''", $message));
$message = $lang['Drafts_Saved'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(VIEWFORUM_MG . '?' . POST_FORUM_URL . '=' . $forum_id) . '">', '</a>');
$redirect_url = append_sid(VIEWFORUM_MG . '?' . POST_FORUM_URL . '=' . $forum_id);
meta_refresh(3, $redirect_url);
message_die(GENERAL_MESSAGE, $message);
}
// MG Drafts - END
if ($error_msg == '')
{
if ($mode == 'reply')
{
$topic_type = $post_data['topic_type'];
}
else
{
$topic_type = (($topic_type != $post_data['topic_type']) && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] && !$is_auth['auth_globalannounce']) ? $post_data['topic_type'] : $topic_type;
}
if(($mode == 'editpost') && ($board_config['edit_notes'] == 1) && (strlen($notes) > 2))
{
$sql = "SELECT edit_notes FROM " . POSTS_TABLE . " WHERE post_id='" . $post_id . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$notes_list = strlen($row['edit_notes']) ? unserialize($row['edit_notes']) : array();
// check limit and delete notes
if(count($notes_list) >= intval($board_config['edit_notes_n']))
{
if($notes_list[$i]['poster'] == $userdata['user_id'])
{
$del_num = $i;
}
for($i = count($notes_list) - 1; $i >= 0; $i--)
{
$del_num = $i;
}
if($del_num >= 0)
{
$new_list = array();
for($n = 0; $n < count($notes_list); $n++)
{
if($n !== $del_num)
{
$new_list[] = $notes_list[$n];
}
}
$notes_list = $new_list;
}
}
$notes_list[] = array(
'poster' => $userdata['user_id'],
'time' => time(),
//'text' => htmlspecialchars($notes)
'text' => $notes
);
empty_cache_folders(POSTS_CACHE_FOLDER);
$sql = "UPDATE " . POSTS_TABLE . " SET edit_notes='" . addslashes(serialize($notes_list)) . "' WHERE post_id='" . $post_id . "'";
$db->sql_query($sql);
// We need this, otherwise editing for normal users will be account twice!
$edit_count_sql = '';
if($userdata['user_level'] == ADMIN)
{
$edit_count_sql = ", post_edit_count = (post_edit_count + 1)";
}
$edited_sql = "post_edit_time = '" . time() . "'" . $edit_count_sql . ", post_edit_id = '" . $userdata['user_id'] . "'";
$sql = "UPDATE " . POSTS_TABLE . " SET " . $edited_sql . " WHERE post_id='" . $post_id . "'";
$db->sql_query($sql);
}
if ($lock_subject)
{
$url = '[url="' . VIEWTOPIC_MG . '?' . (!empty($forum_id_append) ? ($forum_id_append . '&') : '') . (!empty($topic_id_append) ? ($topic_id_append . '&') : '') . POST_POST_URL . '=' . $lock_subject . '#p' . $lock_subject . '"]';
$message = addslashes(sprintf($lang['Link_to_post'], $url, '[/url]')) . $message;
}
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $acro_auto_on, $smilies_on, $attach_sig, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length, $reg_active, $reg_reset, $reg_max_option1, $reg_max_option2, $reg_max_option3, $reg_length, $news_category, $topic_show_portal, $mark_edit, str_replace("\'", "''", $topic_desc), $topic_calendar_time, $topic_calendar_duration);
}
break;