Exemplo n.º 1
0
 $post->setIP($_SERVER['REMOTE_ADDR']);
 $post->setHTML(isset($dohtml) ? 1 : 0);
 $post->setBBCode(isset($doxcode) ? 1 : 0);
 $post->setSmiley(isset($dosmiley) ? 1 : 0);
 $post->setBR(isset($dobr) ? 1 : 0);
 $post->setImage(isset($doimg) ? 1 : 0);
 $post->setIcon('');
 $post->setApproved($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'approve'));
 $post->setSignature(isset($sig) ? 1 : 0);
 $post->setText($msg);
 if (!$post->save() && $create) {
     $topic->delete();
     redirect_header($retlink, 2, __('Message could not be posted! Please try again', 'bxpress'));
     die;
 }
 if (!$topic->approved()) {
     bXFunctions::notifyAdmin($forum->moderators(), $forum, $topic, $post);
 }
 // Adjuntamos archivos si existen
 if ($forum->attachments() && $forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'attach')) {
     $folder = $xoopsModuleConfig['attachdir'];
     $exts = array();
     include_once RMCPATH . '/class/uploader.php';
     $up = new RMFileUploader($folder, $xoopsModuleConfig['maxfilesize'] * 1024, $forum->extensions());
     $errors = '';
     $filename = '';
     if ($up->fetchMedia('attach')) {
         if (!$up->upload()) {
             $errors .= $up->getErrors();
         } else {
             $filename = $up->getSavedFileName();
Exemplo n.º 2
0
        header('Location: topic.php?pid=' . $lastid . '#p' . $lastid);
        exit;
    }
}
if ($id == '') {
    redirect_header('./', 2, __('Specified topic is not valid!', 'bxpress'));
    die;
}
$topic = new bXTopic($id);
if ($topic->isNew()) {
    redirect_header('./', 2, __('Specified topic does not exists!', 'bxpress'));
    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'])) {
Exemplo n.º 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'));
}