Exemplo n.º 1
0
    redirect_header($retlink, 2, __('You do not have permission to do this!', 'bxpress'));
    die;
}
switch ($op) {
    case 'post':
        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);
            }
Exemplo n.º 2
0
/**
* @desc Aprueba o no un tema
**/
function approvedTopics($app = 0)
{
    global $forum, $xoopsSecurity;
    $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;
    if (!$xoopsSecurity->check()) {
        redirect_header('moderate.php?id=' . $forum->id(), 2, __('Session token expired!', 'bxpress'));
        die;
    }
    $lastpost = false;
    foreach ($topics as $k) {
        $topic = new bXTopic($k);
        if ($topic->isNew()) {
            continue;
        }
        $lastapp = $topic->approved();
        $topic->setApproved($app);
        $topic->save();
    }
    //Actualizamos el último mensaje del foro
    $post = $forum->getLastPost();
    $forum->setPostId($post);
    $forum->save();
    redirect_header('moderate.php?id=' . $forum->id(), 1, __('Action completed!', 'bxpress'));
}