예제 #1
0
     $topic->setPosterName($xoopsUser ? $xoopsUser->uname() : $name);
     $topic->setRating(0);
     $topic->setReplies(0);
     $topic->setStatus(0);
     if ($xoopsUser && $xoopsModuleConfig['sticky']) {
         $csticky = $xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()) || $xoopsUser->posts() > $xoopsModuleConfig['sticky_posts'];
         if ($sticky) {
             $topic->sticky(isset($sticky) ? $sticky : 0);
         }
     } else {
         $topic->setSticky(0);
     }
     $topic->setTitle($myts->addSlashes($subject));
     $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());