Esempio n. 1
0
 public function checkContent()
 {
     if ($this->_data['content'] === '') {
         return new PwError('BBS:post.content.empty');
     }
     $len = Pw::strlen($this->_data['content']);
     $config = Wekit::C('bbs');
     if ($this->forum && $this->forum->forumset['minlengthofcontent']) {
         $config['content.length.min'] = $this->forum->forumset['minlengthofcontent'];
     }
     if ($len < $config['content.length.min']) {
         return new PwError('BBS:post.content.length.less', array('{min}' => $config['content.length.min']));
     }
     if ($len > $config['content.length.max']) {
         return new PwError('BBS:post.content.length.more', array('{max}' => $config['content.length.max']));
     }
     if ($this->forum && $this->user) {
         if ((!$this->forum->forumset['allowhide'] || !$this->user->getPermission('allow_thread_extend.hide')) && (PwUbbCode::hasTag($this->_data['content'], 'post') || PwUbbCode::hasTag($this->_data['content'], 'hide'))) {
             return new PwError('BBS:post.content.hide');
         }
         if ((!$this->forum->forumset['allowsell'] || !$this->user->getPermission('allow_thread_extend.sell')) && PwUbbCode::hasTag($this->_data['content'], 'sell')) {
             return new PwError('BBS:post.content.sell');
         }
     }
     return true;
 }