示例#1
0
function updateForumCount($fid, $topic, $replies, $tpost = 0)
{
    global $db, $db_fcachenum;
    $fm = $db->get_one("SELECT fup,type,password,allowvisit,f_type FROM pw_forums WHERE fid=" . S::sqlEscape($fid));
    if ($fm['type'] == 'category') {
        return false;
    }
    delfcache($fid, $db_fcachenum);
    $topic = intval($topic);
    $article = $topic + intval($replies);
    $tpost = intval($tpost);
    $lastpost = '';
    $lt = $db->get_one("SELECT tid,author,postdate,lastpost,lastposter,subject FROM pw_threads WHERE fid=" . S::sqlEscape($fid) . " AND specialsort='0' AND ifcheck='1' AND lastpost>0 ORDER BY lastpost DESC LIMIT 1");
    if ($lt) {
        if ($lt['postdate'] == $lt['lastpost']) {
            $subject = substrs($lt['subject'], 26);
        } else {
            $subject = 'Re:' . substrs($lt['subject'], 26);
        }
        $lastpost = ",lastpost=" . S::sqlEscape($subject . "\t" . $lt['lastposter'] . "\t" . $lt['lastpost'] . "\t" . "read.php?tid={$lt['tid']}&page=e#a");
    }
    $db->update("UPDATE pw_forumdata SET article=article+'{$article}',topic=topic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid=" . S::sqlEscape($fid));
    Perf::gatherInfo('changeForumData', array('fid' => $fid));
    if (($fm['type'] == 'sub' || $fm['type'] == 'sub2') && ($fids = getUpFids($fid))) {
        if ($fm['password'] != '' || $fm['allowvisit'] != '' || $fm['f_type'] == 'hidden') {
            $lastpost = '';
        }
        $db->update("UPDATE pw_forumdata SET article=article+'{$article}',subtopic=subtopic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid IN(" . S::sqlImplode($fids) . ')');
        Perf::gatherInfo('changeForumData', array('fid' => $fids));
    }
}
 function _postThread($id, $postAudit, $expand)
 {
     $postVerifyService = $this->getPostVerifyService();
     $postVerifyService->insertPostVerify(1, $id, 0);
     $GLOBALS['db']->query("UPDATE pw_threads SET ifcheck=0 WHERE tid=" . CLOUDWIND_SECURITY_SERVICE::sqlEscape($id));
     if (class_exists("Perf")) {
         Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $expand['fid']));
         // 8.3+
     } else {
         $threadList = L::loadClass("threadlist", 'forum');
         $threadList && $threadList->refreshThreadIdsByForumId($expand['fid']);
     }
     return true;
 }
 function shieldThread($tid, $fid)
 {
     list($tid, $fid) = array(intval($tid), intval($fid));
     if ($tid < 1 || $fid < 1) {
         return $this->buildResponse(THREAD_INVALID_PARAMS);
     }
     $GLOBALS['db']->query("UPDATE pw_threads SET ifcheck=0 WHERE tid=" . S::sqlEscape($tid));
     if (class_exists("Perf")) {
         Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
     } else {
         $threadList = L::loadClass("threadlist", 'forum');
         $threadList && $threadList->refreshThreadIdsByForumId($fid);
     }
     return $this->buildResponse(0);
 }
