示例#1
0
 }
 $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);
 $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';
示例#2
0
/**
* @desc Aprueba o no un mensaje editado
**/
function approvedPosts($app = 0)
{
    global $xoopsUser, $xoopsSecurity;
    $posts = isset($_REQUEST['posts']) ? intval($_REQUEST['posts']) : 0;
    //Verifica que el mensaje sea válido
    if ($posts <= 0) {
        redirect_header('./topic.php?id=' . $posts, 1, __('Topic not valid!', 'bxpress'));
        die;
    }
    //Comprueba que el mensaje exista
    $post = new bXPost($posts);
    if ($post->isNew()) {
        redirect_header('./topic.php?id=' . $posts, 1, __('Post doesn\'t exists!', 'bxpress'));
        die;
    }
    //Comprueba si usuario es moderador del foro
    $forum = new bXForum($post->forum());
    if (!$forum->isModerator($xoopsUser->uid()) || !$xoopsUser->isAdmin()) {
        redirect_header('./topic.php?id=' . $posts, 1, __('You don\'t have permission to do this action!', 'bxpress'));
        die;
    }
    if (!$xoopsSecurity->check()) {
        redirect_header('./topic.php?id=' . $posts, 2, __('Session token expired!', 'bxpress'));
        die;
    }
    $post->setApproved($app);
    if ($post->editText()) {
        $post->setText($post->editText());
    }
    $post->setEditText('');
    $post->save();
    redirect_header('./topic.php?id=' . $post->topic(), 1, __('Operation completed!', 'bxpress'));
}