예제 #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
/**
* @desc Realiza una búsqueda en el módulo desde EXM
*/
function bxpressSearch($queryarray, $andor, $limit, $offset, $userid = 0)
{
    global $myts, $module;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tbl1 = $db->prefix("mod_bxpress_topics");
    $tbl2 = $db->prefix("mod_bxpress_posts_text");
    $tbl3 = $db->prefix("mod_bxpress_posts");
    if ($userid <= 0) {
        $sql = "SELECT a.*,b.*,c.* FROM {$tbl1} a, {$tbl2} b, {$tbl3} c ";
        $sql1 = '';
        foreach ($queryarray as $k) {
            $sql1 .= ($sql1 == '' ? '' : " {$andor} ") . " (\n        \t    (a.title LIKE '%{$k}%' AND a.id_topic=c.id_topic) OR \n        \t     (b.post_text LIKE '%{$k}%' AND b.post_id=c.id_post))";
        }
        $sql .= $sql1 != '' ? "WHERE {$sql1}" : '';
        $sql .= $userid > 0 ? "GROUP BY c.id_topic" : " GROUP BY c.id_topic";
        $sql .= " ORDER BY c.post_time DESC LIMIT {$offset}, {$limit}";
        $result = $db->queryF($sql);
    } else {
        $sql = "SELECT a.*, b.*, c.post_text FROM {$tbl3} a, {$tbl1} b, {$tbl2} c WHERE a.uid='{$userid}' AND b.id_topic=a.id_topic \n                AND c.post_id=a.id_post ";
        $sql1 = '';
        foreach ($queryarray as $k) {
            $sql1 .= ($sql1 == '' ? 'AND ' : " {$andor} ") . "\n                b.title LIKE '%{$k}%' AND c.post_text LIKE '%{$k}%'";
        }
        $sql .= $sql1;
        $sql .= "ORDER BY a.post_time DESC\n                LIMIT {$offset}, {$limit}";
        $result = $db->query($sql);
    }
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $tc = TextCleaner::getInstance();
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $post = new bXPost();
        $post->assignVars($row);
        $rtn = array();
        $rtn['image'] = 'images/forum16.png';
        $rtn['link'] = $post->permalink();
        $rtn['title'] = $row['title'];
        $rtn['time'] = $row['post_time'];
        $rtn['uid'] = $row['uid'];
        $rtn['desc'] = substr($tc->clean_disabled_tags($row['post_text']), 0, 150) . '...';
        $ret[] = $rtn;
    }
    return $ret;
}
예제 #3
0
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();
}
예제 #4
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;
}
예제 #5
0
파일: index.php 프로젝트: petitours/bxpress
//Lista de Mensajes recientes
$tbl1 = $db->prefix('mod_bxpress_posts');
$tbl2 = $db->prefix('mod_bxpress_topics');
$tbl3 = $db->prefix('mod_bxpress_posts_text');
$tbl4 = $db->prefix('mod_bxpress_forums');
$sql = "SELECT a.*, b.*, c.post_text, d.* \n        FROM {$tbl1} a, {$tbl2} b, {$tbl3} c, {$tbl4} d \n        WHERE b.id_topic = a.id_topic AND c.post_id=a.id_post AND d.id_forum=b.id_forum\n        GROUP BY a.id_topic \n        ORDER BY a.post_time DESC \n        LIMIT 0,5";
$result = $db->query($sql);
$posts = array();
$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');