示例#4
0
function recycle($ids)
{
    global $db, $fid;
    $delids = array();
    foreach ($ids as $key => $value) {
        if (is_numeric($value)) {
            $delids[] = $value;
        }
    }
    if ($delids) {
        $delids = S::sqlImplode($delids);
    } else {
        Showmsg('forumcp_recycle_nodata');
    }
    $query = $db->query("SELECT r.*,t.special,t.ifshield,t.ifupload,t.ptable,t.replies,t.fid AS ckfid FROM pw_recycle r LEFT JOIN pw_threads t ON r.tid=t.tid WHERE r.tid IN ({$delids}) AND r.pid='0' AND r.fid=" . S::sqlEscape($fid));
    $taid_a = $ttable_a = $ptable_a = array();
    $delids = $pollids = $actids = $delaids = $rewids = $ids = array();
    while (@extract($db->fetch_array($query))) {
        $ids[] = $tid;
        ($ifshield != '2' || $replies == '0' || $ckfid == '0') && ($delids[] = $tid);
        $special == 1 && ($pollids[] = $tid);
        $special == 2 && ($actids[] = $tid);
        $special == 3 && ($rewids[] = $tid);
        if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
            $ptable_a[$ptable] = 1;
            $ttable_a[GetTtable($tid)][] = $tid;
        }
        if ($ifupload) {
            $taid_a[GetTtable($tid)][] = $tid;
            if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
                $pw_posts = GetPtable($ptable);
                $query2 = $db->query("SELECT aid FROM {$pw_posts} WHERE tid=" . S::sqlEscape($tid) . " AND aid!=''");
                while (@extract($db->fetch_array($query2))) {
                    if (!$aid) {
                        continue;
                    }
                    $attachs = unserialize(stripslashes($aid));
                    foreach ($attachs as $key => $value) {
                        is_numeric($key) && ($delaids[] = $key);
                        pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']);
                        $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']);
                    }
                }
            }
        }
    }
    foreach ($taid_a as $pw_tmsgs => $value) {
        $value = S::sqlImplode($value);
        $query = $db->query("SELECT aid FROM {$pw_tmsgs} WHERE tid IN({$value}) AND aid!=''");
        while (@extract($db->fetch_array($query))) {
            if (!$aid) {
                continue;
            }
            $attachs = unserialize(stripslashes($aid));
            foreach ($attachs as $key => $value) {
                is_numeric($key) && ($delaids[] = $key);
                pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']);
                $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']);
            }
        }
    }
    if ($pollids) {
        $pollids = S::sqlImplode($pollids);
        $db->update("DELETE FROM pw_polls WHERE tid IN({$pollids})");
    }
    if ($actids) {
        $actids = S::sqlImplode($actids);
        $db->update("DELETE FROM pw_activity WHERE tid IN({$actids})");
        $db->update("DELETE FROM pw_actmember WHERE actid IN({$actids})");
    }
    if ($rewids) {
        $rewids = S::sqlImplode($rewids);
        $db->update("DELETE FROM pw_reward WHERE tid IN({$rewids})");
    }
    if ($delaids) {
        $pw_attachs = L::loadDB('attachs', 'forum');
        $pw_attachs->delete($delaids);
    }
    //$delids  = S::sqlImplode($delids);
    if ($delids) {
        # $db->update("DELETE FROM pw_threads	WHERE tid IN($delids)");
        # ThreadManager
        //* $threadManager = L::loadClass("threadmanager", 'forum');
        //* $threadManager->deleteByThreadIds($fid,$delids);
        $threadService = L::loadclass('threads', 'forum');
        $threadService->deleteByThreadIds($delids);
        Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
    }
    foreach ($ttable_a as $pw_tmsgs => $val) {
        //* $val = S::sqlImplode($val);
        //* $db->update("DELETE FROM $pw_tmsgs WHERE tid IN($val)");
        pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($val));
    }
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        //$db->update("DELETE FROM $pw_posts WHERE tid IN($delids)");
        pwQuery::delete($pw_posts, 'tid IN(:tid)', array($delids));
    }
    delete_tag(S::sqlImplode($delids));
    if ($ids) {
        $ids = S::sqlImplode($ids);
        $db->update("DELETE FROM pw_recycle WHERE tid IN ({$ids})");
    }
    pwFtpClose($GLOBALS['ftp']);
}
示例#5
0
 /**
  * 取消评分
  * @param $tid
  * @param $pids
  * @param $params
  */
 function deletePing($params = array())
 {
     global $groupid, $windid, $winduid, $credit, $onlineip, $timestamp, $gp_gptype;
     //* $threadService = L::loadClass("threads", 'forum');
     require_once R_P . 'require/credit.php';
     foreach ($this->postData as $pid => $atc) {
         $rpid = $pid == 'tpc' ? '0' : $pid;
         // delete pinglog
         $pingdata = $this->db->get_one('SELECT * FROM pw_pinglog WHERE tid=' . S::sqlEscape($this->tid) . ' AND pid=' . S::sqlEscape($rpid) . ' AND pinger=' . S::sqlEscape($windid) . ' ORDER BY pingdate DESC LIMIT 1');
         //$this->db->update('DELETE FROM pw_pinglog WHERE id=' . S::sqlEscape($pingdata['id']));
         pwQuery::delete('pw_pinglog', 'id=:id', array($pingdata['id']));
         $this->update_markinfo($this->tid, $rpid);
         //* $threadService->clearTmsgsByThreadId($this->tid);
         Perf::gatherInfo('changeTmsgWithThreadIds', array('tid' => $this->tid));
         $addpoint = $pingdata['point'];
         if (!($cid = $credit->getCreditTypeByName($pingdata['name']))) {
             continue;
         }
         $cName = $credit->cType[$cid];
         $addpoint = $addpoint > 0 ? -$addpoint : abs($addpoint);
         !$atc['subject'] && ($atc['subject'] = substrs(strip_tags(convert($atc['content'])), 35));
         $credit->addLog('credit_delping', array($cid => $addpoint), array('uid' => $atc['authorid'], 'username' => $atc['author'], 'ip' => $onlineip, 'operator' => $windid, 'tid' => $this->tid, 'subject' => $atc['subject'], 'reason' => $params['atc_content']));
         $credit->set($atc['authorid'], $cid, $addpoint);
         if (!is_numeric($pid)) {
             //* $this->db->update('UPDATE pw_threads SET ifmark=ifmark+'.S::sqlEscape($addpoint).' WHERE tid='.S::sqlEscape($tid));
             $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET ifmark=ifmark+:ifmark WHERE tid=:tid", array('pw_threads', $addpoint, $this->tid)));
         }
         if ($params['ifmsg'] && !$atc['anonymous'] && $atc['author'] != $windid) {
             //发消息
             $title = getLangInfo('writemsg', 'delping_title', array('sender' => $windid, 'receiver' => $atc['author']));
             $content = getLangInfo('writemsg', 'delping_content', array('manager' => $windid, 'fid' => $atc['fid'], 'tid' => $this->tid, 'pid' => $pid, 'subject' => $atc['subject'], 'postdate' => get_date($atc['postdate']), 'forum' => strip_tags($this->forum->foruminfo['name']), 'affect' => "{$cName}:{$addpoint}", 'admindate' => get_date($timestamp), 'reason' => stripslashes($params['atc_content']), 'sender' => $windid, 'receiver' => $atc['author']));
             $this->sendMessage($atc['author'], $title, $content);
         }
         if ($gp_gptype == 'system') {
             require_once R_P . 'require/writelog.php';
             $log = array('type' => 'credit', 'username1' => $atc['author'], 'username2' => $windid, 'field1' => $atc['fid'], 'field2' => '', 'field3' => '', 'descrip' => 'creditdel_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $this->tid, 'forum' => strip_tags($this->forum->foruminfo['name']), 'subject' => $atc['subject'], 'affect' => "{$name}:{$addpoint}", 'reason' => $params['atc_content']);
             writelog($log);
         }
         $pingLog[$pid] = $pingdata['id'];
     }
     $credit->runsql();
     defined('AJAX') && ($GLOBALS['pingLog'] = $pingLog);
     //GLOBAL
     if ($this->forum->foruminfo['allowhtm'] && $_REQUEST['page'] == 1) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
     return true;
 }
示例#6
0
function deleteThreadsHander($tidarray)
{
    global $windid, $manager, $groupid, $SYSTEM;
    PostCheck();
    (!$SYSTEM['superright'] || !$SYSTEM['delatc']) && Showmsg('mawhole_right');
    if ($tidarray == "") {
        Showmsg('data_error');
    }
    $tidarray = explode("|", $tidarray);
    if (!is_array($tidarray)) {
        Showmsg('data_error');
    }
    $forums = $threadIds = array();
    foreach ($tidarray as $v) {
        if ($v == "") {
            continue;
        }
        if (intval($v) < 0) {
            continue;
        }
        $threadIds[] = $v;
    }
    /**
    	$threadManager = L::loadclass('threadmanager', 'forum');
    	foreach($forums as $fid=>$threadIds){
    		$threadManager->deleteByThreadIds($fid,$threadIds);
    	}**/
    $threadService = L::loadclass('threads', 'forum');
    foreach ($forums as $fid => $_threadIds) {
        $threadService->deleteByThreadIds($_threadIds);
        Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
    }
    $delarticle = L::loadClass('DelArticle', 'forum');
    $delarticle->delTopicByTids($threadIds, true);
    echo getLangInfo('other', 'search_manager_success');
    ajax_footer();
}
示例#7
0
function _clearMembersCache($id)
{
    global $db;
    $query = $db->query("SELECT uid FROM pw_userbinding WHERE id =" . S::sqlEscape($id));
    $uid = array();
    while ($rt = $db->fetch_array($query)) {
        $uid[] = $rt['uid'];
    }
    Perf::gatherInfo('changeMembersWithUserIds', array('uid' => $uid));
}
示例#8
0
 function afterReply()
 {
     global $db_ifpwcache, $timestamp, $db_readperpage;
     if ($this->data['ifcheck'] == 1) {
         if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms'] && $this->tpcArr['replies'] < $db_readperpage) {
             $StaticPage = L::loadClass('StaticPage');
             $StaticPage->update($this->tid);
         }
         if ($this->tpcArr['ifcheck'] == 1) {
             $lastpost = array('subject' => $this->data['title'] ? substrs($this->data['title'], 26) : 'Re:' . substrs($this->tpcArr['subject'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $this->tpcArr['postdate']);
             $this->forum->lastinfo('reply', '+', $lastpost);
         }
         //Start Here pwcache
         if ($db_ifpwcache & 270) {
             L::loadClass('elementupdate', '', false);
             $elementupdate = new ElementUpdate($this->forum->fid);
             $elementupdate->special = $this->tpcArr['special'];
             if ($db_ifpwcache & 14) {
                 $elementupdate->replySortUpdate($this->tid, $this->forum->fid, $this->tpcArr['postdate'], $this->tpcArr['replies'] + 1);
             }
             if ($db_ifpwcache & 256) {
                 $elementupdate->newReplyUpdate($this->tid, $this->forum->fid, $this->tpcArr['postdate']);
             }
             $elementupdate->updateSQL();
         }
         require_once R_P . 'require/functions.php';
         updateDatanalyse($this->data['authorid'], 'memberThread', 1);
         updateDatanalyse($this->tid, 'threadPost', 1);
         // memcache refresh
         // $threadsObj = L::loadclass("threads", 'forum');
         // $threadsObj->clearThreadByThreadId($this->tid);
         // memcache refresh
         // $threadlistObj = L::loadclass("threadlist", 'forum');
         // $threadlistObj->updateThreadIdsByForumId($this->forum->fid, $this->tid);
         Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $this->tid));
         Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $this->forum->fid));
     }
     if ($this->postdata->filter->filter_weight > 1) {
         $this->postdata->filter->insert($this->tid, $this->pid, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight);
     }
 }
