예제 #1
0
        } else {
            if ($data->src_lpi == $data->last_post_id && $data->last_post_date >= $lpd) {
                q('UPDATE phpgw_fud_forum SET thread_count=thread_count+1 WHERE id=' . $data->forum_id);
            } else {
                q('UPDATE phpgw_fud_forum SET thread_count=thread_count+1, last_post_id=' . $data->new_th_lpi . ' WHERE id=' . $data->forum_id);
            }
        }
        rebuild_forum_view($data->forum_id);
        db_unlock();
        logaction(_uid, 'THRSPLIT', $new_th);
        $th_id = $new_th;
    } else {
        /* moving entire thread */
        q("UPDATE phpgw_fud_msg SET subject='" . addslashes(htmlspecialchars($_POST['new_title'])) . "' WHERE id=" . $data->root_msg_id);
        if ($forum != $data->forum_id) {
            th_move($data->id, $forum, $data->root_msg_id, $thr->forum_id, $data->last_post_date, $data->last_post_id);
            if ($data->src_lpi == $data->last_post_id) {
                q('UPDATE phpgw_fud_forum SET last_post_id=' . th_frm_last_post_id($data->forum_id, $data->id) . ' WHERE id=' . $data->forum_id);
            }
            if ($data->old_fm_lpd < $data->last_post_date) {
                q('UPDATE phpgw_fud_forum SET last_post_id=' . $data->last_post_id . ' WHERE id=' . $forum);
            }
            logaction(_uid, 'THRMOVE', $th);
        }
        $th_id = $data->id;
    }
    header('Location: /egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&th=' . $th_id . '&' . _rsidl);
    exit;
}
/* fetch a list of accesible forums */
$c = uq('SELECT f.id, f.name
예제 #2
0
			INNER JOIN phpgw_fud_group_cache gs1 ON gs1.user_id=2147483647 AND gs1.resource_id=f1.id
			LEFT JOIN phpgw_fud_group_cache gs2 ON gs2.user_id=' . _uid . ' AND gs2.resource_id=f1.id
			INNER JOIN phpgw_fud_group_cache gd1 ON gd1.user_id=2147483647 AND gd1.resource_id=f2.id
			LEFT JOIN phpgw_fud_group_cache gd2 ON gd2.user_id=' . _uid . ' AND gd2.resource_id=f2.id
			WHERE t.id=' . $th);
    if (!$thr) {
        invl_inp_err();
    }
    if (!$thr->mod1 && !($thr->sgco & 8192) || !$thr->mod2 && !($thr->dgco & 8192)) {
        std_error('access');
    }
    /* fetch data about source thread & forum */
    $src_frm_lpi = (int) $thr->f1_lpi;
    /* fetch data about dest forum */
    $dst_frm_lpi = (int) $thr->f2_lpi;
    th_move($thr->id, $to, $thr->root_msg_id, $thr->forum_id, $thr->last_post_date, $thr->last_post_id);
    if ($src_frm_lpi == $thr->last_post_id) {
        $mid = (int) q_singleval('SELECT MAX(last_post_id) FROM phpgw_fud_thread t INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE t.forum_id=' . $thr->forum_id . ' AND t.moved_to=0 AND m.apr=1');
        q('UPDATE phpgw_fud_forum SET last_post_id=' . $mid . ' WHERE id=' . $thr->forum_id);
    }
    if ($dst_frm_lpi < $thr->last_post_id) {
        q('UPDATE phpgw_fud_forum SET last_post_id=' . $thr->last_post_id . ' WHERE id=' . $to);
    }
    logaction(_uid, 'THRMOVE', $th);
    exit("<html><script>window.opener.location='/egroupware/fudforum/3814588639/index.php?t=" . t_thread_view . "&" . _rsid . "&frm_id=" . $thr->forum_id . "'; window.close();</script></html>");
}
if (!$thx) {
    $thr = db_sab('SELECT f.name AS frm_name, m.subject, t.forum_id, t.id FROM phpgw_fud_thread t INNER JOIN phpgw_fud_forum f ON f.id=t.forum_id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE t.id=' . $th);
    $r = uq('SELECT f.name, f.id, c.name, m.user_id, (CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) AS gco
			FROM phpgw_fud_forum f
			INNER JOIN phpgw_fud_fc_view v ON v.f=f.id
예제 #3
0
    $data = db_sab('SELECT
					t.forum_id, t.last_post_id, t.root_msg_id, t.last_post_date, t.last_post_id,
					f1.id, f1.last_post_id as f1_lpi, f2.last_post_id AS f2_lpi,
					' . ($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 . '
				LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f2.id AND mm.user_id=' . _uid . '
				WHERE t.id=' . $thrx->th);
    if (!$data) {
        invl_inp_err();
    }
    if (!$data->md) {
        std_error('access');
    }
    th_move($thrx->th, $thrx->frm, $data->root_msg_id, $data->forum_id, $data->last_post_date, $data->last_post_id);
    if ($data->f1_lpi == $data->last_post_id) {
        $mid = (int) q_singleval('SELECT MAX(last_post_id) FROM phpgw_fud_thread t INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE t.forum_id=' . $data->forum_id . ' AND t.moved_to=0 AND m.apr=1');
        q('UPDATE phpgw_fud_forum SET last_post_id=' . $mid . ' WHERE id=' . $data->forum_id);
    }
    if ($data->f2_lpi < $data->last_post_id) {
        q('UPDATE phpgw_fud_forum SET last_post_id=' . $data->last_post_id . ' WHERE id=' . $thrx->frm);
    }
    thx_delete($thrx->id);
    logaction($usr->id, 'THRXAPPROVE', $thrx->th);
} else {
    if ((isset($_GET['decl']) || isset($_POST['decl'])) && ($thrx = thx_get($decl = (int) (isset($_GET['decl']) ? $_GET['decl'] : $_POST['decl'])))) {
        $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 . '