コード例 #1
0
 public function doreplyAction()
 {
     $id = $this->getInput('id');
     $content = $this->getInput('content', 'post');
     $transmit = $this->getInput('transmit', 'post');
     Wind::import('SRV:attention.srv.PwFreshReplyPost');
     $reply = new PwFreshReplyPost($id, $this->loginUser);
     if (($result = $reply->check()) !== true) {
         $this->showError($result->getError());
     }
     $reply->setContent($content);
     $reply->setIsTransmit($transmit);
     if (($result = $reply->execute()) instanceof PwError) {
         $this->showError($result->getError());
     }
     if (!$reply->getIscheck()) {
         $this->showError('BBS:post.reply.ischeck');
     }
     $content = Wekit::load('forum.srv.PwThreadService')->displayContent($content, $reply->getIsuseubb(), $reply->getRemindUser());
     /*
     		$content = WindSecurity::escapeHTML($content);
     		if ($reply->getIsuseubb()) {
     			Wind::import('LIB:ubb.PwSimpleUbbCode');
     			Wind::import('LIB:ubb.config.PwUbbCodeConvertThread');
     			$content = PwSimpleUbbCode::convert($content, 140, new PwUbbCodeConvertThread());
     		}*/
     $fresh = array();
     if ($transmit && ($newId = $reply->getNewFreshSrcId())) {
         Wind::import('SRV:attention.srv.dataSource.PwFetchFreshByTypeAndSrcId');
         $data = $reply->getData();
         $freshDisplay = new PwFreshDisplay(new PwFetchFreshByTypeAndSrcId($data['type'] == 3 ? 3 : 2, array($newId)));
         $fresh = $freshDisplay->gather();
         $fresh = current($fresh);
     }
     $this->setOutPut(Pw::getTime(), 'timestamp');
     $this->setOutPut($content, 'content');
     $this->setOutPut($this->loginUser->uid, 'uid');
     $this->setOutPut($this->loginUser->username, 'username');
     $this->setOutPut($fresh, 'fresh');
 }