示例#9
0
        $timelimit < 0 && ($timelimit = 24);
        $downtime = $timelimit * 3600;
        $msgdb = $logdb = array();
        //* $threadList = L::loadClass("threadlist", 'forum');
        $query = $db->query("SELECT tid,fid,postdate,author,authorid,subject,locked FROM pw_threads WHERE tid IN(" . S::sqlImplode($selids) . ")");
        while ($rt = $db->fetch_array($query)) {
            $sql = "locked='" . ($ifpush ? $rt['locked'] % 3 + 3 : $rt['locked'] % 3) . "'";
            $db->update("UPDATE pw_argument SET lastpost=lastpost-" . S::sqlEscape($downtime) . " WHERE tid=" . S::sqlEscape($rt['tid']));
            //$db->update("UPDATE pw_threads SET $sql WHERE tid=".S::sqlEscape($rt['tid']));
            $db->update(pwQuery::buildClause("UPDATE :pw_table SET {$sql} WHERE tid=:tid", array('pw_threads', $rt['tid'])));
            if ($ifmsg) {
                $msgdb[] = array('toUser' => $rt['author'], 'title' => getLangInfo('writemsg', 'down_title'), 'content' => getLangInfo('writemsg', 'down_content', array('manager' => $windid, 'timelimit' => $timelimit, 'fid' => $fid, 'tid' => $rt['tid'], 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content))));
            }
            $logdb[] = array('type' => 'down', 'username1' => $rt['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => $rt['tid'], 'field3' => '', 'descrip' => 'down_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $rt['tid'], 'subject' => substrs($rt['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content));
            //* $threadList->updateThreadIdsByForumId($fid,$rt['tid'],$downtime);
            Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
        }
        sendMawholeMessages($msgdb);
        foreach ($logdb as $key => $val) {
            writelog($val);
        }
        refreshto("apps.php?q=group&a=thread&cyid={$cyid}", 'downtopic_success');
    }
} elseif ($action == 'highlight') {
    if (empty($_POST['step'])) {
        if (is_numeric($seltid)) {
            $rt = $db->get_one("SELECT a.titlefont,t.author FROM pw_argument a LEFT JOIN pw_threads t ON a.tid=t.tid WHERE a.tid=" . S::sqlEscape($seltid));
            $titledetail = explode("~", $rt['titlefont']);
            $titlecolor = $titledetail[0];
            if ($titlecolor && !preg_match('/\\#[0-9A-F]{6}/is', $titlecolor)) {
                $titlecolor = '';
示例#10
0
/**
 * 发表、回复、修改帖子后更新帖子数、回复时间和生成静态页面访问地址的函数
 *
 * @param int $fid 所属版块
 * @param int $allowhtm 是否允许生成静态页
 * @param string $type new:发表新帖、reply:回复
 * @param string $sys_type:现无用
 */
function lastinfo($fid, $allowhtm = 0, $type = '', $sys_type = '')
{
    global $db, $R_url, $db_readdir, $foruminfo, $tid, $windid, $timestamp, $atc_title, $t_date, $replytitle;
    if ($type == 'new') {
        $rt['tid'] = $tid;
        $rt['postdate'] = $timestamp;
        $rt['lastpost'] = $timestamp;
        $author = $windid;
        $subject = substrs($atc_title, 26);
        $topicadd = ",tpost=tpost+1,article=article+1,topic=topic+1 ";
        $fupadd = "subtopic=subtopic+1,tpost=tpost+1,article=article+1";
    } elseif ($type == 'reply') {
        $rt['tid'] = $tid;
        $rt['postdate'] = $t_date;
        $rt['lastpost'] = $timestamp;
        $author = $windid;
        $subject = $atc_title ? substrs($atc_title, 26) : 'Re:' . addslashes(substrs($replytitle, 26));
        $topicadd = ",tpost=tpost+1,article=article+1 ";
        $fupadd = "tpost=tpost+1,article=article+1 ";
    } else {
        $rt = $db->get_one("SELECT tid,author,postdate,subject,lastpost,lastposter FROM pw_threads WHERE fid=" . S::sqlEscape($fid) . " AND specialsort=0 AND ifcheck=1 AND lastpost>0 ORDER BY lastpost DESC LIMIT 0,1");
        if ($rt['postdate'] == $rt['lastpost']) {
            $subject = addslashes(substrs($rt['subject'], 26));
            $author = $rt['author'];
        } else {
            $subject = 'Re:' . addslashes(substrs($rt['subject'], 26));
            $author = $rt['lastposter'];
        }
        $topicadd = $fupadd = "";
    }
    $GLOBALS['anonymous'] && ($author = $GLOBALS['db_anonymousname']);
    $htmurl = $db_readdir . '/' . $fid . '/' . date('ym', $rt['postdate']) . '/' . $rt['tid'] . '.html';
    $new_url = file_exists(R_P . $htmurl) && $allowhtm && $sys_type != '1B' ? "{$R_url}/{$htmurl}" : "read.php?tid={$rt['tid']}&page=e#a";
    $lastpost = $subject . "\t" . addslashes($author) . "\t" . $rt['lastpost'] . "\t" . $new_url;
    //* $db->update("UPDATE pw_forumdata SET lastpost=".S::sqlEscape($lastpost).$topicadd." WHERE fid=".S::sqlEscape($fid));
    $db->update(pwQuery::buildClause("UPDATE :pw_table SET lastpost=:lastpost {$topicadd} WHERE fid=:fid", array('pw_forumdata', $lastpost, $fid)));
    if ($foruminfo['type'] == 'sub' || $foruminfo['type'] == 'sub2') {
        if ($foruminfo['password'] != '' || $foruminfo['allowvisit'] != '' || $foruminfo['f_type'] == 'hidden') {
            $lastpost = '';
        } else {
            $lastpost = "lastpost=" . S::sqlEscape($lastpost);
        }
        if ($lastpost && $fupadd) {
            $lastpost .= ', ';
        }
        if ($lastpost || $fupadd) {
            $db->update("UPDATE pw_forumdata SET {$lastpost} {$fupadd} WHERE fid=" . S::sqlEscape($foruminfo['fup']));
            Perf::gatherInfo('changeForumData', array('fid' => $foruminfo['fup']));
            if ($foruminfo['type'] == 'sub2') {
                $rt1 = $db->get_one("SELECT fup FROM pw_forums WHERE fid=" . S::sqlEscape($foruminfo['fup']));
                $db->update("UPDATE pw_forumdata SET {$lastpost} {$fupadd} WHERE fid=" . S::sqlEscape($rt1['fup']));
                Perf::gatherInfo('changeForumData', array('fid' => $rt1['fup']));
            }
        }
    }
}
示例#11
0
 function lastinfo($type, $action = '+', $lastpost = array())
 {
     global $db_readdir, $R_url;
     $lp = $topicadd = $fupadd = '';
     $_arrTopicAdd = $_arrFupAdd = $_arrLp = array();
     $_num = intval($action . '1');
     if ($action == '+' || $action == '-') {
         if ($type == 'topic') {
             $topicadd = "tpost=tpost{$action}'1',article=article{$action}'1',topic=topic{$action}'1' ";
             $fupadd = "tpost=tpost{$action}'1',article=article{$action}'1',subtopic=subtopic{$action}'1' ";
             $_arrTopicAdd = array('tpost' => $_num, 'article' => $_num, 'topic' => $_num);
             $_arrFupAdd = array('tpost' => $_num, 'article' => $_num, 'subtopic' => $_num);
         } else {
             $topicadd = "tpost=tpost{$action}'1',article=article{$action}'1' ";
             $fupadd = "tpost=tpost{$action}'1',article=article{$action}'1' ";
             $_arrTopicAdd = $_arrFupAdd = array('tpost' => $_num, 'article' => $_num);
         }
     }
     if ($lastpost) {
         $newurl = "read.php?tid={$lastpost['tid']}&page=e#a";
         if ($this->foruminfo['allowhtm']) {
             $htmurl = $db_readdir . '/' . $this->fid . '/' . date('ym', $lastpost['t_date']) . '/' . $lastpost['tid'] . '.html';
             if (file_exists(R_P . $htmurl)) {
                 $newurl = "{$R_url}/{$htmurl}";
             }
         }
         $lp = "lastpost=" . S::sqlEscape($lastpost['subject'] . "\t" . $lastpost['author'] . "\t" . $lastpost['lastpost'] . "\t" . $newurl);
         $_arrLp = array('lastpost' => $lastpost['subject'] . "\t" . $lastpost['author'] . "\t" . $lastpost['lastpost'] . "\t" . $newurl);
     }
     if ($topicadd || $lp) {
         $sql = trim($topicadd . ',' . $lp, ',');
         $this->db->update("UPDATE pw_forumdata SET {$sql} WHERE fid=" . S::sqlEscape($this->fid));
         Perf::gatherInfo('changeForumDataWithForumId', array(array_merge($_arrTopicAdd, $_arrLp, array('fid' => $this->fid))));
         //*$this->db->update(pwQuery::updateClause("UPDATE :pw_table SET $sql WHERE fid=:fid", array('pw_forumdata',$this->fid)));
     }
     if ($this->foruminfo['type'] == 'sub' || $this->foruminfo['type'] == 'sub2') {
         !$this->isOpen() && ($lp = '');
         if ($lp || $fupadd) {
             $sql = trim($fupadd . ',' . $lp, ',');
             $this->db->update("UPDATE pw_forumdata SET {$sql} WHERE fid=" . S::sqlEscape($this->foruminfo['fup']));
             Perf::gatherInfo('changeForumDataWithForumId', array(array_merge($_arrFupAdd, $_arrLp, array('fid' => $this->foruminfo['fup']))));
             if ($this->foruminfo['type'] == 'sub2') {
                 $rt1 = $this->db->get_one("SELECT fup FROM pw_forums WHERE fid=" . S::sqlEscape($this->foruminfo['fup']));
                 $this->db->update("UPDATE pw_forumdata SET {$sql} WHERE fid=" . S::sqlEscape($rt1['fup']));
                 Perf::gatherInfo('changeForumDataWithForumId', array(array_merge($_arrFupAdd, $_arrLp, array('fid' => $rt1['fup']))));
             }
         }
     }
 }
示例#12
0
 }
 !$lines && ($lines = 200);
 !$tstart && ($tstart = 0);
 $ftable = $tfrom ? 'pw_posts' . $tfrom : 'pw_posts';
 $ttable = $tto ? 'pw_posts' . $tto : 'pw_posts';
 if (!$tend) {
     @extract($db->get_one("SELECT MAX(tid) AS tend FROM {$ftable}"));
 }
 $end = $tstart + $lines;
 $end > $tend && ($end = $tend);
 $db->update("INSERT INTO {$ttable} SELECT * FROM {$ftable} WHERE tid>=" . S::sqlEscape($tstart) . 'AND tid<=' . S::sqlEscape($end));
 //$db->update("DELETE FROM $ftable WHERE tid>".S::sqlEscape($tstart)."AND tid<=".S::sqlEscape($end));
 pwQuery::delete($ftable, 'tid>=:tid1 AND tid<=:tid2', array($tstart, $end));
 //$db->update("UPDATE pw_threads SET ptable=".S::sqlEscape($tto)."WHERE tid>".S::sqlEscape($tstart)."AND tid<=".S::sqlEscape($end)."AND ptable=".S::sqlEscape($tfrom));
 pwQuery::update('pw_threads', 'tid>=:tid AND tid<=:end AND ptable=:ptable', array($tstart, $end, $tfrom), array('ptable' => $tto));
 Perf::gatherInfo('changeThreadListWithThreadIds', array('tid' => $tstart + 1));
 if ($end < $tend) {
     $step++;
     $end++;
     $j_url = "{$basename}&action={$action}&step={$step}&tstart={$end}&tend={$tend}&tfrom={$tfrom}&tto={$tto}&lines={$lines}";
     adminmsg('table_change', EncodeUrl($j_url), 2);
 } else {
     //* $_cache = getDatastore();
     //* $_cache->flush();
     $_cacheService = perf::gatherCache('pw_membersdbcache');
     $_cacheService->flush();
     if (Perf::checkMemcache()) {
         $_cacheService = L::loadClass('cacheservice', 'utility');
         $_cacheService->flush(PW_CACHE_MEMCACHE);
     }
     $db->query('OPTIMIZE TABLE ' . S::sqlMetadata($ftable));
示例#13
0
 //回复数
 if ($oldLastPostInfo) {
     $db->query("UPDATE pw_threads SET replies = replies - {$pidNum},lastpost = " . S::sqlEscape($oldLastPostInfo['postdate']) . ",lastposter = " . S::sqlEscape($oldLastPostInfo['author']) . " WHERE  tid = " . S::sqlEscape($tid));
 } else {
     $db->query("UPDATE pw_threads SET replies = replies - {$pidNum},lastpost = " . S::sqlEscape($splitThread['postdate']) . ",lastposter = " . S::sqlEscape($splitThread['author']) . " WHERE  tid = " . S::sqlEscape($tid));
 }
 Perf::gatherInfo('changeThreads', array('tid' => $tid));
 //拆到的帖子
 if ($splittype == 0 && $pidNum > 1) {
     $pidNum = $pidNum - 1;
 }
 if ($lastPostInfo) {
     $db->query("UPDATE pw_threads SET replies = replies + {$pidNum},lastpost = " . S::sqlEscape($lastPostInfo['postdate']) . ",lastposter = " . S::sqlEscape($lastPostInfo['author']) . " WHERE  tid = " . S::sqlEscape($splitid));
     //拆到 回复数 最后发帖人
 }
 Perf::gatherInfo('changeThreads', array('tid' => $splitid));
 //评分操作
 if ($pidsStr) {
     //$db->update("UPDATE pw_pinglog SET tid = ".S::sqlEscape($splitid)." WHERE tid = ".S::sqlEscape($tid)." AND  pid in ($pidsStr)");
     pwQuery::update('pw_pinglog', 'tid=:tid  AND pid IN(:pid)', array($tid, $pids), array('tid' => $splitid));
 }
 if ($splittype == 0) {
     //$db->update("UPDATE pw_pinglog SET tid = ".S::sqlEscape($splitid)." , pid = 0 WHERE tid = ".S::sqlEscape($splitid)." AND  pid = ".S::sqlEscape($postInfo['pid']));
     pwQuery::update('pw_pinglog', 'tid=:tid  AND pid =:pid', array($tid, $postInfo['pid']), array('tid' => $splitid, 'pid' => 0));
 }
 $pingService->update_markinfo($fid, $tid, 0);
 $pingService->update_markinfo($fid, $splitid, 0);
 //附件操作
 if ($pidsStr) {
     $db->update("UPDATE pw_attachs SET tid = " . S::sqlEscape($splitid) . " WHERE tid = " . S::sqlEscape($tid) . " AND  pid in ({$pidsStr})");
 }
示例#14
0
 function afterModify()
 {
     global $page;
     $replies = '';
     $pwSQL = array();
     if ($this->data['anonymous'] != $this->atcdb['anonymous']) {
         $lt = $this->db->get_one("SELECT pid FROM {$this->pw_posts} WHERE tid=" . S::sqlEscape($this->tid) . " ORDER BY postdate DESC LIMIT 1");
         if ($this->pid == $lt['pid']) {
             $pwSQL['lastposter'] = $this->data['lastposter'];
         }
     }
     $this->data['ifupload'] && ($pwSQL['ifupload'] = $this->data['ifupload']);
     $threadService = L::loadClass('threads', 'forum');
     $threadService->updateAtUsers($this->tid, $this->atcdb['pid'], $this->data['atusers']);
     if ($this->data['ifcheck'] && $this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms'] && $page == 1) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
     if ($this->data['ifcheck'] != $this->atcdb['ifcheck']) {
         $action = $this->atcdb['ifcheck'] == 1 ? '-' : '+';
         $this->forum->lastinfo('reply', $action);
         $replies = "replies=replies{$action}'1'";
     }
     if ($pwSQL || $replies) {
         $sql = trim(S::sqlSingle($pwSQL) . ',' . $replies, ',');
         $this->db->update("UPDATE pw_threads SET {$sql} WHERE tid=" . S::sqlEscape($this->tid));
         Perf::gatherInfo('changeThreads', array('tid' => $this->tid));
     }
 }
示例#15
0
 function recountTopic($read, $ifdel, $recycle)
 {
     global $db_anonymousname, $timestamp;
     $ret = 0;
     $tid = $read['tid'];
     $pw_posts = GetPtable($read['ptable']);
     $replies = $this->db->get_value("SELECT COUNT(*) AS replies FROM {$pw_posts} WHERE tid='{$tid}' AND ifcheck='1'");
     if (!$replies) {
         $read['anonymous'] && ($read['author'] = $db_anonymousname);
         if ($ifdel) {
             if ($recycle) {
                 //$this->db->update("UPDATE pw_threads SET fid='0',ifshield='0' WHERE tid='$tid'");
                 pwQuery::update('pw_threads', 'tid = :tid', array($tid), array('fid' => 0, 'ifshield' => 0));
             } else {
                 //* $threadManager = L::loadClass("threadmanager", 'forum');
                 //* $threadManager->deleteByThreadId($read['fid'], $tid);
                 $threadService = L::loadclass('threads', 'forum');
                 $threadService->deleteByThreadId($tid);
                 Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $read['fid']));
                 $pw_tmsgs = GetTtable($tid);
                 //* $this->db->update("DELETE FROM $pw_tmsgs WHERE tid='$tid'");
                 pwQuery::delete($pw_tmsgs, 'tid=:tid', array($tid));
             }
             $ret = 1;
         } else {
             $pwSQL = array('replies' => 0, 'lastposter' => $read['author']);
             !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $read['postdate']);
             //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid));
             pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL);
         }
     } else {
         $pt = $this->db->get_one("SELECT postdate,author,anonymous FROM {$pw_posts} WHERE tid='{$tid}' ORDER BY postdate DESC LIMIT 1");
         $pt['anonymous'] && ($pt['author'] = $db_anonymousname);
         $pwSQL = array('replies' => $replies, 'lastposter' => $pt['author']);
         !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $pt['postdate']);
         //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid));
         pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL);
     }
     return $ret;
 }
