예제 #1
0
 /**
  * 用户添加关注,同时推送条新鲜事
  * 
  * @param $uid	用户
  * @param $friendid 关注的对象
  * @param $limit	新鲜事数量
  */
 function addFollow($uid, $friendid, $limit = 20, $from = '')
 {
     //fixed
     global $timestamp;
     if (!$uid || !$friendid) {
         return false;
     }
     if ($this->isFollow($uid, $friendid)) {
         return 'user_attention_exists';
     }
     $attentionDB = $this->_getAttentionDB();
     $attentionDB->insert(array('uid' => $uid, 'friendid' => $friendid, 'joindate' => $this->_timestamp));
     $userServer = L::loadClass('UserService', 'user');
     $userServer->updateByIncrement($uid, array(), array('follows' => 1));
     $userServer->updateByIncrement($friendid, array(), array('fans' => 1, 'newfans' => 1));
     $medalservice = L::loadClass('medalservice', 'medal');
     $medalservice->runAutoMedal($friendid, 'fans', 'fans', 1);
     $friendService = L::loadClass('Friend', 'friend');
     if (!$friendService->isFriend($uid, $friendid) || $from == 'addFriend') {
         $this->addUserWeiboRelationsByFriendid($friendid, $uid, $limit);
     }
     /*更新粉丝排行记录*/
     L::loadClass('elementupdate', '', false);
     $elementupdate = new ElementUpdate('fans');
     $elementupdate->setCacheNum(100);
     $elementupdate->totalFansUpdate($friendid);
     $elementupdate->updateSQL();
     $elementupdate->setCacheNum(20);
     $elementupdate->todayFansUpdate($friendid);
     $elementupdate->updateSQL();
     return true;
 }
예제 #2
0
 /**
  *
  *记录升级排行记录
  *
  */
 function elementUpdate($uid)
 {
     global $db_ifpwcache;
     L::loadClass('elementupdate', '', false);
     $elementupdate = new ElementUpdate('gradeuser');
     $elementupdate->ugradeUserUpdate($uid);
     $elementupdate->updateSQL();
 }
