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; }
$tf = new RMTimeFormatter(0, __('%T% %d%, %Y%', 'bxpress')); // Likes parsing if (!is_null($row['liked'])) { $likes_ids = explode(",", $row['liked'], 3); } else { $likes_ids = array(); } $likes = array(); foreach ($likes_ids as $like) { if (!isset($users[$like])) { $users[$like] = new XoopsUser($like); } $like_user = $users[$like]; $likes[] = array('uid' => $like, 'uname' => $like_user->getVar('uname'), 'name' => $like_user->getVar('name') != '' ? $like_user->getVar('name') : $like_user->getVar('uname'), 'avatar' => RMEvents::get()->run_event("rmcommon.get.avatar", $like_user->getVar('email'), 40)); } $posts[$post->id()] = array('id' => $post->id(), 'text' => $post->text(), 'edit' => $post->editText(), 'approved' => $post->approved(), 'date' => $tf->ago($post->date()), 'canedit' => $canedit, 'candelete' => $candelete, 'canshow' => $canshow, 'canreport' => $report, 'poster' => $userData, 'attachs' => $attachs, 'attachscount' => count($attachs), 'parent' => $post->parent, 'replies' => $row['replies'], 'likes_count' => $row['likes'], 'likes' => $likes); $posts_ids[] = $post->id(); } $tpl->assign('posts', $posts); unset($userData, $bbUser, $users); // Common Utilities Notifications $notifications = RMNotifications::get(); $events = Bxpress_Notifications::get(); $permissions = $forum->permissions(); // New topics notifications $event = $events->event('reply')->parameters($topic->id())->permissions(array('groups' => in_array(0, $permissions['view']) ? array() : $permissions['view'])); $notifications->add_item($event); unset($event, $permissions); $tpl->assign('notifications', $notifications->render()); $tpl->assign('lang_edit', __('Edit', 'bxpress')); $tpl->assign('lang_delete', __('Delete', 'bxpress'));
$form->addElement(new RMFormEditor(__('Post', 'bxpress'), 'msg', 'auto', '400px', isset($quote) ? $quote : ''), true); // Adjuntar Archivos if ($forum->attachments() && $forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'attach')) { $ele = new RMFormFile(__('Attach file', 'bxpress'), 'attach', 45, $xoopsModuleConfig['maxfilesize'] * 1024); $ele->setDescription(sprintf(__('Allowed file types: %s', 'bxpress'), implode(',', $forum->extensions()))); $form->addElement($ele); $form->setExtra('enctype="multipart/form-data"'); } $form->addElement(new RMFormHidden('op', 'post')); $form->addElement(new RMFormHidden($fid > 0 ? 'fid' : 'tid', $fid > 0 ? $fid : $tid)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Send', 'bxpress'), 'submit'); $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1)";'); $form->addElement($ele); $tpl->assign('topic_form', $form->render()); /** * @desc Cargamos los mensajes realizados en este tema */ if ($mc['numpost'] > 0 && !$create) { $sql = "SELECT * FROM " . $db->prefix("bxpress_posts") . " WHERE id_topic='" . $topic->id() . "' ORDER BY post_time DESC LIMIT 0, {$mc['numpost']}"; $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $post = new bXPost(); $post->assignVars($row); $tpl->append('posts', array('id' => $post->id(), 'text' => $post->text(), 'time' => date($xoopsConfig['datestring'], $post->date()), 'uname' => $post->uname())); } } $tpl->assign('lang_topicreview', __('Topic review (newest first)', 'bxpress')); include 'footer.php'; break; }
$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; }
$userData = array(); $userData['id'] = 0; $userData['uname'] = $xoopsModuleConfig['anonymous_prefix'] . $post->uname(); $userData['rank'] = $xoopsConfig['anonymous']; $userData['rank_image'] = ''; $userData['registered'] = ''; $userData['avatar'] = RMEvents::get()->run_event("rmcommon.get.avatar", '', 0); $userData['posts'] = sprintf(__('Posts: %u', 'bxpress'), 0); $userData['online'] = false; } // Adjuntos $attachs = array(); foreach ($post->attachments() as $k) { $attachs[] = array('title' => $k->name(), 'downs' => $k->downloads(), 'id' => $k->id(), 'ext' => $k->extension(), 'size' => RMUtilities::formatBytesSize($k->size()), 'icon' => $k->getIcon()); } $tpl->append('posts', array('id' => $post->id(), 'text' => $post->text(), 'edit' => $post->editText(), 'approved' => $post->approved(), 'date' => bXFunctions::formatDate($post->date()), 'canedit' => $canedit, 'candelete' => $candelete, 'canshow' => $canshow, 'canreport' => $report, 'poster' => $userData, 'attachs' => $attachs, 'attachscount' => count($attachs))); } unset($userData, $bbUser, $users); $tpl->assign('lang_edit', __('Edit', 'bxpress')); $tpl->assign('lang_delete', __('Delete', 'bxpress')); $tpl->assign('lang_report', __('Report', 'bxpress')); $tpl->assign('lang_quote', __('Quote', 'bxpress')); $tpl->assign('lang_online', __('Online!', 'bxpress')); $tpl->assign('lang_offline', __('Disconnected', 'bxpress')); $tpl->assign('lang_attachments', __('Attachments', 'bxpress')); $tpl->assign('xoops_pagetitle', $topic->title() . " » " . $xoopsModuleConfig['forum_title']); $tpl->assign('token', $xoopsSecurity->createToken()); $tpl->assign('lang_edittext', __('Edit Text', 'bxpress')); $tpl->assign('lang_goto', __('Change Forum:', 'bxpress')); $tpl->assign('lang_go', __('Go!', 'bxpress')); //$tpl->assign('url',XOOPS_URL."/modules/bxpress/report.php");