示例#1
0
         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());
 $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);
示例#2
0
    die;
}
//Determinamos de el mensaje esta aprobado y si el usuario es administrador o moderador
$forum = new bXForum($topic->forum());
if (!$topic->approved() && (!$xoopsUser->isAdmin() || !$forum->isModerator($xoopsUser->uid()))) {
    redirect_header('./', 2, __('This topic has not been approved yet!', 'bxpress'));
    die;
}
$forum = new bXForum($topic->forum());
if (!$forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'view')) {
    redirect_header('./', 2, __('Sorry, you don\'t have permission to view this forum!', 'bxpress'));
    die;
}
if (!isset($_SESSION['topics_viewed'])) {
    $topic->addView();
    $topic->save();
    $_SESSION['topics_viewed'] = array();
    $_SESSION['topics_viewed'][] = $topic->id();
} else {
    if (!in_array($topic->id(), $_SESSION['topics_viewed'])) {
        $topic->addView();
        $topic->save();
        $_SESSION['topics_viewed'][] = $topic->id();
    }
}
$xoopsOption['template_main'] = "bxpress-topic.tpl";
$xoopsOption['module_subpage'] = "topics";
include 'header.php';
bXFunctions::makeHeader();
$tpl->assign('forum', array('id' => $forum->id(), 'title' => $forum->name(), 'moderator' => $xoopsUser ? $forum->isModerator($xoopsUser->uid()) || $xoopsUser->isAdmin() : false));
$tpl->assign('topic', array('id' => $topic->id(), 'title' => $topic->title(), 'closed' => $topic->status(), 'sticky' => $topic->sticky(), 'approved' => $topic->approved()));
示例#3
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'));
}