예제 #3
0
             }
         }
         if ($db_ifpwcache & 64 && $thread['postdate'] > $timestamp - 7 * 24 * 3600) {
             if ($thread['hits'] > $hitsort_judge['hitsortweek'][$fid] && $thread['fid'] == $fid) {
                 $updatelist[] = array('hitsortweek', $fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0);
                 $updatetype['hitsortweek'] = 1;
             }
         }
     }
     if ($updatelist) {
         L::loadClass('elementupdate', '', false);
         $elementupdate = new ElementUpdate($fid);
         $elementupdate->setJudge('hitsort', $hitsort_judge);
         $elementupdate->setUpdateList($updatelist);
         $elementupdate->setUpdateType($updatetype);
         $elementupdate->updateSQL();
         unset($elementupdate);
     }
     unset($updatelist, $updatetype, $hitsort_judge);
 }
 //End Here
 $pwAnonyHide = $isGM || $pwSystem['anonyhide'];
 $rewids = $cyids = array();
 $arrStatus = array(1 => 'vote', 2 => 'active', 3 => 'reward', 4 => 'trade', 5 => 'debate');
 foreach ($tpcdb as $key => $thread) {
     $foruminfo['allowhtm'] == 1 && ($htmurl = $db_readdir . '/' . $fid . '/' . date('ym', $thread['postdate']) . '/' . $thread['tid'] . '.html');
     $thread['tpcurl'] = "read.php?tid={$thread['tid']}" . ($page > 1 ? "&fpage={$page}" : '');
     if ($managemode == 1) {
         $thread['tpcurl'] .= '&toread=1';
     } elseif (!$foruminfo['cms'] && $foruminfo['allowhtm'] == 1 && file_exists(R_P . $htmurl)) {
         $thread['tpcurl'] = "{$htmurl}";
예제 #4
0
파일: mawhole.php 프로젝트: jechiy/PHPWind
function copyAttachs($tid, $pid, $content, $newtid, $newpid, $newfid)
{
    global $db, $db_ifpwcache;
    $_aids = $array = array();
    $newtid = (int) $newtid;
    $newpid = (int) $newpid;
    $newfid = (int) $newfid;
    $query = $db->query("SELECT * FROM pw_attachs WHERE tid=" . S::sqlEscape($tid) . " AND pid=" . S::sqlEscape($pid));
    $count = $ifAttach = 0;
    while ($rt = $db->fetch_array($query)) {
        if (!$count && !$pid && $rt['type'] == 'img') {
            $ifAttach = true;
            $count++;
        }
        if (strpos($content, "[attachment=" . $rt['aid'] . "]") !== false) {
            $db->update("INSERT INTO pw_attachs\n\t\t\t(fid,uid,tid,pid,did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb)\n\t\t\tSELECT {$newfid},uid,{$newtid},{$newpid},did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb\n\t\t\tFROM pw_attachs WHERE aid=" . S::sqlEscape($rt['aid']));
            $array[$rt['aid']] = $db->insert_id();
        } else {
            $_aids[] = $rt['aid'];
        }
    }
    if ($_aids) {
        $db->update("INSERT INTO pw_attachs (fid,uid,tid,pid,did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb) SELECT {$newfid},uid,{$newtid},{$newpid},did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb FROM pw_attachs WHERE tid=" . S::sqlEscape($tid) . ' AND pid=' . S::sqlEscape($pid) . ' AND aid IN (' . S::sqlImplode($_aids) . ')');
    }
    //Start elementupdate
    if ($db_ifpwcache & 512 && $ifAttach) {
        L::loadClass('elementupdate', '', false);
        $elementAttach = $db->get_one("SELECT * FROM pw_attachs WHERE tid=" . S::sqlEscape($newtid) . " AND pid=" . S::sqlEscape($pid));
        $elementupdate = new ElementUpdate($newfid);
        $elementupdate->newPicUpdate($elementAttach['aid'], $newfid, $newtid, $elementAttach['attachurl'], $elementAttach['ifthumb'], $content);
        $elementupdate->updateSQL();
    }
    //End elementupdate
    return $array;
}
예제 #5
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);
         }
         $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) {
             require_once R_P . 'lib/elementupdate.class.php';
             $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();
         }
         updateDatanalyse($this->data['authorid'], 'memberThread', 1);
         updateDatanalyse($this->tid, 'threadPost', 1);
         # memcache refresh
         $threadsObj = L::loadclass("threads");
         $threadsObj->clearThreadByThreadId($this->tid);
         # memcache refresh
         $threadlistObj = L::loadclass("threadlist");
         $threadlistObj->updateThreadIdsByForumId($this->forum->fid, $this->tid);
     }
     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);
     }
 }
예제 #6
0
 function afterModify()
 {
     global $db_ifpwcache;
     if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) {
         $elementpic = $this->att->elementpic;
         require_once R_P . 'lib/elementupdate.class.php';
         $elementupdate = new ElementUpdate($this->forum->fid);
         $elementupdate->newPicUpdate($elementpic['aid'], $this->forum->fid, $this->tid, $elementpic['attachurl'], '', $this->data['content']);
         $elementupdate->updateSQL();
     }
     //End elementupdate
     if ($this->data['ifcheck'] && $this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
     if ($this->data['ifcheck'] != $this->atcdb['ifcheck']) {
         $this->forum->lastinfo('topic', $this->atcdb['ifcheck'] == 1 ? '-' : '+');
     }
     $this->updateForumsextra();
     $threads = L::loadClass('Threads');
     $threads->delThreads($this->tid);
 }
