function readForum($uid, $fid) { list($uid, $fid) = array(intval($uid), intval($fid)); if ($uid < 1 || $fid < 1) { return $this->buildResponse(PERMISSIONS_INVALID_PARAMS); } $userInfo = $GLOBALS['db']->get_one("SELECT m.uid,m.username,m.password,m.safecv,m.email,m.bday,m.oicq,m.groupid,m.memberid,m.groups,m.icon,m.regdate,m.honor,m.timedf, m.style,m.datefm,m.t_num,m.p_num,m.yz,m.newpm,m.userstatus,m.shortcut,m.medals,md.lastmsg,md.postnum,md.rvrc,md.money,md.credit,md.currency,md.lastvisit,md.thisvisit,md.onlinetime,md.lastpost,md.todaypost,md.monthpost,md.onlineip,md.uploadtime,md.uploadnum,md.starttime,md.pwdctime,md.monoltime,md.digests,md.f_num,md.creditpop,md.jobnum,md.lastgrab,md.follows,md.fans,md.newfans,md.newreferto,md.newcomment,md.postcheck FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid WHERE m.uid=" . S::sqlEscape($uid) . " AND m.groupid<>'0' AND md.uid IS NOT NULL"); if (!S::isArray($userInfo)) { return $this->buildResponse(PERMISSIONS_USER_NOT_EXISTS); } $groupId = $userInfo['groupid'] == -1 ? $userInfo['memberid'] : $userInfo['groupid']; L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); $code = !$pwforum->allowvisit($userInfo, $groupId) ? 500 : 0; return $this->buildResponse($code); }
/** * 是否有群管理权限 * return bool */ function getIfadmin() { global $windid, $SYSTEM, $manager, $groupid; /*关联版块权限*/ $rForumAdmin = false; if ($SYSTEM['forumcolonyright'] && $this->info['classid'] > 0) { if ($groupid == 5) { L::loadClass('forum', 'forum', false); $rForum = new PwForum($this->info['classid']); $rForumAdmin = $rForum->isBM($windid); } else { $rForumAdmin = true; } } /* end */ return $rForumAdmin || $this->info['ifadmin'] == '1' || $this->info['admin'] == $windid || S::inArray($windid, $manager) || $SYSTEM['colonyright']; }
if (!$tidarray) { $tidarray = is_numeric($seltid) ? array($seltid) : explode(',',$seltid); } */ $action == "delall" && deleteThreadsHander($tidarray); //搜索删除操作 if (!in_array($action, array('type', 'check', 'del', 'move', 'copy', 'headtopic', 'digest', 'lock', 'pushtopic', 'downtopic', 'edit', 'unite', 'push', 'overprint', 'batch', 'banuser', 'commend', 'multioverprint')) || empty($fid) || empty($tidarray)) { Showmsg('undefined_action'); } L::loadClass('forum', 'forum', false); require_once R_P . 'require/updateforum.php'; require_once R_P . 'require/writelog.php'; //* include_once pwCache::getPath(D_P . 'data/bbscache/forum_cache.php'); pwCache::getData(D_P . 'data/bbscache/forum_cache.php'); L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { Showmsg('data_error'); } $pwforum->forumcheck($winddb, $groupid); $foruminfo =& $pwforum->foruminfo; $forumset =& $pwforum->forumset; $isGM = S::inArray($windid, $manager); $isBM = $pwforum->isBM($windid); if (!$isGM) { switch ($action) { case 'type': $admincheck = pwRights($isBM, 'tpctype'); break; case 'del': $admincheck = pwRights($isBM, 'delatc');
function _checkForum() { $this->tid = $this->attach['tid']; $thread = $this->_db->get_one("SELECT fid,tpcstatus,ifcheck FROM pw_threads WHERE tid=" . S::sqlEscape($this->tid, false)); if (getstatus($thread['tpcstatus'], 1) && !$thread['fid'] && $thread['ifcheck'] == '2') { return true; } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($thread['fid']); if (!$pwforum->isForum()) { return 'forum_purview_erro'; //读取数据错误,原因:您要访问的链接无效,可能链接不完整,或数据已被删除! } if ($pwforum->foruminfo['f_type'] == 'former' && $this->groupid == 'guest' && $_COOKIE) { return 'forum_purview_erro'; //本版块为正规版块,只有注册会员才能进入! } if (!empty($pwforum->foruminfo['style']) && file_exists(D_P . "data/style/{$pwforum->foruminfo[style]}.php")) { $GLOBALS['skin'] = $pwforum->foruminfo['style']; } $pwdcheck = GetCookie('pwdcheck'); if ($pwforum->foruminfo['password'] != '' && ($groupid == 'guest' || $pwdcheck[$pwforum->fid] != $pwforum->foruminfo['password'] && !S::inArray($this->user['username'], $GLOBALS['manager']))) { require_once R_P . 'require/forumpw.php'; } if (!$pwforum->allowvisit($this->user, $this->groupid)) { return 'forum_purview_erro'; //对不起,本版块为认证版块,您没有权限查看此版块的内容! } if (!$pwforum->foruminfo['cms'] && $pwforum->foruminfo['f_type'] == 'hidden' && !$pwforum->foruminfo['allowvisit']) { return 'forum_purview_erro'; //本版块为隐藏版块,您无权进入! } $this->foruminfo =& $pwforum->foruminfo; $this->admincheck = $this->groupid == '3' || $pwforum->isBM($this->username) ? 1 : 0; if (!$this->admincheck && !$pwforum->allowdownload($this->user, $this->groupid)) { //版块权限判断 return 'forum_purview_erro'; //对不起,本版块只有特定用户可以下载附件,请返回 } if (!$this->foruminfo['allowdownload'] && $this->_G['allowdownload'] == 0 && !$this->admincheck) { //用户组权限判断 return 'forum_purview_erro'; //用户组权限:你所属的用户组没有下载附件的权限 } return true; }
$add = $value['type'] == 'forum' ? ">" : ($forum[$value['fup']]['type'] == 'forum' ? ">>" : ">>>"); $value['name'] = wap_cv(strip_tags($value['name'])); $cates .= "<option value=\"{$key}\">{$add}{$value['name']}</option>\n"; } } $refer = "index.php?a=post&action=new&tmp={$timestamp}"; } else { $forumName = wap_cv(strip_tags($forum[$fid]['name'])); $refer = "index.php?a=post&action=new&fid={$fid}&tmp={$timestamp}"; } $showpost = 1; } else { if (!is_numeric($fid)) { wap_msg("post_nofid", $basename); } !$pwforum && ($pwforum = new PwForum($fid)); !$pwpost && ($pwpost = new PwPost($pwforum)); $pwpost->errMode = true; $pwpost->forumcheck(); !empty($pwpost->errMsg) && wap_msg($pwpost->errMsg, $basename); $pwpost->postcheck(); !empty($pwpost->errMsg) && wap_msg($pwpost->errMsg, $basename); list($uploadcredit, $uploadmoney, , ) = explode("\t", $pwforum->forumset['uploadset']); if (!$pwpost->admincheck && !$pwforum->allowpost($pwpost->user, $pwpost->groupid)) { wap_msg('postnew_forum_right', 'index.php?a=post&fid=0'); } if (!$pwforum->foruminfo['allowpost'] && !$pwpost->admincheck && $_G['allowpost'] == 0) { wap_msg('postnew_group_right', 'index.php?a=post&fid=0'); } InitGP(array('subject', 'content'), 'P', 0); $refer = "index.php?a=post&action=new&fid={$fid}&tmp={$timestamp}";
function isEditAttachRight($aid, $tid) { global $isGM, $winduid; $aid = intval($aid); $tid = intval($tid); if ($aid < 1 || $tid < 1) { return false; } $threadsService = L::loadClass('threads', 'forum'); $read = $threadsService->getByThreadId($tid); if (!$read) { return false; } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($read['fid']); if (!$pwforum->isForum()) { return false; } $isBM = $pwforum->isBM($windid); return $isGM || $isBM || $read['authorid'] == $winduid ? true : false; }
<?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();
function postModify($tid, $fid, $uid, $title, $content, $tags = '', $convert = 1, $usesign = 1, $usehtml = 0, $topped = 0, $digest = 0, $p_type = '', $p_sub_type = '') { global $winddb, $winduid, $windid, $groupid, $_G, $SYSTEM, $timestamp; require_once R_P . 'lib/forum.class.php'; $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { return new ErrorMsg(API_THREAD_FORUM_NOT_EXISTS, 'Forum not exists'); } $winddb = $this->db->get_one("SELECT m.uid,m.username,m.password,m.safecv,m.email,m.oicq,m.groupid,m.memberid,m.groups,m.icon,m.regdate,m.honor,m.timedf,m.style,m.datefm,m.t_num,m.p_num,m.yz,m.newpm,m.userstatus,m.shortcut,md.postnum,md.rvrc,md.money,md.credit,md.currency,md.lastvisit,md.thisvisit,md.onlinetime,md.lastpost,md.todaypost,md.monthpost,md.onlineip,md.uploadtime,md.uploadnum,md.starttime,md.pwdctime,md.monoltime,md.digests,md.f_num,md.creditpop FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid WHERE m.uid=" . pwEscape($uid)); if (empty($winddb)) { return new ErrorMsg(API_THREAD_AUTHOR_NOT_EXISTS, 'User not exists'); } $winduid = $winddb['uid']; $groupid = $winddb['groupid']; $windid = $winddb['username']; $groupid == '-1' && ($groupid = $winddb['memberid']); if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) { include Pcv(D_P . "data/groupdb/group_{$groupid}.php"); } else { include D_P . 'data/groupdb/group_1.php'; } require_once R_P . 'lib/post.class.php'; require_once R_P . 'require/bbscode.php'; $pwpost = new PwPost($pwforum); $pwpost->errMode = true; require_once R_P . 'lib/postmodify.class.php'; $postmodify = new topicModify($tid, 0, $pwpost); $atcdb = $postmodify->init(); if (empty($atcdb) || $atcdb['fid'] != $fid) { return new ErrorMsg(API_THREAD_ILLEGAL_TID, 'The tid is illegal'); } if ($winduid != $atcdb['authorid'] && $groupid != 3 && $groupid != 4) { $authordb = $this->db->get_one("SELECT groupid FROM pw_members WHERE uid=" . pwEscape($atcdb['authorid'])); if ($authordb['groupid'] == 3 || $authordb['groupid'] == 4) { return new ErrorMsg(API_THREAD_MODIFY_ADMIN, 'The tid is not modify'); } } if ($_G['edittime'] && $timestamp - $atcdb['postdate'] > $_G['edittime'] * 60) { return new ErrorMsg(API_THREAD_MODIFY_TIMELIMIT, 'The modify time limit'); } $postdata = new topicPostData($pwpost); include_once D_P . 'data/bbscache/cache_post.php'; $t_db = $topic_type_cache[$fid]; $postdata->setWtype($p_type, $p_sub_type, 0, $t_db); $postdata->initData($postmodify); $postdata->setTitle($title); $postdata->setContent($content); $postdata->setConvert($convert, 1); $postdata->setTags($tags); $postdata->setDigest($digest); $postdata->setTopped($topped); $postdata->setIfsign($usesign, $usehtml); if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) { $errmsg = $this->getErrMsg($msg); return new ErrorMsg($errmsg[0], $errmsg[1]); } $postmodify->execute($postdata); return new ApiResponse(true); }
function sendPost($tid, $uid, $title, $content) { global $winddb, $winduid, $windid, $groupid, $fid, $timestamp, $pwforum, $pwpost, $_G, $db_uploadfiletype, $uploadcredit, $uploadmoney, $manager, $isBM, $_time; $timestamp = time(); $_time = array('hours' => get_date($timestamp, 'G'), 'day' => get_date($timestamp, 'j'), 'week' => get_date($timestamp, 'w')); list($uid, $tid, $title, $content) = array(intval($uid), intval($tid), trim($title), trim($content)); if ($uid < 1 || $tid < 1 || !$content) { return $this->buildResponse(THREAD_INVALID_PARAMS); } ACloud_Sys_Core_Common::setGlobal('customized_current_uid', $uid); $user = $this->getCurrentUser(); if (!$user->isLogin()) { return $this->buildResponse(USER_NOT_LOGIN); } if ($user->groupid == 6 || getstatus($user->info['userstatus'], PW_USERSTATUS_BANUSER)) { return $this->buildResponse(THREAD_USER_NOT_RIGHT); } $user->initRight(); $winduid = $user->uid; $groupid = $user->groupid; $windid = $user->username; $winddb = $user->info; $_G = $user->_G; if ($_G['postlimit'] && $winddb['todaypost'] >= $_G['postlimit']) { return $this->buildResponse(POST_GP_LIMIT); } $tpcarray = $GLOBALS['db']->get_one("SELECT t.tid,t.fid,t.locked,t.ifcheck,t.author,t.authorid,t.postdate,t.lastpost,t.ifmail,t.special,t.subject,t.type,t.ifshield,t.anonymous,t.ptable,t.replies,t.tpcstatus FROM pw_threads t WHERE t.tid=" . pwEscape($tid)); L::loadClass('forum', 'forum', false); $pwforum = new PwForum($tpcarray['fid']); if (!$pwforum->isForum()) { return $this->buildResponse(THREAD_FORUM_NOT_EXIST); } $fid = $tpcarray['fid']; $isBM = $pwforum->isBM($windid); $isGM = S::inArray($windid, $manager); if (!$isGM && $tpcarray['locked'] % 3 != 0 && !pwRights($isBM, 'replylock')) { return $this->buildResponse(THREAD_LOCKED); } L::loadClass('post', 'forum', false); require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.bbscode.php'; $pwpost = new PwPost($pwforum); $pwpost->errMode = true; $pwpost->forumcheck(); $pwpost->postcheck(); L::loadClass('replypost', 'forum', false); $replypost = new replyPost($pwpost); $replypost->setTpc($tpcarray); $replypost->check(); $pw_posts = GetPtable($replypost->tpcArr['ptable']); $postdata = new replyPostData($pwpost); $postdata->setTitle($title); $postdata->setContent($content); $postdata->conentCheck(); if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) { return $this->buildResponse(THREAD_SYSTEM_ERROR, $msg); } require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.attupload.php'; if (PwUpload::getUploadNum()) { $_G['uploadtype'] && ($db_uploadfiletype = $_G['uploadtype']); $db_uploadfiletype = !empty($db_uploadfiletype) ? is_array($db_uploadfiletype) ? $db_uploadfiletype : unserialize($db_uploadfiletype) : array(); $postdata->att = new AttUpload($user->uid); $return = $postdata->att->check(); if ($return) { $msginfo = getLangInfo('msg', $return); return $this->errMessage(THREAD_USER_NOT_RIGHT, $msginfo); } list($windVersion) = explode(',', WIND_VERSION); if ($windVersion && $windVersion < '8.5') { $postdata->att->transfer(); PwUpload::upload($postdata->att); } } $replypost->execute($postdata); $pid = $replypost->getNewId(); return $this->buildResponse(0, array('pid' => $pid)); }
} if ($winduid != $atcdb['authorid']) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $authordb = $userService->get($atcdb['authorid']); /**Begin modify by liaohu*/ $pce_arr = explode(",", $GLOBALS['SYSTEM']['tcanedit']); if (($authordb['groupid'] == 3 || $authordb['groupid'] == 4 || $authordb['groupid'] == 5) && !in_array($authordb['groupid'], $pce_arr)) { Showmsg('modify_admin'); } /**End modify by liaohu*/ } //版块编辑时间限制 global $postedittime; L::loadClass('forum', 'forum', false); $pwforum = new PwForum($atcdb['fid']); $isBM = $pwforum->isBM($windid); $userSystemRight = userSystemRight($windid, $isBM, 'deltpcs'); $postedittime = $pwforum->foruminfo['forumset']['postedittime']; if (!$userSystemRight && $winduid == $atcdb['authorid'] && $postedittime !== "" && $postedittime != 0 && $timestamp - $atcdb['postdate'] > $postedittime * 60) { Showmsg('modify_forumtimelimit'); } if ($winduid == $atcdb['authorid'] && $_G['edittime'] && $timestamp - $atcdb['postdate'] > $_G['edittime'] * 60) { Showmsg('modify_timelimit'); } if ($atcdb['specialsort'] == PW_THREADSPECIALSORT_KMD && $postmodify->type == 'topic' && $winduid == $atcdb['authorid']) { $kmdService = L::loadClass('KmdService', 'forum'); $kmdInfo = $kmdService->getKmdInfoByTid($tid); $isKmd = 1; } if (empty($_POST['step'])) {
function _checkForum() { $this->tid = $this->attach['tid']; $thread = $this->_db->get_one("SELECT fid,tpcstatus,ifcheck FROM pw_threads WHERE tid=" . S::sqlEscape($this->tid, false)); if (getstatus($thread['tpcstatus'], 1) && !$thread['fid'] && $thread['ifcheck'] == '2') { return true; } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($thread['fid']); if (!$pwforum->isForum()) { return 'data_error'; } $pwforum->forumcheck($this->user, $this->groupid); $this->foruminfo =& $pwforum->foruminfo; $this->admincheck = $this->groupid == '3' || $pwforum->isBM($this->username) ? 1 : 0; $forumset = $this->foruminfo['forumset']; list($this->uploadcredit, , $this->downloadmoney, ) = explode("\t", $forumset['uploadset']); if (!$this->admincheck && !$pwforum->allowdownload($this->user, $this->groupid)) { //版块权限判断 return 'job_attach_forum'; } if ($this->groupid == 'guest' && $this->_G['allowdownload'] == 0) { return 'download_not_login'; } if (!$this->foruminfo['allowdownload'] && $this->_G['allowdownload'] == 0 && !$this->admincheck) { //用户组权限判断 return 'job_attach_group'; } return true; }
$colony['descrip'] = convert($colony['descrip'], array()); $annouce = convert(nl2br($colony['annouce']), $db_windpost); $colonyNums = PwColony::calculateCredit($colony); $magdb = $newColony->getManager(); } $viewcolony = $cyid ? "cyid={$cyid}" : "fid={$fid}"; //读取版块信息 empty($fid) && Showmsg('data_error'); /*The app client*/ if ($db_siteappkey && $db_apps_list['17']['status'] == 1) { $forumappinfo = array(); $appclient = L::loadClass('appclient'); $forumappinfo = $appclient->showForumappinfo($fid, 'thread', '17'); } /*The app client*/ $pwforum = new PwForum($fid); if (!$pwforum->isForum(true)) { Showmsg('data_error'); } $foruminfo =& $pwforum->foruminfo; $forumset =& $pwforum->forumset; if (Perf::checkMemcache()) { $_cacheService = Perf::getCacheService(); $rt = $_cacheService->get('forumdata_announce_' . $fid); } if (!Perf::checkMemcache() || !$rt) { $rt = $db->get_one("SELECT fd.tpost,fd.topic,fd.article,fd.subtopic,fd.top1,fd.top2,fd.topthreads,fd.lastpost,fd.aid,fd.aids,fd.aidcache,a.ifconvert,a.author,a.startdate,a.enddate,a.subject,a.content FROM pw_forumdata fd LEFT JOIN pw_announce a ON fd.aid=a.aid WHERE fd.fid=" . S::sqlEscape($fid)); Perf::checkMemcache() && $_cacheService->set('forumdata_announce_' . $fid, $rt, 300); } $rt && ($foruminfo += $rt); #版块信息合并
function postModify($tid, $fid, $uid, $title, $content, $tags = '', $convert = 1, $usesign = 1, $usehtml = 0, $topped = 0, $digest = 0, $p_type = '', $p_sub_type = '') { global $winddb, $winduid, $windid, $groupid, $_G, $SYSTEM, $timestamp; L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { return new ErrorMsg(API_THREAD_FORUM_NOT_EXISTS, 'Forum not exists'); } $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $winddb = $userService->get($uid, true, true); if (empty($winddb)) { return new ErrorMsg(API_THREAD_AUTHOR_NOT_EXISTS, 'User not exists'); } $winduid = $winddb['uid']; $groupid = $winddb['groupid']; $windid = $winddb['username']; $groupid == '-1' && ($groupid = $winddb['memberid']); if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) { //* include pwCache::getPath(S::escapePath(D_P."data/groupdb/group_$groupid.php")); extract(pwCache::getData(S::escapePath(D_P . "data/groupdb/group_{$groupid}.php", false))); } else { //* include pwCache::getPath(D_P.'data/groupdb/group_1.php'); extract(pwCache::getData(D_P . 'data/groupdb/group_1.php', false)); } L::loadClass('post', 'forum', false); require_once R_P . 'require/bbscode.php'; $pwpost = new PwPost($pwforum); $pwpost->errMode = true; L::loadClass('postmodify', 'forum', false); $postmodify = new topicModify($tid, 0, $pwpost); $atcdb = $postmodify->init(); if (empty($atcdb) || $atcdb['fid'] != $fid) { return new ErrorMsg(API_THREAD_ILLEGAL_TID, 'The tid is illegal'); } if ($winduid != $atcdb['authorid'] && $groupid != 3 && $groupid != 4) { $authordb = $userService->get($atcdb['authorid']); /**Begin modify by liaohu*/ $pce_arr = explode(",", $GLOBALS['SYSTEM']['tcanedit']); if (($authordb['groupid'] == 3 || $authordb['groupid'] == 4 || $authordb['groupid'] == 5) && !in_array($authordb['groupid'], $pce_arr)) { return new ErrorMsg(API_THREAD_MODIFY_ADMIN, 'The tid is not modify'); } /*if (($authordb['groupid'] == 3 || $authordb['groupid'] == 4)) { return new ErrorMsg(API_THREAD_MODIFY_ADMIN, 'The tid is not modify'); }*/ /**End modify by liaohu*/ } if ($_G['edittime'] && $timestamp - $atcdb['postdate'] > $_G['edittime'] * 60) { return new ErrorMsg(API_THREAD_MODIFY_TIMELIMIT, 'The modify time limit'); } $postdata = new topicPostData($pwpost); //* include_once pwCache::getPath(D_P.'data/bbscache/cache_post.php'); extract(pwCache::getData(D_P . 'data/bbscache/cache_post.php', false)); $t_db = $topic_type_cache[$fid]; $postdata->setWtype($p_type, $p_sub_type, 0, $t_db); $postdata->initData($postmodify); $postdata->setTitle($title); $postdata->setContent($content); $postdata->setConvert($convert, 1); $postdata->setTags($tags); $postdata->setDigest($digest); $postdata->setTopped($topped); $postdata->setIfsign($usesign, $usehtml); if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) { $errmsg = $this->getErrMsg($msg); return new ErrorMsg($errmsg[0], $errmsg[1]); } $postmodify->execute($postdata); return new ApiResponse(true); }
function checkReplyRight($tid) { global $isGM, $winddb, $isBM, $timestamp; $threadService = L::loadClass('threads', 'forum'); L::loadClass('forum', 'forum', false); $read = $threadService->getByThreadId($tid); $pwforum = new PwForum($read['fid']); $forumset =& $pwforum->forumset; $tpc_locked = $read['locked'] % 3 != 0 ? 1 : 0; $admincheck = $isGM || $isBM ? 1 : 0; if (getstatus($read['tpcstatus'], 7)) { $robbuildService = L::loadClass('RobBuild', 'forum'); /* @var $robbuildService PW_RobBuild */ $robbuild = $robbuildService->getByTid($tid); if ($robbuild['starttime'] > $timestamp) { return false; } } $isAuthStatus = $admincheck || (!$forumset['auth_allowrp'] || $pwforum->authStatus($winddb['userstatus'], $forumset['auth_logicalmethod']) === true); if ($isAuthStatus && (!$tpc_locked || $SYSTEM['replylock']) && ($admincheck || $pwforum->allowreply($winddb, $groupid))) { return true; } return false; }
<?php !defined('P_W') && exit('Forbidden'); S::gp(array('tid', 'fid', 'article', 'pid'), 'GP', 2); if ($tid < 1 || $fid < 1) { quickPostMessage('undefined_action'); } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { quickPostMessage('data_error'); } list($isGM, $isBM, $forumset, $foruminfo) = array(S::inArray($windid, $manager), $pwforum->isBM($windid), $pwforum->forumset, $pwforum->foruminfo); $cacheService = Perf::gatherCache('pw_threads'); $read = $cacheService->getThreadAndTmsgByThreadId($tid); if (!$read) { quickPostMessage('illegal_tid'); } list($tpc_locked, $admincheck) = array($read['locked'] % 3 != 0 ? 1 : 0, $isGM || $isBM ? 1 : 0); //实名认证权限 if ($db_authstate && !$admincheck && $forumset['auth_allowrp'] && true !== ($authMessage = $pwforum->authStatus($winddb['userstatus'], $forumset['auth_logicalmethod']))) { quickPostMessage($authMessage . '_rp'); } //quote required require_once R_P . 'require/bbscode.php'; if ($article == '0') { $atcarray = $read; $userservice = L::loadClass('userservice', 'user'); $userinfo = $userservice->get($read['authorid']); $userinfo && ($atcarray = array_merge($atcarray, $userinfo)); } else {
echo 'have_login'; } ajax_footer(); } elseif ($a == 'pingpage') { S::gp(array('tid', 'page', 'count', 'pid', 'fid')); $pingPerPage = 10; $tid = intval($tid); $page = intval($page); $count = intval($count); $pid = intval($pid); if ($tid < 1 || $count < 1 || $fid < 1) { Showmsg('undefined_action'); } global $db; L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); $isBM = $pwforum->isBM($windid); $admincheck = $isGM || $isBM ? 1 : 0; $creditnames = pwCreditNames(); !$page && ($page = 1); $sqlLimit = S::sqlLimit(($page - 1) * $pingPerPage, $pingPerPage); $query = $db->query("SELECT a.*,b.uid,b.icon FROM pw_pinglog a LEFT JOIN pw_members b ON a.pinger=b.username WHERE tid=" . S::sqlEscape($tid) . " AND a.pid = " . S::sqlEscape($pid) . " AND ifhide = 0 order by pingdate desc " . $sqlLimit); $pingList = array(); while ($rt = $db->fetch_array($query)) { $rt['pid'] = $rt['pid'] ? $rt['pid'] : 'tpc'; list($rt['pingtime'], $rt['pingdate']) = getLastDate($rt['pingdate']); $rt['record'] = $rt['record'] ? $rt['record'] : "-"; if ($rt['point'] > 0) { $rt['point'] = "+" . $rt['point']; } // $tmp = showfacedesign($rt['icon'],true,'s');
function postThread($uid, $fid, $subject, $content) { global $winddb, $winduid, $windid, $groupid, $_G, $timestamp, $pwforum, $pwpost, $uploadcredit, $uploadmoney, $db_uploadfiletype, $_time; $timestamp = time(); $_time = array('hours' => get_date($timestamp, 'G'), 'day' => get_date($timestamp, 'j'), 'week' => get_date($timestamp, 'w')); list($uid, $fid, $subject, $content) = array(intval($uid), intval($fid), trim($subject), trim($content)); if ($uid < 1 || $fid < 1 || !$subject || !$content) { return $this->buildResponse(THREAD_INVALID_PARAMS); } ACloud_Sys_Core_Common::setGlobal('customized_current_uid', $uid); $user = $this->getCurrentUser(); if (!$user->isLogin()) { return $this->buildResponse(USER_NOT_LOGIN); } if ($user->groupid == 6 || getstatus($user->info['userstatus'], PW_USERSTATUS_BANUSER)) { return $this->buildResponse(THREAD_USER_NOT_RIGHT); } $user->initRight(); $winduid = $user->uid; $groupid = $user->groupid; $windid = $user->username; $winddb = $user->info; $_G = $user->_G; if ($_G['postlimit'] && $winddb['todaypost'] >= $_G['postlimit']) { return $this->buildResponse(POST_GP_LIMIT); } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { return $this->buildResponse(THREAD_FORUM_NOT_EXIST); } list($uploadcredit, $uploadmoney, , ) = explode("\t", $pwforum->forumset['uploadset']); L::loadClass('post', 'forum', false); require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.bbscode.php'; $pwpost = new PwPost($pwforum); $pwpost->errMode = true; $pwpost->forumcheck(); $pwpost->postcheck(); L::loadClass('topicpost', 'forum', false); $topicpost = new topicPost($pwpost); $topicpost->check(); $postdata = new topicPostData($pwpost); $postdata->setWtype('', '', $pwforum->foruminfo['t_type'], $pwforum->foruminfo['topictype']); $postdata->setTitle($subject); $postdata->setContent($content); $postdata->setConvert(1, 1); $postdata->setTags(''); $postdata->setDigest(''); $postdata->setTopped(''); $postdata->setIfsign(1, 0); if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) { return $this->buildResponse(THREAD_SYSTEM_ERROR, $msg); } require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.attupload.php'; if (PwUpload::getUploadNum()) { $_G['uploadtype'] && ($db_uploadfiletype = $_G['uploadtype']); $db_uploadfiletype = !empty($db_uploadfiletype) ? is_array($db_uploadfiletype) ? $db_uploadfiletype : unserialize($db_uploadfiletype) : array(); $postdata->att = new AttUpload($user->uid); $return = $postdata->att->check(); if ($return) { $msginfo = getLangInfo('msg', $return); return $this->buildResponse(THREAD_USER_NOT_RIGHT); } list($windVersion) = explode(',', WIND_VERSION); if ($windVersion && $windVersion < '8.5') { PwUpload::upload($postdata->att); $postdata->att->transfer(); } } $topicpost->execute($postdata); $tid = $topicpost->getNewId(); return $this->buildResponse(0, array('tid' => $tid)); }
$_cacheService = Perf::getCacheService(); $_thread = $_cacheService->get('thread_tid_' . $tid); $_thread && ($_tmsg = $_cacheService->get('thread_tmsg_tid_' . $tid)); $read = $_thread && $_tmsg ? array_merge($_thread, $_tmsg) : false; if (!$read) { $_cacheService = Perf::gatherCache('pw_threads'); $read = $page > 1 ? $_cacheService->getThreadByThreadId($tid) : $_cacheService->getThreadAndTmsgByThreadId($tid); } } else { $read = $db->get_one("SELECT t.* ,tm.* FROM pw_threads t LEFT JOIN " . S::sqlMetadata(GetTtable($tid)) . " tm ON t.tid=tm.tid WHERE t.tid=" . S::sqlEscape($tid)); } !$read && Showmsg('illegal_tid'); $postdate = get_date($read['postdate'], 'Y-m-d'); list($fid, $ptable, $ifcheck, $openIndex, $topped_count, $subject, $authorid, $author) = array($read['fid'], $read['ptable'], $read['ifcheck'], getstatus($read['tpcstatus'], 2), $read['topreplays'], $read['subject'], $read['authorid'], $read['author']); $pw_posts = GetPtable($ptable); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { Showmsg('data_error'); } $foruminfo =& $pwforum->foruminfo; $forumset =& $pwforum->forumset; if (!S::inArray($windid, $manager)) { $pwforum->forumcheck($winddb, $groupid); } if (!$foruminfo['allowvisit'] && $_G['allowread'] == 0 && $_COOKIE) { Showmsg('read_group_right'); } /**************************************/ //帖子浏览及管理权限 $isGM = $isBM = $admincheck = $managecheck = $pwPostHide = $pwSellHide = $pwEncodeHide = 0; $pwSystem = array();
function _getPermission() { global $windid; $isGM = $this->isGM(); if ($isGM) { return true; } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($this->fid); $isBM = $pwforum->isBM($windid); return $isBM ? true : false; }
<?php define('AJAX', '1'); require_once 'global.php'; require_once R_P . 'lib/forum.class.php'; require_once R_P . 'lib/post.class.php'; $groupid == 'guest' && Showmsg('not_login'); empty($fid) && Showmsg('undefined_action'); $pwforum = new PwForum($fid); $pwpost = new PwPost($pwforum); $pwpost->forumcheck(); $pwpost->postcheck(); list($uploadcredit, $uploadmoney, $downloadmoney, $downloadimg) = explode("\t", $pwforum->forumset['uploadset']); if ($groupid == 6 || getstatus($winddb['userstatus'], 1)) { $pwSQL = ''; $flag = 0; $bandb = $delban = array(); $query = $db->query("SELECT * FROM pw_banuser WHERE uid=" . pwEscape($winduid)); while ($rt = $db->fetch_array($query)) { if ($rt['type'] == 1 && $timestamp - $rt['startdate'] > $rt['days'] * 86400) { $delban[] = $rt['id']; } elseif ($rt['fid'] == 0 || $rt['fid'] == $fid) { $bandb[$rt['fid']] = $rt; } else { $flag = 1; } } $delban && $db->update('DELETE FROM pw_banuser WHERE id IN(' . pwImplode($delban) . ')'); $groupid == 6 && !isset($bandb[0]) && ($pwSQL .= "groupid='-1',"); if (getstatus($winddb['userstatus'], 1) && !isset($bandb[$fid]) && !$flag) { $pwSQL .= 'userstatus=userstatus&(~1),';
function _checkForum($fid) { L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { return 'data_error'; } $pwforum->forumcheck($this->user, $this->groupid); $this->foruminfo =& $pwforum->foruminfo; $isBM = $pwforum->isBM($this->username); $this->admincheck = $this->isGM || pwRights($isBM, 'delattach', $fid) ? 1 : 0; return true; }
<?php !defined('R_P') && exit('Forbidden'); S::gp(array('a')); $pwforum = new PwForum($fid); if (!$pwforum->isForum(true)) { Showmsg('data_error'); } $foruminfo =& $pwforum->foruminfo; $groupRight =& $newColony->getRight(); $pwModeImg = "{$imgpath}/apps"; require_once R_P . 'u/require/core.php'; //* include_once pwCache::getPath(D_P . 'data/bbscache/o_config.php'); pwCache::getData(D_P . 'data/bbscache/o_config.php'); require_once R_P . 'require/header.php'; list($guidename, $forumtitle) = $pwforum->getTitle(); $msg_guide = $pwforum->headguide($guidename); $styleid = $colony['styleid']; $basename = "thread.php?cyid={$cyid}&showtype=member"; if (empty($a)) { $a_key = 'member'; if (!$colony['ifmemberopen'] && !$ifadmin && (!$colony['ifcyer'] || $colony['ifadmin'] == '-1')) { Showmsg('colony_cnmenber'); } if (empty($_POST['operateStep'])) { require_once R_P . 'require/showimg.php'; S::gp(array('group', 'orderby')); $group && ($tmpUrlAdd .= '&group=' . $group); $lang_no_member = array('2' => '没有普通成员', '3' => '没有未验证会员', '4' => '没有最近访客'); $order_lastpost = $order_lastvisit = ''; if ($group && $group == 4) {
list($fid, $ptable, $ifcheck, $openIndex) = array($read['fid'], $read['ptable'], $read['ifcheck'], getstatus($read['tpcstatus'], 2)); $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*/ $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { Showmsg('data_error'); } $foruminfo =& $pwforum->foruminfo; $forumset =& $pwforum->forumset; if ($forumset['link']) { ObHeader(str_replace("&", "&", $forumset['link'])); } if (!S::inArray($windid, $manager)) { $pwforum->forumcheck($winddb, $groupid); } $pwforum->setForumStyle(); if (!$foruminfo['allowvisit'] && $_G['allowread'] == 0 && $_COOKIE) { Showmsg('read_group_right'); }