Пример #1
0
        $lastpost['date'] = formatTimeStamp($last->date(), 'c');
        $lastpost['by'] = sprintf(__('By: %s', 'bxpress'), $last->uname());
        $lastpost['id'] = $last->id();
        if ($xoopsUser) {
            $lastpost['new'] = $last->date() > $xoopsUser->getVar('last_login') && time() - $last->date() < $xoopsModuleConfig['time_new'];
        } else {
            $lastpost['new'] = time() - $last->date() <= $xoopsModuleConfig['time_new'];
        }
    }
    $tpages = ceil($topic->replies() / $xoopsModuleConfig['perpage']);
    if ($tpages > 1) {
        $pages = bXFunctions::paginateIndex($tpages);
    } else {
        $pages = null;
    }
    $tpl->append('topics', array('id' => $topic->id(), 'title' => $topic->title(), 'replies' => $topic->replies(), 'views' => $topic->views(), 'by' => sprintf(__('By: %s', 'bxpress'), $topic->posterName()), 'last' => $lastpost, 'popular' => $topic->replies() >= $forum->hotThreshold(), 'sticky' => $topic->sticky(), 'pages' => $pages, 'tpages' => $tpages, 'closed' => $topic->status()));
}
// Datos del Foro
$tpl->assign('forum', array('id' => $forum->id(), 'title' => $forum->name(), 'moderator' => $xoopsUser ? $forum->isModerator($xoopsUser->uid()) || $xoopsUser->isAdmin() : false));
$tpl->assign('lang_pages', __('Pages:', 'bxpress'));
$tpl->assign('lang_topic', __('Topics', 'bxpress'));
$tpl->assign('lang_replies', __('Replies', 'bxpress'));
$tpl->assign('lang_views', __('Views', 'bxpress'));
$tpl->assign('lang_lastpost', __('Last Post', 'bxpress'));
$tpl->assign('lang_nonew', __('No new posts', 'bxpress'));
$tpl->assign('lang_withnew', __('New posts', 'bxpress'));
$tpl->assign('lang_hotnonew', __('No hot topics', 'bxpress'));
$tpl->assign('lang_hotnew', __('New hot topics', 'bxpress'));
$tpl->assign('lang_sticky', __('Sticky', 'bxpress'));
$tpl->assign('lang_closed', __('Closed Topic', 'bxpress'));
if ($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'topic')) {
Пример #2
0
        $lastpost['time'] = $last->date();
        $lastpost['id'] = $last->id();
        $lastpost['poster'] = array('uid' => $last->uid, 'uname' => $last->poster_name, 'name' => $last_poster->name != '' ? $last_poster->name : $last_poster->uname, 'email' => $last_poster->email, 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $last_poster->getVar('email'), 50), 'link' => XOOPS_URL . '/userinfo.php?uid=' . $last_poster->uid);
        if ($xoopsUser) {
            $lastpost['new'] = $last->date() > $xoopsUser->getVar('last_login') && time() - $last->date() < $xoopsModuleConfig['time_new'];
        } else {
            $lastpost['new'] = time() - $last->date() <= $xoopsModuleConfig['time_new'];
        }
    }
    $tpages = ceil($topic->replies() / $xoopsModuleConfig['perpage']);
    if ($tpages > 1) {
        $pages = bXFunctions::paginateIndex($tpages);
    } else {
        $pages = null;
    }
    $tpl->append('topics', array('id' => $topic->id(), 'title' => $topic->title(), 'replies' => $topic->replies(), 'views' => $topic->views(), 'by' => sprintf(__('By: %s', 'bxpress'), $topic->posterName()), 'last' => $lastpost, 'popular' => $topic->replies() >= $forum->hotThreshold(), 'sticky' => $topic->sticky(), 'pages' => $pages, 'tpages' => $tpages, 'closed' => $topic->status(), 'poster' => array('uid' => $topic->poster, 'uname' => $poster->uname, 'name' => $poster->name, 'email' => $poster->email, 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $poster->getVar('email'), 100), 'type' => $poster->isAdmin() ? 'admin' : ($forum->isModerator($topic->poster) ? 'moderator' : 'user'))));
}
// Datos del Foro
$tpl->assign('forum', array('id' => $forum->id(), 'title' => $forum->name(), 'moderator' => $xoopsUser ? $forum->isModerator($xoopsUser->uid()) || $xoopsUser->isAdmin() : false));
// Notificaciones de Common Utilities
$notifications = RMNotifications::get();
$events = Bxpress_Notifications::get();
// New topics notifications
$event = $events->event('newtopic')->parameters($forum->id())->permissions(array('users' => $forum->moderators(), 'groups' => array(XOOPS_GROUP_ADMIN)));
$notifications->add_item($event);
// New posts notification
$event = $events->event('forum-newpost')->parameters($forum->id())->permissions(array('users' => $forum->moderators(), 'groups' => array(XOOPS_GROUP_ADMIN)));
$notifications->add_item($event);
// Assign output to a Smarty variable
$tpl->assign('notifications', $notifications->render());
$tpl->assign('lang_pages', __('Pages:', 'bxpress'));
Пример #3
0
/**
* @desc Muestra todas las opciones configurables
*/
function showItemsAndOptions()
{
    global $xoopsUser, $db, $xoopsOption, $tpl, $xoopsModule, $xoopsConfig, $xoopsSecurity;
    global $xoopsModuleConfig, $forum;
    $xoopsOption['template_main'] = "bxpress_moderate.html";
    $xoopsOption['module_subpage'] = "moderate";
    include 'header.php';
    /**
     * Cargamos los temas
     */
    $tbl1 = $db->prefix("bxpress_topics");
    $tbl2 = $db->prefix("bxpress_forumtopics");
    $sql = "SELECT COUNT(*) FROM {$tbl1} WHERE id_forum='" . $forum->id() . "' ";
    list($num) = $db->fetchRow($db->queryF($sql));
    $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : '';
    $limit = $xoopsModuleConfig['topicperpage'] > 0 ? $xoopsModuleConfig['topicperpage'] : 15;
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $rest = $pactual - $tpages;
        $pactual = $pactual - $rest + 1;
        $start = ($pactual - 1) * $limit;
    }
    if ($tpages > 0) {
        $nav = new RMPageNav($num, $limit, $pactual);
        $nav->target_url('moderate.php?id=' . $forum->id() . '&amp;pag={PAGE_NUM}');
        $tpl->assign('itemsNavPage', $nav->render(false));
    }
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY sticky DESC, date DESC LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $topic = new bXTopic();
        $topic->assignVars($row);
        $last = new bXPost($topic->lastPost());
        $lastpost = array();
        if (!$last->isNew()) {
            $lastpost['date'] = bXFunctions::formatDate($last->date());
            $lastpost['by'] = sprintf(__('By: %s', 'bxpress'), $last->uname());
            $lastpost['id'] = $last->id();
            if ($xoopsUser) {
                $lastpost['new'] = $last->date() > $xoopsUser->getVar('last_login') && time() - $last->date() < $xoopsModuleConfig['time_new'];
            } else {
                $lastpost['new'] = time() - $last->date() <= $xoopsModuleConfig['time_new'];
            }
        }
        $tpages = ceil($topic->replies() / $xoopsModuleConfig['perpage']);
        if ($tpages > 1) {
            $pages = bXFunctions::paginateIndex($tpages);
        } else {
            $pages = null;
        }
        $tpl->append('topics', array('id' => $topic->id(), 'title' => $topic->title(), 'replies' => $topic->replies(), 'views' => $topic->views(), 'by' => sprintf(__('By: %s', 'bxpress'), $topic->posterName()), 'last' => $lastpost, 'popular' => $topic->replies() >= $forum->hotThreshold(), 'sticky' => $topic->sticky(), 'pages' => $pages, 'tpages' => $tpages, 'approved' => $topic->approved(), 'closed' => $topic->status()));
    }
    $tpl->assign('forum', array('id' => $forum->id(), 'title' => $forum->name()));
    $tpl->assign('lang_topic', __('Topic', 'bxpress'));
    $tpl->assign('lang_replies', __('Replies', 'bxpress'));
    $tpl->assign('lang_views', __('Views', 'bxpress'));
    $tpl->assign('lang_lastpost', __('Last Post', 'bxpress'));
    $tpl->assign('lang_sticky', __('Sticky', 'bxpress'));
    $tpl->assign('lang_moderating', __('Moderating Forum', 'bxpress'));
    $tpl->assign('lang_pages', __('Pages', 'bxpress'));
    $tpl->assign('lang_move', __('Move', 'bxpress'));
    $tpl->assign('lang_open', __('Unlock', 'bxpress'));
    $tpl->assign('lang_close', __('Lock', 'bxpress'));
    $tpl->assign('lang_dosticky', __('Sticky', 'bxpress'));
    $tpl->assign('lang_dounsticky', __('Unsticky', 'bxpress'));
    $tpl->assign('lang_approved', __('Approved', 'bxpress'));
    $tpl->assign('lang_app', __('Approve', 'bxpress'));
    $tpl->assign('lang_noapp', __('Unapprove', 'bxpress'));
    $tpl->assign('lang_delete', __('Delete', 'bxpress'));
    $tpl->assign('lang_confirm', __('Do you really want to delete selected topics?', 'bxpress'));
    $tpl->assign('token_input', $xoopsSecurity->getTokenHTML());
    bXFunctions::makeHeader();
    RMTemplate::get()->add_xoops_style('style.css', 'bxpress');
    include 'footer.php';
}