<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
@include ENGINE_DIR.'/data/forum_config.php';
$forum_config['site_inpage'] = '10';
/// для категории 1
if ($forum_config['site_inpage'])
{
if (!$forum_table)
{
if ($forum_config['hide_forum'])
{
$access_hide = "WHERE ". PREFIX ."_forum_forums.access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
}
else { $access_hide = ""; }
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_topics LEFT JOIN ". PREFIX ."_forum_forums ON WHERE main_id=1 ". PREFIX ."_forum_topics.forum_id = ". PREFIX ."_forum_forums.id {$access_hide} GROUP BY last_date DESC LIMIT ".$forum_config['site_inpage']."");
while ($row = $db->get_row ($result))
{
if ($forum_config['mod_rewrite'])
{
$fl_forum = "<a href='/forum/forum_{$row['id']}'>{$row['name']}</a>";
$fl_topic = "<a href='/forum/topic_$row[tid]/last#reply'>{$row['title']}</a>";
$fl_author = "<a href='/user/$row[author_topic]/'>{$row['author_topic']}</a>";
$fl_last_poster = "<a href='/user/$row[last_poster_name]/'>{$row['last_poster_name']}</a>";
}
else
{
$fl_forum = "<a href='/?do=forum&showforum={$row['id']}'>{$row['name']}</a>";
$fl_topic = "<a href='/?do=forum&showtopic=$row[tid]&lastpost=1'>{$row['title']}</a>";
$fl_author = "<a href='/?subaction=userinfo&user=$row[author_topic]/'>{$row['author_topic']}</a>";
$fl_last_poster = "<a href='/?subaction=userinfo&user=$row[last_poster_name]/'>{$row['last_poster_name']}</a>";
}
$row['last_date'] = strtotime($row['last_date']);
if (date(Ymd, $row['last_date']) == date(Ymd, $_TIME))
{
$show_date = $lang['time_heute'].langdate(", H:i", $row['last_date']);
}
elseif (date(Ymd, $row['last_date']) == date(Ymd, ($_TIME - 86400)))
{
$show_date = $lang['time_gestern'].langdate(", H:i", $row['last_date']);
}
else
{
$show_date = langdate($forum_config['timestamp'], $row['last_date']);
}
$tpl->load_template('forum_last_list.tpl');
$tpl->set('{fl_forum}', $fl_forum);
$tpl->set('{fl_topic}', $fl_topic);
$tpl->set('{fl_post}', $row['post']);
$tpl->set('{fl_views}', $row['views']);
$tpl->set('{fl_author}', $fl_author);
$tpl->set('{fl_last_date}', $show_date);
$tpl->set('{fl_last_poster}', $fl_last_poster);
$tpl->compile('forum_last_list');
$tpl->clear();
}
$tpl->load_template('forum_last.tpl');
$tpl->set('{last_list}', $tpl->result["forum_last_list"]);
$tpl->compile('forum_table');
$tpl->clear();
create_cache ('dlef_show_last', $tpl->result['forum_table']);
}
else
{
$tpl->result['forum_table'] = $forum_table;
}
}
/// для категории 2
if ($forum_config['site_inpage'])
{
if (!$forum_table)
{
if ($forum_config['hide_forum'])
{
$access_hide = "WHERE ". PREFIX ."_forum_forums.access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
}
else { $access_hide = ""; }
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_topics LEFT JOIN ". PREFIX ."_forum_forums ON WHERE main_id=2 ". PREFIX ."_forum_topics.forum_id = ". PREFIX ."_forum_forums.id {$access_hide} GROUP BY last_date DESC LIMIT ".$forum_config['site_inpage']."");
while ($row = $db->get_row ($result))
{
if ($forum_config['mod_rewrite'])
{
$fl_forum2 = "<a href='/forum/forum_{$row['id']}'>{$row['name']}</a>";
$fl_topic2 = "<a href='/forum/topic_$row[tid]/last#reply'>{$row['title']}</a>";
$fl_author2 = "<a href='/user/$row[author_topic]/'>{$row['author_topic']}</a>";
$fl_last_poster2 = "<a href='/user/$row[last_poster_name]/'>{$row['last_poster_name']}</a>";
}
else
{
$fl_forum2 = "<a href='/?do=forum&showforum={$row['id']}'>{$row['name']}</a>";
$fl_topic2 = "<a href='/?do=forum&showtopic=$row[tid]&lastpost=1'>{$row['title']}</a>";
$fl_author2 = "<a href='/?subaction=userinfo&user=$row[author_topic]/'>{$row['author_topic']}</a>";
$fl_last_poster2 = "<a href='/?subaction=userinfo&user=$row[last_poster_name]/'>{$row['last_poster_name']}</a>";
}
$row['last_date'] = strtotime($row['last_date']);
if (date(Ymd, $row['last_date']) == date(Ymd, $_TIME))
{
$show_date = $lang['time_heute'].langdate(", H:i", $row['last_date']);
}
elseif (date(Ymd, $row['last_date']) == date(Ymd, ($_TIME - 86400)))
{
$show_date = $lang['time_gestern'].langdate(", H:i", $row['last_date']);
}
else
{
$show_date = langdate($forum_config['timestamp'], $row['last_date']);
}
$tpl->load_template('forum_last_list2.tpl');
$tpl->set('{fl_forum2}', $fl_forum);
$tpl->set('{fl_topic2}', $fl_topic);
$tpl->set('{fl_post2}', $row['post']);
$tpl->set('{fl_views2}', $row['views']);
$tpl->set('{fl_author2}', $fl_author);
$tpl->set('{fl_last_date2}', $show_date);
$tpl->set('{fl_last_poster2}', $fl_last_poster);
$tpl->compile('forum_last_list2');
$tpl->clear();
}
$tpl->load_template('forum_last2.tpl');
$tpl->set('{last_list2}', $tpl->result["forum_last_list2"]);
$tpl->compile('forum_table2');
$tpl->clear();
create_cache ('dlef_show_last2', $tpl->result['forum_table2']);
}
else
{
$tpl->result['forum_table2'] = $forum_table2;
}
}
/// для категории 3
if ($forum_config['site_inpage'])
{
if (!$forum_table)
{
if ($forum_config['hide_forum'])
{
$access_hide = "WHERE ". PREFIX ."_forum_forums.access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
}
else { $access_hide = ""; }
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_topics LEFT JOIN ". PREFIX ."_forum_forums ON WHERE main_id=3 ". PREFIX ."_forum_topics.forum_id = ". PREFIX ."_forum_forums.id {$access_hide} GROUP BY last_date DESC LIMIT ".$forum_config['site_inpage']."");
while ($row = $db->get_row ($result))
{
if ($forum_config['mod_rewrite'])
{
$fl_forum3 = "<a href='/forum/forum_{$row['id']}'>{$row['name']}</a>";
$fl_topic3 = "<a href='/forum/topic_$row[tid]/last#reply'>{$row['title']}</a>";
$fl_author3 = "<a href='/user/$row[author_topic]/'>{$row['author_topic']}</a>";
$fl_last_poster3 = "<a href='/user/$row[last_poster_name]/'>{$row['last_poster_name']}</a>";
}
else
{
$fl_forum3 = "<a href='/?do=forum&showforum={$row['id']}'>{$row['name']}</a>";
$fl_topic3 = "<a href='/?do=forum&showtopic=$row[tid]&lastpost=1'>{$row['title']}</a>";
$fl_author3 = "<a href='/?subaction=userinfo&user=$row[author_topic]/'>{$row['author_topic']}</a>";
$fl_last_poster3 = "<a href='/?subaction=userinfo&user=$row[last_poster_name]/'>{$row['last_poster_name']}</a>";
}
$row['last_date'] = strtotime($row['last_date']);
if (date(Ymd, $row['last_date']) == date(Ymd, $_TIME))
{
$show_date = $lang['time_heute'].langdate(", H:i", $row['last_date']);
}
elseif (date(Ymd, $row['last_date']) == date(Ymd, ($_TIME - 86400)))
{
$show_date = $lang['time_gestern'].langdate(", H:i", $row['last_date']);
}
else
{
$show_date = langdate($forum_config['timestamp'], $row['last_date']);
}
$tpl->load_template('forum_last_list3.tpl');
$tpl->set('{fl_forum3}', $fl_forum);
$tpl->set('{fl_topic3}', $fl_topic);
$tpl->set('{fl_post3}', $row['post']);
$tpl->set('{fl_views3}', $row['views']);
$tpl->set('{fl_author3}', $fl_author);
$tpl->set('{fl_last_date3}', $show_date);
$tpl->set('{fl_last_poster3}', $fl_last_poster);
$tpl->compile('forum_last_list3');
$tpl->clear();
}
$tpl->load_template('forum_last3.tpl');
$tpl->set('{last_list3}', $tpl->result["forum_last_list3"]);
$tpl->compile('forum_table3');
$tpl->clear();
create_cache ('dlef_show_last3', $tpl->result['forum_table3']);
}
else
{
$tpl->result['forum_table3'] = $forum_table3;
}
}
?>