function PwForum($fid) { $this->fid = $fid; $this->db =& $GLOBALS['db']; $this->foruminfo = L::forum($fid); $this->name = $this->foruminfo['name']; $this->forumset = $this->foruminfo['forumset']; $this->creditset = $this->foruminfo['creditset']; }
function get($fid) { if (!$fid) { return array(); } $info = L::forum($fid); if (!$info && ($info = $this->getFromDB($fid))) { $info['creditset'] = unserialize($info['creditset']); $info['forumset'] = unserialize($info['forumset']); $info['commend'] = unserialize($info['commend']); } return $info; }
/** * * 设置版块 * @param mixed $forum (int fid|array foruminfo) */ function setForum($forum) { if (!S::isArray($forum)) { $forum = intval($forum); if ($forum < 1) { return false; } $foruminfo = L::forum($forum); if (!S::isArray($foruminfo)) { return false; } $forum = $foruminfo; } $forum && ($this->foruminfo = $forum); return true; }
} else { $sTid = (int) $tid; } $sql = "SELECT pf.id,pf.tid,pt.fid,pt.subject,pt.author,pt.authorid FROM pw_filter AS pf " . "LEFT JOIN pw_threads AS pt ON pf.tid=pt.tid WHERE pf.tid IN (" . $sTid . ") AND pf.pid=0"; $query = $db->query($sql); $objid = array(); $threadsid = array(); require_once R_P . 'require/credit.php'; $creditOpKey = "Delete"; $forumInfos = array(); while ($rt = $db->fetch_array($query)) { $fids[$rt['fid']][] = $rt['tid']; $objid[] = $rt['id']; $threadsid[] = $rt['tid']; if (!isset($forumInfos[$rt['fid']])) { $forumInfos[$rt['fid']] = L::forum($rt['fid']); } $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); M::sendNotice(array($rt['author']), array('title' => getLangInfo('writemsg', 'filtermsg_thread_del_title'), 'content' => getLangInfo('writemsg', 'filtermsg_thread_del_content', array('subject' => $rt['subject'])))); } $filter_id = implode(',', $objid); $credit->runsql(); $delarticle->delTopicByTids($threadsid, $db_recycle); //更改审核状态,更新审核人员信息 $sql = "UPDATE pw_filter SET state=2,assessor=" . S::sqlEscape($admin_name) . ",updated_at=" . S::sqlEscape($timestamp) . " WHERE id IN (" . $filter_id . ")"; $db->update($sql); //重定向 adminmsg('operate_success', "{$basename}" . "&action=check");
$db->update("UPDATE pw_threads SET replies=replies+" . pwEscape($value) . ",lastpost=" . pwEscape($rt['postdate'], false) . ",lastposter =" . pwEscape($rt['author'], false) . "WHERE tid=" . pwEscape($key)); # memcache refresh $threadList = L::loadClass("threadlist"); $threadList->updateThreadIdsByForumId($fid, $tid); } $db->update("UPDATE {$pw_posts} SET ifcheck='1' WHERE pid IN({$pids}) AND fid='{$fid}'"); require_once R_P . 'require/updateforum.php'; updateforum($fid); refreshto("forumcp.php?action=edit&type={$type}&fid={$fid}", 'operate_success'); } else { PostCheck(); InitGP(array('selid', 'ptable')); require_once R_P . 'require/credit.php'; require_once R_P . 'require/msg.php'; $creditOpKey = "Deleterp"; $foruminfo = L::forum($fid); $creditset = $credit->creditset($foruminfo['creditset'], $db_creditset); $tids = ''; $_tids = $_pids = $deluids = array(); foreach ($selid as $key => $value) { is_numeric($value) && ($tids .= ($tids ? ',' : '') . $value); } !$tids && Showmsg('id_error'); $msg_delrvrc = abs($creditset['Deleterp']['rvrc']); $msg_delmoney = abs($creditset['Deleterp']['money']); $pw_posts = GetPtable($ptable); $query = $db->query("SELECT tid,pid,fid,aid,author,authorid,postdate,subject,content FROM {$pw_posts} WHERE fid='{$fid}' AND pid IN({$tids})"); while ($rt = $db->fetch_array($query)) { $rt['fid'] != $fid && Showmsg('admin_forum_right'); $deluids[$rt['authorid']] = isset($deluids[$rt['authorid']]) ? $deluids[$rt['authorid']] + 1 : 1; //积分操作
function getForumInfo($fid, $key = null) { $forum = L::forum($fid); return $key ? $forum[$key] : $forum; }
function _getForum($fid) { if (!$fid) { return array(); } static $forums = array(); if (!$forums[$fid]) { $forums[$fid] = L::forum($fid); } return $forums[$fid]; }
/** * 组装帖子数据 * @param $result * @return unknown_type */ function _buildThreads($threads, $keywords) { if (!$threads) { return false; } $keywords = is_array($keywords) ? $keywords : explode(" ", $keywords); $data = array(); require_once R_P . 'require/bbscode.php'; foreach ($threads as $t) { $t['postdate'] = get_date($t['postdate'], "Y-m-d H:i"); $forum = L::forum($t['fid']); $t['content'] = substrs(stripWindCode(strip_tags(convert($t['content'], array()))), 170); foreach ($keywords as $keyword) { $keyword = stripslashes($keyword); $keyword && ($t['subject'] = $this->_highlighting($keyword, $t['subject'])); $keyword && ($t['content'] = $this->_highlighting($keyword, $t['content'])); } $t['subject'] = $t['subject'] ? $t['subject'] : 'RE:'; $t['name'] = strip_tags($forum['name']); $data[] = $t; } return $this->_buildThreadsAttachs($data); }
if ($prep < 1) { $prep = $total; } $rt['subject'] = str_replace(' ', '', wap_cv($rt['subject'])); $ht = viewOneReply($tid, $pid, $rt['ptable']); $nextr = nextReply($tid, $pid, $rt['ptable'], 1); $prer = nextReply($tid, $pid, $rt['ptable'], -1); } else { wap_msg('illegal_tid'); } } elseif ($action == 'modify') { InitGP(array('step'), 'GP', 2); $pw_tmsgs = GetTtable($tid); $rt = $db->get_one("SELECT t.fid,t.tid,t.subject,t.author,t.authorid,t.replies,t.locked,t.postdate,t.anonymous,t.ptable,tm.content FROM pw_threads t LEFT JOIN {$pw_tmsgs} tm ON tm.tid=t.tid WHERE t.tid=" . pwEscape($tid) . " AND ifcheck=1"); //读取板块信息 if (!($foruminfo = L::forum($rt[fid]))) { wap_msg('data_error'); } $isBM = admincheck($foruminfo['forumadmin'], $foruminfo['fupadmin'], $windid); //获得管理权限 $pw_posts = GetPtable($rt['ptable']); $reply = $db->get_one("SELECT * FROM {$pw_posts} WHERE pid = " . pwEscape($pid)); $editright = $isGM || pwRights($isBM, 'deltpcs') || $reply['authorid'] == $winduid; !$editright && wap_msg('您没有权限编辑此回复', 'index.php?a=reply&tid=' . $tid . '&pid=' . $pid); if (empty($step)) { $reply['content'] = str_replace(array('<', '>', ' '), array('<', '>', ' '), $reply['content']); } elseif ($step == 2) { InitGP(array('content'), 'GP'); $pw_posts = GetPtable('N', $tid); $db->update("UPDATE {$pw_posts} SET content = " . pwEscape(wap_cv($content)) . " WHERE pid = " . pwEscape($pid)); wap_msg('operate_success', 'index.php?a=reply&tid=' . $tid . '&pid=' . $pid);
/** * * 过滤未开启图酷版块 * @param string $fid * @return string */ function filterForums($fid) { $tmpfids = $this->_cookFid($fid); $fids = array(); if ($tmpfids && !S::isArray($tmpfids)) { return $tmpfids; } foreach ((array) $tmpfids as $v) { $foruminfo = L::forum($v); if (isset($foruminfo['forumset']['iftucool']) && !$foruminfo['forumset']['iftucool']) { continue; } $fids[] = $v; } return S::sqlImplode($fids); }
$per['maxmsg'] = (int) $gRight['maxmsg']; $per['signnum'] = (int) $gRight['signnum']; $per['allownum'] = (int) $gRight['allownum']; $per['maxfavor'] = (int) $gRight['maxfavor']; $per['maxgraft'] = !$gRight['maxgraft'] ? 0 : $gRight['maxgraft']; $per['uploadmaxsize'] = ceil(($gRight['uploadmaxsize'] ? $gRight['uploadmaxsize'] : $db_uploadmaxsize) / 1024); !$gRight['uploadtype'] && ($gRight['uploadtype'] = $db_uploadfiletype); $gRight['uploadtype'] = unserialize($gRight['uploadtype']); $per['uptype'] = ''; foreach ($gRight['uploadtype'] as $key => $value) { $per['uptype'] .= ($per['uptype'] ? ', ' : '') . "{$key}:{$value}"; } unset($creditdb, $groups, $value, $ltitle, $gRight); } else { require_once R_P . 'require/forum.php'; if (!($rt = L::forum($fid))) { Showmsg('data_error'); } (!$rt || $rt['type'] == 'category') && Showmsg('data_error'); wind_forumcheck($rt); $forumset = $rt['forumset']; $forumset['link'] && Showmsg('data_error'); $per = $forumright = array(); $creditset = $credit->creditset($rt['creditset'], $db_creditset); foreach ($creditset as $key => $value) { foreach ($value as $k => $v) { $forumright[$k][$key] = (int) $v; } } $per['upload'] = $per['down'] = $per['rp'] = $per['post'] = $per['visit'] = 1; $per['name'] = strip_tags($rt['name']);
/** * 解封某个用户 * * @param int $uid 用户id * @param array $params * ifmsg 是否发送消息 1-是,0-否 * reason 操作原因 * fid 版块ID * tid */ function banfree($uid, $params = array()) { $uid = intval($uid); $tid = intval($params['tid']); $pid = intval($params['pid']); $ifmsg = intval($params['ifmsg']); $reason = $params['reason']; $banuserDb = $this->_getBanUserDB(); $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userinfo = $userService->get($uid); if (!$userinfo) { return 'undefined_action'; } $GLOBALS['username'] = $userinfo['username']; if ($banuserDb->deleteByUserId($uid)) { //解除禁言 $userService->setUserStatus($uid, PW_USERSTATUS_BANUSER, false); //* $userinfo['groupid'] == 6 && $this->db->update("UPDATE `pw_members` SET groupid='-1' WHERE `uid`=".S::sqlEscape($uid)); $userinfo['groupid'] == 6 && pwQuery::update('pw_members', 'uid=:uid', array($uid), array('groupid' => -1)); $ifmsg && M::sendNotice(array($userinfo['username']), array('title' => getLangInfo('writemsg', 'banuser_free_title'), 'content' => getLangInfo('writemsg', 'banuser_free_content', array('reason' => stripslashes($reason), 'manager' => $GLOBALS['windid'])))); /*如果是版块禁言,获取帖子信息*/ if ($tid > 0) { $postInfo = $this->getPostInfo($tid, $pid); if ($postInfo === false) { return 'banuser_post_data_error'; } $fid = $postInfo['fid']; $userip = $postInfo['userip']; //解除禁止的IP/ require_once R_P . 'admin/cache.php'; $ipban = $this->db->get_one("SELECT db_value FROM pw_config WHERE db_name='db_ipban'"); $bannedIps = explode(',', $ipban['db_value']); if (in_array($userip, $bannedIps)) { $bannedIps = array_filter(str_replace($userip, '', $bannedIps)); setConfig('db_ipban', implode(',', $bannedIps)); updatecache_c(); } $fid && ($foruminfo = L::forum($fid)); if ($foruminfo) { //omit write log if ($foruminfo['allowhtm']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($tid); } } } $this->clearUserCache($uid); } else { //未被禁言 return 'banuser_notfound'; } return true; }
S::gp(array('tid', 'pids')); if (empty($tid) || empty($pids)) { echo 'fail'; ajax_footer(); } $pidArr = array_unique(explode(',', $pids)); $readdb = $_pids = array(); //* $threadService = L::loadClass('threads', 'forum'); //* $read = $threadService->getThreads($tid, in_array('tpc', $pidArr)); $_cacheService = Perf::gatherCache('pw_threads'); $read = in_array('tpc', $pidArr) ? $_cacheService->getThreadAndTmsgByThreadId($tid) : $_cacheService->getThreadByThreadId($tid); if (empty($read)) { echo 'fail'; ajax_footer(); } if (!($foruminfo = L::forum($read['fid']))) { echo 'fail'; ajax_footer(); } extract(L::style()); $ptable = $read['ptable']; $forumset = $foruminfo['forumset']; list(, , $downloadmoney, $downloadimg) = explode("\t", $forumset['uploadset']); $isGM = S::inArray($windid, $manager); $isBM = admincheck($foruminfo['forumadmin'], $foruminfo['fupadmin'], $windid); $admincheck = $isGM || $isBM ? 1 : 0; if (!$isGM) { #非创始人权限获取 $pwSystem = pwRights($isBM); if ($pwSystem && ($pwSystem['tpccheck'] || $pwSystem['digestadmin'] || $pwSystem['lockadmin'] || $pwSystem['pushadmin'] || $pwSystem['coloradmin'] || $pwSystem['downadmin'] || $pwSystem['delatc'] || $pwSystem['moveatc'] || $pwSystem['copyatc'] || $pwSystem['topped'] || $pwSystem['unite'] || $pwSystem['pingcp'] || $pwSystem['areapush'])) { $managecheck = 1;
/** * 获取主题的主题分类名称及url * @param $type * @param $fid * @return array */ function getTopicType($type, $fid) { $foruminfo = L::forum($fid); $topic_type = isset($foruminfo['topictype'][$type]) ? $foruminfo['topictype'][$type] : array(); return $topic_type ? array($topic_type['name'], getForumUrl($fid) . '&type=' . $type) : array('', ''); }
function finish_doPost($factor) { $forum = L::forum($factor['fid']); $title = '<a target="_blank" href="thread.php?fid=' . $forum['fid'] . '">' . $forum['name'] . '</a>'; return '在 【' . $title . '】 版块发 ' . $factor['num'] . ' 个帖子即可完成任务 ' . $this->getLimitTime($factor); }
$tidarray = array($seltid); } if (empty($tidarray)) { Showmsg('no_selected_topic'); } //验证帖子的合法性(是否是本群的帖子,是否越权操作) $threaddb = $newColony->checkTopic($tidarray); empty($threaddb) && Showmsg('data_error'); $selids = array_keys($threaddb); //站点创始人,后台赋予群组管理权限的用户组,群组等级到达后台配置的要求才能有管理权限 $ifTopicAdmin = $newColony->checkTopicAdmin($action, $seltid); //当用户删除自己的帖子 $ifOwnDelRight = $newColony->getOwnDelRight($action, $threaddb[$seltid]['authorid'], $seltid); !$ifTopicAdmin && !$ifOwnDelRight && Showmsg('colony_topicadmin'); //取关联版块的信息 $foruminfo = L::forum($colony['classid']); $tmpActionUrl = 'thread.php?cyid=' . $cyid; //SEO require_once R_P . 'apps/groups/lib/colonyseo.class.php'; $colonySeo = new Pw_ColonySEO($cyid); $webPageTitle = $colonySeo->getPageTitle($groupRight['modeset']['thread']['title'], $colony['cname']); $metaDescription = $colonySeo->getPageMetadescrip($colony['descrip']); $metaKeywords = $colonySeo->getPageMetakeyword($colony['cname']); if (empty($_POST['step'])) { //操作标题 $lang_action = array('del' => '删除话题', 'highlight' => '话题标题加亮操作', 'lock' => '话题锁定操作', 'pushtopic' => '话题提前操作', 'downtopic' => '话题压帖操作', 'toptopic' => '话题置顶操作', 'digest' => '话题精华操作'); $reason_sel = ''; $reason_a = explode("\n", $db_adminreason); foreach ($reason_a as $k => $v) { if ($v = trim($v)) { $reason_sel .= "<option value=\"{$v}\">{$v}</option>";
//send message $forum = L::forum($payLog['fid']); sendKmdMessages($payLog['uid'], 'kmd_admin_paylog_checked_title', 'kmd_admin_paylog_checked_content', array(), array('forumname' => $forum['name'], 'fid' => $payLog['fid'], 'price' => $payLog['money'])); } } elseif ($operater == 2) { //未到帐 foreach ($payids as $v) { $payLog = $kmdService->getPayLogById($v); if (!S::isArray($payLog)) { continue; } //$kmdService->deletePayLogById($v); $fieldData = array('status' => KMD_PAY_STATUS_INVALID); $kmdService->updatePayLog($fieldData, $v); //send message $forum = L::forum($payLog['fid']); sendKmdMessages($payLog['uid'], 'kmd_admin_paylog_reject_title', 'kmd_admin_paylog_reject_content', array(), array('forumname' => $forum['name'], 'fid' => $payLog['fid'], 'price' => $payLog['money'])); } } adminmsg('operate_success'); } else { //购买记录列表 S::gp(array('username', 'starttime', 'endtime')); S::gp(array('fid', 'status'), 'gp', 2); $forumcache = getSelectedForumCache($fid); $params = array(); if ($username) { $userService = L::loadClass('userservice', 'user'); /* @var $userService PW_UserService */ $userInfo = $userService->getByUserName($username); $userInfo && ($params['uid'] = $userInfo['uid']);
$pw_posts = GetPtable($ptable); /*The app client*/ if ($db_siteappkey && ($db_apps_list['17']['status'] == 1 || is_array($db_threadconfig))) { $appclient = L::loadClass('appclient'); if ($db_apps_list['17']['status'] == 1) { $forumappinfo = array(); $forumappinfo = $appclient->showForumappinfo($fid, 'read', '17'); } if (is_array($db_threadconfig)) { $threadright = array(); $threadright = $appclient->getThreadRight(); } } /*The app client*/ //读取版块信息及权限判断 if (!($foruminfo = L::forum($fid))) { Showmsg('data_error'); } if (!S::inArray($windid, $manager)) { wind_forumcheck($foruminfo); } $forumset = $foruminfo['forumset']; if (!$foruminfo['allowvisit'] && $_G['allowread'] == 0 && $_COOKIE) { Showmsg('read_group_right'); } /**************************************/ $isTucool = $forumset['iftucool'] && getstatus($read['tpcstatus'], 5); if (is_array($customfield)) { foreach ($customfield as $key => $value) { if ($value['ifsys']) { continue;
/** * 根据发布时间获取版块图酷帖 * @param int $fid * @param int $startTime * @param int $endTime * return array */ function getTuCool($fid, $tucoolPic, $startTime, $endTime, $offset, $size = 10) { $startTime = intval($startTime); $endTime = intval($endTime); $offset = intval($offset); $fid = intval($fid); $tucoolPic = intval($tucoolPic); if (!$fid || !$startTime || !$endTime || $offset < 0 || !$tucoolPic) { return array(); } $foruminfo = L::forum($fid); if (!S::isArray($foruminfo)) { continue; } if (!$foruminfo['forumset']['iftucool'] || $foruminfo['forumset']['tucoolpic'] < 1) { continue; } $attachsDao = $this->getAttachsDao(); $tmpTids = $attachsDao->getImgs($fid, $tucoolPic, $startTime, $endTime, $offset, $size); return array_keys($tmpTids); }