Example #1
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));
 }
Example #2
0
 /**
  * 
  * @param $tid
  */
 function checkReply($tid)
 {
     global $timestamp, $groupid, $winddb, $winduid, $_time;
     $this->hours =& $_time['hours'];
     $tpcarray = $this->db->get_one("SELECT tid,fid,locked,ifcheck,postdate,ptable,tpcstatus FROM pw_threads WHERE tid=" . S::sqlEscape($tid));
     if (empty($tpcarray)) {
         return false;
     }
     L::loadClass('forum', 'forum', false);
     L::loadClass('post', 'forum', false);
     $pwforum = new PwForum($tpcarray['fid']);
     $pwpost = new PwPost($pwforum);
     if (getstatus($tpcarray['tpcstatus'], 7)) {
         $robbuildService = L::loadClass('RobBuild', 'forum');
         /* @var $robbuildService PW_RobBuild */
         $robbuild = $robbuildService->getByTid($tid);
         if ($robbuild['starttime'] > $timestamp) {
             return false;
         }
     }
     if (!$pwforum->foruminfo['allowrp'] && !$pwpost->admincheck && $GLOBALS['_G']['allowrp'] == 0) {
         return 'reply_group_right';
     } elseif ($pwforum->forumset['lock'] && !$pwpost->isGM && $timestamp - $tpcarray['postdate'] > $pwforum->forumset['lock'] * 86400 && !pwRights($pwpost->isBM, 'replylock')) {
         return 'forum_locked';
     } elseif (!$pwpost->isGM && !$tpcarray['ifcheck'] && !pwRights($pwpost->isBM, 'viewcheck')) {
         return 'reply_ifcheck';
     } elseif (!$pwpost->isGM && $tpcarray['locked'] % 3 != 0 && !pwRights($pwpost->isBM, 'replylock')) {
         return 'reply_lockatc';
     } elseif (!$pwpost->isGM && !$pwpost->forum->allowtime($this->hours) && !pwRights($pwpost->isBM, 'allowtime')) {
         return 'forum_allowtime';
     } else {
         if ($groupid == 6 || getstatus($winddb['userstatus'], PW_USERSTATUS_BANUSER)) {
             $bandb = array();
             $query = $this->db->query("SELECT * FROM pw_banuser WHERE uid=" . S::sqlEscape($winduid));
             while ($rt = $this->db->fetch_array($query)) {
                 if ($rt['fid'] == 0 || $rt['fid'] == $tpcarray['fid']) {
                     $bandb[$rt['fid']] = $rt;
                 }
             }
             if ($bandb) {
                 return 'ban_info3';
             }
         }
         L::loadClass('replypost', 'forum', false);
         $replypost = new replyPost($pwpost);
         $replypost->setTpc($tpcarray);
         $pwpost->errMode = true;
         $replypost->check();
         if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) {
             return $msg;
         }
         return true;
     }
 }
Example #3
0
            $old_content = preg_replace("/\\<(.+?)\\>/is", "", $old_content);
            $atc_content = "[quote]" . ($pid == 'tpc' ? getLangInfo('post', 'info_post_1') : getLangInfo('post', 'info_post_2')) . "\n{$old_content} [url={$db_bbsurl}/apps.php?q=group&a=read&cyid={$cyid}&tid={$tid}#article_{$pid}][img]{$imgpath}/back.gif[/img][/url]\n[/quote]\n";
        }
        list($isheader, $isfooter, $tplname, $isleft) = array(false, true, "m_group", true);
    } else {
        PostCheck(1, $o_groups_p_gdcheck, $o_groups_p_qcheck);
        S::gp(array('atc_content', 'atc_title', 'flashatt'));
        $postdata = new replyPostData($pwpost);
        $postdata->setTitle($atc_title);
        $postdata->setContent($atc_content);
        $postdata->setConvert(1);
        $postdata->setIfsign(1, 0);
        $postdata->conentCheck();
        L::loadClass('replypost', 'forum', false);
        require_once R_P . 'apps/groups/lib/colonypost.class.php';
        $replypost = new replyPost($pwpost);
        $replypost->extraBehavior = new PwColonyPost($cyid);
        $replypost->check();
        $replypost->setTpc($tpc);
        L::loadClass('attupload', 'upload', false);
        if (PwUpload::getUploadNum() || $flashatt) {
            S::gp(array('savetoalbum', 'albumid'), 'P', 2);
            $postdata->att = new AttUpload($winduid, $flashatt, $savetoalbum, $albumid);
            $postdata->att->check();
        }
        $replypost->execute($postdata);
        $url = "{$basename}a=read&cyid={$cyid}&tid={$tid}";
        $msg = defined('AJAX') ? "success\t" . $url : 'colony_postsuccess';
        refreshto($url, $msg);
    }
} elseif ($a == 'top') {
Example #4
0
     wap_msg('illegal_tid', $rurl);
 }
 if ($pwforum->forumset['lock'] && !$pwpost->isGM && $timestamp - $tpcarray['postdate'] > $pwforum->forumset['lock'] * 86400 && !pwRights($pwpost->isBM, 'replylock')) {
     $forumset['lock'] = $pwforum->forumset['lock'];
     wap_msg('forum_locked', $rurl);
 }
 if (!$pwpost->isGM && !$tpcarray['ifcheck'] && !pwRights($pwpost->isBM, 'viewcheck')) {
     wap_msg('reply_ifcheck', $rurl);
 }
 if (!$pwpost->isGM && $tpcarray['locked'] % 3 != 0 && !pwRights($pwpost->isBM, 'replylock')) {
     wap_msg('reply_lockatc', $rurl);
 }
 InitGP(array('subject', 'content'), 'P', 0);
 checkWapPost(0);
 require_once R_P . 'lib/forum/replypost.class.php';
 $replypost = new replyPost($pwpost);
 $replypost->setTpc($tpcarray);
 $replypost->check();
 !empty($pwpost->errMsg) && wap_msg($pwpost->errMsg);
 require_once R_P . 'require/bbscode.php';
 $replypost->setTpc($tpcarray);
 $content = $content . "\r\n\r\n[size=2][color=#a5a5a5]内容来自[/color][color=#4f81bd][url=" . $db_bbsurl . "/m/index.php][手机版][/url][/color] [/size]";
 $postdata = new replyPostData($pwpost);
 $postdata->setTitle(wap_cv($subject, false));
 $postdata->setContent(wap_cv($content, false));
 $postdata->conentCheck();
 $postdata->checkdata();
 !empty($pwpost->errMsg) && wap_msg($pwpost->errMsg);
 $replypost->execute($postdata);
 $pid = $replypost->getNewId();
 pwHook::runHook('after_reply');
Example #5
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);
 }