public function eventRmcommonGetFeedsList($feeds) { load_mod_locale('bxpress'); include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php'; include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php'; $module = RMModules::load_module('bxpress'); $config = RMSettings::module_settings('bxpress'); $url = XOOPS_URL . '/' . ($config->urlmode ? $config->htbase : 'modules/bxpress') . '/'; $bxFunc = new bXFunctions(); $data = array('title' => $module->name(), 'url' => $url, 'module' => 'bxpress'); $options[] = array('title' => __('All Recent Messages', 'bxpress'), 'params' => 'show=all', 'description' => __('Show all recent messages', 'bxpress')); $forums = $bxFunc->forumList('', false); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($forums as $forum) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=bxpress&show=forum&forum=' . $forum['id'] . '">' . $forum['title'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Posts by forum', 'bxpress'), 'description' => __('Select a forum to see the messages posted recently.', 'bxpress') . ' <a href="javascript:;" onclick="$(\'#bxforums-feed\').slideToggle(\'slow\');">Show Forums</a> <div id="bxforums-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($forums); $feed = array('data' => $data, 'options' => $options); $feeds[] = $feed; return $feeds; }
function forums_data($data) { global $xoopsUser; if (empty($data)) { return; } $forums = array(); foreach ($data as $forum) { $isModerator = $xoopsUser && ($xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid())); if (!$forum->active && !$isModerator) { continue; } $last = new bXPost($forum->lastPostId()); $lastpost = array(); if (!$last->isNew()) { if (!isset($posters[$last->uid])) { $posters[$last->uid] = new RMUser($last->uid); } $user = $posters[$last->uid]; $lastpost['date'] = bXFunctions::formatDate($last->date()); $lastpost['by'] = sprintf(__('by %s', 'bxpress'), $last->uname()); $lastpost['id'] = $last->id(); $lastpost['topic'] = $last->topic(); $lastpost['user'] = array('uname' => $user->uname, 'name' => $user->name != '' ? $user->name : $user->uname, 'avatar' => $user ? RMEvents::get()->run_event('rmcommon.get.avatar', $user->getVar('email'), 50) : ''); 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']; } } $category = new bXCategory($forum->cat); $forums[] = array('id' => $forum->id(), 'name' => $forum->name(), 'desc' => $forum->description(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'link' => $forum->makeLink(), 'last' => $lastpost, 'image' => $forum->image, 'active' => $forum->active, 'category' => array('title' => $category->title)); } return $forums; }
/** * @desc Muestra el formulario para edición/creación de categorías */ function showForm($edit = 0) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig; define('RMSUBLOCATION', 'newcategory'); if ($edit) { $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirectMsg('categos.php', __('You had not provided a category ID', 'bxpress'), 1); die; } $catego = new bXCategory($id); if ($catego->isNew()) { redirectMsg('categos.php', __('Specified category does not exists!', 'bxpress'), 1); die; } } bXFunctions::menu_bar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . ($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'), 'frmCat', 'categos.php'); $form->addElement(new RMFormText(__('Name', 'bxpress'), 'title', 50, 100, $edit ? $catego->title() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'bxpress'), 'friendname', 50, 100, $catego->friendName())); } $form->addElement(new RMFormEditor(__('Description', 'bxpress'), 'desc', '90%', '300px', $edit ? $catego->description() : '')); $form->addElement(new RMFormYesNo(__('Show description', 'bxpress'), 'showdesc', $edit ? $catego->showDesc() : 1)); $form->addElement(new RMFormYesNo(__('Activate', 'bxpress'), 'status', $edit ? $catego->status() : 1)); $form->addElement(new RMFormGroups(__('Groups', 'bxpress'), 'groups', 1, 1, 4, $edit ? $catego->groups() : array(0)), true, 'checked'); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $catego->id())); } $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Submit', 'bxpress'), 'submit', '', true); $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'categos.php\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * @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; } }
/** * @desc Permitirá al administrador elegir los temas que serán * eliminados despues de un cierto período **/ function prune() { global $xoopsModule; xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Prune Posts', 'bxpress')); xoops_cp_header(); bXFunctions::menu_bar(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $form = new RMForm(__('Prune Posts', 'bxpress'), 'frmprune', 'prune.php'); //Lista de foros $ele = new RMFormSelect(__('Prune from forum', 'bxpress'), 'forums'); $ele->addOption('', __('Select option...', 'bxpress')); $ele->addOption(0, __('All forums', 'bxpress')); $sql = "SELECT id_forum,name FROM " . $db->prefix('bxpress_forums'); $result = $db->queryF($sql); while ($row = $db->fetchArray($result)) { $ele->addOption($row['id_forum'], $row['name']); } $form->addElement($ele, true); //Dias de antigüedad de temas $days = new RMFormText(__('Days old', 'bxpress'), 'days', 3, 3, 30); $days->setDescription(__('Delete topics older than these days', 'bxpress')); $form->addElement($days, true); //Lista de opciones para purgar temas $opc = new RMFormSelect(__('Topics to delete', 'bxpress'), 'option'); $opc->addOption('', __('Select option', 'bxpress')); $opc->addOption(1, __('All topics', 'bxpress')); $opc->addOption(2, __('Unanswered Topics', 'bxpress')); $form->addElement($opc, true); //Temas fijos $form->addElement(new RMFormYesno(__('Delete Sticky Topics', 'bxpress'), 'fixed')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Prune Now!'), 'submit', 'onclick="return confirm(\'' . __('Do you really wish to delete the topics? \\nThis action will delete the data permanently.', 'bxpress') . '\');"'); $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1);"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'deltopics')); $form->display(); xoops_cp_footer(); }
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('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/'); bXFunctions::menu_bar(); RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress')); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Reports Management', 'bxpress')); xoops_cp_header(); include RMTemplate::get()->get_template('admin/forums_reports.php', 'module', 'bxpress'); xoops_cp_footer(); }
die; } } } } else { redirect_header('edit.php?id=' . $post->id() . '#attachments', 2, __('Sorry, you do not have permission to do this action', 'bxpress')); } redirect_header('edit.php?id=' . $post->id() . '#attachments', 1, __('File attached successfully!', 'bxpress') . $errors); break; default: $xoopsOption['template_main'] = "bxpress_postform.html"; $xoopsOption['module_subpage'] = "edit"; include 'header.php'; bXFunctions::makeHeader(); $form = new RMForm(__('Edit Topic', 'bxpress'), 'frmTopic', 'edit.php'); $first_id = bXFunctions::getFirstId($topic->id()); if ($id == $first_id) { $form->addElement(new RMFormText(__('Topic Subject:', 'bxpress'), 'subject', 50, 255, $topic->title()), true); // Sticky if ($xoopsUser && $xoopsModuleConfig['sticky']) { $sticky = $xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()) || $xoopsUser->posts() > $xoopsModuleConfig['sticky_posts'] && $topic->poster() == $xoopsUser->uid(); if ($sticky) { $form->addElement(new RMFormYesNo(__('Sticky Topic', 'bxpress'), 'sticky', $topic->sticky())); } } } // Si se especifico una acotación entonces la cargamos $idq = isset($_GET['quote']) ? intval($_GET['quote']) : 0; if ($idq > 0) { $post = new bXPost($idq); if ($post->isNew()) {
$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')) { $tpl->assign('lang_newtopic', __('New Topic')); $tpl->assign('can_topic', 1); } $tpl->assign('lang_newposts', __('New Posts', 'bxpress')); bXFunctions::makeHeader(); $tpl->assign('xoops_pagetitle', $forum->name() . ' » ' . $xoopsModuleConfig['forum_title']); if ($xoopsUser) { if ($forum->isModerator($xoopsUser->uid()) || $xoopsUser->isAdmin()) { $tpl->assign('lang_moderate', __('Moderate', 'bxpress')); } } $tpl->assign('lang_goto', __('Go to:', 'bxpress')); $tpl->assign('lang_go', __('Go!', 'bxpress')); $tpl->assign('lang_updated', __('Updated on %s.', 'bxpress')); $tpl->assign('lang_lastreply', __('Last reply', 'bxpress')); $tpl->assign('lang_lastreply_by', __('%s by %s', 'bxpress')); $tpl->assign('lang_noreplies', __('No replies yet', 'bxpress')); $tpl->assign('lang_admin', __('Admin', 'bxpress')); $tpl->assign('lang_moderator', __('Mod', 'bxpress')); $tpl->assign('lang_user', __('User', 'bxpress')); bXFunctions::forumList(); bXFunctions::loadAnnouncements(1, $forum->id()); include 'footer.php';
$sql1 .= " (a.title LIKE '%{$search}%' OR b.post_text LIKE '%{$search}%') "; } } $sql2 .= ($sql1 ? " AND " : '') . " c.approved=1 AND a.id_topic=c.id_topic AND b.post_id=c.id_post AND d.id_forum=c.id_forum "; $sql2 .= $themes ? $themes == 1 ? " AND a.date>" . (time() - $xoopsModuleConfig['time_topics'] * 3600) : ($themes == 2 ? " AND a.replies=0" : '') : ''; $sql2 .= " ORDER BY a.sticky DESC, a.date DESC LIMIT {$start},{$limit}"; } $result = $db->queryF($sql . $sql1 . $sql2); while ($rows = $db->fetchArray($result)) { $date = bXFunctions::formatDate($rows['date']); $lastpost = array(); $firstpost = array(); if (!$search && $themes == 0) { $firstpost = bXFunctions::getFirstId($rows['id_topic']); $last = new bXPost($rows['last_post']); $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']; } } $tpl->append('posts', array('id' => $rows['id_topic'], 'title' => $rows['title'], 'sticky' => $rows['sticky'], 'user' => $rows['poster_name'], 'replies' => $rows['replies'], 'views' => $rows['views'], 'closed' => $rows['status'], 'date' => $date, 'by' => sprintf(__('By: %s', 'bxpress'), $rows['poster_name']), 'forum' => $rows['name'], 'id_post' => $rows['id_post'], 'post_text' => TextCleaner::getInstance()->truncate($rows['post_text'], 100), 'last' => $lastpost, 'firstpost' => $firstpost)); } $tpl->assign('lang_search', __('Search:', 'bxpress')); $tpl->assign('lang_recenttopics', __('Recent topics', 'bxpress')); $tpl->assign('lang_alltopics', __('All topics', 'bxpress')); $tpl->assign('lang_anunswered', __('Unanswered topics', 'bxpress')); $tpl->assign('themes', $themes);
include 'header.php'; bXFunctions::makeHeader(); $form = new RMForm($tid > 0 ? __('Reply', 'bxpress') : __('Create New Topic', 'bxpress'), 'frmTopic', 'post.php'); $form->addElement(new RMFormSubTitle(__('Write your post and send it', 'bxpress'), 1, 'even')); if (!$xoopsUser) { $form->addElement(new RMFormText(__('Your name:', 'bxpress'), 'name', 50, 255), true); $form->addElement(new RMFormText(__('Your email:', 'bxpress'), 'email', 50, 255), true, 'email'); } if ($create) { $form->addElement(new RMFormText(__('Topic subject:', 'bxpress'), 'subject', 50, 255, $tid > 0 ? $topic->title() : ''), true); } // Sticky if ($xoopsUser && $xoopsModuleConfig['sticky'] && $create) { $sticky = $xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()) || $xoopsUser->posts() > $xoopsModuleConfig['sticky_posts']; if ($sticky) { if ($create || bXFunctions::getFirstId($topic->id()) == $topic->id()) { $form->addElement(new RMFormYesNo(__('Sticky topic', 'bxpress'), 'sticky', !$create ? $topic->sticky() : 0)); } } } // Si se especifico una acotación entonces la cargamos $idq = isset($_GET['quote']) ? intval($_GET['quote']) : 0; if ($idq > 0) { $post = new bXPost($idq); if ($post->isNew()) { break; } $quote = "[quote=" . $post->uname() . "]" . $post->getVar('post_text', 'n') . "[/quote]\n\n"; } $type = $rmc_config['editor_type']; // Verificamos el tipo de editor
/** * Gets the permalink for current post * @return string */ public function permalink() { $link = bXFunctions::url() . '/topic.php?pid=' . $this->id() . '#p' . $this->id(); return $link; }
} } $tpl->append('forums', array('id' => $forum->id(), 'idname' => $forum->friendName(), 'name' => $forum->name(), 'desc' => $forum->description(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'link' => $forum->makeLink(), 'last' => $lastpost)); } } $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()); $tpl->assign('lang_forum', __('Forum', 'bxpress')); $tpl->assign('lang_topics', __('Topics', 'bxpress')); $tpl->assign('lang_posts', __('Posts', 'bxpress')); $tpl->assign('lang_lastpost', __('Last Post', 'bxpress')); $tpl->assign('lang_lastuser', __('Last registered user:'******'bxpress')); $tpl->assign('lang_regnum', __('Registered users conected:', 'bxpress')); $tpl->assign('lang_annum', __('Anonymous users conected:', 'bxpress')); $tpl->assign('lang_totalusers', __('Registered users:', 'bxpress')); $tpl->assign('lang_totaltopics', __('Total topics:', 'bxpress')); $tpl->assign('lang_totalposts', __('Total posts:', 'bxpress')); $tpl->assign('xoops_pagetitle', $xoopsModuleConfig['forum_title']); RMTemplate::get()->add_xoops_style('style.css', 'bxpress'); bXFunctions::makeHeader(); bXFunctions::loadAnnouncements(0); include 'footer.php';
} else { redirect_header('topic.php?pid=' . $id, 1, ($wtopic ? __('The topic could not be deleted!', 'bxpress') : __('The post could not be deleted!', 'bxpress')) . '<br />' . ($wtopic ? $topic->errors() : $post->errors())); } } else { include 'header.php'; //include '../../header.php'; $myts =& MyTextSanitizer::getInstance(); $hiddens['ok'] = 1; $hiddens['id'] = $id; $buttons['sbt']['value'] = __('Delete', 'bxpress'); $buttons['sbt']['type'] = 'submit'; $buttons['cancel']['value'] = __('Cancel', 'bxpress'); $buttons['cancel']['type'] = 'button'; $buttons['cancel']['extra'] = 'onclick="window.location=\'topic.php?pid=' . $id . '#p' . $id . '\';"'; $text = __('Dou you really wish to delete specified post?', 'bxpress'); if ($id == bXFunctions::getFirstId($topic->id())) { $text .= "<br /><br /><span class='bbwarning'>" . __('<strong>Warning:</strong> This is the first post in the topic. By deleting this all posts will be deleted also.', 'bxpress') . "</span>"; } $text .= "<br /><br /><strong>" . $post->uname() . ":</strong><br />"; $text .= substr($post->getVar('post_text', 'e'), 0, 100) . '...'; $form = new RMForm(__('Delete post?', 'bxpress'), 'frmDelete', 'delete.php'); $form->addElement(new RMFormHidden('ok', 1)); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormLabel('', $text)); $but = new RMFormButtonGroup(); $but->addButton('sbt', __('Delete!', 'bxpress'), 'submit'); $but->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1);"'); $form->addElement($but); echo $form->render(); $tpl->assign('xoops_pagetitle', __('Delete Post?', 'bxpress') . ' » ' . $xoopsModuleConfig['forum_title']); include 'footer.php';
/** * @desc Notifica al grupo de administradores la creación de un nuevo tema no aprobado * @param {@link } Objetos de Foro, Tema y mensaje * @param int edit indica si es la edición de un mensaje o un nuevo tema no aprobado **/ public function notifyAdmin($moderators, BBForum &$forum, BBTopic &$topic, BBPost &$post, $edit = 0) { global $db, $xoopsModule, $rmc_config; $bxf = bXFunctions::get(); $mhand = new XoopsMemberHandler($db); $configCat = new XoopsConfigCategory('mailer', 'mailer'); $config =& $configCat->getConfigs(3); $users = $moderators; if (!$edit) { if (file_exists(XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG . '/admin_notify.tpl')) { $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG; } else { $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/en'; } } else { if (file_exists(XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG . '/admin_notify_post.tpl')) { $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG; } else { $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/en'; } } foreach ($users as $k) { $xoopsMailer =& getMailer(); $xoopsMailer->setFromEmail($config['from']); $xoopsMailer->setFromName($config['fromname']); $xoopsMailer->setTemplateDir($tpldir); if (!$edit) { $xoopsMailer->setSubject(sprintf(__('New topic created', 'bxpress'), $forum->name())); $xoopsMailer->setTemplate('admin_notify.tpl'); } else { $xoopsMailer->setSubject(sprintf(__('A unapproved message has been edited', 'dtransport'), $topic->title())); $xoopsMailer->setTemplate('admin_notify_post.tpl'); } $xoopsMailer->assign('FORUM_NAME', $forum->name()); $xoopsMailer->assign('FORUM_MODNAME', $xoopsModule->name()); $xoopsMailer->assign('TOPIC_UNAME', $topic->posterName()); $xoopsMailer->assign('TOPIC_NAME', $topic->title()); $xoopsMailer->assign('TOPIC_APPROVED', $topic->approved() ? _YES : _NO); $xoopsMailer->assign('TOPIC_LINK', $bxf->url() . '/moderate.php?id=' . $forum->id()); $xoopsMailer->assign('POST_UNAME', $post->uname()); $xoopsMailer->assign('POST_LINK', $post->permalink()); $user = new XoopsUser($k); $xoopsMailer->setToUsers($user); $xoopsMailer->isMail = $user->getVar('notify_method') == 2; $xoopsMailer->isPM = $user->getVar('notify_method') == 1; $xoopsMailer->send(true); $xoopsMailer->clearAddresses(); } echo $xoopsMailer->getErrors(); }
/** * @desc Visualiza lista de usuarios para determinar moderadores **/ function bx_moderators() { global $xoopsModule; $id = rmc_server_var($_REQUEST, 'id', 0); if ($id <= 0) { redirectMsg('forums.php', __('No forum ID has been provided!', 'bxpress'), 1); break; } $forum = new bXForum($id); if ($forum->isNew()) { redirectMsg('forums.php', __('Specified forum does not exists!', 'bxpress'), 1); break; } RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/foros/standalone/1/#moderadores'); bXFunctions::menu_bar(); xoops_cp_header(); //Lista de usuarios $form = new RMForm(sprintf(__('Forum "%s" Moderators', 'bxpress'), $forum->name()), 'formmdt', 'forums.php'); $form->addElement(new RMFormUser(__('Moderators', 'bxpress'), 'users', 1, $forum->moderators(), 30), true, 'checked'); $form->element('users')->setDescription(__('Choose from the list the moderators users', 'bxpress')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Save Moderators', 'bxpress'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location.href=\'forums.php\';"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'savemoderat')); $form->addElement(new RMFormHidden('id', $id)); $form->display(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('forum Moderators', 'bxpress')); xoops_cp_footer(); }
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']);
/** * @desc Mover temas de un foro a otro */ function moveTopics() { global $db, $xoopsModuleConfig, $xoopsSecurity, $forum, $xoopsUser, $xoopsOption, $xoopsConfig; $topics = isset($_REQUEST['topics']) ? $_REQUEST['topics'] : null; $ok = isset($_POST['ok']) ? $_POST['ok'] : 0; $moveforum = rmc_server_var($_POST, 'moveforum', 0); if (empty($topics) || is_array($topics) && empty($topics)) { redirect_header('moderate.php?id=' . $moveforum, 2, __('Select at least a topic to moderate!', 'bxpress')); die; } $topics = !is_array($topics) ? array($topics) : $topics; if ($ok) { if (!$xoopsSecurity->check()) { redirect_header('moderate.php?id=' . $moveforum, 2, __('Session token expired!', 'bxpress')); die; } if ($moveforum <= 0) { redirect_header('moderate.php?id=' . $forum->id(), 2, __('Please select the target forum', 'bxpress')); die; } $mf = new bXForum($moveforum); if ($mf->isNew()) { redirect_header('moderate.php?id=' . $forum->id(), 2, __('Specified forum does not exists!', 'bxpress')); die; } $lastpost = false; foreach ($topics as $k) { $topic = new bXTopic($k); if ($topic->forum() != $forum->id()) { continue; } //Verificamos si el tema contiene el último mensaje del foro if (!$lastpost && array_key_exists($forum->lastPostId(), $topic->getPosts(0))) { $lastpost = true; } $topic->setForum($moveforum); if ($topic->save()) { //Decrementa el número de temas $forum->setTopics($forum->topics() - 1 > 0 ? $forum->topics() - 1 : 0); $forum->setPosts($forum->posts() - ($topic->replies() + 1) > 0 ? $forum->posts() - ($topic->replies() + 1) : 0); $forum->save(); $mf->setPosts($mf->posts() + ($topic->replies() + 1)); $mf->addTopic(); $mf->save(); //Cambiamos el foro de los mensajes del tema if ($topic->getPosts()) { foreach ($topic->getPosts() as $k => $v) { $v->setForum($moveforum); $v->save(); } } } } //Actualizamos el último mensaje del foro if ($lastpost) { $post = $forum->getLastPost(); $forum->setPostId($post); $forum->save(); } //Actualizamos el último mensaje del foro al que fue movido el tema $post = $mf->getLastPost(); $post ? $mf->setPostId($post) : ''; $mf->save(); redirect_header('moderate.php?id=' . $forum->id(), 1, __('Topics has been relocated!', 'bxpress')); die; } else { global $xoopsTpl; $tpl = $xoopsTpl; $xoopsOption['template_main'] = "bxpress_moderateforms.html"; $xoopsOption['module_subpage'] = "moderate"; include 'header.php'; bXFunctions::makeHeader(); $form = new RMForm(__('Move Topics', 'bxpress'), 'frmMove', 'moderate.php'); $form->addElement(new RMFormHidden('id', $forum->id())); $form->addElement(new RMFormHidden('op', 'move')); $form->addElement(new RMFormHidden('ok', '1')); $i = 0; foreach ($topics as $k) { $form->addElement(new RMFormHidden('topics[' . $i . ']', $k)); ++$i; } $form->addElement(new RMFormSubTitle(' ', 1, '')); $form->addElement(new RMFormSubTitle(__('Select the forum where you wish to move selected topics', 'bxpress'), 1, 'even')); $ele = new RMFormSelect(__('Forum', 'bxpress'), 'moveforum'); $ele->addOption(0, '', 1); $tbl1 = $db->prefix("bxpress_categories"); $tbl2 = $db->prefix("bxpress_forums"); $sql = "SELECT b.*, a.title FROM {$tbl1} a, {$tbl2} b WHERE b.cat=a.id_cat AND b.active='1' AND id_forum<>" . $forum->id() . " ORDER BY a.order, b.order"; $result = $db->query($sql); $categories = array(); while ($row = $db->fetchArray($result)) { $cforum = array('id' => $row['id_forum'], 'name' => $row['name']); if (isset($categores[$row['cat']])) { $categories[$row['cat']]['forums'][] = $cforum; } else { $categories[$row['cat']]['title'] = $row['title']; $categories[$row['cat']]['forums'][] = $cforum; } } foreach ($categories as $cat) { $ele->addOption(0, $cat['title'], 0, true, 'color: #000; font-weight: bold; font-style: italic; border-bottom: 1px solid #c8c8c8;'); foreach ($cat['forums'] as $cforum) { $ele->addOption($cforum['id'], $cforum['name'], 0, false, 'padding-left: 10px;'); } } $form->addElement($ele, true, "noselect:0"); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Move Topics Now!', 'bxpress'), 'submit'); $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele); $tpl->assign('moderate_form', $form->render()); include 'footer.php'; } }
/** * @desc Presenta el formulario para creación o edición de un anuncio */ function showForm($edit = 0) { global $tpl, $xoopsModule, $db; if ($edit) { $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirectMsg('announcements.php', __('Provided ID is not valid!', 'bxpress'), 1); die; } $an = new bXAnnouncement($id); if ($an->isNew()) { redirectMsg('announcements.php', __('Specified announcement does not exists!', 'bxpress'), 1); die; } } RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/anuncios/standalone/1/#crear-un-anuncio'); bXFunctions::menu_bar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . ($edit ? __('Edit Announcement', 'bxpress') : __('New Announcement', 'bxpress'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Announcement', 'bxpress') : __('New Announcement', 'bxpress'), 'frmAnnouncements', 'announcements.php'); $form->oddClass('oddForm'); $form->addElement(new RMFormEditor(__('Text', 'bxpress'), 'text', '100%', '300px', $edit ? $an->text('e') : ''), true); // Caducidad $ele = new RMFormDate(__('Expire on', 'bxpress'), 'expire', $edit ? $an->expire() : time()); $form->addElement($ele); // Mostran en $ele = new RMFormRadio(__('Show on', 'bxpress'), 'where', 1, 0); $ele->addOption(__('Module home page', 'bxpress'), 0, $edit ? $an->where() == 0 : 1); $ele->addOption(__('Forum', 'bxpress'), 1, $edit ? $an->where() == 1 : 0); $ele->addOption(__('All module', 'bxpress'), 2, $edit ? $an->where() == 2 : 0); $form->addElement($ele); // Foros $ele = new RMFormSelect(__('Forum', 'bxpress'), 'forum', 0, $edit ? array($an->forum()) : array()); $ele->setDescription(__('Please select the forum where this announcement will be shown. This option only is valid when "In Forum" has been selected.', 'bxpress')); $tbl1 = $db->prefix("bxpress_categories"); $tbl2 = $db->prefix("bxpress_forums"); $sql = "SELECT b.*, a.title FROM {$tbl1} a, {$tbl2} b WHERE b.cat=a.id_cat AND b.active='1' ORDER BY a.order, b.order"; $result = $db->query($sql); $categories = array(); while ($row = $db->fetchArray($result)) { $cforum = array('id' => $row['id_forum'], 'name' => $row['name']); if (isset($categores[$row['cat']])) { $categories[$row['cat']]['forums'][] = $cforum; } else { $categories[$row['cat']]['title'] = $row['title']; $categories[$row['cat']]['forums'][] = $cforum; } } foreach ($categories as $cat) { $ele->addOption(0, $cat['title'], 0, true, 'color: #000; font-weight: bold; font-style: italic; border-bottom: 1px solid #c8c8c8;'); foreach ($cat['forums'] as $cforum) { $ele->addOption($cforum['id'], $cforum['name'], 0, false, 'padding-left: 10px;'); } } $form->addElement($ele); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes', 'bxpress') : __('Create Announcement', 'bxpress'), 'submit'); $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'announcements.php\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form = RMEvents::get()->run_event('bxpress.form.announcement', $form); $form->display(); xoops_cp_footer(); }
$tpl->assign('lang_inreply', __('In reply to %s.', 'bxpress')); $tpl->assign('lang_postnum', __('post #%u', 'bxpress')); $tpl->assign('lang_user', __('User', 'bxpress')); $tpl->assign('lang_admin', __('Admin', 'bxpress')); $tpl->assign('lang_moderator', __('Mod', 'bxpress')); $tpl->assign('lang_anonymous', __('Anonymous', 'bxpress')); $tpl->assign('lang_likedby', __('Liked by', 'bxpress')); $tpl->assign('lang_likedmore', __('and %u more.', 'bxpress')); // Security token $tpl->assign('bxpress_token', $xoopsSecurity->createToken(0, 'BXTOKEN')); bXFunctions::forumList(); if ($xoopsUser) { if ($forum->isModerator($xoopsUser->uid()) || $xoopsUser->isAdmin()) { $tpl->assign('lang_move', __('Move Topic', 'bxpress')); if ($topic->status()) { $tpl->assign('lang_open', __('Unlock Topic', 'bxpress')); } else { $tpl->assign('lang_close', __('Lock Topic', 'bxpress')); } if ($topic->sticky()) { $tpl->assign('lang_unsticky', __('Unsticky Topic', 'bxpress')); } else { $tpl->assign('lang_sticky', __('Sticky Topic', 'bxpress')); } $tpl->assign('lang_app', __('Approve', 'bxpress')); $tpl->assign('lang_noapp', __('Unnaprove', 'bxpress')); } } bXFunctions::loadAnnouncements(1, $forum->id()); bXFunctions::include_js_language(); include 'footer.php';
// $Id$ // -------------------------------------------------------------- // bXpress Forums // 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);
public function element_data() { $module = RMModules::load_module('bxpress'); include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php'; $ret = array('name' => $module->getVar('name'), 'link' => bXFunctions::url()); return $ret; }
$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_xoops_style('dashboard.css', 'bxpress'); RMTemplate::get()->add_local_script('dashboard.js', 'bxpress'); RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/dashboard/standalone/1/'); bXFunctions::menu_bar(); // Activity // 30 Days $ago = strtotime("-30 days"); $sql = "SELECT id_post,post_time,id_forum FROM " . $db->prefix("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']); if (!isset($posts[$row['id_forum']])) { $forums[$row['id_forum']] = new bXForum($row['id_forum']); } if (!isset($posts[$row['id_forum']][$ds])) { $posts[$row['id_forum']][$ds] = 1;