$is_auth = array();
switch ($mode)
{
case 'newtopic':
case 'new_rel':
if (bf($userdata['user_opt'], 'user_opt', 'dis_topic'))
{
bb_die($lang['RULES_POST_CANNOT']);
}
if ($topic_type == POST_ANNOUNCE)
{
$is_auth_type = 'auth_announce';
}
elseif ($topic_type == POST_STICKY)
{
$is_auth_type = 'auth_sticky';
}
else
{
$is_auth_type = 'auth_post';
}
break;
case 'reply':
case 'quote':
if (bf($userdata['user_opt'], 'user_opt', 'dis_post'))
{
bb_die($lang['RULES_REPLY_CANNOT']);
}
$is_auth_type = 'auth_reply';
break;
case 'editpost':
if (bf($userdata['user_opt'], 'user_opt', 'dis_post_edit'))
{
bb_die($lang['RULES_EDIT_CANNOT']);
}
$is_auth_type = 'auth_edit';
break;
case 'delete':
$is_auth_type = 'auth_delete';
break;
default:
bb_die($lang['NO_POST_MODE']);
break;
}
// Here we do various lookups to find topic_id, forum_id, post_id etc.
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
$error_msg = '';