} die; } elseif ($op == 'last') { $result = $db->query('SELECT MAX(id_post) FROM ' . $db->prefix('mod_bxpress_posts') . " WHERE id_topic='{$id}'"); list($lastid) = $db->fetchRow($result); if ($lastid) { header('Location: topic.php?pid=' . $lastid . '#p' . $lastid); exit; } } 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'])) {
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; }
/** * @desc Aprueba o no un tema **/ function approvedTopics($app = 0) { global $forum, $xoopsSecurity; $topics = isset($_REQUEST['topics']) ? $_REQUEST['topics'] : null; if (empty($topics) || is_array($topics) && empty($topics)) { redirect_header('moderate.php?id=' . $forum->id(), 2, __('Select at least one topic to moderate', 'bxpress')); die; } $topics = !is_array($topics) ? array($topics) : $topics; if (!$xoopsSecurity->check()) { redirect_header('moderate.php?id=' . $forum->id(), 2, __('Session token expired!', 'bxpress')); die; } $lastpost = false; foreach ($topics as $k) { $topic = new bXTopic($k); if ($topic->isNew()) { continue; } $lastapp = $topic->approved(); $topic->setApproved($app); $topic->save(); } //Actualizamos el último mensaje del foro $post = $forum->getLastPost(); $forum->setPostId($post); $forum->save(); redirect_header('moderate.php?id=' . $forum->id(), 1, __('Action completed!', 'bxpress')); }