示例#1
0
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;
}
示例#2
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);
 }
示例#3
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));
 }
示例#4
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();
     }
 }
示例#5
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();
     }
 }