예제 #7
0
 function afterpost()
 {
     global $db_ifpwcache, $timestamp;
     if ($this->data['ifcheck'] == 1) {
         if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) {
             $StaticPage = L::loadClass('StaticPage');
             $StaticPage->update($this->tid);
         }
         $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp);
         $this->forum->lastinfo('topic', '+', $lastpost);
         if ($this->forum->isOpen() && !$this->data['anonymous']) {
             pwAddFeed($this->post->uid, 'post', $this->tid, array('subject' => stripslashes($this->data['title']), 'tid' => $this->tid, 'fid' => $this->forum->fid));
             //会员资讯缓存
             $usercachedata = array();
             $usercache = L::loadDB('Usercache');
             $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N);
             $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N);
             $usercachedata['postdate'] = $timestamp;
             if ($this->att) {
                 $usercachedata['attimages'] = $this->att->getImages(4);
             }
             $usercache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata);
         }
         //Start elementupdate
         if ($db_ifpwcache & 128 || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) {
             require_once R_P . 'lib/elementupdate.class.php';
             $elementupdate = new ElementUpdate($this->forum->fid);
             if ($db_ifpwcache & 128) {
                 $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']);
             }
             if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) {
                 $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']);
             }
             $elementupdate->updateSQL();
         }
         updateDatanalyse($this->data['authorid'], 'memberThread', 1);
         //End elementupdate
     }
     if ($this->postdata->filter->filter_weight > 1) {
         $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight);
     }
     if ($this->data['topped'] > 0) {
         require_once R_P . 'require/updateforum.php';
         setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']);
         updatetop();
     }
 }
예제 #8
0
 function afterModify()
 {
     global $db_ifpwcache, $timestamp, $db_kmd_deducttime;
     if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) {
         $elementpic = $this->att->elementpic;
         L::loadClass('elementupdate', '', false);
         $elementupdate = new ElementUpdate($this->forum->fid);
         $elementupdate->newPicUpdate($elementpic['aid'], $this->forum->fid, $this->tid, $elementpic['attachurl'], '', $this->data['content']);
         $elementupdate->updateSQL();
     }
     //End elementupdate
     //update at users
     $threadService = L::loadClass('threads', 'forum');
     $threadService->updateAtUsers($this->tid, 0, $this->data['atusers']);
     if ($this->data['ifcheck'] && $this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
     if ($this->data['ifcheck'] != $this->atcdb['ifcheck']) {
         $actions = $this->atcdb['ifcheck'] == 1 ? '-' : '+';
         $this->forum->lastinfo('topic', $actions);
         if ($this->extraBehavior) {
             $this->extraBehavior->topicModify($this->tid, $this->data);
         }
     }
     $this->updateForumsextra();
     if ($this->data['kmdinfo']) {
         $kmdService = L::loadClass('KmdService', 'forum');
         $tmpTime = $this->data['kmdinfo']['endtime'] - $db_kmd_deducttime * 3600;
         $newKmdEndTime = $db_kmd_deducttime && $tmpTime > 0 ? $tmpTime : $this->data['kmdinfo']['endtime'];
         $updateKmdInfo = array('status' => KMD_THREAD_STATUS_CHECK, 'endtime' => $newKmdEndTime);
         $kmdService->updateKmdInfo($updateKmdInfo, $this->data['kmdinfo']['kid']);
     }
     //* $threads = L::loadClass('Threads', 'forum');
     //* $threads->delThreads($this->tid);
     Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $this->tid));
 }
