示例#1
0
 }
 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']) {
         if ($xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()) || $xoopsUser->posts() > $xoopsModuleConfig['sticky_posts']) {
             $topic->setSticky($sticky);
示例#2
0
/**
* @desc Cerrar o abrir un tema
*/
function closeTopic($close)
{
    global $xoopsSecurity, $forum, $xoopsUser;
    $topics = isset($_REQUEST['topics']) ? $_REQUEST['topics'] : null;
    if (empty($topics) || is_array($topics) && empty($topics)) {
        redirect_header('moderate.php?id=' . $forum->id(), 2, __('Select at least one topic to moderate!', 'bxpress'));
        die;
    }
    $topics = !is_array($topics) ? array($topics) : $topics;
    foreach ($topics as $k) {
        $topic = new bXTopic($k);
        if ($topic->isNew()) {
            continue;
        }
        $topic->setStatus($close);
        $topic->save();
    }
    redirect_header('moderate.php?id=' . $forum->id(), 1, __('Action completed!', 'bxpress'));
}