コード例 #1
0
ファイル: setforum.php プロジェクト: adi00/wumaproject
            if ($forum[$fup]['type'] != 'category' && $ifsave[$key] == 1) {
                $db->update("INSERT INTO pw_forums SET " . pwSqlSingle(array('fup' => $fup, 'type' => $forumtype, 'logo' => $logo[$key], 'name' => $value, 'descrip' => $descrip[$key], 'keywords' => $keywords[$key], 'vieworder' => $vieworder[$key], 'forumadmin' => $str_admin, 'style' => $style[$key], 'allowhide' => $allowhide, 'allowsell' => $allowsell, 'allowtype' => $allowtype, 'copyctrl' => $copyctrl, 'viewsub' => $viewsub, 'allowvisit' => $allowvisit, 'allowpost' => $allowpost, 'allowrp' => $allowrp, 'allowdownload' => $allowdownload, 'allowupload' => $allowupload, 'f_type' => $f_type, 'f_check' => $f_check, 'cms' => $cms, 'ifhide' => $ifhide)));
                $fid = $db->insert_id();
                if ($creditset || $forumset) {
                    $db->update("INSERT INTO pw_forumsextra SET " . pwSqlSingle(array('fid' => $fid, 'creditset' => $creditset, 'forumset' => $forumset)));
                }
            } else {
                $f_type = $forum[$fup]['f_type'] == 'hidden' ? 'hidden' : 'forum';
                $db->update("INSERT INTO pw_forums SET " . pwSqlSingle(array('fup' => $fup, 'type' => $forumtype, 'logo' => $logo[$key], 'name' => $value, 'descrip' => $descrip[$key], 'keywords' => $keywords[$key], 'vieworder' => $vieworder[$key], 'forumadmin' => $str_admin, 'style' => $style[$key], 'f_type' => $f_type, 'cms' => 0, 'ifhide' => 1, 'allowtype' => 3)));
                $fid = $db->insert_id();
            }
            $db->update("INSERT INTO pw_forumdata SET fid=" . pwEscape($fid));
        }
        P_unlink(D_P . 'data/bbscache/c_cache.php');
        updatecache_f();
        $forumtype != 'category' && updatetop();
        if ($addtype == 1) {
            ObHeader("{$basename}&action=edit&fid={$fid}");
        } else {
            adminmsg('operate_success');
        }
    }
} elseif ($_POST['action'] == 'editforum') {
    InitGP(array('forumadmin'), 'P', 0);
    InitGP(array('order'), 'P', 2);
    $errorname = array();
    $forumdb = $db->query("SELECT fid,forumadmin,vieworder FROM pw_forums WHERE cms!='1'");
    while ($foruminfo = $db->fetch_array($forumdb)) {
        $pwSQL = $admin_a = $admin_n = $admin_d = array();
        if ($foruminfo['forumadmin'] != $forumadmin[$foruminfo['fid']] && $foruminfo['forumadmin'] != ',' . $forumadmin[$foruminfo['fid']] . ',') {
            $admin_a = explode(',', $forumadmin[$foruminfo['fid']]);
コード例 #2
0
ファイル: postmodify.php プロジェクト: adi00/wumaproject
        $msg_delrvrc = abs($creditset['Deleterp']['rvrc']);
        $msg_delmoney = abs($creditset['Deleterp']['money']);
        $credit->addLog('topic_Deleterp', $creditset['Deleterp'], array('uid' => $authorid, 'username' => $author, 'ip' => $onlineip, 'fname' => strip_tags($forum[$fid]['name']), 'operator' => $windid));
        $credit->sets($authorid, $creditset['Deleterp'], false);
    }
    $credit->setMdata($authorid, 'postnum', -1);
    $credit->runsql();
    if ($db_guestread) {
        require_once R_P . 'require/guestfunc.php';
        clearguestcache($tid, $rs['replies']);
    }
    P_unlink(D_P . 'data/bbscache/c_cache.php');
    require_once R_P . 'require/updateforum.php';
    updateforum($fid);
    if ($rs['topped']) {
        updatetop();
    }
    $msg_delrvrc = floor($msg_delrvrc / 10);
    require_once R_P . 'require/writelog.php';
    $log = array('type' => 'delete', 'username1' => $author, 'username2' => $windid, 'field1' => $fid, 'field2' => '', 'field3' => '', 'descrip' => $deltype . '_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $tid, 'forum' => $pwforum->foruminfo['name'], 'subject' => $deltitle, 'affect' => "{$db_rvrcname}:-{$msg_delrvrc},{$db_moneyname}:-{$msg_delmoney}", 'reason' => 'edit delete article!');
    writelog($log);
    if ($pwforum->foruminfo['allowhtm'] && $article <= $db_readperpage) {
        $StaticPage = L::loadClass('StaticPage');
        $StaticPage->update($tid);
    }
    if ($deltype == 'delrp') {
        refreshto("read.php?tid={$tid}", 'enter_thread');
    } else {
        refreshto("thread.php?fid={$fid}", 'enter_thread');
    }
} elseif ($_POST['step'] == 2) {
コード例 #3
0
ファイル: delarticle.class.php プロジェクト: jechiy/PHPWind
 function delTopic($readdb, $recycle = false, $delCredit = true, $extra = array())
 {
     global $db, $db_htmdir, $db_guestread, $windid, $db_ifpwcache, $db_creditset, $timestamp, $onlineip, $credit;
     if ($db_guestread) {
         require_once R_P . 'require/guestfunc.php';
     }
     require_once R_P . 'require/credit.php';
     $updatetop = 0;
     $kmdTids = $specialdb = $tids = $fids = $ttable_a = $ptable_a = $recycledb = $deluids = $delutids = $cydb = $modeldb = $pcdb = $activityDb = array();
     foreach ($readdb as $key => $read) {
         $isInRecycle = $read['fid'] == 0 && $read['ifcheck'] == 1;
         $msg_delrvrc = $msg_delmoney = 0;
         if ($delCredit && !$isInRecycle) {
             /* 删除积分 */
             $creditset = $this->getcreditset($read['fid']);
             $credit->addLog('topic_Delete', $creditset['Delete'], array('uid' => $read['authorid'], 'username' => $read['author'], 'ip' => $onlineip, 'fname' => strip_tags($this->getForumInfo($read['fid'], 'name')), 'operator' => $windid));
             $credit->sets($read['authorid'], $creditset['Delete'], false);
             $msg_delrvrc = abs($creditset['Delete']['rvrc']);
             $msg_delmoney = abs($creditset['Delete']['money']);
         }
         /*记录日志 */
         $logdb[] = array('type' => 'delete', 'username1' => $read['author'], 'username2' => $windid, 'field1' => $read['fid'], 'field2' => $read['tid'], 'field3' => '', 'descrip' => 'del_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'affect' => "{$GLOBALS[db_rvrcname]}:-{$msg_delrvrc},{$GLOBALS[db_moneyname]}:-{$msg_delmoney}", 'tid' => $read['tid'], 'subject' => substrs($read['subject'], 28), 'reason' => $extra['reason']);
         if ($read['modelid']) {
             $modeldb[$read['modelid']][] = $read['tid'];
         } elseif ($read['special'] == 8) {
             //活动
             $activityDb[] = $read['tid'];
         } elseif ($read['special'] > 20) {
             $pcdb[$read['special']][] = $read['tid'];
         } elseif ($read['special'] == 6) {
             $robbuildTids[] = $read['tid'];
         }
         if ($read['special'] > 0 && $read['special'] < 5) {
             $specialdb[$read['special']][] = $read['tid'];
         }
         if ($read['tpcstatus'] && getstatus($read['tpcstatus'], 1)) {
             $cydb[] = $read['tid'];
         }
         $htmurl = R_P . $db_readdir . '/' . $read['fid'] . '/' . date('ym', $read['postdate']) . '/' . $read['tid'] . '.html';
         if (file_exists($htmurl)) {
             P_unlink($htmurl);
         }
         if ($db_guestread) {
             clearguestcache($read['tid'], $read['replies']);
         }
         if ($recycle) {
             $recycledb[] = array('pid' => 0, 'tid' => $read['tid'], 'fid' => $read['fid'], 'deltime' => $GLOBALS['timestamp'], 'admin' => $GLOBALS['windid']);
         }
         $read['specialsort'] > 0 && ($updatetop = 1);
         $read['specialsort'] == PW_THREADSPECIALSORT_KMD && ($kmdTids[] = $read['tid']);
         $ttable_a[GetTtable($read['tid'])] = 1;
         $ptable_a[$read['ptable']] = 1;
         $fids[$read['fid']]['tids'][] = $read['tid'];
         !$isInRecycle && $deluids[$read['authorid']]++;
         if ($read['fid'] > 0 && $read['ifcheck'] < 2) {
             $fids[$read['fid']]['replies'] += $read['replies'];
             if ($read['ifcheck']) {
                 $fids[$read['fid']]['topic']++;
                 $delutids[$read['authorid']][] = $read['tid'];
             }
         }
         $tids[] = $read['tid'];
     }
     if (!$tids) {
         return true;
     }
     require_once R_P . 'require/updateforum.php';
     $deltids = S::sqlImplode($tids);
     /*写操作日志 */
     require_once R_P . 'require/writelog.php';
     foreach ($logdb as $key => $val) {
         writelog($val);
     }
     if ($cydb) {
         $this->_reCountColony($cydb);
     }
     if ($recycle) {
         //$this->db->update("UPDATE pw_threads SET fid='0',ifcheck='1',topped='0' WHERE tid IN($deltids)");
         pwQuery::update('pw_threads', 'tid IN (:tid)', array($tids), array('fid' => '0', 'ifcheck' => '1', 'topped' => '0'));
         //这里的$tid是还未过滤的$deltids
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("UPDATE $pw_posts SET fid='0' WHERE tid IN($deltids)");
             pwQuery::update($pw_posts, 'tid IN(:tid)', array($tids), array('fid' => '0'));
         }
         if ($recycledb) {
             $this->db->update("REPLACE INTO pw_recycle (pid,tid,fid,deltime,admin) VALUES " . S::sqlMulti($recycledb));
         }
         // ThreadManager reflesh memcache
         /*
         $threadlist = L::loadClass("threadlist", 'forum');
         foreach ($fids as $fid => $value) {
         	$threadlist->refreshThreadIdsByForumId($fid);
         }
         
         $threads = L::loadClass('Threads', 'forum');
         $threads->delThreads($tids);
         */
         Perf::gatherInfo('changeThreadWithForumIds', array('fid' => array_keys($fids)));
         Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $tids));
         if ($modeldb) {
             $this->_RecycleModelTopic($modeldb);
         }
         if ($activityDb) {
             $this->_RecycleActivityTopic($activityDb);
         }
         if ($pcdb) {
             $this->_RecyclePcTopic($pcdb);
         }
     } else {
         //* $threadManager = L::loadClass("threadmanager", 'forum'); /* @var $threadManager PW_ThreadManager */
         $threadService = L::loadclass('threads', 'forum');
         foreach ($fids as $fid => $value) {
             //* $threadManager->deleteByThreadIds($fid, $value['tids']);
             $threadService->deleteByThreadIds($value['tids']);
             Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
         }
         foreach ($ttable_a as $pw_tmsgs => $val) {
             //* $this->db->update("DELETE FROM $pw_tmsgs WHERE tid IN($deltids)");
             pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($tids));
         }
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("DELETE FROM $pw_posts WHERE tid IN($deltids)");
             pwQuery::delete($pw_posts, 'tid IN(:tid)', array($tids));
         }
         if ($specialdb) {
             $this->_delSpecialTopic($specialdb);
         }
         if ($modeldb) {
             $this->_delModelTopic($modeldb);
         }
         if ($activityDb) {
             $this->_delActivityTopic($activityDb);
         }
         if ($pcdb) {
             $this->_delPcTopic($pcdb);
         }
         if ($robbuildTids) {
             $robbuildService = L::loadClass("robbuild", 'forum');
             $robbuildService->deleteByTids($robbuildTids);
         }
         if ($cydb) {
             $this->db->update("DELETE FROM pw_argument WHERE tid IN(" . S::sqlImplode($cydb) . ')');
         }
         delete_tag($deltids);
     }
     /* 删除微博 */
     $weiboService = L::loadClass('weibo', 'sns');
     /* @var $weiboService PW_Weibo */
     $weibos = $weiboService->getWeibosByObjectIdsAndType($tids, 'article');
     if ($weibos) {
         $mids = array();
         foreach ($weibos as $key => $weibo) {
             $mids[] = $weibo['mid'];
         }
         $weiboService->deleteWeibos($mids);
     }
     /* delete cache*/
     if ($db_ifpwcache ^ 1) {
         $db->update("DELETE FROM pw_elements WHERE type !='usersort' AND id IN(" . S::sqlImplode($tids) . ')');
     }
     //* P_unlink(D_P . 'data/bbscache/c_cache.php');
     pwCache::deleteData(D_P . 'data/bbscache/c_cache.php');
     /* 扣除积分 */
     $delCredit && $credit->runsql();
     //更新置顶帖表
     $this->db->update("DELETE FROM pw_poststopped WHERE tid IN ({$deltids}) AND pid = '0' AND fid != '0' ");
     if ($delutids) {
         $userCache = L::loadClass('Usercache', 'user');
         $userCache->delete(array_keys($delutids), array('article', 'cardtopic', 'weibo'));
     }
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     foreach ($deluids as $key => $value) {
         $userService->updateByIncrement($key, array(), array('postnum' => -$value));
     }
     $pw_attachs = L::loadDB('attachs', 'forum');
     if ($attachdb = $pw_attachs->getByTid($tids)) {
         delete_att($attachdb, !$recycle);
         require_once R_P . 'require/functions.php';
         pwFtpClose($GLOBALS['ftp']);
     }
     if ($updatetop) {
         if ($kmdTids) {
             $kmdService = L::loadClass('kmdservice', 'forum');
             foreach ($kmdTids as $tid) {
                 $kmdService->initThreadInfoByTid($tid);
             }
         }
         updatetop();
     }
     foreach ($fids as $fid => $value) {
         updateForumCount($fid, -$value['topic'], -$value['replies']);
     }
 }
