コード例 #1
0
function bxpress_recents_show($options)
{
    $util = RMUtilities::get();
    $tc = TextCleaner::getInstance();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $xoopsModuleConfig = $util->module_config('exmbb');
    $mc = RMUtilities::module_config('bxpress');
    $tbl1 = $db->prefix('bxpress_posts');
    $tbl2 = $db->prefix('bxpress_topics');
    $tbl3 = $db->prefix('bxpress_posts_text');
    $tbl4 = $db->prefix('bxpress_forums');
    $sql = "SELECT MAX(id_post) AS id FROM {$tbl1} WHERE approved=1 GROUP BY id_topic ORDER BY MAX(id_post) DESC LIMIT 0,{$options['0']}";
    $result = $db->queryF($sql);
    $topics = array();
    $block = array();
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $post = new bXPost();
    $forum = new bXForum();
    $tf = new RMTimeFormatter(0, '%T%-%d%-%Y% at %h%:%i%');
    while ($row = $db->fetchArray($result)) {
        $post = new bXPost($row['id']);
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        $ret = array();
        $ret['id'] = $topic->id();
        $ret['post'] = $post->id();
        $ret['link'] = $post->permalink();
        if ($options[2]) {
            $ret['date'] = $tf->format($post->date());
        }
        if ($options[3]) {
            $ret['poster'] = sprintf(__('Posted by: %s', 'bxpress'), "<a href='" . $post->permalink() . "'>" . $post->uname() . "</a>");
        }
        $ret['title'] = $topic->title();
        if ($options[4]) {
            $ret['text'] = $tc->clean_disabled_tags($post->text());
        }
        $ret['forum'] = array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink());
        $topics[] = $ret;
    }
    // Opciones
    $block['showdates'] = $options[2];
    $block['showuname'] = $options[3];
    $block['showtext'] = $options[4];
    $block['topics'] = $topics;
    $block['lang_topic'] = __('Topic', 'bxpress');
    $block['lang_date'] = __('Date', 'bxpress');
    $block['lang_poster'] = __('Poster', 'bxpress');
    return $block;
}
コード例 #2
0
ファイル: bxpress-topics.php プロジェクト: petitours/bxpress
function bxpress_block_topics_show($options)
{
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $mc = RMSettings::module_settings('bxpress');
    $tbl1 = $db->prefix('mod_bxpress_posts');
    $tbl2 = $db->prefix('mod_bxpress_topics');
    $tbl3 = $db->prefix('mod_bxpress_likes');
    $tbl4 = $db->prefix('mod_bxpress_forums');
    // Calculate period of time
    if (0 < $options['days']) {
        $period = time() - $options['days'] * 86400;
    }
    $order = 'DESC' == $options['order'] ? 'DESC' : 'ASC';
    $sql = "SELECT topics.*, forums.name,\n                (SELECT SUM(likes) FROM {$tbl1} WHERE id_topic=topics.id_topic) as likes,\n                (SELECT post_time FROm {$tbl1} WHERE id_topic=topics.id_topic ORDER BY post_time DESC LIMIT 0, 1) as updated\n                FROM {$tbl2} as topics, {$tbl4} as forums WHERE ";
    if (0 < $options['days']) {
        $sql .= " topics.date > {$period} AND ";
    }
    $sql .= "forums.id_forum=topics.id_forum";
    if ('recent' == $options['type']) {
        $sql .= " ORDER BY topics.id_topic {$order} LIMIT 0, {$options['limit']}";
    } elseif ('hot' == $options['type']) {
        $sql .= " ORDER BY topics.replies {$order} LIMIT 0, {$options['limit']}";
    } elseif ('hits' == $options['type']) {
        $sql .= " ORDER BY topics.views {$order} LIMIT 0, {$options['limit']}";
    }
    $result = $db->queryF($sql);
    $topics = array();
    $block = array();
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $topic = new bXTopic();
    $forum = new bXForum();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y%');
    while ($row = $db->fetchArray($result)) {
        $topic->assignVars($row);
        $forum->assignVars(array('id_forum' => $topic->forum()));
        $ret = array('id' => $topic->id(), 'title' => $topic->title, 'link' => $topic->permalink(), 'likes' => $topic->likes, 'replies' => $topic->replies, 'hits' => $topic->views, 'forum' => array('name' => $row['name'], 'id' => $row['id_forum'], 'link' => $forum->permalink()), 'time' => $topic->date, 'date' => $tf->ago($topic->date), 'likes' => $row['likes'], 'updated' => 'full' == $options['format'] ? sprintf(__('Updated on %s', 'bxpress'), $tf->format($row['updated'])) : $tf->ago($row['updated']));
        $topics[] = $ret;
    }
    $block['topics'] = $topics;
    $block['format'] = $options['format'];
    // Add css styles
    RMTemplate::get()->add_style('bxpress-blocks.min.css', 'bxpress');
    return $block;
}
コード例 #3
0
ファイル: notification.php プロジェクト: petitours/bxpress
/**
* @desc Genera los datos para el envio de las notificaciones
* @param string I de la categoría
* @param int Id del elemento
* @param string Id del Evento generado
* @param array Parámetros adicionales
* @return string
*/
function bxNotifications($category, $id, $event, $params = array())
{
    $bxf = bXFunctions::get();
    if ($category == 'forum') {
        //Notificación de nuevo tema en foro
        if ($event == 'newtopic') {
            $forum = new bXForum($id);
            $info['name'] = $forum->name();
            $info['url'] = $bxf->url() . "/topic.php?id={$params['topic']}";
            //$info['desc']=$param['topic'];
            return $info;
        }
        //Notificación de nuevo mensaje en foro
        if ($event == 'postforum') {
            $forum = new bXForum($id);
            $info['name'] = $forum->name();
            $info['url'] = $bxf->url() . "/topic.php?pid={$params['post']}#p{$params['post']}";
            //$info['desc']=$param['topic'];
            return $info;
        }
    }
    //Notificación de nuevo mensaje en tema
    if ($category == 'topic') {
        $topic = new bXTopic($id);
        $info['name'] = $topic->title();
        $info['url'] = $bxf->url() . "/topic.php?pid={$params['post']}#p{$params['post']}";
        //$info['desc']=$param['topic'];
        return $info;
    }
    //Notificación de mensaje en cualquier foro
    if ($category == 'any_forum') {
        $forum = new bXForum($params['forum']);
        $info['name'] = $forum->name();
        $info['url'] = $bxf->url() . "/topic.php?pid={$params['post']}#p{$params['post']}";
        //$info['desc']=$param['topic'];
        return $info;
    }
}
コード例 #4
0
ファイル: reports.php プロジェクト: petitours/bxpress
function showReports()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity;
    //Indica la lista a mostrar
    $show = isset($_REQUEST['show']) ? intval($_REQUEST['show']) : '0';
    //$show = 0 Muestra todos los reportes
    //$show = 1 Muestra los reportes revisados
    //$show = 2 Muestra los reportes no revisados
    define('RMCSUBLOCATION', $show == 0 ? 'allreps' : ($show == 1 ? 'reviews' : 'noreviewd'));
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Lista de Todos los reportes
    $sql = "SELECT * FROM " . $db->prefix('mod_bxpress_report') . ($show ? $show == 1 ? " WHERE zapped=1" : " WHERE zapped=0 " : '') . " ORDER BY report_time DESC";
    $result = $db->queryF($sql);
    $reports = array();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y% %h%:%i%:%s%');
    while ($rows = $db->fetchArray($result)) {
        $report = new bXReport();
        $report->assignVars($rows);
        $user = new XoopsUser($report->user());
        $post = new bXPost($report->post());
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        if ($report->zappedBy() > 0) {
            $zuser = new XoopsUser($report->zappedBy());
        }
        $reports[] = array('id' => $report->id(), 'post' => array('link' => $post->permalink(), 'id' => $report->post()), 'user' => $user->uname(), 'uid' => $user->uid(), 'date' => $tf->format($report->time()), 'report' => $report->report(), 'forum' => array('link' => $forum->permalink(), 'name' => $forum->name()), 'topic' => array('link' => $topic->permalink(), 'title' => $topic->title()), 'zapped' => $report->zapped(), 'zappedby' => $report->zappedby() > 0 ? array('uid' => $zuser->uid(), 'name' => $zuser->uname()) : '', 'zappedtime' => $report->zappedtime() > 0 ? $tf->format($report->zappedtime()) : '');
    }
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'bxpress');
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/introduccion/standalone/1/');
    RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress'));
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Reports management', 'bxpress'));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/forums-reports.php', 'module', 'bxpress');
    xoops_cp_footer();
}
コード例 #5
0
ファイル: delete.php プロジェクト: petitours/bxpress
// License: GPL 2.0
// --------------------------------------------------------------
include '../../mainfile.php';
$ok = isset($_POST['ok']) ? $_POST['ok'] : 0;
// Id del Post
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
if ($id <= 0) {
    redirect_header('./', 2, __('Please specify a post id to delete!', 'bxpress'));
    die;
}
$post = new bXPost($id);
if ($post->isNew()) {
    redirect_header('./', 2, __('Specified post does not exists!', 'bxpress'));
    die;
}
$topic = new bXTopic($post->topic());
$forum = new bXForum($post->forum());
// Verificamos que el usuario tenga permiso
if (!$xoopsUser || !$forum->isAllowed($xoopsUser->getGroups(), 'delete')) {
    redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('Sorry, you don\'t have permission to do this action!', 'bxpress'));
    die;
}
// Verificamos si el usuario tiene permiso de eliminación para el post
if ($xoopsUser->uid() != $post->user() && (!$xoopsUser->isAdmin() && !$forum->isModerator($xoopsUser->uid()))) {
    redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('Sorry, you don\'t have permission to do this action!', 'bxpress'));
    die;
}
if ($ok) {
    if (!$xoopsSecurity->check()) {
        redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('Session token expired!', 'bxpress'));
        die;
コード例 #6
0
ファイル: topic.php プロジェクト: petitours/bxpress
        header('Location: topic.php?id=' . $id . '&op=last');
    }
    die;
} elseif ($op == 'last') {
    $result = $db->query('SELECT MAX(id_post) FROM ' . $db->prefix('mod_bxpress_posts') . " WHERE id_topic='{$id}'");
    list($lastid) = $db->fetchRow($result);
    if ($lastid) {
        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;
}
コード例 #7
0
ファイル: rss.php プロジェクト: petitours/bxpress
        $rss_channel['title'] = $xoopsModule->name();
        $rss_channel['link'] = XOOPS_URL . ($config->urlmode ? $config->htbase : '/modules/bxpress');
        $rss_channel['description'] = __('All recent messages posted on forum', 'bxpress');
        $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss');
        $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['category'] = 'Forum';
        $rss_channel['generator'] = 'Common Utilities';
        $rss_channel['language'] = RMCLANG;
        $sql = "SELECT * FROM {$tbl1} WHERE approved=1 ORDER BY post_time DESC LIMIT 0,50";
        $result = $db->queryF($sql);
        $topics = array();
        $block = array();
        $post = new bXPost();
        $forum = new bXForum();
        $tf = new RMTimeFormatter(0, '%T%-%d%-%Y% at %h%:%i%');
        while ($row = $db->fetchArray($result)) {
            $post = new bXPost();
            $post->assignVars($row);
            $topic = new bXTopic($post->topic());
            $forum = new bXForum($post->forum());
            $item = array();
            $item['title'] = sprintf(__('Posted on: %s :: %s'), $topic->title(), $forum->name());
            $item['link'] = $post->permalink();
            $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($post->text(), ENT_QUOTES));
            $item['pubdate'] = formatTimestamp($post->date(), 'rss');
            $item['guid'] = $post->permalink();
            $rss_items[] = $item;
        }
        break;
}
コード例 #8
0
ファイル: bxforum.class.php プロジェクト: petitours/bxpress
 /**
  * @desc Elimina un foro junto con sus temas y mensajes
  */
 public function delete()
 {
     $sql = "SELECT * FROM " . $this->db->prefix("mod_bxpress_topics") . " WHERE id_forum='" . $this->id() . "'";
     $result = $this->db->query($sql);
     while ($row = $this->db->fetchArray($result)) {
         $topic = new bXTopic();
         $topic->assignVars($row);
         $topic->delete();
     }
     return $this->deleteFromTable();
 }
