Exemple #1
0
     $topic->setViews(0);
     $topic->setVotes(0);
     $topic->setFriendName(TextCleaner::getInstance()->sweetstring($subject));
     if ($xoopsUser && isset($sticky) && $xoopsModuleConfig['sticky']) {
         if ($xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()) || $xoopsUser->posts() > $xoopsModuleConfig['sticky_posts']) {
             $topic->setSticky($sticky);
         }
     }
     if (!$topic->save()) {
         redirect_header('./forum.php?id=' . $forum->id(), 2, __('Message could not be posted! Please try again', 'bxpress'));
         die;
     }
 }
 $post = new bXPost();
 $post->setPid(0);
 $post->setTopic($topic->id());
 $post->setForum($forum->id());
 $post->setDate(time());
 $post->setUser($xoopsUser ? $xoopsUser->uid() : 0);
 $post->setUname($xoopsUser ? $xoopsUser->uname() : $name);
 $post->setIP($_SERVER['REMOTE_ADDR']);
 $post->setHTML(isset($dohtml) ? 1 : 0);
 $post->setBBCode(isset($doxcode) ? 1 : 0);
 $post->setSmiley(isset($dosmiley) ? 1 : 0);
 $post->setBR(isset($dobr) ? 1 : 0);
 $post->setImage(isset($doimg) ? 1 : 0);
 $post->setIcon('');
 $post->setApproved($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'approve'));
 $post->setSignature(isset($sig) ? 1 : 0);
 $post->setText($msg);
 if (!$post->save() && $create) {