while ($r = db_rowarr($c)) { $data[$r[0]] = array($r[1], $r[2]); } if (!$data) { $data = null; } } else { /* register single vote */ $data[$poll_id][1] += 1; } } if (isset($_GET['del']) && ($del = (int) $_GET['del'])) { if ($usr->users_opt & 1048576 || q_singleval('SELECT mr.id FROM phpgw_fud_msg_report mr INNER JOIN phpgw_fud_msg m ON m.id=mr.msg_id INNER JOIN phpgw_fud_thread t ON t.id=m.thread_id INNER JOIN phpgw_fud_mod mm ON mm.forum_id=t.forum_id AND mm.user_id=' . _uid . ' WHERE mr.id=' . $del)) { q('DELETE FROM phpgw_fud_msg_report WHERE id=' . $del); if (db_affected()) { logaction(_uid, 'DELREPORT'); } } else { std_error('access'); } } $r = $query_type('SELECT m.*, t.thread_opt, t.root_msg_id, t.last_post_id, t.forum_id, f.message_threshold, f.name AS frm_name, u.id AS user_id, u.alias AS login, u.avatar_loc, u.email, u.posted_msg_count, u.join_date, u.location, u.sig, u.custom_status, u.icq, u.jabber, u.affero, u.aim, u.msnm, u.yahoo, u.users_opt, u.last_visit AS time_sec, l.name AS level_name, l.level_opt, l.img AS level_img, p.max_votes, p.expiry_date, p.creation_date, p.name AS poll_name, p.total_votes, mr.id AS report_id, mr.stamp AS report_stamp, mr.reason AS report_reason, u2.id AS report_user_id, u2.alias AS report_user_login, u2.last_visit AS time_sec_r,
q("DELETE FROM phpgw_fud_thread WHERE id IN({$tl})"); rebuild_forum_view($forum); if ($forum != $frm) { rebuild_forum_view($frm); foreach (array($frm, $forum) as $v) { $r = db_saq("SELECT MAX(last_post_id), SUM(replies), COUNT(*) FROM phpgw_fud_thread INNER JOIN phpgw_fud_msg ON root_msg_id=phpgw_fud_msg.id AND phpgw_fud_msg.apr=1 WHERE forum_id={$v}"); if (empty($r[2])) { $r = array(0, 0, 0); } q("UPDATE phpgw_fud_forum SET thread_count={$r[2]}, post_count={$r[1]}, last_post_id={$r[0]} WHERE id={$v}"); } } else { q("UPDATE phpgw_fud_forum SET thread_count=thread_count-" . (count($_POST['sel_th']) - 1) . " WHERE id={$frm}"); } db_unlock(); logaction(_uid, 'THRMERGE', $new_th, count($_POST['sel_th'])); unset($_POST['sel_th']); } } } /* fetch a list of accesible forums */ $c = uq('SELECT f.id, f.name FROM phpgw_fud_forum f INNER JOIN phpgw_fud_fc_view v ON v.f=f.id INNER JOIN phpgw_fud_cat c ON c.id=f.cat_id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' INNER JOIN phpgw_fud_group_cache g1 ON g1.resource_id=f.id AND g1.user_id=' . (_uid ? '2147483647' : '0') . ' ' . (_uid ? ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.resource_id=f.id AND g2.user_id=' . _uid : '') . ' ' . ($usr->users_opt & 1048576 ? '' : ' WHERE mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NULL THEN g1.group_cache_opt ELSE g2.group_cache_opt END) & 2) > 0') . ' ORDER BY v.id'); $vl = $kl = '';
header('Location: /egroupware/fudforum/3814588639/index.php?t=tree&' . _rsidl . '&th=' . $data[1]); } else { header('Location: /egroupware/fudforum/3814588639/index.php?t=tree&' . _rsidl . '&th=' . $data[1] . '&mid=' . $data[5]); } } else { header('Location: /egroupware/fudforum/3814588639/index.php?t=msg&th=' . $data[1] . '&' . _rsidl . '&start=end'); } exit; } else { if ($th) { if (!($data = db_saq('SELECT mm.id, (CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) AS gco FROM phpgw_fud_thread t LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=t.forum_id AND mm.user_id=' . _uid . ' INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=t.forum_id LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=t.forum_id WHERE t.id=' . $th))) { check_return($usr->returnto); } if (!$data[0] && !($data[1] & 4096) && !($usr->users_opt & 1048576)) { check_return($usr->returnto); } if (isset($_GET['lock'])) { logaction(_uid, 'THRLOCK', $th); th_lock($th, 1); } else { logaction(_uid, 'THRUNLOCK', $th); th_lock($th, 0); } } } check_return($usr->returnto);
if (!$th_id) { $create_thread = 1; $msg_post->add($frm->id, $frm->message_threshold, $frm->forum_opt, $perms & (64 | 4096), false); } else { if ($th_id && !$msg_id) { $msg_post->thread_id = $th_id; $msg_post->add_reply($reply_to, $th_id, $perms & (64 | 4096), false); } else { if ($msg_id) { $msg_post->id = $msg_id; $msg_post->thread_id = $th_id; $msg_post->post_stamp = $msg->post_stamp; $msg_post->sync(_uid, $frm->id, $frm->message_threshold, $perms & (64 | 4096)); /* log moderator edit */ if (_uid && _uid != $msg->poster_id) { logaction($usr->id, 'MSGEDIT', $msg_post->id); } } 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 (!$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 INNER JOIN phpgw_fud_cat c ON c.id=v.c LEFT JOIN phpgw_fud_mod m ON m.user_id=' . _uid . ' AND m.forum_id=f.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=f.id LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=f.id WHERE c.id!=0 AND f.id!=' . $thr->forum_id . ($usr->users_opt & 1048576 ? '' : ' AND (CASE WHEN m.user_id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 1) > 0 THEN 1 ELSE 0 END)=1') . ' ORDER BY v.id'); $table_data = $prev_cat = ''; while ($ent = db_rowarr($r)) {
if (!($a_src['threadtime'] > $a_tgt['threadtime'])) { message('Fehler', 'Der Ziel-Thread ist jünger als der Quell-Thread. Dies würde die Beitragsreihenfolge zerstören'); } // do it. thwb_query('UPDATE ' . $pref . 'post SET threadid = \'' . $tgt . '\' WHERE threadid = \'' . $src . '\''); thwb_query('DELETE FROM ' . $pref . 'thread WHERE threadid = \'' . $src . '\''); thwb_query('UPDATE ' . $pref . 'thread SET threadreplies = ' . ($a_tgt['threadreplies'] + $a_src['threadreplies'] + 1) . ' WHERE threadid = \'' . $tgt . '\''); updatethread($tgt); updateboard($a_src['boardid']); updateboard($a_tgt['boardid']); logaction('merge with ' . $tgt); message('Info', 'Die Threads wurden erfolgreich verschmolzen.<br><a href="' . build_link('showtopic.php?threadid=' . $tgt) . '">Zum Ziel-Thread</a>.'); } /* * =============================================================== * action: markthread thread * =============================================================== */ /*if( $action == 'markthread' ) { $navpath .= "Thread markieren"; if( $g_user['userid'] != 0 ) { if ( substr_count( $g_user['usermarkedthreads'], ';'.$thread['threadid'].';' ) != 0 ) { $usermarkedthreads = str_replace(';'.$thread['threadid'].';', ';', $g_user['usermarkedthreads'] );
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 FROM phpgw_fud_thr_exchange thx LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f2.id AND mm.user_id=' . _uid . ' INNER JOIN phpgw_fud_thread t ON thx.th=t.id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id INNER JOIN phpgw_fud_forum f1 ON t.forum_id=f1.id INNER JOIN phpgw_fud_forum f2 ON thx.frm=f2.id INNER JOIN phpgw_fud_users u ON thx.req_by=u.id WHERE ' . ($usr->users_opt & 1048576 ? '1=1' : ' mm.id IS NOT NULL')); while ($obj = db_rowobj($r)) {
if (isset($_GET['chpos'], $_GET['newpos'])) { frm_change_pos((int) $_GET['chpos'], (int) $_GET['newpos'], $cat_id); rebuild_forum_cat_order(); unset($_GET['chpos'], $_GET['newpos']); } else { if (isset($_GET['del'])) { if (frm_move_forum((int) $_GET['del'], 0, $cat_id)) { rebuild_forum_cat_order(); logaction(_uid, 'FRMMARKDEL', q_singleval('SELECT name FROM ' . $tbl . 'forum WHERE id=' . (int) $_GET['del'])); } } else { if (isset($_POST['btn_chcat'], $_POST['frm_id'], $_POST['cat_id'], $_POST['dest_cat'])) { if (frm_move_forum((int) $_POST['frm_id'], (int) $_POST['dest_cat'], $cat_id)) { rebuild_forum_cat_order(); $r = db_saq('SELECT f.name, c1.name, c2.name FROM ' . $tbl . 'forum f INNER JOIN ' . $tbl . 'cat c1 ON c1.id=' . $cat_id . ' INNER JOIN ' . $tbl . 'cat c2 ON c2.id=' . (int) $_POST['dest_cat'] . ' WHERE f.id=' . (int) $_POST['frm_id']); logaction(_uid, 'CHCATFORUM', 'Moved forum "' . addslashes($r[0]) . '" from category: "' . addslashes($r[1]) . '" to category: "' . addslashes($r[2]) . '"'); } } } } if (isset($_GET['o'], $_GET['ot'])) { if (in_array($_GET['ot'], array('name', 'descr', 'date_created'))) { $i = 0; $r = q("SELECT id FROM {$tbl}forum WHERE cat_id={$cat_id} ORDER BY {$_GET['ot']} " . ((int) $_GET['o'] ? 'ASC' : 'DESC')); while ($o = db_rowarr($r)) { q("UPDATE {$tbl}forum SET view_order=" . ++$i . " WHERE id={$o[0]}"); } rebuild_forum_cat_order(); } } require $WWW_ROOT_DISK . 'adm/admpanel.php';