$data = db_sab('SELECT u.email, u.login, u.id, m.subject, f1.name AS f1_name, f2.name AS f2_name, ' . ($usr->users_opt & 1048576 ? ' 1 ' : ' mm.id ') . ' AS md
				FROM phpgw_fud_thread t
				INNER JOIN phpgw_fud_forum f1 ON t.forum_id=f1.id
				INNER JOIN phpgw_fud_forum f2 ON f2.id=' . $thrx->frm . '
				INNER JOIN phpgw_fud_msg m ON m.id=t.root_msg_id
				INNER JOIN phpgw_fud_users u ON u.id=' . $thrx->req_by . '
				LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=' . $thrx->frm . ' AND mm.user_id=' . _uid . '
				WHERE t.id=' . $thrx->th);
        if (!$data) {
            invl_inp_err();
        }
        if (!$data->md) {
            std_error('access');
        }
        if (!empty($_POST['reason'])) {
            send_status_update($data->id, $data->login, $data->email, 'Moving of topic ' . $data->subject . ' into forum ' . htmlspecialchars($data->f2_name) . ' was declined.', htmlspecialchars($_POST['reason']));
            thx_delete($thrx->id);
            $decl = null;
        } else {
            $thr_exch_data = '<form method="post" action="/egroupware/fudforum/3814588639/index.php?t=thr_exch" name="thr_exch">
' . _hs . '<input type="hidden" name="decl" value="' . $decl . '">
<tr><td class="RowStyleC">Reason for declining topic <b>' . $data->subject . '</b> into forum <b>' . htmlspecialchars($data->f2_name) . '</b><br /><textarea name="reason" cols=60 rows=10></textarea><br /><input type="submit" class="button" name="btn_submit" value="Submit"></td><tr>
</form>';
        }
        logaction($usr->id, 'THRXDECLINE', $thrx->th);
    }
}
if (!isset($decl)) {
    $thr_exch_data = '';
    $r = uq('SELECT
				thx.*, m.subject, f1.name AS sf_name, f2.name AS df_name, u.alias
        $data = db_sab('SELECT u.email, u.login, u.id, m.subject, f1.name AS f1_name, f2.name AS f2_name, ' . ($usr->users_opt & 1048576 ? ' 1 ' : ' mm.id ') . ' AS md
				FROM phpgw_fud_thread t
				INNER JOIN phpgw_fud_forum f1 ON t.forum_id=f1.id
				INNER JOIN phpgw_fud_forum f2 ON f2.id=' . $thrx->frm . '
				INNER JOIN phpgw_fud_msg m ON m.id=t.root_msg_id
				INNER JOIN phpgw_fud_users u ON u.id=' . $thrx->req_by . '
				LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=' . $thrx->frm . ' AND mm.user_id=' . _uid . '
				WHERE t.id=' . $thrx->th);
        if (!$data) {
            invl_inp_err();
        }
        if (!$data->md) {
            std_error('access');
        }
        if (!empty($_POST['reason'])) {
            send_status_update($data->id, $data->login, $data->email, 'La richiesta di spostamento del topic ' . $data->subject . ' nel forum ' . $frm->name . ' è stata rifiutata.', htmlspecialchars($_POST['reason']));
            thx_delete($thrx->id);
            $decl = null;
        } else {
            $thr_exch_data = '<form method="post" action="/egroupware/fudforum/3814588639/index.php?t=thr_exch" name="thr_exch">
' . _hs . '<input type="hidden" name="decl" value="' . $decl . '">
<tr><td class="RowStyleC">Motivazione per il rifiuto dell&#39;inserimento del topic <b>' . htmlspecialchars($frm->name) . '</b> nel forum <b>' . $frm->name . '</b><br /><textarea name="reason" cols=60 rows=10></textarea><br /><input type="submit" class="button" name="btn_submit" value="Invia"></td><tr>
</form>';
        }
        logaction($usr->id, 'THRXDECLINE', $thrx->th);
    }
}
if (!isset($decl)) {
    $thr_exch_data = '';
    $r = uq('SELECT
				thx.*, m.subject, f1.name AS sf_name, f2.name AS df_name, u.alias