Esempio n. 1
0
<?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 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));
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
 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);
 }