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; }
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(); }
// -------------------------------------------------------------- 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; }
/** * @desc Aprueba o no un mensaje editado **/ function approvedPosts($app = 0) { global $xoopsUser, $xoopsSecurity; $posts = isset($_REQUEST['posts']) ? intval($_REQUEST['posts']) : 0; //Verifica que el mensaje sea válido if ($posts <= 0) { redirect_header('./topic.php?id=' . $posts, 1, __('Topic not valid!', 'bxpress')); die; } //Comprueba que el mensaje exista $post = new bXPost($posts); if ($post->isNew()) { redirect_header('./topic.php?id=' . $posts, 1, __('Post doesn\'t exists!', 'bxpress')); die; } //Comprueba si usuario es moderador del foro $forum = new bXForum($post->forum()); if (!$forum->isModerator($xoopsUser->uid()) || !$xoopsUser->isAdmin()) { redirect_header('./topic.php?id=' . $posts, 1, __('You don\'t have permission to do this action!', 'bxpress')); die; } if (!$xoopsSecurity->check()) { redirect_header('./topic.php?id=' . $posts, 2, __('Session token expired!', 'bxpress')); die; } $post->setApproved($app); if ($post->editText()) { $post->setText($post->editText()); } $post->setEditText(''); $post->save(); redirect_header('./topic.php?id=' . $post->topic(), 1, __('Operation completed!', 'bxpress')); }