コード例 #4
0
ファイル: class_Thread.php プロジェクト: adi00/wumaproject
 function downTopped($tid)
 {
     //取消置顶贴
     $tid = $this->db->get_value('SELECT tid FROM pw_threads WHERE tid=' . pwEscape($tid));
     if (!$tid) {
         return new ApiResponse(false);
     }
     $this->db->update('UPDATE pw_threads SET topped=0 WHERE tid=' . pwEscape($tid));
     require_once R_P . 'require/updateforum.php';
     updatetop();
     return new ApiResponse(true);
 }
コード例 #5
0
ファイル: class_Forum.php プロジェクト: sherlockhouse/aliyun
 function createForum($name, $fup = 0, $descrip = '', $linkurl = '')
 {
     //创建版块
     if (!$name) {
         return new ApiResponse(false);
     }
     //* @include_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
     extract(pwCache::getData(D_P . 'data/bbscache/forum_cache.php', false));
     $forumtype = $forum[$fup]['type'] == 'category' ? 'forum' : ($forum[$fup]['type'] == 'forum' ? 'sub' : 'sub2');
     /*
     $this->db->update("INSERT INTO pw_forums SET " . S::sqlSingle(array(
     	'fup'			=> $fup,
     	'type'			=> $forumtype,
     	'name'			=> $name,
     	'descrip'		=> $descrip,
     	'cms'			=> 0,
     	'ifhide'		=> 1,
     	'allowtype'		=> 3
     )));
     */
     pwQuery::insert('pw_forums', array('fup' => $fup, 'type' => $forumtype, 'name' => $name, 'descrip' => $descrip, 'cms' => 0, 'ifhide' => 1, 'allowtype' => 3));
     $fid = $this->db->insert_id();
     $this->db->update("INSERT INTO pw_forumdata SET fid=" . S::sqlEscape($fid));
     $forumset = array('lock' => 0, 'cutnums' => 0, 'threadnum' => 0, 'readnum' => 0, 'newtime' => 0, 'orderway' => 'lastpost', 'asc' => 'DESC', 'allowencode' => 0, 'anonymous' => 0, 'rate' => 0, 'dig' => 0, 'inspect' => 0, 'watermark' => 0, 'commend' => 0, 'autocommend' => 0, 'commendlist' => '', 'commendnum' => 0, 'commendlength' => 0, 'commendtime' => 0, 'addtpctype' => 0, 'ifrelated' => 0, 'relatednums' => 0, 'relatedcon' => 'ownpost', 'relatedcustom' => array(), 'rvrcneed' => 0, 'moneyneed' => 0, 'creditneed' => 0, 'postnumneed' => 0, 'sellprice' => array(), 'uploadset' => 'money 0', 'rewarddb' => '', 'allowtime' => '');
     $forumset['link'] = $linkurl;
     $forumset = serialize($forumset);
     $this->db->update("INSERT INTO pw_forumsextra SET " . S::sqlSingle(array('fid' => $fid, 'forumset' => $forumset)));
     //* P_unlink(D_P.'data/bbscache/c_cache.php');
     pwCache::deleteData(D_P . 'data/bbscache/c_cache.php');
     require_once R_P . 'admin/cache.php';
     updatecache_f();
     require_once R_P . 'require/updateforum.php';
     $forumtype != 'category' && updatetop();
     return new ApiResponse($fid);
 }
