public function __construct(PwPost $pwpost, $postInfo, $content) { $this->user = $pwpost->user; $this->postDm = $pwpost->getDm(); $this->postInfo = $postInfo; $this->content = $content; }
public function __construct(PwPost $pwpost, $flashatt) { $bhv = new PwAttUpload($pwpost->user, $pwpost->forum, $flashatt); $this->post = $pwpost; $this->action = new PwUpload($bhv); $this->attach = $pwpost->getAttachs(); $this->fid = $pwpost->forum->fid; }
/** * 发表帖子 * @param int $tid * @param int $fid * @param string $subject * @param string $content * return bool */ public function postThread($uid, $fid, $subject, $content) { 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, "参数错误"); } $user = PwUserBo::getInstance($uid); if (!$user->isExists()) { return $this->buildResponse(USER_NOT_EXISTS, "用户不存在"); } Wind::import('SRV:forum.srv.PwPost'); Wind::import('SRV:forum.srv.post.PwTopicPost'); $postAction = new PwTopicPost($fid); $pwPost = new PwPost($postAction); $postDm = $pwPost->getDm(); $postDm->setFid($fid)->setTitle($subject)->setContent($content)->setAuthor($uid, $user->username, $user->ip); if (($result = $pwPost->execute($postDm)) !== true) { $this->buildResponse(-1, $result->getError()); } $tid = $pwPost->getNewId(); return $this->buildResponse(0, array('tid' => $tid)); }
<?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 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)); }
/** * 发送回复 * @param int $tid * @param int $uid * @param string $title * @param string $content * return bool */ public function sendPost($tid, $uid, $title, $content) { 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, "参数错误"); } if ($this->_getOnline()->isOnline($uid) !== true) { $this->buildResponse(USER_NOT_LOGIN, "用户没有登录"); } Wind::import('SRV:forum.srv.PwPost'); Wind::import('SRV:forum.srv.post.PwReplyPost'); $postAction = new PwReplyPost($tid); $pwPost = new PwPost($postAction); $info = $pwPost->getInfo(); $title == 'Re:' . $info['subject'] && ($title = ''); $postDm = $pwPost->getDm(); $postDm->setTitle($title)->setContent($content)->setAuthor($uid, $user->username, $user->ip); if (($result = $pwPost->execute($postDm)) !== true) { $this->buildResponse(-1, $result->getError()); } $postId = $pwPost->getNewId(); return $this->buildResponse(0, array('pid' => $postId)); }
/** * 发送回复 * @param int $tid * @param int $uid * @param string $title * @param string $content * return bool */ public function sendPost($tid, $uid, $title, $content) { $userBo = new PwUserBo($uid); if (!$userBo->isExists()) { return $this->buildResponse(THREAD_USER_NOT_EXIST); } Wind::import('SRV:forum.srv.PwPost'); Wind::import('SRV:forum.srv.post.PwReplyPost'); $postAction = new PwReplyPost($tid); $pwPost = new PwPost($postAction); $info = $pwPost->getInfo(); $title == 'Re:' . $info['subject'] && ($title = ''); $postDm = $pwPost->getDm(); $postDm->setTitle($title)->setContent($content)->setAuthor($uid, $userBo->username, $userBo->ip); if (($result = $pwPost->execute($postDm)) !== true) { $this->buildResponse(-1, $result->getError()); } return $this->buildResponse(0, $result); }
function reply($tid, $author, $title, $content) { global $winddb, $winduid, $windid, $groupid, $timestamp, $pwforum, $pwpost; $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $winddb = $userService->getByUserName($author, true, true); if (empty($winddb)) { return new ApiResponse('API_THREAD_AUTHOR_NOT_EXISTS'); //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 ($groupid == 6 || getstatus($winddb['userstatus'], PW_USERSTATUS_BANUSER)) { //会员禁言 return new ApiResponse('API_THREAD_THE_USER_BAN'); } $tpcarray = $this->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 new ApiResponse('THREAD_FORUM_NOT_EXIST'); } L::loadClass('post', 'forum', false); require_once R_P . 'require/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(); $postdata = new replyPostData($pwpost); $postdata->setTitle($title); $postdata->setContent($content); $postdata->conentCheck(); if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) { return new ApiResponse('THREAD_SYSTEM_ERROR'); } $replypost->execute($postdata); $pid = $replypost->getNewId(); return new ApiResponse($pid); }
private function _getSourceInfo($typeid, $fromid) { $extend = array(); switch ($typeid) { case PwLikeContent::THREAD: $msg = Wekit::load('forum.PwThread')->getThread($fromid); //needcheck Wind::import('SRV:forum.srv.post.PwReplyPost'); Wind::import('SRV:forum.srv.PwPost'); $postAction = new PwReplyPost($fromid); $post = new PwPost($postAction); if ($post->getDisabled()) { $extend = array('needcheck' => true); } return array($msg['created_userid'], $msg['special'], $msg['like_count'], $msg['fid'], $extend); case PwLikeContent::POST: $msg = Wekit::load('forum.PwThread')->getPost($fromid); return array($msg['created_userid'], 0, $msg['like_count'], $msg['fid']); case PwLikeContent::WEIBO: $msg = Wekit::load('weibo.PwWeibo')->getWeibo($fromid); return array($msg['created_userid'], 0, $msg['like_count'], 0); case PwLikeContent::APP: $msg = Wekit::load('like.PwLikeSource')->getSource($fromid); return array(0, 0, $msg['like_count'], 0); } }
/** * 发表帖子 * @param int $tid * @param int $fid * @param string $subject * @param string $content * return bool */ public function postThread($uid, $fid, $subject, $content) { $userBo = new PwUserBo($uid); if (!$userBo->isExists()) { return $this->buildResponse(THREAD_USER_NOT_EXIST); } Wind::import('SRV:forum.srv.PwPost'); Wind::import('SRV:forum.srv.post.PwTopicPost'); $postAction = new PwTopicPost($fid); $pwPost = new PwPost($postAction); $postDm = $pwPost->getDm(); $postDm->setFid($fid)->setTitle($subject)->setContent($content)->setAuthor($uid, $userBo->username, $userBo->ip); if (($result = $pwPost->execute($postDm)) !== true) { $this->buildResponse(-1, $result->getError()); } return $this->buildResponse(0, $result); }
} } $page = floor($article / $db_readperpage) + 1; $url = "apps.php?q=group&a=read&cyid={$cyid}&tid={$tid}&page={$page}#{$pid}"; $msg = defined('AJAX') ? "success\t" . $url : $pinfo; refreshto($url, $msg); } } elseif ($a == 'ajaxedit') { define('AJAX', 1); define('F_M', true); S::gp(array('pid', 'article'), 'GP'); banUser(); L::loadClass('forum', 'forum', false); L::loadClass('post', 'forum', false); $pwforum = new PwForum($colony['classid']); $pwpost = new PwPost($pwforum); //$pwpost->forumcheck(); $pwpost->postcheck(); L::loadClass('postmodify', 'forum', false); if ($pid && is_numeric($pid)) { $postmodify = new replyModify($tid, $pid, $pwpost); } else { $pid = 'tpc'; $postmodify = new topicModify($tid, 0, $pwpost); } $atcdb = $postmodify->init(); $postmodify->check(); if ($postmodify->type == 'topic' && !($atcdb['tpcstatus'] & 1)) { Showmsg('data_error'); } if (empty($_POST['step'])) {
public function isDisabled() { $config = Wekit::C('bbs'); if ($config['post.check.open'] && !$this->user->inGroup($config['post.check.groups']) && PwPost::inTime($config['post.check.start_hour'], $config['post.check.start_min'], $config['post.check.end_hour'], $config['post.check.end_min'])) { return 1; } switch ($this->user->getPermission('post_check')) { case '2': $disabled = 0; break; case '1': $disabled = $this->isForumContentCheck() ? 1 : 0; break; default: $disabled = 1; } return $disabled; }
/** * 安装完成 */ public function finishAction() { //Wekit::createapp('phpwind'); Wekit::C()->reload('windid'); WindidApi::api('user'); $db = $this->_checkDatabase(); //更新HOOK配置数据 Wekit::load('hook.srv.PwHookRefresh')->refresh(); //初始化站点config $site_hash = WindUtility::generateRandStr(8); $cookie_pre = WindUtility::generateRandStr(3); Wekit::load('config.PwConfig')->setConfig('site', 'hash', $site_hash); Wekit::load('config.PwConfig')->setConfig('site', 'cookie.pre', $cookie_pre); Wekit::load('config.PwConfig')->setConfig('site', 'info.mail', $db['founder']['manager_email']); Wekit::load('config.PwConfig')->setConfig('site', 'info.url', PUBLIC_URL); Wekit::load('nav.srv.PwNavService')->updateConfig(); Wind::import('WINDID:service.config.srv.WindidConfigSet'); $windidConfig = new WindidConfigSet('site'); $windidConfig->set('hash', $site_hash)->set('cookie.pre', $cookie_pre)->flush(); //风格默认数据 Wekit::load('APPCENTER:service.srv.PwStyleInit')->init(); //计划任务默认数据 Wekit::load('cron.srv.PwCronService')->updateSysCron(); //更新数据缓存 /* @var $usergroup PwUserGroupsService */ $usergroup = Wekit::load('SRV:usergroup.srv.PwUserGroupsService'); $usergroup->updateLevelCache(); $usergroup->updateGroupCache(range(1, 16)); $usergroup->updateGroupRightCache(); /* @var $emotion PwEmotionService */ $emotion = Wekit::load('SRV:emotion.srv.PwEmotionService'); $emotion->updateCache(); //创始人配置 $uid = $this->_writeFounder($db['founder']['manager'], $db['founder']['manager_pwd'], $db['founder']['manager_email']); //门户演示数据 Wekit::load('SRV:design.srv.PwDesignDefaultService')->likeModule(); Wekit::load('SRV:design.srv.PwDesignDefaultService')->tagModule(); Wekit::load('SRV:design.srv.PwDesignDefaultService')->reviseDefaultData(); //演示数据导入 Wind::import('SRV:forum.srv.PwPost'); Wind::import('SRV:forum.srv.post.PwTopicPost'); $pwPost = new PwPost(new PwTopicPost(2, new PwUserBo($uid))); $threads = $this->_getDemoThreads(); foreach ($threads as $thread) { $postDm = $pwPost->getDm(); $postDm->setTitle($thread['title'])->setContent($thread['content']); $result = $pwPost->execute($postDm); } //全局缓存更新 Wekit::load('SRV:cache.srv.PwCacheUpdateService')->updateConfig(); Wekit::load('SRV:cache.srv.PwCacheUpdateService')->updateMedal(); //清理安装过程的文件 WindFile::write($this->_getInstallLockFile(), 'LOCKED'); WindFile::del($this->_getTempFile()); WindFile::del($this->_getTableLogFile()); WindFile::del($this->_getTableSqlFile()); }
function conentCheck() { global $db_tcheck; $postcheck = unserialize($this->post->user['postcheck']); $checkValue = $this->post->fromGroup ? $postcheck['group'] : $postcheck['post']; if ($db_tcheck && $checkValue == PwPost::tcheck($this->data['content'])) { return $this->post->showmsg('content_same'); } }
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)); }
public function domarkAction() { list($_credits, $tid, $pid, $reason, $isreply) = $this->getInput(array('credits', 'tid', 'pid', 'reason', 'isreply'), 'post'); if (!$_credits) { $this->showError('还未添加评分哦'); } if (!$reason) { $this->showError('请输入评分理由'); } $credits = array(); foreach ($_credits as $k => $v) { $v && ($credits[$k] = $v); } //检查权限 if (($result = $this->_checkMarkRight($tid, $pid)) instanceof PwError) { $this->showError($result->getError()); } //检查积分权限 if (($result = $this->_checkMarkCreditsRight($credits)) instanceof PwError) { $this->showError($result->getError()); } // 积分处理 if (($info = $this->setCredits($credits, $tid, $pid)) instanceof PwError) { $this->showError($info->getError()); } Wind::import('EXT:mark.service.dm.App_Mark_RecordDm'); $newIds = array(); foreach ($credits as $k => $v) { $dm = new App_Mark_RecordDm(); $dm->setTid($tid)->setPid($pid)->setCreatedUserid($this->loginUser->uid)->setCreatedUsername($this->loginUser->username)->setPingUserid($info['created_userid'])->setReason($reason)->setCtype($k)->setCnum($v); if (($result = $this->_getDs()->addRecord($dm)) instanceof PwError) { $this->showError($result->getError()); } $result && is_numeric($result) && ($newIds[] = $result); } // 回复帖子 if ($isreply) { Wind::import('SRV:forum.srv.PwPost'); Wind::import('SRV:forum.srv.post.PwReplyPost'); $rpid = $pid ? $pid : 0; $pwPost = new PwPost(new PwReplyPost($tid, $this->loginUser)); $postDm = $pwPost->getDm(); $postDm->setContent($reason)->setReplyPid($rpid); $pwPost->execute($postDm); } // 更新帖子 $this->_updateThreadAddMark($credits, $newIds, $info); $this->showMessage('success'); }
function conentCheck() { global $db_tcheck; if ($db_tcheck && $this->post->user['postcheck'] == PwPost::tcheck($this->data['content'])) { return $this->post->showmsg('content_same'); } }