示例#16
0
 function _del()
 {
     $this->delfile($this->attach['attachurl'], $this->attach['ifthumb']);
     $this->attachsDB->delete($this->aid);
     require_once R_P . 'require/updateforum.php';
     $ifupload = getattachtype($this->tid);
     $ifaid = $ifupload === false ? 0 : 1;
     $updateArr = array('aid' => $ifaid);
     if ($this->attach['pid']) {
         $pw_posts = GetPtable('N', $this->tid);
         $content = $this->_db->get_value("SELECT content FROM {$pw_posts} WHERE tid=" . S::sqlEscape($this->tid, false) . "AND pid=" . S::sqlEscape($this->attach['pid'], false));
         if (($content = $this->parseAttContent($content)) !== false) {
             $updateArr['content'] = $content;
             $updateThreadCache = TRUE;
         }
         //$this->_db->update("UPDATE $pw_posts SET " . S::sqlSingle($updateArr) . " WHERE tid=" . S::sqlEscape($this->tid, false) . "AND pid=" . S::sqlEscape($this->attach['pid'], false));
         pwQuery::update($pw_posts, 'tid=:tid AND pid=:pid', array($this->tid, $this->attach['pid']), $updateArr);
     } else {
         $pw_tmsgs = GetTtable($this->tid);
         $content = $this->_db->get_value("SELECT content FROM {$pw_tmsgs} WHERE tid=" . S::sqlEscape($this->tid, false));
         if (($content = $this->parseAttContent($content)) !== false) {
             $updateArr['content'] = $content;
             $updateThreadCache = TRUE;
         }
         //* $this->_db->update("UPDATE $pw_tmsgs SET " . S::sqlSingle($updateArr) . " WHERE tid=" . S::sqlEscape($this->tid, false));
         pwQuery::update($pw_tmsgs, 'tid=:tid', array($this->tid), $updateArr);
     }
     if ($this->attach['type'] == 'img') {
         $tucoolService = L::loadClass('tucool', 'forum');
         $tucoolService->updateTucoolImageNum($this->tid);
         $tucoolInfo = $tucoolService->get($this->tid);
         if ($this->attach['attachurl'] == $tucoolInfo['cover']) {
             $attachService = L::loadClass('attachs', 'forum');
             /* @var $attachService PW_Attachs */
             $coverInfo = $attachService->getLatestAttachInfoByTidType($this->tid);
             $tucoolService->setCover($this->tid, $coverInfo['attachurl'], $coverInfo['ifthumb']);
         }
     }
     if ($updateThreadCache) {
         //* $threadService = L::loadClass("threads", 'forum'); /* @var $threadService PW_Threads */
         //* $threadService->clearTmsgsByThreadId($this->tid);
         Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $this->tid));
     }
     $ifupload = (int) $ifupload;
     //$this->_db->update('UPDATE pw_threads SET ifupload=' . S::sqlEscape($ifupload) . ' WHERE tid=' . S::sqlEscape($this->tid));
     pwQuery::update('pw_threads', "tid=:tid", array($this->tid), array("ifupload" => $ifupload));
     if ($this->foruminfo['allowhtm'] && $GLOBALS['page'] == 1) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
 }