コード例 #6
0
ファイル: setforum.php プロジェクト: jechiy/PHPWind
function updateForumPostTop($fidArr)
{
    global $db;
    if (!is_array($fidArr)) {
        return false;
    }
    $postTopData = array();
    $query = $db->query("SELECT * FROM pw_poststopped WHERE floor = 3 GROUP BY tid ");
    while ($row = $db->fetch_array($query)) {
        $postTopData[] = $row;
    }
    foreach ($postTopData as $key => $value) {
        foreach ($fidArr as $fid) {
            pwQuery::insert('pw_poststopped', array('fid' => $fid, 'tid' => $value['tid'], 'pid' => $value['pid'], 'floor' => $value['floor'], 'uptime' => $value['uptime'], 'overtime' => $value['overtime']));
        }
    }
    updatetop();
}
コード例 #7
0
 /**
  * 回收所有孔明灯(给开关关闭等操作服务)
  */
 function recycleAllKmds($fid = 0)
 {
     $fid = intval($fid);
     $kmdInfoDb = $this->_getKmdInfoDB();
     $recycles = $kmdInfoDb->getAllValidKmds($fid);
     foreach ($recycles as $v) {
         if ($v['tid'] > 0) {
             $this->updateKmdThread($v['kid']);
         }
         $this->initKmdInfoByKid($v['kid']);
     }
     require_once R_P . 'require/updateforum.php';
     updatetop();
 }
