Возможно помог
<?php
/* Настройки */
/* ========================================================================== */
// Путь к форуму
if (!defined('IPBNETRU_IPB3_ROOT')) {
define('IPBNETRU_IPB3_ROOT', '/lalala/forum/');
}
// Количество тем
if (!defined('IPBNETRU_RECENT_TOPICS_COUNT')) {
define('IPBNETRU_RECENT_TOPICS_COUNT', ;
}
/* Инициализация */
/* ========================================================================== */
define('IPB_THIS_SCRIPT', 'public');
define('IPS_PUBLIC_SCRIPT', 'index.php');
require_once IPBNETRU_IPB3_ROOT.'/initdata.php';
require_once IPS_ROOT_PATH.'sources/base/ipsRegistry.php';
ipsRegistry::init();
/* Функции */
/* ========================================================================== */
/**
* Возвращает указанное количество последних тем.
*
* @param int $count
*
* @return string
*/
function ipbnetruGetCustomRecentTopics($count = 5) {
$topicIDs = array();
$bvnp = explode(',', ipsRegistry::$settings['vnp_block_forums']);
$classForum = ipsRegistry::getClass('class_forums');
ipsRegistry::getClass('class_localization')->loadLanguageFile('public_topic', 'forums');
// Grab last X data
foreach($classForum->forum_by_id as $forumID => $forumData) {
if (!isset($forumData['can_view_others']) || !$forumData['can_view_others']) {
continue;
}
if ($forumData['password']) {
continue;
}
if ( !ipsRegistry::getClass('permissions')->check('read', $forumData)){
continue;
}
if (is_array($bvnp) && in_array($forumID, $bvnp)) {
continue;
}
$isTrash = ($forumID == ipsRegistry::$settings['forum_trash_can_id']);
if (ipsRegistry::$settings['forum_trash_can_id'] && $isTrash) {
continue;
}
$_topics = $classForum->lastXThaw($forumData['last_x_topic_ids']);
if (is_array($_topics)) {
foreach($_topics as $id => $time) {
$topicIDs[$time] = $id;
}
}
}
// Получаем данные
$topics = array();
if ($topicIDs) {
krsort($topicIDs);
$_topics = array_slice($topicIDs, 0, $count);
if ($_topics) {
ipsRegistry:B()->build(array(
'select' => 't.tid, t.title, t.title_seo, t.start_date, t.starter_id, t.starter_name',
'from' => array('topics' => 't'),
'where' => 't.tid IN ('.implode(',', array_values($_topics)).')',
'order' => 't.start_date DESC',
'add_join' => array(
array(
'select' => 'm.members_display_name, m.members_seo_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=t.starter_id',
'type' => 'left',
),
),
));
ipsRegistry:B()->execute();
while ($topic = ipsRegistry:B()->fetch()) {
$topics[$topic['start_date']] = $topic;
}
}
}
// Вывод: создать собственный шаблон
return ipsRegistry::getClass('output')->getTemplate('boards')
->hookRecentTopics2($topics);
}
/* Получение */
/* ========================================================================== */
$html = ipbnetruGetCustomRecentTopics(IPBNETRU_RECENT_TOPICS_COUNT);
// Замена стандартных строк
$html = ipsRegistry::getClass('output')->replaceMacros($html);
// Хуки
$html = ipsRegistry::getClass('output')->templateHooks($html);
$html = preg_replace("#<!--hook\.([^\>]+?)-->#", '', $html);
/* Вывод */
/* ========================================================================== */
echo $html;
?>