Ejemplo n.º 1
0
        foreach (C::t('forum_post')->fetch_all_by_tid('tid:' . $_G['tid'], array($_G['tid'], $othertid), false, 'ASC') as $row) {
            C::t('forum_post')->update('tid:' . $_G['tid'], $row['pid'], array('position' => $pos));
            $pos++;
        }
    }
    if ($posttable != $otherposttable) {
        foreach (C::t('forum_post')->fetch_all_by_tid('tid:' . $othertid, $othertid) as $row) {
            C::t('forum_post')->insert('tid:' . $_G['tid'], $row);
        }
        C::t('forum_post')->delete_by_tid('tid:' . $othertid, $othertid);
    }
    $query = C::t('forum_post')->fetch_all_by_tid('tid:' . $_G['tid'], array($_G['tid'], $othertid), false, 'ASC', 0, 1, null, 0);
    foreach ($query as $row) {
        $firstpost = $row;
    }
    $postsmerged = C::t('forum_post')->update_by_tid('tid:' . $_G['tid'], $othertid, array('tid' => $_G['tid']));
    updateattachtid('tid', array($othertid), $othertid, $_G['tid']);
    C::t('forum_thread')->delete_by_tid($othertid);
    C::t('forum_threadmod')->delete_by_tid($othertid);
    C::t('forum_post')->update_by_tid('tid:' . $_G['tid'], $_G['tid'], array('first' => 0, 'fid' => $_G['forum']['fid']));
    C::t('forum_post')->update('tid:' . $_G['tid'], $firstpost['pid'], array('first' => 1));
    $fieldarr = array('views' => $other['views'], 'replies' => $other['replies']);
    C::t('forum_thread')->increase($_G['tid'], $fieldarr);
    $fieldarr = array('authorid' => $firstpost['authorid'], 'author' => $firstpost['author'], 'subject' => $firstpost['subject'], 'dateline' => $firstpost['dateline'], 'moderated' => 1, 'maxposition' => $other['maxposition'] + $thread['maxposition']);
    C::t('forum_thread')->update($_G['tid'], $fieldarr);
    updateforumcount($other['fid']);
    updateforumcount($_G['fid']);
    $_G['forum']['threadcaches'] && deletethreadcaches($thread['tid']);
    $modpostsnum++;
    $resultarray = array('redirect' => "forum.php?mod=forumdisplay&fid={$_G['fid']}", 'reasonpm' => $sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => 'reason_merge', 'notictype' => 'post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason), 'modtids' => $thread['tid'], 'modlog' => array($thread, $other));
}
Ejemplo n.º 2
0
     $i++;
 }
 if (!($pids = implode(',', $pids))) {
     showmessage('admin_split_new_invalid');
 }
 $modaction = 'SPL';
 $reason = checkreasonpm();
 $subject = dhtmlspecialchars($_G['gp_subject']);
 DB::query("INSERT INTO " . DB::table('forum_thread') . " (fid, posttableid, subject) VALUES ('{$_G['fid']}', '{$posttableid}', '{$subject}')");
 $newtid = DB::insert_id();
 my_thread_log('split', array('tid' => $_G['tid']));
 foreach ((array) explode(',', $pids) as $pid) {
     my_post_log('split', array('pid' => $pid));
 }
 DB::query("UPDATE " . DB::table($posttable) . " SET tid='{$newtid}' WHERE pid IN ({$pids})");
 updateattachtid("pid IN ({$pids})", $_G['tid'], $newtid);
 $splitauthors = array();
 $query = DB::query("SELECT pid, tid, authorid, subject, dateline FROM " . DB::table($posttable) . " WHERE tid='{$newtid}' AND invisible='0' GROUP BY authorid ORDER BY dateline");
 while ($splitauthor = DB::fetch($query)) {
     $splitauthor['subject'] = $subject;
     $splitauthors[] = $splitauthor;
 }
 DB::query("UPDATE " . DB::table($posttable) . " SET first='1', subject='{$subject}' WHERE pid='" . $splitauthors[0]['pid'] . "'", 'UNBUFFERED');
 $fpost = DB::fetch_first("SELECT pid, author, authorid, dateline FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' ORDER BY dateline LIMIT 1");
 DB::query("UPDATE " . DB::table('forum_thread') . " SET author='" . addslashes($fpost['author']) . "', authorid='{$fpost['authorid']}', dateline='{$fpost['dateline']}', moderated='1' WHERE tid='{$_G['tid']}'");
 DB::query("UPDATE " . DB::table($posttable) . " SET subject='" . addslashes($thread['subject']) . "' WHERE pid='{$fpost['pid']}'");
 $fpost = DB::fetch_first("SELECT author, authorid, dateline, rate FROM " . DB::table($posttable) . " WHERE tid='{$newtid}' ORDER BY dateline ASC LIMIT 1");
 DB::query("UPDATE " . DB::table('forum_thread') . " SET author='" . addslashes($fpost['author']) . "', authorid='{$fpost['authorid']}', dateline='{$fpost['dateline']}', rate='" . intval(@($fpost['rate'] / abs($fpost['rate']))) . "', moderated='1' WHERE tid='{$newtid}'");
 updatethreadcount($_G['tid']);
 updatethreadcount($newtid);
 updateforumcount($_G['fid']);
