$categos = bXCategoryHandler::getObjects(1); foreach ($categos as $catego) { if (!$catego->groupAllowed($xoopsUser ? $xoopsUser->getGroups() : array(0, XOOPS_GROUP_ANONYMOUS))) { continue; } $forums = bXForumHandler::getForums($catego->id(), $xoopsModuleConfig['show_inactive'] ? -1 : 1, true); $tpl->append('categos', array('id' => $catego->id(), 'title' => $catego->title(), 'forums' => forums_data($forums))); } } else { /** * Cargamos solo los foros */ $xoopsOption['template_main'] = 'bxpress-index-forums.tpl'; $xoopsOption['module_subpage'] = "index"; include 'header.php'; $fHand = new bXForumHandler(); $forums = $fHand->getForums(0, $xoopsModuleConfig['show_inactive'] ? -1 : 1, true); $posters = array(); $tpl->assign('forums', forums_data($forums)); } $user = bXFunctions::getLastUser(); if ($user) { $tpl->assign('user', array('id' => $user->uid(), 'uname' => $user->uname())); } unset($user); // Usuarios Conectados $tpl->assign('register_num', bXFunctions::getOnlineCount(1)); $tpl->assign('anonymous_num', bXFunctions::getOnlineCount(0)); $tpl->assign('total_users', bXFunctions::totalUsers()); $tpl->assign('total_topics', bXFunctions::totalTopics()); $tpl->assign('total_posts', bXFunctions::totalPosts());
$lastpost['new'] = time() - $last->date() <= $xoopsModuleConfig['time_new']; } } $ret[] = array('id' => $forum->id(), 'idname' => $forum->friendName(), 'name' => $forum->name(), 'desc' => $forum->description(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'link' => $forum->makeLink(1), 'last' => $lastpost); } unset($forums); $tpl->append('categos', array('id' => $catego->id(), 'title' => $catego->title(), 'forums' => $ret)); } } else { /** * Cargamos solo los foros */ $xoopsOption['template_main'] = 'bxpress_index_forums.html'; $xoopsOption['module_subpage'] = "index"; include 'header.php'; $fHand = new bXForumHandler(); $forums = $fHand->getForums(0, 1, true); foreach ($forums as $forum) { $last = new bXPost($forum->lastPostId()); $lastpost = array(); if (!$last->isNew()) { $lastpost['date'] = bXFunctions::formatDate($last->date()); $lastpost['by'] = sprintf(__('by %s', 'bxpress'), $last->uname()); $lastpost['id'] = $last->id(); $lastpost['topic'] = $last->topic(); 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']; } }