}
$perms = perms_from_obj($frm, $usr->users_opt & 1048576);
if (!($perms & 2)) {
    if (!isset($_GET['logoff'])) {
        std_error('perms');
    } else {
        header('Location: /egroupware/fudforum/3814588639/index.php?t=index&' . _rsidl);
        exit;
    }
}
$msg_forum_path = '<font class="GenText"><a class="GenLink" name="page_top" href="/egroupware/fudforum/3814588639/index.php?t=index&amp;' . _rsid . '">' . $frm->cat_name . '</a> &raquo; <a href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&amp;frm_id=' . $frm->forum_id . '&amp;' . _rsid . '">' . htmlspecialchars($frm->frm_name) . '</a> &raquo; <b>' . $frm->subject . '</b></font>';
if (_uid) {
    /* Deal with thread subscriptions */
    if (isset($_GET['notify'], $_GET['opt'])) {
        if ($_GET['opt'] == 'on') {
            thread_notify_add(_uid, $_GET['th']);
            $frm->subscribed = 1;
        } else {
            thread_notify_del(_uid, $_GET['th']);
            $frm->subscribed = 0;
        }
    }
}
if (!$mid) {
    $mid = $frm->root_msg_id;
}
$msg_obj = db_sab('SELECT
		m.*,
		t.thread_opt, t.root_msg_id, t.last_post_id, t.forum_id,
		f.message_threshold,
		u.id AS user_id, u.alias AS login, u.avatar_loc, u.email, u.posted_msg_count, u.join_date, u.location,
         } else {
             std_error('systemerr');
         }
     }
 }
 /* write file attachments */
 if ($perms & 256 && isset($attach_list)) {
     attach_finalize($attach_list, $msg_post->id);
 }
 if (!$msg_id && (!($frm->forum_opt & 2) || $MOD)) {
     $msg_post->approve($msg_post->id, true);
 }
 if (_uid && !$msg_id) {
     /* deal with notifications */
     if (isset($_POST['msg_poster_notif'])) {
         thread_notify_add(_uid, $msg_post->thread_id);
     } else {
         thread_notify_del(_uid, $msg_post->thread_id);
     }
     /* register a view, so the forum marked as read */
     if (isset($frm)) {
         user_register_forum_view($frm->id);
     }
 }
 /* where to redirect, to the treeview or the flat view and consider what to do for a moderated forum */
 if ($frm->forum_opt & 2 && !$MOD) {
     if ($FUD_OPT_2 & 262144) {
         $modl = array();
         $c = uq('SELECT u.email FROM phpgw_fud_mod mm INNER JOIN phpgw_fud_users u ON u.id=mm.user_id WHERE mm.forum_id=' . $frm->id);
         while ($r = db_rowarr($c)) {
             $modl[] = $r[0];