コード例 #8
0
 /**
  * 改变帖子归属版块
  * @param int $cyid 群组id
  * @param int $ifTopicShowInForum 帖子是否显示在版块中
  * @param int $tocid 目标群组
  * @param int $fromcid 来源群组
  * void
  */
 function changeTopicToForum($cyid, $ifTopicShowInForum, $tocid, $fromcid)
 {
     global $db_plist;
     $tocid = intval($tocid);
     $ifcheck = $tocid > 0 && $ifTopicShowInForum ? 1 : 2;
     $this->_db->update("REPLACE INTO pw_poststopped \r\n\t\t\tSELECT {$tocid},p.tid,p.pid,p.floor,p.uptime,p.overtime \r\n\t\t\tFROM pw_poststopped p \r\n\t\t\tLEFT JOIN pw_argument a ON p.tid=a.tid \r\n\t\t\tWHERE p.fid=" . S::sqlEscape($fromcid) . " AND p.pid=0 AND a.cyid=" . S::sqlEscape($cyid));
     $_sql_Where = $fromcid > 0 ? ' AND t.fid>0' : " AND t.ifcheck='2'";
     /*$this->_db->update("UPDATE pw_argument a LEFT JOIN pw_threads t ON a.tid=t.tid 
     			SET t.fid=" . S::sqlEscape($tocid) . ",t.ifcheck=" . S::sqlEscape($ifcheck) . 
     			" WHERE a.cyid=" . S::sqlEscape($cyid) . $_sql_Where
     		);*/
     $this->_db->update(pwQuery::buildClause("UPDATE :pw_table1 a LEFT JOIN :pw_table2 t ON a.tid=t.tid SET t.fid=:fid,t.ifcheck=:ifcheck WHERE a.cyid=:cyid {$_sql_Where}", array('pw_argument', 'pw_threads', $tocid, $ifcheck, $cyid)));
     $this->_db->update("UPDATE pw_argument a LEFT JOIN pw_posts p ON a.tid=p.tid SET p.fid=" . S::sqlEscape($tocid) . " WHERE a.cyid=" . S::sqlEscape($cyid));
     if ($db_plist && count($db_plist) > 1) {
         foreach ($db_plist as $key => $value) {
             if ($key == 0) {
                 continue;
             }
             $pw_posts = GetPtable($key);
             $this->_db->update("UPDATE pw_argument a LEFT JOIN {$pw_posts} p ON a.tid=p.tid SET p.fid=" . S::sqlEscape($tocid) . " WHERE a.cyid=" . S::sqlEscape($cyid));
         }
     }
     require_once R_P . 'require/updateforum.php';
     if ($tocid > 0) {
         $this->_db->update("UPDATE pw_cnclass SET cnsum=cnsum+1 WHERE fid=" . S::sqlEscape($tocid));
         updateforum($tocid);
     }
     if ($fromcid > 0) {
         $this->_db->update("UPDATE pw_cnclass SET cnsum=cnsum-1 WHERE fid=" . S::sqlEscape($fromcid) . " AND cnsum>0");
         updateforum($fromcid);
     }
     updatetop();
 }
