if ($mode == 'editpost' || $mode == 'delete')
{
$topic_id = $post_info['topic_id'];
$post_data['poster_post'] = ($post_info['poster_id'] == $userdata['user_id']);
$post_data['first_post'] = ($post_info['topic_first_post_id'] == $post_id);
$post_data['last_post'] = ($post_info['topic_last_post_id'] == $post_id);
$post_data['last_topic'] = ($post_info['forum_last_post_id'] == $post_id);
$post_data['topic_type'] = $post_info['topic_type'];
$post_data['poster_id'] = $post_info['poster_id'];
$selected_rg = $post_info['poster_rg_id'];
$switch_rg_sig = ($post_info['attach_rg_sig']) ? true : false;
// Can this user edit/delete the post?
if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'])
{
$auth_err = ($delete || $mode == 'delete') ? $lang['DELETE_OWN_POSTS'] : $lang['EDIT_OWN_POSTS'];
}
elseif (!$post_data['last_post'] && !$is_auth['auth_mod'] && ($mode == 'delete' || $delete))
{
$auth_err = $lang['CANNOT_DELETE_REPLIED'];
}
if (isset($auth_err)) bb_die($auth_err);
}
else
{
if ($mode == 'quote')
{
$topic_id = $post_info['topic_id'];
}
if ($mode == 'newtopic')
{
$post_data['topic_type'] = POST_NORMAL;
}
$post_data['first_post'] = ($mode == 'newtopic');
$post_data['last_post'] = false;
}
}
else
{
bb_die($lang['NO_SUCH_POST']);
}