Ejemplo n.º 3
0
 } elseif (!($nos = explode(',', $_GET['split']))) {
     showmessage('admin_split_new_invalid');
 }
 sort($nos);
 foreach (C::t('forum_post')->fetch_all_by_tid_position($thread['posttableid'], $_G['tid'], $nos) as $post) {
     $pids[] = $post['pid'];
 }
 if (!($pids = implode(',', $pids))) {
     showmessage('admin_split_new_invalid');
 }
 $modaction = 'SPL';
 $reason = checkreasonpm();
 $subject = dhtmlspecialchars($_GET['subject']);
 $newtid = C::t('forum_thread')->insert(array('fid' => $_G['fid'], 'posttableid' => $posttableid, 'subject' => $subject), true);
 C::t('forum_post')->update('tid:' . $_G['tid'], explode(',', $pids), array('tid' => $newtid));
 updateattachtid('pid', (array) explode(',', $pids), $_G['tid'], $newtid);
 $splitauthors = array();
 foreach (C::t('forum_post')->fetch_all_visiblepost_by_tid_groupby_authorid('tid:' . $_G['tid'], $newtid) as $splitauthor) {
     $splitauthor['subject'] = $subject;
     $splitauthors[] = $splitauthor;
 }
 C::t('forum_post')->update('tid:' . $_G['tid'], $splitauthors[0]['pid'], array('first' => 1, 'subject' => $subject), true);
 $query = C::t('forum_post')->fetch_all_by_tid('tid:' . $_G['tid'], $_G['tid'], false, 'ASC', 0, 1);
 foreach ($query as $row) {
     $fpost = $row;
 }
 C::t('forum_thread')->update($_G['tid'], array('author' => $fpost['author'], 'authorid' => $fpost['authorid'], 'dateline' => $fpost['dateline'], 'moderated' => 1));
 C::t('forum_post')->update('tid:' . $_G['post'], $fpost['pid'], array('subject' => $thread['subject']));
 $query = C::t('forum_post')->fetch_all_by_tid('tid:' . $_G['tid'], $newtid, false, 'ASC', 0, 1);
 foreach ($query as $row) {
     $fpost = $row;
Ejemplo n.º 4
0
    } elseif ($other['special']) {
        showmessage('special_noaction');
    }
    if ($othertid == $_G['tid'] || $_G['adminid'] == 3 && $other['fid'] != $_G['forum']['fid']) {
        showmessage('admin_merge_invalid');
    }
    $other['views'] = intval($other['views']);
    $other['replies']++;
    if ($posttable != $otherposttable) {
        $query = DB::query("SELECT * FROM " . DB::table($otherposttable) . " WHERE tid='{$othertid}'");
        while ($row = DB::fetch($query)) {
            $row = daddslashes($row);
            DB::insert($posttable, $row);
        }
        DB::delete($otherposttable, "tid='{$othertid}'");
    }
    $firstpost = DB::fetch_first("SELECT pid, fid, authorid, author, subject, dateline FROM " . DB::table($posttable) . " WHERE tid IN ('{$_G['tid']}', '{$othertid}') AND invisible='0' ORDER BY dateline LIMIT 1");
    DB::query("UPDATE " . DB::table($posttable) . " SET tid='{$_G['tid']}' WHERE tid='{$othertid}'");
    $postsmerged = DB::affected_rows();
    updateattachtid("tid='{$othertid}'", $othertid, $_G['tid']);
    DB::query("DELETE FROM " . DB::table('forum_thread') . " WHERE tid='{$othertid}'");
    DB::query("DELETE FROM " . DB::table('forum_threadmod') . " WHERE tid='{$othertid}'");
    DB::query("UPDATE " . DB::table($posttable) . " SET first=(pid='{$firstpost['pid']}'), fid='" . $_G['forum']['fid'] . "' WHERE tid='{$_G['tid']}'");
    DB::query("UPDATE " . DB::table('forum_thread') . " SET authorid='{$firstpost['authorid']}', author='" . addslashes($firstpost['author']) . "', subject='" . addslashes($firstpost['subject']) . "', dateline='{$firstpost['dateline']}', views=views+{$other['views']}, replies=replies+{$other['replies']}, moderated='1' WHERE tid='{$_G['tid']}'");
    my_thread_log('merge', array('tid' => $othertid, 'otherid' => $_G['tid'], 'fid' => $thread['fid']));
    updateforumcount($other['fid']);
    updateforumcount($_G['fid']);
    $_G['forum']['threadcaches'] && deletethreadcaches($thread['tid']);
    $modpostsnum++;
    $resultarray = array('redirect' => "forum.php?mod=forumdisplay&fid={$_G['fid']}", 'reasonpm' => $sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => 'reason_merge') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason)), 'modtids' => $thread['tid'], 'modlog' => array($thread, $other));
}