コード例 #9
0
 function delTopic($readdb, $recycle = false)
 {
     global $db_htmdir, $db_guestread;
     if ($db_guestread) {
         require_once R_P . 'require/guestfunc.php';
     }
     $updatetop = 0;
     $specialdb = $tids = $fids = $ttable_a = $ptable_a = $recycledb = $deluids = $delutids = $cydb = $modeldb = $pcdb = array();
     foreach ($readdb as $key => $read) {
         if ($read['modelid']) {
             $modeldb[$read['modelid']][] = $read['tid'];
         } elseif ($read['special'] > 20) {
             $pcdb[$read['special']][] = $read['tid'];
         }
         if ($read['special'] > 0 && $read['special'] < 5) {
             $specialdb[$read['special']][] = $read['tid'];
         }
         if ($read['tpcstatus'] && getstatus($read['tpcstatus'], 1)) {
             $cydb[] = $read['tid'];
         }
         $htmurl = R_P . $db_htmdir . '/' . $read['fid'] . '/' . date('ym', $read['postdate']) . '/' . $read['tid'] . '.html';
         if (file_exists($htmurl)) {
             P_unlink($htmurl);
         }
         if ($db_guestread) {
             clearguestcache($read['tid'], $read['replies']);
         }
         if ($recycle) {
             $recycledb[] = array('pid' => 0, 'tid' => $read['tid'], 'fid' => $read['fid'], 'deltime' => $GLOBALS['timestamp'], 'admin' => $GLOBALS['windid']);
         }
         $read['topped'] > 0 && ($updatetop = 1);
         $ttable_a[GetTtable($read['tid'])] = 1;
         $ptable_a[$read['ptable']] = 1;
         $fids[$read['fid']]['tids'][] = $read['tid'];
         if ($read['fid'] > 0) {
             $fids[$read['fid']]['replies'] += $read['replies'];
             $deluids[$read['authorid']]++;
             if ($read['ifcheck']) {
                 $fids[$read['fid']]['topic']++;
                 $delutids[$read['authorid']][] = $read['tid'];
             }
         }
         $tids[] = $read['tid'];
     }
     if (!$tids) {
         return true;
     }
     require_once R_P . 'require/updateforum.php';
     $deltids = pwImplode($tids);
     if ($recycle) {
         $this->db->update("UPDATE pw_threads SET fid='0',ifcheck='1',topped='0' WHERE tid IN({$deltids})");
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             $this->db->update("UPDATE {$pw_posts} SET fid='0' WHERE tid IN({$deltids})");
         }
         if ($recycledb) {
             $this->db->update("REPLACE INTO pw_recycle (pid,tid,fid,deltime,admin) VALUES " . pwSqlMulti($recycledb));
         }
         // ThreadManager reflesh memcache
         $threadlist = L::loadClass("threadlist");
         foreach ($fids as $fid => $value) {
             $threadlist->refreshThreadIdsByForumId($fid);
         }
         $threads = L::loadClass('Threads');
         $threads->delThreads($tids);
         if ($modeldb) {
             $this->_RecycleModelTopic($modeldb);
         } elseif ($pcdb) {
             $this->_RecyclePcTopic($pcdb);
         }
     } else {
         $threadManager = L::loadClass("threadmanager");
         foreach ($fids as $fid => $value) {
             $threadManager->deleteByThreadIds($fid, $value['tids']);
         }
         foreach ($ttable_a as $pw_tmsgs => $val) {
             $this->db->update("DELETE FROM {$pw_tmsgs} WHERE tid IN({$deltids})");
         }
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             $this->db->update("DELETE FROM {$pw_posts} WHERE tid IN({$deltids})");
         }
         if ($specialdb) {
             $this->_delSpecialTopic($specialdb);
         }
         if ($modeldb) {
             $this->_delModelTopic($modeldb);
         } elseif ($pcdb) {
             $this->_delPcTopic($pcdb);
         }
         delete_tag($deltids);
         //TODO 这里不是完整的删贴业务,积分等业务未考虑
     }
     //更新置顶帖表
     $this->db->update("DELETE FROM pw_poststopped WHERE tid IN ({$deltids}) AND pid = '0' AND fid != '0' ");
     //删除动态
     if ($deltids) {
         $this->db->update("DELETE FROM pw_feed WHERE type='post' AND typeid IN(" . $deltids . ")");
     }
     if ($cydb) {
         $this->db->update("DELETE FROM pw_argument WHERE tid IN(" . pwImplode($cydb) . ')');
     }
     if ($delutids) {
         $usercache = L::loadDB('Usercache');
         $usercache->delByType('topic', $delutids);
     }
     foreach ($deluids as $key => $value) {
         $this->db->update("UPDATE pw_memberdata SET postnum=postnum-" . pwEscape($value) . " WHERE uid=" . pwEscape($key));
     }
     $pw_attachs = L::loadDB('attachs');
     if ($attachdb = $pw_attachs->getByTid($tids)) {
         delete_att($attachdb, !$recycle);
         pwFtpClose($GLOBALS['ftp']);
     }
     if ($updatetop) {
         updatetop();
     }
     foreach ($fids as $fid => $value) {
         updateForumCount($fid, -$value['topic'], -$value['replies']);
     }
 }
