Example #1
0
 function post($fid, $author, $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;
     require_once R_P . 'lib/forum.class.php';
     $pwforum = new PwForum($fid);
     if (!$pwforum->isForum()) {
         return new ApiResponse('API_THREAD_FORUM_NOT_EXISTS');
         //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.username="******"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/topicpost.class.php';
     $topicpost = new topicPost($pwpost);
     $topicpost->check();
     $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, 1, $t_db);
     $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))) {
         return new ApiResponse($msg);
         //$errmsg = $this->getErrMsg($msg);
         //return new ErrorMsg($errmsg[0], $errmsg[1]);
     }
     $topicpost->execute($postdata);
     $tid = $topicpost->getNewId();
     return new ApiResponse($tid);
 }
Example #2
0
     $postdata->setStatus('2');
     $postdata->setStatus('7');
 }
 L::loadClass('attupload', 'upload', false);
 /*上传错误检查
 	$return = PwUpload::checkUpload();
 	$return !== true && Showmsg($return);
 	end*/
 if (PwUpload::getUploadNum() || $flashatt) {
     S::gp(array('savetoalbum', 'albumid'), 'P', 2);
     $postdata->att = new AttUpload($winduid, $flashatt, $savetoalbum, $albumid);
     $postdata->att->check();
 }
 $postdata->iscontinue = (int) $iscontinue;
 $topicpost->execute($postdata);
 $tid = $topicpost->getNewId();
 // defend start
 CloudWind::yunUserDefend('postthread', $winduid, $windid, $timestamp, $cloud_information[1] ? $timestamp - $cloud_information[1] : 0, $tid ? 101 : 102, '', $postdata->data['content'], '', '');
 // defend end
 defined('AJAX') && ($pinfo = $pinfo . $tid);
 if ($postSpecial) {
     $postSpecial->insertData($tid);
 }
 if ($postTopic) {
     //分类主题插入数据
     $postTopic->insertData($tid, $fid);
 }
 if ($postCate) {
     //团购插入数据
     $postCate->insertData($tid, $fid);
 }
 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));
 }
Example #4
0
 function post($fid, $author, $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, $db_ipban;
     L::loadClass('forum', 'forum', false);
     $pwforum = new PwForum($fid);
     if (!$pwforum->isForum()) {
         return new ApiResponse('API_THREAD_FORUM_NOT_EXISTS');
         //return new ErrorMsg(API_THREAD_FORUM_NOT_EXISTS, 'Forum not exists');
     }
     $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');
     }
     //检查是否有html发帖权限 没有的话返回提示信息
     $htmlright = $this->db->get_value("SELECT rvalue FROM pw_permission WHERE uid='0' AND fid='0' AND rkey='htmlcode' AND gid=" . S::sqlEscape($groupid));
     if ($htmlright == '0') {
         return new ApiResponse('API_THREAD_NO_HTMLRIGHT');
     }
     if ($db_ipban) {
         //IP禁止
         $onlineip = pwGetIp();
         $baniparray = explode(',', $db_ipban);
         foreach ($baniparray as $banip) {
             if ($banip && strpos(",{$onlineip}.", ',' . trim($banip) . '.') !== false) {
                 return new ApiResponse('API_THREAD_THE_IP_BAN');
             }
         }
     }
     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('topicpost', 'forum', false);
     $topicpost = new topicPost($pwpost);
     $topicpost->check();
     $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));
     //* include_once pwCache::getPath(D_P.'data/bbscache/forum_typecache.php');
     extract(pwCache::getData(D_P . 'data/bbscache/forum_typecache.php', false));
     $t_db = $topic_type_cache[$fid];
     $postdata->setWtype($p_type, $p_sub_type, 1, $t_db);
     $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))) {
         return new ApiResponse($msg);
         //$errmsg = $this->getErrMsg($msg);
         //return new ErrorMsg($errmsg[0], $errmsg[1]);
     }
     $topicpost->execute($postdata);
     $tid = $topicpost->getNewId();
     return new ApiResponse($tid);
 }