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 bxpress_block_topics_show($options) { $db = XoopsDatabaseFactory::getDatabaseConnection(); $mc = RMSettings::module_settings('bxpress'); $tbl1 = $db->prefix('mod_bxpress_posts'); $tbl2 = $db->prefix('mod_bxpress_topics'); $tbl3 = $db->prefix('mod_bxpress_likes'); $tbl4 = $db->prefix('mod_bxpress_forums'); // Calculate period of time if (0 < $options['days']) { $period = time() - $options['days'] * 86400; } $order = 'DESC' == $options['order'] ? 'DESC' : 'ASC'; $sql = "SELECT topics.*, forums.name,\n (SELECT SUM(likes) FROM {$tbl1} WHERE id_topic=topics.id_topic) as likes,\n (SELECT post_time FROm {$tbl1} WHERE id_topic=topics.id_topic ORDER BY post_time DESC LIMIT 0, 1) as updated\n FROM {$tbl2} as topics, {$tbl4} as forums WHERE "; if (0 < $options['days']) { $sql .= " topics.date > {$period} AND "; } $sql .= "forums.id_forum=topics.id_forum"; if ('recent' == $options['type']) { $sql .= " ORDER BY topics.id_topic {$order} LIMIT 0, {$options['limit']}"; } elseif ('hot' == $options['type']) { $sql .= " ORDER BY topics.replies {$order} LIMIT 0, {$options['limit']}"; } elseif ('hits' == $options['type']) { $sql .= " ORDER BY topics.views {$order} LIMIT 0, {$options['limit']}"; } $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'; $topic = new bXTopic(); $forum = new bXForum(); $tf = new RMTimeFormatter(0, '%T% %d%, %Y%'); while ($row = $db->fetchArray($result)) { $topic->assignVars($row); $forum->assignVars(array('id_forum' => $topic->forum())); $ret = array('id' => $topic->id(), 'title' => $topic->title, 'link' => $topic->permalink(), 'likes' => $topic->likes, 'replies' => $topic->replies, 'hits' => $topic->views, 'forum' => array('name' => $row['name'], 'id' => $row['id_forum'], 'link' => $forum->permalink()), 'time' => $topic->date, 'date' => $tf->ago($topic->date), 'likes' => $row['likes'], 'updated' => 'full' == $options['format'] ? sprintf(__('Updated on %s', 'bxpress'), $tf->format($row['updated'])) : $tf->ago($row['updated'])); $topics[] = $ret; } $block['topics'] = $topics; $block['format'] = $options['format']; // Add css styles RMTemplate::get()->add_style('bxpress-blocks.min.css', '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(); }
/** * @desc Obtiene los foros ordenados en padres e hijos * @param array $retorno Referencia al arreglo que se llenará * @param int $parent Id del foro en el cual se empiezan a buscar hijos * @param int $category Id de la categoria. 0 Indica todas * @param int $saltos Número de saltos que se asignarán al nivel actual * @param int $activo -1 devuelve todos los foros, 0 solo los inactivos y 1 solo activos * @param bool $object Indica si se devueven los objetos bXForum */ private function getForumsTree($retorno, $parent = 0, $category = 0, $saltos = 0, $active = -1, $object = false) { $sql = "SELECT * FROM {$this->table} WHERE `parent`='{$parent}'" . ($active > -1 ? " AND active='{$active}' " : '') . ($category > 0 ? " AND cat='{$category}' " : '') . " ORDER BY `cat`,`order`"; $result = $this->db->queryF($sql); while ($row = $this->db->fetchArray($result)) { if ($object) { $forum = new bXForum(); $forum->assignVars($row); $retorno[] =& $forum; } else { $retorno[] = $row; } $this->getForumsTree($retorno, $row['id_forum'], $category, $saltos + 1, $active, $object); } }
// -------------------------------------------------------------- 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; }
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; }
public function forumList($varname = 'forums', $assign = true) { global $db, $tpl; $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mod_bxpress_forums") . " WHERE active='1' ORDER BY cat,`order`"; $result = $db->query($sql); $forums = array(); while ($row = $db->fetchArray($result)) { $forum = new bXForum(); $forum->assignVars($row); $forums[] = array('id' => $forum->id(), 'title' => $forum->name()); } if ($assign) { $tpl->assign($varname, $forums); } else { return $forums; } }
if ($id == '') { redirect_header('./', 2, __('Specified topic is not valid!', 'bxpress')); die; } $topic = new bXTopic($id); if ($topic->isNew()) { redirect_header('./', 2, __('Specified topic does not exists!', 'bxpress')); die; } //Determinamos de el mensaje esta aprobado y si el usuario es administrador o moderador $forum = new bXForum($topic->forum()); if (!$topic->approved() && (!$xoopsUser->isAdmin() || !$forum->isModerator($xoopsUser->uid()))) { redirect_header('./', 2, __('This topic has not been approved yet!', 'bxpress')); die; } $forum = new bXForum($topic->forum()); if (!$forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'view')) { redirect_header('./', 2, __('Sorry, you don\'t have permission to view this forum!', 'bxpress')); die; } if (!isset($_SESSION['topics_viewed'])) { $topic->addView(); $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(); }
/** * @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')); }
public function delete() { foreach ($this->getPosts() as $post) { $post->delete(); } $forum = new bXForum($this->forum()); $forum->setTopics($forum->topics() - 1 > 0 ? $forum->topics() - 1 : 0); $forum->save(); return $this->deleteFromTable(); }
$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; }
// Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- define('RMCLOCATION', 'forum'); include '../../mainfile.php'; $xoopsOption['template_main'] = "bxpress_forum.html"; $xoopsOption['module_subpage'] = "forums"; include 'header.php'; $myts =& MyTextSanitizer::getInstance(); $id = isset($_GET['id']) ? $myts->addSlashes($_GET['id']) : ''; if ($id == '') { redirect_header(BB_URL, 2, __('No forum ID has been specified', 'bxpress')); die; } $forum = new bXForum($id); if ($forum->isNew()) { redirect_header(BB_URL, 2, __('Specified forum does not exists!', 'bxpress')); die; } /** * Comprobamos que el usuario actual tenga permisos * de acceso al foro */ if (!$forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : array(0, XOOPS_GROUP_ANONYMOUS), BXPRESS_PERM_VIEW) && !$xoopsUser->isAdmin()) { redirect_header(BB_URL, 2, __('You are not allowed to view this forum!', 'bxpress')); die; } /** * Cargamos los temas */
// Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- define('RMCLOCATION', 'forum'); include '../../mainfile.php'; $xoopsOption['template_main'] = "bxpress-forum.tpl"; $xoopsOption['module_subpage'] = "forums"; include 'header.php'; $myts =& MyTextSanitizer::getInstance(); $id = isset($_GET['id']) ? $myts->addSlashes($_GET['id']) : ''; if ($id == '') { redirect_header(BB_URL, 2, __('No forum ID has been specified', 'bxpress')); die; } $forum = new bXForum($id); if ($forum->isNew()) { redirect_header(BB_URL, 2, __('Specified forum does not exists!', 'bxpress')); die; } /** * Check if module is inactive */ $isModerator = $xoopsUser && ($xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid())); if (!$forum->active && !$isModerator) { RMUris::redirect_with_message(__('This forum is closed and you don\'t have permissions to view it', 'bxpress'), BX_URL, RMMSG_WARN); } /** * Comprobamos que el usuario actual tenga permisos * de acceso al foro */
// Days running $sql = "SELECT post_time FROM " . $db->prefix("mod_bxpress_posts") . ' ORDER BY post_time ASC LIMIT 0, 1'; list($daysnum) = $db->fetchRow($db->query($sql)); $daysnum = time() - $daysnum; $daysnum = ceil($daysnum / 86400); //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);
public function forumList($varname = 'forums') { global $db, $tpl; $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("bxpress_forums") . " WHERE active='1' ORDER BY cat,`order`"; $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $forum = new bXForum(); $forum->assignVars($row); $tpl->append($varname, array('id' => $forum->id(), 'title' => $forum->name())); } }
$tid = isset($_REQUEST['tid']) ? intval($_REQUEST['tid']) : 0; if ($fid <= 0 && $tid <= 0) { redirect_header('./', 2, __('You must specify a forum in order to create a new topic!', 'bxpress')); die; } if ($fid > 0) { $forum = new bXForum($fid); $retlink = './forum.php?id=' . $forum->id(); $create = true; } else { $topic = new bXTopic($tid); if ($topic->isNew()) { redirect_header('./', 2, __('Specified topic does not exists!', 'bxpress')); die; } $forum = new bXForum($topic->forum()); $retlink = './topic.php?id=' . $topic->id(); $create = false; } if ($forum->isNew()) { redirect_header('./', 2, __('Specified forum does not exists!', 'bxpress')); die; } if (!$forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, $fid > 0 ? 'topic' : 'reply')) { redirect_header($retlink, 2, __('You do not have permission to do this!', 'bxpress')); die; } switch ($op) { case 'post': foreach ($_POST as $k => $v) { ${$k} = $v;
/** * @desc Almacena los usuarios moderadores **/ function bx_save_moderators() { global $xoopsSecurity; if (!$xoopsSecurity->check()) { redirectMsg('forums.php', __('Session token expired!', 'bxpress'), 1); die; } foreach ($_POST as $k => $v) { ${$k} = $v; } //Verificamos si el foro es válido if ($id <= 0) { redirectMsg('forums.php', __('A forum ID has not been provided!', 'bxpress'), 1); die; } //Comprobamos que el foro exista $forum = new bXForum($id); if ($forum->isNew()) { redirectMsg('forums.php', __('Sepecified forum does not exists!', 'bxpress'), 1); die; } $forum->setModerators($users); if ($forum->save()) { redirectMsg('forums.php', __('Moderator saved successfully!', 'bxpress'), 0); } else { redirectMsg('forums.php', __('Moderators could not be saved!', 'bxpress') . '<br />' . $forum->errors(), 1); } }
// An simple forums module for XOOPS and Common Utilities // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- include '../../mainfile.php'; $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; if ($op == 'report') { $xoopsOption['template_main'] = 'bxpress_report.html'; $xoopsOption['module_subpage'] = "report"; include 'header.php'; bXFunctions::makeHeader(); //Id de mensaje $pid = isset($_REQUEST['pid']) ? intval($_REQUEST['pid']) : 0; $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());
// -------------------------------------------------------------- define('BB_LOCATION', 'posts'); include '../../mainfile.php'; $op = rmc_server_Var($_REQUEST, 'op', ''); $id = rmc_server_Var($_REQUEST, 'id', 0); if ($id <= 0) { redirect_header('./', 2, __('No post has been specified!', '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($topic->forum()); // Verificamos si el usuario tiene permisos de edición en el foro if (!$xoopsUser || !$forum->isAllowed($xoopsUser->getGroups(), 'edit')) { redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('You don\'t have permission to edit this post!', 'bxpress')); die; } // Verificamos si el usuario tiene permiso de edición para el post if ($xoopsUser->uid() != $post->user() && (!$xoopsUser->isAdmin() && !$forum->isModerator($xoopsUser->uid()))) { redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('You don\'t have permission to edit this post!', 'bxpress')); die; } switch ($op) { case 'post': foreach ($_POST as $k => $v) { ${$k} = $v; }