예제 #9
0
파일: thread.php 프로젝트: jechiy/PHPWind
 function analyseDataToCache($tpcdb)
 {
     global $db_ifpwcache, $timestamp;
     if (!($db_ifpwcache & 112) || pwFilemtime(D_P . 'data/bbscache/hitsort_judge.php') > $timestamp - 600) {
         return;
     }
     extract(pwCache::getData(D_P . 'data/bbscache/hitsort_judge.php', false));
     $updatelist = $updatetype = array();
     foreach ($tpcdb as $thread) {
         if ($db_ifpwcache & 16) {
             if ($thread['hits'] > $hitsort_judge['hitsort'][$this->fid] && $thread['fid'] == $this->fid) {
                 $updatelist[] = array('hitsort', $this->fid, $thread['tid'], $thread['hits'], '', 0);
                 $updatetype['hitsort'] = 1;
             }
         }
         if ($db_ifpwcache & 32 && $thread['postdate'] > $timestamp - 24 * 3600) {
             if ($thread['hits'] > $hitsort_judge['hitsortday'][$this->fid] && $thread['fid'] == $this->fid) {
                 $updatelist[] = array('hitsortday', $this->fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0);
                 $updatetype['hitsortday'] = 1;
             }
         }
         if ($db_ifpwcache & 64 && $thread['postdate'] > $timestamp - 7 * 24 * 3600) {
             if ($thread['hits'] > $hitsort_judge['hitsortweek'][$this->fid] && $thread['fid'] == $this->fid) {
                 $updatelist[] = array('hitsortweek', $this->fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0);
                 $updatetype['hitsortweek'] = 1;
             }
         }
     }
     if ($updatelist) {
         L::loadClass('elementupdate', '', false);
         $elementupdate = new ElementUpdate($this->fid);
         $elementupdate->setJudge('hitsort', $hitsort_judge);
         $elementupdate->setUpdateList($updatelist);
         $elementupdate->setUpdateType($updatetype);
         $elementupdate->updateSQL();
         unset($elementupdate);
     }
 }
예제 #10
0
 function afterpost()
 {
     global $db_ifpwcache, $timestamp;
     if ($this->data['ifcheck'] == 1) {
         if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) {
             $StaticPage = L::loadClass('StaticPage');
             $StaticPage->update($this->tid);
         }
         $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp);
         $this->forum->lastinfo('topic', '+', $lastpost);
         if ($this->forum->isOpen() && !$this->data['anonymous']) {
             require_once R_P . 'require/functions.php';
             if (!$this->extraBehavior) {
                 $weiboService = L::loadClass('weibo', 'sns');
                 /* @var $weiboService PW_Weibo */
                 $weiboContent = substrs(stripWindCode($weiboService->escapeStr(strip_tags($this->data['content']))), 125);
                 $weiboExtra = array('title' => stripslashes($this->data['title']), 'fid' => $this->forum->fid, 'fname' => $this->forum->name, 'atusers' => $this->data['atusers']);
                 $weiboService->send($this->post->uid, $weiboContent, 'article', $this->tid, $weiboExtra);
                 $threadService = L::loadClass('threads', 'forum');
                 $threadService->setAtUsers($this->tid, 0, $this->data['atusers']);
             }
             //会员资讯缓存
             $userCache = L::loadClass('Usercache', 'user');
             $userCache->delete($this->data['authorid'], array('article', 'cardtopic'));
             /*
             $usercachedata = array();
             $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N);
             $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N);
             $usercachedata['postdate'] = $timestamp;
             if ($this->att) {
             	$usercachedata['attimages'] = $this->att->getImages(4);
             }
             $userCache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata);
             */
         }
         //Start elementupdate
         require_once D_P . 'data/bbscache/o_config.php';
         if ($db_ifpwcache & 128 || $o_browseopen || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) {
             L::loadClass('elementupdate', '', false);
             $elementupdate = new ElementUpdate($this->forum->fid);
             if ($db_ifpwcache & 128) {
                 $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']);
             }
             if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic && $this->_checkIfHidden()) {
                 $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']);
             }
             if ($o_browseopen) {
                 $elementupdate->setCacheNum(100);
                 /*设置缓存100个*/
                 $elementupdate->lastPostUpdate($this->data['authorid'], $this->tid, $timestamp);
             }
             $elementupdate->updateSQL();
         }
         require_once R_P . 'require/functions.php';
         updateDatanalyse($this->data['authorid'], 'memberThread', 1);
         //End elementupdate
     }
     if ($this->postdata->filter->filter_weight > 1) {
         $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight);
     }
     if ($this->data['topped'] > 0) {
         require_once R_P . 'require/updateforum.php';
         setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']);
         updatetop();
     }
 }