Esempio n. 1
0
function undeletethreads($tids)
{
    global $_G;
    $threadsundel = 0;
    if ($tids && is_array($tids)) {
        foreach ($tids as $t) {
            my_thread_log('restore', array('tid' => $t));
        }
        $tids = '\'' . implode('\',\'', $tids) . '\'';
        $tuidarray = $ruidarray = $fidarray = array();
        $postarray = getfieldsofposts('fid, first, authorid', "tid IN ({$tids})");
        foreach ($postarray as $post) {
            if ($post['first']) {
                $tuidarray[] = $post['authorid'];
            } else {
                $ruidarray[] = $post['authorid'];
            }
            if (!in_array($post['fid'], $fidarray)) {
                $fidarray[] = $post['fid'];
            }
        }
        if ($tuidarray) {
            updatepostcredits('+', $tuidarray, 'post');
        }
        if ($ruidarray) {
            updatepostcredits('+', $ruidarray, 'reply');
        }
        updatepost(array('invisible' => '0'), "tid IN ({$tids})", true);
        DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0', moderated='1' WHERE tid IN ({$tids})");
        $threadsundel = DB::affected_rows();
        updatemodlog($tids, 'UDL');
        updatemodworks('UDL', $threadsundel);
        foreach ($fidarray as $fid) {
            updateforumcount($fid);
        }
    }
    return $threadsundel;
}
Esempio n. 2
0
     showformfooter();
 } else {
     $moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
     $pmlist = array();
     $validates = $ignores = $deletes = 0;
     if (is_array($moderate)) {
         foreach ($moderate as $pid => $act) {
             $moderation[$act][] = intval($pid);
         }
     }
     if ($ignorepids = dimplode($moderation['ignore'])) {
         updatepost(array('invisible' => '-3'), "pid IN ({$ignorepids}) AND invisible='-2' AND first='0' {$fidadd['and']}{$fidadd['fids']}");
         $ignores = DB::affected_rows();
     }
     if ($deletepids = dimplode($moderation['delete'])) {
         $postarray = getfieldsofposts('pid, authorid, tid, message', "pid IN ({$deletepids}) AND invisible='{$displayorder}' AND first='0' {$fidadd['and']}{$fidadd['fids']}");
         $pids = $comma = '';
         foreach ($postarray as $post) {
             $pids .= $comma . $post['pid'];
             $pm = 'pm_' . $post['pid'];
             if (isset(${$pm}) && ${$pm} != '' && $post['authorid']) {
                 $pmlist[] = array('action' => 'modreplies_delete', 'notevar' => array('post' => $post, 'reason' => stripslashes($reason)), 'authorid' => $post['authorid'], 'tid' => $post['tid'], 'post' => dhtmlspecialchars(cutstr($post['message'], 30)), 'reason' => dhtmlspecialchars(${$pm}));
             }
             $comma = ',';
         }
         if ($pids) {
             $query = DB::query("SELECT attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE pid IN ({$deletepids})");
             while ($attach = DB::fetch($query)) {
                 dunlink($attach);
             }
             DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE pid IN ({$pids})", 'UNBUFFERED');
Esempio n. 3
0
         if (strlen($keywords[$i]) > 3) {
             $sqlkeywords .= " {$or} message LIKE '%" . $keywords[$i] . "%'";
             $or = 'OR';
         } else {
             $error = 3;
             return;
         }
     }
     $sql .= " AND ({$sqlkeywords})";
 }
 $useip = trim($useip);
 if ($useip != '') {
     $sql .= " AND useip LIKE '" . str_replace('*', '%', $useip) . "'";
 }
 if ($sql) {
     $postarray = getfieldsofposts('pid', "1 {$fidadd} {$sql} ORDER BY dateline DESC LIMIT 1000");
     $pids = $comma = '';
     $count = 0;
     foreach ($postarray as $pid) {
         $pids .= $comma . $pid['pid'];
         $comma = ',';
         $count++;
     }
     $result['pids'] = $pids;
     $result['count'] = $count;
     $result['fid'] = $_G['fid'];
     $modsession->set('srchresult_p' . $_G['fid'], $result, true);
     unset($result, $pids);
     $do = 'list';
     $page = 1;
 } else {
Esempio n. 4
0
         }
     }
     DB::query("UPDATE " . DB::table('forum_thread') . " SET typeid='{$_G['gp_totype']}' WHERE {$tidsadd}");
     $cpmsg = cplang('threads_succeed');
 } elseif ($operation == 'movesort') {
     if ($_G['gp_tosort'] != 0) {
         if (!DB::result_first("SELECT typeid FROM " . DB::table('forum_threadtype') . " WHERE typeid='{$_G['gp_tosort']}' AND special='1'")) {
             cpmsg('threads_move_invalid', '', 'error');
         }
     }
     DB::query("UPDATE " . DB::table('forum_thread') . " SET sortid='{$_G['gp_tosort']}' WHERE {$tidsadd}");
     $cpmsg = cplang('threads_succeed');
 } elseif ($operation == 'delete') {
     if (!$_G['gp_donotupdatemember']) {
         $tuidarray = $ruidarray = array();
         $postarray = getfieldsofposts('first, authorid', $tidsadd);
         foreach ($postarray as $post) {
             if ($post['first']) {
                 $tuidarray[] = $post['authorid'];
             } else {
                 $ruidarray[] = $post['authorid'];
             }
         }
         if ($tuidarray) {
             updatepostcredits('-', $tuidarray, 'post');
         }
         if ($ruidarray) {
             updatepostcredits('-', $ruidarray, 'reply');
         }
     }
     require_once libfile('function/delete');
Esempio n. 5
0
            $hiddennum++;
            continue;
        }
        $date = dgmdate($value['starttimefrom'], 'Ymd');
        $tids[$value['tid']] = $value['tid'];
        $value['week'] = dgmdate($value['starttimefrom'], 'w');
        $value['month'] = dgmdate($value['starttimefrom'], 'n' . lang('space', 'month'));
        $value['day'] = dgmdate($value['starttimefrom'], 'j');
        $value['time'] = dgmdate($value['starttimefrom'], 'Y' . lang('space', 'year') . 'm' . lang('space', 'month') . 'd' . lang('space', 'day'));
        $value['starttimefrom'] = dgmdate($value['starttimefrom']);
        $daytids[$value['tid']] = $date;
        $list[$date][$value['tid']] = procthread($value);
    }
    if ($tids) {
        require_once libfile('function/post');
        $activitylist = getfieldsofposts('tid, pid, message, dateline', "tid IN (" . dimplode($tids) . ") AND first='1'");
        foreach ($activitylist as $value) {
            $date = $daytids[$value['tid']];
            $value['message'] = messagecutstr($value['message'], 150);
            $list[$date][$value['tid']]['message'] = $value['message'];
        }
    }
    $multi = multi($count, $perpage, $page, $theurl);
}
if ($_G['uid']) {
    if ($_G['gp_view'] == 'all') {
        $navtitle = lang('core', 'title_view_all') . lang('core', 'title_activity');
    } elseif ($_G['gp_view'] == 'me') {
        $navtitle = lang('core', 'title_my_activity');
    } else {
        $navtitle = lang('core', 'title_friend_activity');
Esempio n. 6
0
        $processed = 1;
        $membernum = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_groupuser') . " WHERE fid='{$group['fid']}' AND level>'0'");
        DB::query("UPDATE " . DB::table('forum_forumfield') . " SET membernum = '{$membernum}' WHERE fid='{$group['fid']}'");
    }
    if ($processed) {
        cpmsg("{$lang['counter_groupmember_num']}: " . cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
    } else {
        cpmsg('counter_groupmember_num_succeed', 'action=counter', 'succeed');
    }
} elseif (submitcheck('groupmemberpost', 1)) {
    $nextlink = "action=counter&current={$next}&pertask={$pertask}&groupmemberpost=yes";
    $processed = 0;
    $queryf = DB::query("SELECT fid FROM " . DB::table('forum_forum') . " WHERE status='3' AND type='sub' LIMIT {$current}, {$pertask}");
    while ($group = DB::fetch($queryf)) {
        $processed = 1;
        $mreplies_tmp = getfieldsofposts("COUNT(*) as num, authorid", "fid='{$group['fid']}' AND first='0' GROUP BY authorid");
        $mreplies_array = array();
        foreach ($mreplies_tmp as $mreplies) {
            if (empty($mreplies_array[$mreplies['authorid']])) {
                $mreplies_array[$mreplies['authorid']] = $mreplies['num'];
            } else {
                $mreplies_array[$mreplies['authorid']] = $mreplies['num'];
            }
        }
        foreach ($mreplies_array as $mreplies) {
            DB::query("UPDATE " . DB::table('forum_groupuser') . " SET replies = '{$mreplies['num']}' WHERE fid='{$group['fid']}' AND uid='{$mreplies['authorid']}'");
        }
        $queryt = DB::query("SELECT COUNT(*) as num, authorid FROM " . DB::table('forum_thread') . " WHERE fid='{$group['fid']}' GROUP BY authorid");
        while ($mthreads = DB::fetch($queryt)) {
            DB::query("UPDATE " . DB::table('forum_groupuser') . " SET threads = '{$mthreads['num']}' WHERE fid='{$group['fid']}' AND uid='{$mthreads['authorid']}'");
        }
Esempio n. 7
0
 DB::query("UPDATE " . DB::table('common_member') . " SET {$sql} WHERE uid='{$member['uid']}'");
 if ($_G['group']['allowbanuser'] && DB::affected_rows()) {
     banlog($member['username'], $member['groupid'], $groupidnew, $_G['gp_banexpirynew'], $reason, $_G['gp_bannew'] == 'status' ? -1 : 0);
 }
 DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET groupterms='" . ($member['groupterms'] ? addslashes(serialize($member['groupterms'])) : '') . "' WHERE uid='{$member['uid']}'");
 if ($_G['gp_bannew'] && $_G['adminid'] == 1) {
     require_once libfile('function/delete');
     if ($_G['gp_delpost']) {
         $query = DB::query("SELECT attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE uid='{$member['uid']}'");
         while ($attach = DB::fetch($query)) {
             dunlink($attach);
         }
         if ($member['uid']) {
             require_once libfile('function/post');
             $pidsdelete = $tidsdelete = '0';
             $postarray = getfieldsofposts('pid, fid, tid, first', "authorid='{$member['uid']}'");
             foreach ($postarray as $post) {
                 $prune['forums'][] = $post['fid'];
                 $prune['thread'][$post['tid']]++;
                 if ($post['first']) {
                     $tidsdelete .= ",{$post['tid']}";
                 }
                 $pidsdelete .= ",{$post['pid']}";
             }
             deletepost("pid IN ({$pidsdelete})");
             deletepost("tid IN ({$tidsdelete})");
             deletethread("tid IN ({$tidsdelete})");
             if (!empty($prune)) {
                 foreach ($prune['thread'] as $tid => $decrease) {
                     updatethreadcount($tid);
                 }
Esempio n. 8
0
        $list = $moderation[$modact];
        include template('forum/modcp_moderate_float');
        dexit();
    } else {
        $updatestat = $op == 'replies' ? 1 : 2;
        $modpost = array('ignore' => count($moderation['ignore']), 'delete' => count($moderation['delete']), 'validate' => count($moderation['validate']));
    }
}
if ($op == 'replies') {
    if (submitcheck('modsubmit')) {
        $pmlist = array();
        if ($ignorepids = dimplode($moderation['ignore'])) {
            updatepost(array('invisible' => '-3'), "pid IN ({$ignorepids}) AND invisible='-2' AND first='0' AND " . ($modfidsadd ? $modfidsadd : '1'));
        }
        if ($deletepids = dimplode($moderation['delete'])) {
            $postarray = getfieldsofposts('pid, authorid, tid, message', "pid IN ({$deletepids}) AND invisible='{$pstat}' AND first='0' AND " . ($modfidsadd ? $modfidsadd : '1'));
            $pids = '0';
            foreach ($postarray as $post) {
                $pids .= ',' . $post['pid'];
                if ($_G['gp_reason'] != '' && $post['authorid'] && $post['authorid'] != $_G['uid']) {
                    $pmlist[] = array('act' => 'modreplies_delete', 'notevar' => array('reason' => dhtmlspecialchars($_G['gp_reason']), 'post' => messagecutstr($post['message'], 30)), 'authorid' => $post['authorid']);
                }
            }
            if ($pids) {
                $query = DB::query("SELECT attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE pid IN ({$pids})");
                while ($attach = DB::fetch($query)) {
                    dunlink($attach);
                }
                DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE pid IN ({$pids})", 'UNBUFFERED');
                DB::query("DELETE FROM " . DB::table('forum_attachmentfield') . " WHERE pid IN ({$pids})", 'UNBUFFERED');
                require_once libfile('function/delete');
Esempio n. 9
0
     $prune['forums'][] = $post['fid'];
     $prune['thread'][$post['tid']]++;
     $pidsdelete .= ",{$post['pid']}";
     $tidsdelete .= $post['first'] ? ",{$post['tid']}" : '';
     if ($post['first']) {
         my_thread_log('delete', array('tid' => $post['tid']));
     } else {
         my_post_log('delete', array('pid' => $post['pid']));
     }
 }
 if ($pidsdelete) {
     require_once libfile('function/post');
     if (!$_G['gp_donotupdatemember']) {
         $postsarray = $tuidarray = $ruidarray = array();
         $postarray1 = getfieldsofposts('fid, pid, first, authorid', "pid IN ({$pidsdelete})");
         $postarray2 = getfieldsofposts('fid, pid, first, authorid', "tid IN ({$tidsdelete})");
         while ((list($tmpkey, $post) = each($postarray1)) || (list($tmpkey, $post) = each($postarray2))) {
             $forumpostsarray[$post['fid']][$post['pid']] = $post;
         }
         foreach ($forumpostsarray as $fid => $postsarray) {
             $query = DB::query("SELECT postcredits, replycredits FROM " . DB::table('forum_forumfield') . " WHERE fid='{$fid}'");
             if ($forum = DB::fetch($query)) {
                 $forum['postcredits'] = !empty($forum['postcredits']) ? unserialize($forum['postcredits']) : array();
                 $forum['replycredits'] = !empty($forum['replycredits']) ? unserialize($forum['replycredits']) : array();
             }
             $postcredits = $forum['postcredits'] ? $forum['postcredits'] : $_G['setting']['creditspolicy']['post'];
             $replycredits = $forum['replycredits'] ? $forum['replycredits'] : $_G['setting']['creditspolicy']['reply'];
             $tuidarray = $ruidarray = array();
             foreach ($postsarray as $post) {
                 if ($post['first']) {
                     $tuidarray[] = $post['authorid'];
Esempio n. 10
0
     if ($thread['digest']) {
         updatecreditbyaction('digest', $thread['authorid'], array('digestposts' => -1), '', -$thread['digest']);
     }
     if (in_array($thread['displayorder'], array(2, 3))) {
         $stickmodify = 1;
     }
     if ($_G['forum']['status'] == 3 && $thread['closed'] > 1) {
         $deleteredirect[] = $thread['closed'];
     }
     if ($thread['isgroup'] == 1 && $thread['closed'] > 1) {
         $remarkclosed[] = $thread['closed'];
     }
 }
 $losslessdel = $_G['setting']['losslessdel'] > 0 ? TIMESTAMP - $_G['setting']['losslessdel'] * 86400 : 0;
 $uidarray = $tuidarray = $ruidarray = array();
 $postlist = getfieldsofposts('first, authorid, dateline', "tid IN ({$moderatetids})");
 foreach ($postlist as $post) {
     if ($post['dateline'] < $losslessdel) {
         if ($post['first']) {
             updatemembercount($post['authorid'], array('threads' => -1, 'post' => -1), false);
         } else {
             updatemembercount($post['authorid'], array('posts' => -1), false);
         }
     } else {
         if ($post['first']) {
             $tuidarray[] = $post['authorid'];
         } else {
             $ruidarray[] = $post['authorid'];
         }
     }
 }