/*
-----------------------------------------------------------------
Последние темы на форуме
-----------------------------------------------------------------
*/
$set_forum = $datauser['set_forum'] ? unserialize($datauser['set_forum']) : array();
$settings = $set['lastThemes'] ? unserialize($set['lastThemes']) : array('totalThemes' => 3, 'timeCache' => 30);
if($settings['totalThemes'] > 0 && !$set_forum['viewThemes']) {
$themesOut = '';
$file_cache = 'files/cache/lastThemes.dat';
echo '<div class="phdr"><b>Последние темы форума</b></div>';
$req = mysql_query("SELECT * FROM `forum` WHERE `type`='t'" . ($rights >= 7 ? '' : " AND `close`!='1'") . " ORDER BY `time` DESC LIMIT " . $settings['totalThemes']);
while (($res = mysql_fetch_assoc($req)) !== false) {
if ($res['close']) $themesOut .= '<div class="rmenu">';
else $themesOut .= $i % 2 ? '<div class="list2" style="padding:0px;">' : '<div class="list1" style="padding:0px;">';
$nickUser = mysql_fetch_assoc(mysql_query("SELECT `from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $res['id'] . "' ORDER BY `time` DESC LIMIT 1"));
$totalPosts = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `refid`='" . $res['id'] . "'" . ($rights >= 7 ? '' : " AND `close` != '1'")), 0);
$endPage = ceil($totalPosts / $kmess);
$icons = array(
(!$res['vip'] ? '<img src="../theme/' . $set_user['skin'] . '/images/op.gif" alt=""/>' : ''),
($res['vip'] ? '<img src="../theme/' . $set_user['skin'] . '/images/pt.gif" alt=""/>' : ''),
($res['realid'] ? functions::image('rate.gif') : ''),
($res['edit'] ? '<img src="../theme/' . $set_user['skin'] . '/images/tz.gif" alt=""/>' : '')
);
$themesOut .= functions::display_menu($icons, ' ', ' ') .
'<a style="display:block;padding: 5px 8px;" href="forum/index.php?id=' . $res['id'] . '">' . $res['text'] . '</a> [' . $totalPosts . ']';
if ($endPage > 1) $themesOut .= '<span class="count"><a href="forum/index.php?id=' . $res['id'] . '&page=' . $endPage . '"> >></span></a>';
$themesOut .= '<div class="sub">' . $res['from'];
if (!empty($nickUser['from'])) $themesOut .= ' / ' . $nickUser['from'];
$themesOut .= ' <span class="gray">(' . functions::display_date($res['time']) . ')</span></div></div>';
++$i;
}
if ($settings['timeCache'] > 0 && time() < (filemtime($file_cache) + $settings['timeCache'])) {
echo file_get_contents($file_cache);
} else {
echo $themesOut;
if($settings['timeCache'] > 0)
file_put_contents($file_cache, $themesOut);
}
}
?>
Вообщем на скрине видна, моя попытка. Получилось только название темы сделать тач, а остальное уехало куда- то(