コード例 #9
0
ファイル: post.php プロジェクト: laiello/bitcero-modules
if (!$forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, $fid > 0 ? 'topic' : 'reply')) {
    redirect_header($retlink, 2, __('You do not have permission to do this!', 'bxpress'));
    die;
}
switch ($op) {
    case 'post':
        foreach ($_POST as $k => $v) {
            ${$k} = $v;
        }
        if (!$xoopsSecurity->check()) {
            redirect_header('./' . ($create ? 'forum.php?id=' . $forum->id() : 'topic.php?id=' . $topic->id()), 2, __('Session token expired!', 'bxpress'));
            die;
        }
        $myts =& MyTextSanitizer::getInstance();
        if ($create) {
            $topic = new bXTopic();
            $topic->setApproved($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'approve'));
            $topic->setDate(time());
            $topic->setForum($forum->id());
            $topic->setPoster($xoopsUser ? $xoopsUser->uid() : 0);
            $topic->setPosterName($xoopsUser ? $xoopsUser->uname() : $name);
            $topic->setRating(0);
            $topic->setReplies(0);
            $topic->setStatus(0);
            if ($xoopsUser && $xoopsModuleConfig['sticky']) {
                $csticky = $xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()) || $xoopsUser->posts() > $xoopsModuleConfig['sticky_posts'];
                if ($sticky) {
                    $topic->sticky(isset($sticky) ? $sticky : 0);
                }
            } else {
                $topic->setSticky(0);
コード例 #10
0
ファイル: report.php プロジェクト: laiello/bitcero-modules
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
include '../../mainfile.php';
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
if ($op == 'report') {
    $xoopsOption['template_main'] = 'bxpress_report.html';
    $xoopsOption['module_subpage'] = "report";
    include 'header.php';
    bXFunctions::makeHeader();
    //Id de mensaje
    $pid = isset($_REQUEST['pid']) ? intval($_REQUEST['pid']) : 0;
    $post = new bXPost($pid);
    $forum = new bXForum($post->forum());
    $topic = new bXTopic($post->topic());
    $form = new RMForm(__('Report Post', 'bxpress'), 'formrep', 'report.php');
    $form->styles('width: 30%;', 'odd');
    $form->addElement(new RMFormEditor(__('Your reasons to report this post', 'bxpress'), 'report', '90%', '300px', '', 'textarea'), true);
    $form->addElement(new RMFormHidden('op', 'savereport'));
    $form->addElement(new RMFormHidden('pid', $pid));
    $form->addElement(new RMFormHidden('id', $topic->id()));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', _SUBMIT, 'submit');
    $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="history.go(-1);"');
    $form->addElement($buttons);
    $tpl->assign('report_contents', $form->render());
    $tpl->assign('forumtitle', $forum->name());
    $tpl->assign('topictitle', $topic->title());
    $tpl->assign('forumid', $forum->id());
    $tpl->assign('topicid', $topic->id());
コード例 #11
0
ファイル: edit.php プロジェクト: laiello/bitcero-modules
// License: GPL 2.0
// --------------------------------------------------------------
define('BB_LOCATION', 'posts');
include '../../mainfile.php';
$op = rmc_server_Var($_REQUEST, 'op', '');
$id = rmc_server_Var($_REQUEST, 'id', 0);
if ($id <= 0) {
    redirect_header('./', 2, __('No post has been specified!', 'bxpress'));
    die;
}
$post = new bXPost($id);
if ($post->isNew()) {
    redirect_header('./', 2, __('Specified post does not exists!', 'bxpress'));
    die;
}
$topic = new bXTopic($post->topic());
$forum = new bXForum($topic->forum());
// Verificamos si el usuario tiene permisos de edición en el foro
if (!$xoopsUser || !$forum->isAllowed($xoopsUser->getGroups(), 'edit')) {
    redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('You don\'t have permission to edit this post!', 'bxpress'));
    die;
}
// Verificamos si el usuario tiene permiso de edición para el post
if ($xoopsUser->uid() != $post->user() && (!$xoopsUser->isAdmin() && !$forum->isModerator($xoopsUser->uid()))) {
    redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('You don\'t have permission to edit this post!', 'bxpress'));
    die;
}
switch ($op) {
    case 'post':
        foreach ($_POST as $k => $v) {
            ${$k} = $v;
コード例 #12
0
ファイル: forum.php プロジェクト: laiello/bitcero-modules
    $rest = $pactual - $tpages;
    $pactual = $pactual - $rest + 1;
    $start = ($pactual - 1) * $limit;
}
if ($tpages > 0) {
    $nav = new RMPageNav($num, $limit, $pactual);
    $nav->target_url($forum->permalink() . '&amp;pag={PAGE_NUM}');
    $tpl->assign('itemsNavPage', $nav->render(false));
}
$sql = str_replace("COUNT(*)", '*', $sql);
$sql .= " ORDER BY sticky DESC,";
$sql .= $xoopsModuleConfig['order_post'] ? " last_post " : " date ";
$sql .= " 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'] = 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) {
コード例 #13
0
ファイル: moderate.php プロジェクト: laiello/bitcero-modules
/**
* @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'));
}
コード例 #14
0
ファイル: index.php プロジェクト: petitours/bxpress
$topics = array();
$topic = new bXTopic();
$forum = new bXForum();
$pt = new bXPost();
while ($row = $db->fetchArray($result)) {
    //print_r($row);
    $pt->assignVars($row);
    $post = array('id' => $row['last_post'], 'date' => sprintf(__('Last post on %s', 'bxpress'), bXFunctions::formatDate($row['post_time'])), 'by' => sprintf(__('By %s', 'bxpress'), $row['poster_name']), 'link' => $pt->permalink(), 'uid' => $row['uid']);
    $topic->assignVars($row);
    $forum->assignVars($row);
    $topics[] = array('id' => $row['id_topic'], 'title' => $row['title'], 'post' => $post, 'link' => $topic->permalink(), 'forum' => array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink()));
}
$sql = "SELECT * FROM {$tbl2} ORDER BY replies DESC LIMIT 0,5";
$result = $db->query($sql);
$poptops = array();
$topic = new bXTopic();
while ($row = $db->fetchArray($result)) {
    $topic->assignVars($row);
    $forum->assignVars($row);
    $poptops[] = array('id' => $topic->id(), 'title' => $topic->title(), 'date' => sprintf(__('Created on %s', 'bxpress'), bXFunctions::formatDate($row['date'])), 'replies' => $topic->replies(), 'link' => $topic->permalink(), 'forum' => array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink()));
}
unset($post, $pt, $topic, $result, $row, $sql, $tbl1, $tbl2, $tbl3);
RMTemplate::get()->add_style('dashboard.css', 'bxpress');
RMTemplate::get()->add_script('dashboard.js', 'bxpress');
RMTemplate::get()->add_help('Ayuda de bXpress', 'http://www.xoopsmexico.net/docs/bxpress-forums/dashboard/standalone/1/');
// Activity
// 30 Days
$ago = strtotime("-30 days");
$sql = "SELECT id_post,post_time,id_forum FROM " . $db->prefix("mod_bxpress_posts") . " WHERE post_time>={$ago} ORDER BY post_time ASC";
$result = $db->query($sql);
$posts = array();
コード例 #15
0
 public function object_data($event)
 {
     include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
     include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
     switch ($event->event) {
         case 'reply':
             // Get topic
             $topic = new bXTopic($event->params);
             if ($topic->isNew()) {
                 return null;
             }
             $ret = array('name' => $topic->title(), 'link' => $topic->permalink());
             break;
         case 'newtopic':
         case 'forum-newpost':
             // Get forum
             $forum = new bXForum($event->params);
             if ($forum->isNew()) {
                 return null;
             }
             $ret = array('name' => $forum->name(), 'link' => $forum->permalink());
             break;
     }
     return $ret;
 }
コード例 #16
0
ファイル: forum.php プロジェクト: petitours/bxpress
if ($tpages > 0) {
    $nav = new RMPageNav($num, $limit, $pactual);
    $nav->target_url($forum->permalink() . '&amp;pag={PAGE_NUM}');
    $tpl->assign('itemsNavPage', $nav->render(false));
}
$sql = str_replace("COUNT(*)", '*', $sql);
$sql .= " ORDER BY sticky DESC,";
$sql .= $xoopsModuleConfig['order_post'] ? " last_post " : " date ";
$sql .= " DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
/**
 * Posters cache
 */
$posters = array();
while ($row = $db->fetchArray($result)) {
    $topic = new bXTopic();
    $topic->assignVars($row);
    $last = new bXPost($topic->lastPost());
    if (!isset($posters[$topic->poster])) {
        $posters[$topic->poster] = new RMUser($topic->poster);
    }
    if (!isset($posters[$last->uid])) {
        $posters[$last->uid] = new RMUser($last->uid);
    }
    $poster = $posters[$topic->poster];
    $last_poster = $posters[$last->uid];
    $lastpost = array();
    if (!$last->isNew()) {
        $lastpost['date'] = formatTimeStamp($last->date(), __('M d, Y'));
        $lastpost['time'] = $last->date();
        $lastpost['id'] = $last->id();
コード例 #17
0
ファイル: topic.php プロジェクト: laiello/bitcero-modules
        header('Location: topic.php?id=' . $id . '&op=last');
    }
    die;
} elseif ($op == 'last') {
    $result = $db->query('SELECT MAX(id_post) FROM ' . $db->prefix('bxpress_posts') . " WHERE id_topic='{$id}'");
    list($lastid) = $db->fetchRow($result);
    if ($lastid) {
        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;
}