<?php require('framework/session.php'); ?>
<?php require('framework/ready.php'); ?>
<?php require('style/layout/header.php'); ?>
<div id="content_wrapper">
<div class="content">
<?php
echo '<div class="content_left">
<div id="breadcrumb">
<ul class="crumbs">
<li class="first"><a href="index.php" style="z-index:9;"><span></span>' . $lang['index'] . '</a></li>
<li><a href="discussions.php" style="z-index:8;">' . $lang['discussions'] . '</a></li>
<li><a href="favorites.php" style="z-index:7;">' . $lang['favorites'] . '</a></li>
</ul>
</div>
</div>
<div class="content_right">';
include('modules/search.inc.php');
echo '</div>
<div class="clear_long"></div>';
$ret = 1;
echo '<div class="main_menu">';
$ret = include 'framework/templates/'.$main_content['menu'];
echo '<div id="line"></div>';
$ret = include 'framework/templates/'.$main_content['infos'];
echo '</div>';
echo '<div class="main_content">';
echo '<h1 class="p_space">' . $lang['fav_dics'] . '</h1>';
$sql = "SELECT
topics.id AS topID,
topics.subject,
topics.date AS topDATE,
topics.author,
COUNT(discussions.id) AS discussions,
members.id AS memID,
members.name
FROM
topics
LEFT JOIN
discussions
ON
discussions.topic = topics.id
LEFT JOIN
members
ON
topics.author = members.id
GROUP BY
topics.subject, topics.id
ORDER BY
discussions DESC
LIMIT
10";
$result = mysql_query($sql) OR die(mysql_error());
if(!$result) {
echo '<p class="false">' . $lang['no_topics'] . '</p>' . mysql_error();
}else{
if(intval(mysql_num_rows($result)) == 0) {
echo '<p class="false">' . $lang['no_topics'] . '</p>';
}else{
echo '<table width="100%" class="tables">
<tr>
<td align="left"><span class="blue_span">' . $lang['topics'] . '</span></td>
<td align="left"><span class="blue_span">' . $lang['author'] . '</span></td>
<td align="left"><span class="blue_span">' . $lang['date'] . '</span></td>
<td align="center"><span class="blue_span">' . $lang['posts'] . '</span></td>
</tr>';
while($row = mysql_fetch_assoc($result)) {
$select_posts = mysql_query("SELECT discussions.id FROM discussions WHERE discussions.topic = '" . (int)$row['topID'] . "'");
$count_posts = intval(mysql_num_rows($select_posts));
echo '<tr>
<td width="52%"><a href="read_discussion.php?id=' . (int)$row['topID'] . '">' . htmlentities($row['subject'], ENT_QUOTES) . '</a></td>
<td width="25%"><a href="member.php?id=' . (int)$row['memID'] . '">' . htmlentities($row['name'], ENT_QUOTES) . '</a></td>
<td width="15%">' . date('d.m.Y', strtotime($row['topDATE'])) . '</td>
<td width="8%" align="center"><div class="bubble"><span class="bubpoint"></span><span class="bubcon">' . $count_posts . '</span></div></td>
</tr>';
}
echo '</table>';
}
}
?>
<?php require('style/layout/footer.php'); ?>