예제 #1
0
 foreach ($_POST as $k => $v) {
     ${$k} = $v;
 }
 if (!$xoopsSecurity->check()) {
     redirect_header('./' . ($create ? 'forum.php?id=' . $forum->id() : 'topic.php?id=' . $topic->id()), 2, __('Session token expired!', 'bxpress'));
     die;
 }
 $myts =& MyTextSanitizer::getInstance();
 if ($create) {
     $topic = new bXTopic();
     $topic->setApproved($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'approve'));
     $topic->setDate(time());
     $topic->setForum($forum->id());
     $topic->setPoster($xoopsUser ? $xoopsUser->uid() : 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']) {