示例#17
0
     $tmpArray = $sendto + array(0);
     $db->query("CREATE TEMPORARY TABLE tmp_datastate SELECT uid FROM pw_members WHERE groupid IN(" . S::sqlImplode($tmpArray) . ')' . pwLimit(($step - 1) * $perpage, $perpage));
     $db->update("INSERT INTO pw_ms_configs (uid) SELECT a.uid FROM tmp_datastate a LEFT JOIN pw_ms_configs b ON a.uid=b.uid WHERE b.uid IS NULL");
     $db->update("UPDATE tmp_datastate a LEFT JOIN pw_members m ON a.uid=m.uid LEFT JOIN pw_ms_configs c ON a.uid=c.uid SET m.newpm=m.newpm+1,c.notice_num=c.notice_num+1");
     //* 清除pw_members缓存 start
     $_num = $db->get_value("SELECT count(*) FROM tmp_datastate");
     if ($_num > 1500) {
         $_cacheService = L::loadClass('cacheservice', 'utility');
         $_cacheService->flush(PW_CACHE_MEMCACHE);
     } else {
         $_query = $db->query("SELECT uid FROM tmp_datastate");
         $_uids = array();
         while ($rt = $db->fetch_array($_query)) {
             $_uids[] = $rt['uid'];
         }
         Perf::gatherInfo('changeMembersWithUserIds', array('uid' => $_uids));
     }
     //* 清除pw_members缓存 end
     if ($havesend < $count) {
         $step++;
         $j_url = "{$basename}&action={$action}&step={$step}&sendto=" . implode(',', $sendto) . "&by={$by}&count={$count}";
         adminmsg("sendmsg_step", EncodeUrl($j_url), 1);
     }
     adminmsg('operate_success');
 } elseif ($by == 2) {
     $cache_file = D_P . "data/bbscache/" . substr(md5($admin_pwd), 10, 10) . ".txt";
     if (!$step) {
         pwCache::setData($cache_file, $atc_content);
     } else {
         //* $atc_content = readover($cache_file);
         $atc_content = pwCache::getData($cache_file, false, true);
示例#18
0
                    $foruminfo = $forumInfos[$rt['fid']];
                    $creditset = $credit->creditset($foruminfo['creditset'], $db_creditset);
                    $credit->addLog("topic_{$creditOpKey}", $creditset[$creditOpKey], array('uid' => $rt['authorid'], 'username' => $rt['author'], 'ip' => $onlineip, 'fname' => strip_tags($foruminfo['name']), 'operator' => $windid));
                    $credit->sets($rt['authorid'], $creditset[$creditOpKey], false);
                    $deluids[$rt['authorid']] = isset($deluids[$rt['authorid']]) ? $deluids[$rt['authorid']] + 1 : 1;
                    if ($rt['aid']) {
                        $_tids[$rt['tid']] = $rt['tid'];
                        $_tids[$rt['pid']] = $rt['pid'];
                    }
                }
                $credit->runsql();
                if ($_tids && $_pids) {
                    $pw_attachs = L::loadDB('attachs', 'forum');
                    $attachdb = $pw_attachs->getByTid($_tids, $_pids);
                    require_once R_P . 'require/updateforum.php';
                    delete_att($attachdb);
                    pwFtpClose($ftp);
                }
                $userService = L::loadClass('UserService', 'user');
                /* @var $userService PW_UserService */
                foreach ($deluids as $uid => $value) {
                    $userService->updateByIncrement($uid, array(), array('postnum' => -$value));
                }
                $db->update("DELETE FROM {$pw_posts} WHERE {$sql} AND pid IN(" . S::sqlImplode($dels) . ")");
                Perf::gatherInfo('deletePosts', array('_tablename' => $pw_posts, 'pid' => $dels));
            }
        }
        adminmsg('operate_success');
        /**End modify by liaohu 2010-06-21*/
    }
}
示例#19
0
<?php

