<?php if( !defined('RSSFIT_ROOT_PATH') ){ exit(); } class RssfitNewbbex{ var $dirname = 'newbbex'; var $modname; var $module; var $grab; function RssfitNewbbex(){ } function loadModule(){ $mod =& $GLOBALS['module_handler']->getByDirname($this->dirname); if( !$mod || !$mod->getVar('isactive') ){ return false; } $this->modname = $mod->getVar('name'); $this->module =& $mod; return $mod; } function &grabEntries(&$obj){ @include XOOPS_ROOT_PATH.'/modules/newbbex/include/functions.php'; global $xoopsDB; $xoopsModule =& $this->module; $myts =& MyTextSanitizer::getInstance(); $i = 0; $forum_handler =& xoops_getmodulehandler('forum', 'newbbex'); $topic_handler =& xoops_getmodulehandler('topic', 'newbbex'); $newbbConfig =& $GLOBALS['config_handler']->getConfigsByCat(0, $this->module->getVar('mid')); $access_forums = $forum_handler->getForums(0, 'access'); $available_forums = array(); foreach($access_forums as $forum){ if($topic_handler->getPermission($forum)) { $available_forums[$forum->getVar('forum_id')] = $forum; } } unset($access_forums); if( count($available_forums) > 0 ){ ksort($available_forums); $cond = ' AND t.forum_id IN ('.implode(',', array_keys($available_forums)).')'; unset($available_forums); $cond .= $newbbexConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; $cond .= $newbbexConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM '.$xoopsDB->prefix('xoops_bbex_posts').' p, '.$xoopsDB->prefix('xoops_bbex_forums').' f, '.$xoopsDB->prefix('xoops_bbex_topics').' t, '.$xoopsDB->prefix('xoops_bbex_text').' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id '.$cond.' ORDER BY p.post_time DESC'; $result = $xoopsDB->query($query, $this->grab); while( $row = $xoopsDB->fetchArray($result) ){ $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['fo rum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; $ret[$i]['title'] = $row['subject']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr']); $ret[$i]['category'] = $row['forum_name']; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; $i++; } } return $ret; } } ?>