示例#1
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'));
}
示例#2
0
    $tf = new RMTimeFormatter(0, __('%T% %d%, %Y%', 'bxpress'));
    // Likes parsing
    if (!is_null($row['liked'])) {
        $likes_ids = explode(",", $row['liked'], 3);
    } else {
        $likes_ids = array();
    }
    $likes = array();
    foreach ($likes_ids as $like) {
        if (!isset($users[$like])) {
            $users[$like] = new XoopsUser($like);
        }
        $like_user = $users[$like];
        $likes[] = array('uid' => $like, 'uname' => $like_user->getVar('uname'), 'name' => $like_user->getVar('name') != '' ? $like_user->getVar('name') : $like_user->getVar('uname'), 'avatar' => RMEvents::get()->run_event("rmcommon.get.avatar", $like_user->getVar('email'), 40));
    }
    $posts[$post->id()] = array('id' => $post->id(), 'text' => $post->text(), 'edit' => $post->editText(), 'approved' => $post->approved(), 'date' => $tf->ago($post->date()), 'canedit' => $canedit, 'candelete' => $candelete, 'canshow' => $canshow, 'canreport' => $report, 'poster' => $userData, 'attachs' => $attachs, 'attachscount' => count($attachs), 'parent' => $post->parent, 'replies' => $row['replies'], 'likes_count' => $row['likes'], 'likes' => $likes);
    $posts_ids[] = $post->id();
}
$tpl->assign('posts', $posts);
unset($userData, $bbUser, $users);
// Common Utilities Notifications
$notifications = RMNotifications::get();
$events = Bxpress_Notifications::get();
$permissions = $forum->permissions();
// New topics notifications
$event = $events->event('reply')->parameters($topic->id())->permissions(array('groups' => in_array(0, $permissions['view']) ? array() : $permissions['view']));
$notifications->add_item($event);
unset($event, $permissions);
$tpl->assign('notifications', $notifications->render());
$tpl->assign('lang_edit', __('Edit', 'bxpress'));
$tpl->assign('lang_delete', __('Delete', 'bxpress'));
示例#3
0
        $userData = array();
        $userData['id'] = 0;
        $userData['uname'] = $xoopsModuleConfig['anonymous_prefix'] . $post->uname();
        $userData['rank'] = $xoopsConfig['anonymous'];
        $userData['rank_image'] = '';
        $userData['registered'] = '';
        $userData['avatar'] = RMEvents::get()->run_event("rmcommon.get.avatar", '', 0);
        $userData['posts'] = sprintf(__('Posts: %u', 'bxpress'), 0);
        $userData['online'] = false;
    }
    // Adjuntos
    $attachs = array();
    foreach ($post->attachments() as $k) {
        $attachs[] = array('title' => $k->name(), 'downs' => $k->downloads(), 'id' => $k->id(), 'ext' => $k->extension(), 'size' => RMUtilities::formatBytesSize($k->size()), 'icon' => $k->getIcon());
    }
    $tpl->append('posts', array('id' => $post->id(), 'text' => $post->text(), 'edit' => $post->editText(), 'approved' => $post->approved(), 'date' => bXFunctions::formatDate($post->date()), 'canedit' => $canedit, 'candelete' => $candelete, 'canshow' => $canshow, 'canreport' => $report, 'poster' => $userData, 'attachs' => $attachs, 'attachscount' => count($attachs)));
}
unset($userData, $bbUser, $users);
$tpl->assign('lang_edit', __('Edit', 'bxpress'));
$tpl->assign('lang_delete', __('Delete', 'bxpress'));
$tpl->assign('lang_report', __('Report', 'bxpress'));
$tpl->assign('lang_quote', __('Quote', 'bxpress'));
$tpl->assign('lang_online', __('Online!', 'bxpress'));
$tpl->assign('lang_offline', __('Disconnected', 'bxpress'));
$tpl->assign('lang_attachments', __('Attachments', 'bxpress'));
$tpl->assign('xoops_pagetitle', $topic->title() . " &raquo; " . $xoopsModuleConfig['forum_title']);
$tpl->assign('token', $xoopsSecurity->createToken());
$tpl->assign('lang_edittext', __('Edit Text', 'bxpress'));
$tpl->assign('lang_goto', __('Change Forum:', 'bxpress'));
$tpl->assign('lang_go', __('Go!', 'bxpress'));
//$tpl->assign('url',XOOPS_URL."/modules/bxpress/report.php");