!defined('P_W') && exit('Forbidden');
InitGP(array('id'), null, 2);
InitGP(array('record'));
$rt = $db->get_one("SELECT tid,fid FROM pw_pinglog WHERE ifhide=0 AND id=" . S::sqlEscape($id));
if (empty($rt) || !$rt['fid']) {
    Showmsg('data_error');
}
L::loadClass('forum', 'forum', false);
$pwforum = new PwForum($rt['fid']);
$isGM = CkInArray($windid, $manager);
if (!$isGM && !pwRights($pwforum->isBM($windid), 'pingcp', $rt['fid'])) {
    Showmsg('mawhole_right');
}
//$db->update("UPDATE pw_pinglog SET record=" . S::sqlEscape($record) . " WHERE id=" . S::sqlEscape($id));
pwQuery::update('pw_pinglog', 'id=:id', array($id), array('record' => $record));
echo "success";
# memcache reflesh
if ($db_memcache) {
    //* $threads = L::loadClass('Threads', 'forum');
    //* $threads->delThreads($rt['tid']);
    Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $rt['tid']));
}
ajax_footer();
示例#20
0
文件: thread.php 项目: jechiy/PHPWind
$urlall = $threadBehavior->getUrlall();
$urladd = $threadBehavior->getUrladd();
$pageUrl = "thread.php?" . ($cyid ? "cyid={$cyid}" : "fid={$fid}");
$pages = numofpage($count, $page, $numofpage, "{$pageUrl}{$urladd}{$viewbbs}&", $db_maxpage);
require_once R_P . 'require/updateforum.php';
$threaddb = $threadBehavior->getThread($start_limit, !$theSpecialFlag);
// 同步pw_hits_threads数据到pw_threads, 进行该操作的概率是1/100
if ($db_hits_store == 1 && $timestamp % 100 == 0) {
    $_tids = array();
    foreach ($threaddb as $_threads) {
        $_tids[] = $_threads['tid'];
    }
    $db->update('UPDATE pw_threads t INNER JOIN pw_hits_threads h ON t.tid=h.tid SET t.hits=h.hits WHERE t.tid IN (' . S::sqlImplode($_tids) . ')');
    // 更新memcache缓存
    if (Perf::checkMemcache()) {
        Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $_tids));
    }
}
//获取列表是否新窗打开的cookie
$newwindows = $_COOKIE['newwindows'];
$tucoolnewwindows = $_COOKIE['tucoolnewwindows'];
$isAuthStatus = $isGM || (!$forumset['auth_allowpost'] || $pwforum->authStatus($winddb['userstatus'], $forumset['auth_logicalmethod']) === true);
//!$isAuthStatus && $N_allowtypeopen = false;
if ($groupid != 'guest' && $db_threadshowpost == 1 && $_G['allowpost'] && $pwforum->allowpost($winddb, $groupid) && $isAuthStatus) {
    $fastpost = 'fastpost';
}
$psot_sta = $titletop1 = '';
$t_exits = 0;
$t_typedb = $t_subtypedb = $withSystemType = $withSystemSubType = array();
if ($t_db) {
    foreach ($t_db as $value) {