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; }
/** * @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; } }
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(); }
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; }
$topic->save(); $_SESSION['topics_viewed'] = array(); $_SESSION['topics_viewed'][] = $topic->id(); } else { if (!in_array($topic->id(), $_SESSION['topics_viewed'])) { $topic->addView(); $topic->save(); $_SESSION['topics_viewed'][] = $topic->id(); } } $xoopsOption['template_main'] = "bxpress-topic.tpl"; $xoopsOption['module_subpage'] = "topics"; include 'header.php'; bXFunctions::makeHeader(); $tpl->assign('forum', array('id' => $forum->id(), 'title' => $forum->name(), 'moderator' => $xoopsUser ? $forum->isModerator($xoopsUser->uid()) || $xoopsUser->isAdmin() : false)); $tpl->assign('topic', array('id' => $topic->id(), 'title' => $topic->title(), 'closed' => $topic->status(), 'sticky' => $topic->sticky(), 'approved' => $topic->approved())); if ($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'reply')) { if ($topic->status()) { $canreply = $xoopsUser ? $forum->isModerator($xoopsUser->uid()) || $xoopsUser->isAdmin() : 0; } else { $canreply = true; } if ($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'topic')) { $tpl->assign('lang_newtopic', __('New Topic', 'bxpress')); $tpl->assign('can_topic', 1); } $tpl->assign('can_reply', $canreply); $tpl->assign('lang_reply', __('Reply', 'bxpress')); $tpl->assign('lang_approved', __('Approved', 'bxpress')); $tpl->assign('lang_noapproved', __('Not approved', '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; }
$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'));
$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()); $tpl->assign('report', __('Report Post', 'bxpress')); include 'footer.php'; } elseif ($op == 'savereport') { foreach ($_POST as $k => $v) { ${$k} = $v; } //Verificamos que el mensaje sea válido if ($pid <= 0) { redirect_header('./topic.php?id=' . $id, 1, __('Sepecified post is not valid!', 'bxpress')); die; } //Comprobamos que el mensaje exista $post = new bXPost($pid);
$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')) {
/** * @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() . '&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'; }
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(); $forums = array(); $p = ''; while ($row = $db->fetchArray($result)) { $ds = date("d-M-Y", $row['post_time']);