<?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="messages.php" style="z-index:8;">' . $lang['messages'] . '</a></li>
<li><a href="outbox.php" style="z-index:7;">' . $lang['outbox'] . '</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['outbox'] . '</h1>';
$query = mysql_query("SELECT
m1.msg, m1.title, m1.date, count(m2.msg) AS reps, members.id AS id, members.name
FROM
messages AS m1, messages AS m2,members
WHERE
((m1.user1 = '" . (int)$_SESSION['id'] . "'
AND
m1.user1read = 'yes'
AND
members.id = m1.user2)
OR
(m1.user2 = '" . (int)$_SESSION['id'] . "'
AND
m1.user2read = 'yes'
AND
members.id = m1.user1))
AND
m1.assign = '1'
AND
m2.msg = m1.msg
GROUP BY
m1.msg
ORDER BY
m1.msg DESC") OR die(mysql_error());
if(intval(mysql_num_rows($query)) > 0) {
echo '<table width="100%" class="tables">
<tr>
<td width="20%"><strong>' . $lang['receiver'] . '</strong></td>
<td width="50%"><strong>' . $lang['subject'] . '</strong></td>
<td width="10%"><strong>' . $lang['replies'] . '</strong></td>
<td width="20%"><strong>' . $lang['date'] . '</strong></td>
</tr>';
while($row = mysql_fetch_assoc($query)) {
$answer = $row['reps'] - 1;
echo '<tr>
<td width="20%"><a href="member.php?id=' . (int)$row['id'] . '">' . htmlentities($row['name'], ENT_QUOTES) . '</a></td>
<td width="50%"><a href="read.php?id=' . (int)$row['msg'] . '">' . htmlentities($row['title'], ENT_QUOTES) . '</a></td>
<td width="10%">' . $answer . '</td>
<td width="20%"><small>' . date('d.m.Y - H:i', strtotime($row['date'])) . '</small></td>
</tr>';
}
echo '</table>';
}else{
echo '<p class="false">' . $lang['not_sent_message'] . '</p>';
}
?>
<?php require('style/layout/footer.php'); ?>