コード例 #10
0
ファイル: topicpost.class.php プロジェクト: adi00/wumaproject
 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();
     }
 }
コード例 #11
0
ファイル: thread.php プロジェクト: jechiy/PHPWind
 function parseThread($tpcdb)
 {
     global $isGM, $pwSystem, $foruminfo, $forumset, $db_readdir, $viewbbs, $page, $managemode, $imgpath, $stylepath, $db_readperpage, $managecheck, $db_threademotion, $winduid, $db_anonymousname, $modelid, $pcid, $actmid, $timestamp;
     $this->analyseDataToCache($tpcdb);
     $pwAnonyHide = $isGM || $pwSystem['anonyhide'];
     $updatetop = 0;
     $threaddb = $rewids = $cyids = $replyReward = array();
     $arrStatus = array(1 => 'vote', 2 => 'active', 3 => 'reward', 4 => 'trade', 5 => 'debate');
     $attachtype = array('1' => 'img', '2' => 'txt', '3' => 'zip');
     foreach ($tpcdb as $key => $thread) {
         $foruminfo['allowhtm'] == 1 && ($htmurl = $db_readdir . '/' . $this->fid . '/' . date('ym', $thread['postdate']) . '/' . $thread['tid'] . '.html');
         $thread['tpcurl'] = "read.php?tid={$thread[tid]}{$viewbbs}" . ($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}";
         }
         if ($thread['toolfield']) {
             list($t, $e, $m) = explode(',', $thread['toolfield']);
             $sqladd = '';
             if ($t && $t < $timestamp) {
                 $sqladd .= ",toolinfo='',specialsort=0,topped='0'";
                 $t = '';
                 $thread['topped'] > 0 && ($updatetop = 1);
             }
             if ($e && $e < $timestamp) {
                 $sqladd .= ",titlefont=''";
                 $thread['titlefont'] = '';
                 $e = '';
             }
             if ($m && $m < $timestamp) {
                 $sqladd .= ",specialsort=0";
                 $m = '';
                 $kmdService = L::loadClass('kmdservice', 'forum');
                 $kmdService->initKmdInfoByTid($thread['tid']);
             }
             if ($sqladd) {
                 $thread['toolfield'] = implode(',', array(0 => $t, 1 => $e, 2 => $m));
                 $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET toolfield=:toolfield {$sqladd} WHERE tid=:tid", array('pw_threads', $thread['toolfield'], $thread['tid'])));
                 //* $threads = L::loadClass('Threads', 'forum');
                 //* $threads->delThreads($thread['tid']);
             }
         }
         $forumset['cutnums'] && ($thread['subject'] = substrs($thread['subject'], $forumset['cutnums']));
         $forumset['cutnums'] > 80 && ($thread['subject'] = substrs(str_replace('&nbsp;', ' ', $thread['subject']), 80));
         if ($thread['titlefont']) {
             $titledetail = explode("~", $thread['titlefont']);
             if ($titledetail[0]) {
                 $thread['subject'] = "<font color={$titledetail['0']}>{$thread['subject']}</font>";
             }
             if ($titledetail[1]) {
                 $thread['subject'] = "<b>{$thread['subject']}</b>";
             }
             if ($titledetail[2]) {
                 $thread['subject'] = "<i>{$thread['subject']}</i>";
             }
             if ($titledetail[3]) {
                 $thread['subject'] = "<u>{$thread['subject']}</u>";
             }
         }
         if ($thread['ifshield']) {
             $thread['subject'] = threadShield('shield_title');
         }
         if ($thread['ifmark']) {
             $thread['ifmark'] = $thread['ifmark'] > 0 ? "<span class='gray tpage w'>&#xFF08;+{$thread['ifmark']}&#xFF09;</span>" : "<span class='gray tpage w'>&#xFF08;{$thread['ifmark']}&#xFF09;</span>";
         } else {
             unset($thread['ifmark']);
         }
         if (isset($arrStatus[$thread['special']])) {
             $p_status = $thread['locked'] % 3 == 0 ? $arrStatus[$thread['special']] : $arrStatus[$thread['special']] . 'lock';
         } elseif ($thread['locked'] % 3 != 0) {
             $p_status = $thread['locked'] % 3 == 1 ? 'topiclock' : 'topicclose';
         } else {
             $p_status = $thread['ifmagic'] ? 'magic' : ($thread['replies'] >= 10 ? 'topichot' : 'topicnew');
         }
         if ($thread['special'] == 8 && $p_status == 'topicnew') {
             //活动帖图标展示
             $p_status = 'activity';
         }
         $thread['inspect'] && ($thread['inspect'] = explode("\t", $thread['inspect']));
         if ($thread['inspect'] && $thread['inspect'][0] == 0) {
             $thread['inspect'][0] = '主';
         }
         $thread['tooltip'] = $p_status;
         $thread['status'] = "<img src=\"{$imgpath}/{$stylepath}/thread/" . $p_status . ".gif\" align=\"absmiddle\">";
         if ($thread['special'] == 8 && $p_status == 'activity') {
             //活动帖图标展示
             $thread['status'] = "<img src=\"{$imgpath}/activity/" . $p_status . ".gif\" border=0 align=\"absmiddle\">";
         }
         $thread['topped'] && ($GLOBALS['ifsort'] = 1);
         $thread['ispage'] = '';
         if ($thread['topreplays'] + $thread['replies'] + 1 > $db_readperpage) {
             $numofpage = ceil(($thread['topreplays'] + $thread['replies'] + 1) / $db_readperpage);
             $fpage = $page > 1 ? "&fpage={$page}" : "";
             $thread['ispage'] = ' ';
             $thread['ispage'] .= "&nbsp;<img src=\"{$imgpath}/{$stylepath}/file/multipage.gif\" align=\"absmiddle\" alt=\"pages\">&nbsp;<span class=\"tpage\">";
             for ($j = 1; $j <= $numofpage; $j++) {
                 if ($j == 6 && $j + 1 < $numofpage) {
                     $thread['ispage'] .= " .. <a href=\"read.php?tid={$thread['tid']}{$fpage}&page={$numofpage}\">{$numofpage}</a>";
                     break;
                 } elseif ($j == 1) {
                     $thread['ispage'] .= "";
                     //				$thread['ispage'].=" <a href=\"read.php?tid=$thread[tid]$fpage\">$j</a>";
                 } else {
                     $thread['ispage'] .= " <a href=\"read.php?tid={$thread['tid']}{$fpage}&page={$j}\">{$j}</a>";
                 }
             }
             $thread['ispage'] .= '</span> ';
         }
         $postdetail = explode(",", $thread['lastpost']);
         if ($thread['ifupload']) {
             $atype = $attachtype[$thread['ifupload']];
             $thread['titleadd'] = " <img src=\"{$imgpath}/{$stylepath}/file/{$atype}.gif\" alt=\"{$atype}\" align=\"absmiddle\">";
         } else {
             $thread['titleadd'] = "";
         }
         /*if ($managecheck) {
         			if ($thread['fid'] == $this->fid) {
         				$thread['adminbox'] = "<input type=\"checkbox\" autocomplete=\"off\" name=\"tidarray[]\" id=tid_{$thread[tid]} value=\"$thread[tid]\" onclick=\"postManage.show('postbatch','a_ajax_{$thread[tid]}')\" />";
         			} else {
         				$thread['adminbox'] = "&nbsp;&nbsp;&nbsp;";
         			}
         		}*/
         if ($db_threademotion) {
             if ($thread['icon'] == "R" || !$thread['icon']) {
                 $thread['useriocn'] = '';
             } else {
                 $thread['useriocn'] = "<img src=\"{$imgpath}/post/emotion/{$thread['icon']}.gif\" alt=\"{$thread['icon']}\" align=\"absmiddle\"> ";
             }
         }
         if ($thread['anonymous'] && $thread['authorid'] != $winduid && !$pwAnonyHide) {
             $thread['author'] = $db_anonymousname;
             $thread['authorid'] = 0;
         }
         if ($thread['special'] == 3 && $thread['state'] < 1) {
             $rewids[] = $thread['tid'];
         }
         //获取分类信息的帖子id
         if ($modelid > 0) {
             $topicids[] = $thread['tid'];
         }
         //获取团购的帖子id
         if ($pcid > 0) {
             $postcatepcids[] = $thread['tid'];
         }
         //获取活动的帖子id
         if ($actmid > 0 || $thread['special'] == 8) {
             $activitytiddb[] = $thread['tid'];
         }
         if (getstatus($thread['tpcstatus'], 1)) {
             $cyids[] = $thread['tid'];
         }
         if (getstatus($thread['tpcstatus'], 8)) {
             $replyReward[] = $thread['tid'];
         }
         $threaddb[$thread['tid']] = $thread;
     }
     if ($rewids) {
         $rewids = S::sqlImplode($rewids);
         $query = $this->db->query("SELECT tid,cbval,caval FROM pw_reward WHERE tid IN({$rewids})");
         while ($rt = $this->db->fetch_array($query)) {
             $threaddb[$rt['tid']]['rewcredit'] = $rt['cbval'] + $rt['caval'];
         }
     }
     if ($cyids && !$cyid) {
         $query = $this->db->query("SELECT a.tid,a.cyid,c.cname FROM pw_argument a LEFT JOIN pw_colonys c ON a.cyid=c.id WHERE tid IN (" . S::sqlImplode($cyids) . ')');
         while ($rt = $this->db->fetch_array($query)) {
             $threaddb[$rt['tid']]['colony'] = $rt;
         }
     }
     if ($topicids) {
         $topicvaluetable = GetTopcitable($modelid);
         $query = $this->db->query("SELECT * FROM {$topicvaluetable} WHERE tid IN (" . S::sqlImplode($topicids) . ")");
         while ($rt = $this->db->fetch_array($query)) {
             $threaddb[$rt['tid']]['topic'] = $rt;
         }
     }
     if ($postcatepcids) {
         //团购
         $pcvaluetable = GetPcatetable($pcid);
         $query = $this->db->query("SELECT * FROM {$pcvaluetable} WHERE tid IN (" . S::sqlImplode($postcatepcids) . ")");
         while ($rt = $this->db->fetch_array($query)) {
             $threaddb[$rt['tid']]['topic'] = $rt;
         }
     }
     if ($activitytiddb) {
         //活动
         global $threadshowfield, $postActForBbs;
         $defaultValueTableName = getActivityValueTableNameByActmid();
         if ($actmid) {
             $userDefinedValueTableName = getActivityValueTableNameByActmid($actmid, 1, 1);
             $query = $this->db->query("SELECT actmid,recommend,starttime,endtime,location,contact,telephone,picture1,picture2,picture3,picture4,picture5,signupstarttime,signupendtime,minparticipant,maxparticipant,userlimit,specificuserlimit,genderlimit,fees,feesdetail,paymethod,ut.* FROM {$defaultValueTableName} dt LEFT JOIN {$userDefinedValueTableName} ut USING(tid) WHERE dt.tid IN(" . S::sqlImplode($activitytiddb) . ")");
         } else {
             $query = $this->db->query("SELECT * FROM {$defaultValueTableName} WHERE tid IN(" . S::sqlImplode($activitytiddb) . ")");
         }
         while ($rt = $this->db->fetch_array($query)) {
             if ($rt['recommend'] == 1) {
                 $threaddb[$rt['tid']]['recommendadd'] = " <img src=\"{$imgpath}/activity/actrecommend.gif\" border=0 align=\"absmiddle\" title=\"" . getLangInfo('other', 'act_recommend') . "\">";
             } else {
                 $threaddb[$rt['tid']]['recommendadd'] = "";
             }
             if ($threadshowfield) {
                 foreach ($threadshowfield as $key => $column) {
                     $i = 0;
                     $columnHtml = '';
                     foreach ($column as $field) {
                         // 如人数限制值为0,视为空
                         if (in_array($field['fieldname'], array('minparticipant', 'maxparticipant')) && $rt[$field['fieldname']] == 0) {
                             $rt[$field['fieldname']] = '';
                         }
                         if ($rt[$field['fieldname']] !== '') {
                             $names = $postActForBbs->getNamePartsByName($field['name']);
                             if ($i != 0) {
                                 $columnHtml .= ' ' . $names[0];
                             }
                             $columnHtml .= $names[1] . ' ';
                             $fieldValueHtml = $postActForBbs->getThreadFieldValueHtml($field['type'], $rt[$field['fieldname']], $field['rules'], $field['fieldname']);
                             $columnHtml .= $fieldValueHtml;
                             $columnHtml .= $names[2];
                             $columnHtml = trim($columnHtml);
                         }
                         $i++;
                     }
                     $threaddb[$rt['tid']]['topic'][$key] = $columnHtml ? $columnHtml : '';
                 }
             }
         }
     }
     if ($replyReward) {
         $replyRewardService = L::loadClass('ReplyReward', 'forum');
         /* @var $replyRewardService PW_ReplyReward */
         $replyRewardInfos = $replyRewardService->getRewardByTids($replyReward);
         foreach ($replyRewardInfos as $value) {
             $threaddb[$value['tid']]['replyrewardtip'] = '[回帖奖励' . intval($value['creditnum'] * $value['lefttimes']) . ']';
         }
     }
     if ($updatetop) {
         require_once R_P . 'require/updateforum.php';
         updatetop();
     }
     return $threaddb;
 }
コード例 #12
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();
     }
 }
コード例 #13
0
ファイル: class_Thread.php プロジェクト: jechiy/PHPWind
 function downTopped($tid)
 {
     //取消置顶帖
     $tid = $this->db->get_value('SELECT tid FROM pw_threads WHERE tid=' . S::sqlEscape($tid));
     if (!$tid) {
         return new ApiResponse(false);
     }
     //$this->db->update('UPDATE pw_threads SET topped=0 WHERE tid='.S::sqlEscape($tid));
     pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('topped' => 0));
     require_once R_P . 'require/updateforum.php';
     updatetop();
     return new ApiResponse(true);
 }