Location: PHPKode > scripts > WH Social > wh_social/modules/messages.inc.php
<?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>
        </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['messages'] . '</h1>';

    echo '<a href="new_message.php" class="nonform"><img src="style/images/new_message.png" border="0">' . $lang['new_message'] . '</a>
    <br><br>
    <a href="outbox.php" class="nonform"><img src="style/images/outbox.png" border="0">' . $lang['outbox'] . '</a>
    <div class="head_spacer"></div>';

	$sql = 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 = 'no' AND members.id = m1.user2) OR (m1.user2 = '" . (int)$_SESSION['id'] . "' AND m1.user2read = 'no' 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(!$sql) {

	echo '<p class="false">' . $lang['no_unread_messages'] . '</p>';

		}else{

		if(intval(mysql_num_rows($sql)) == 0) {

		echo '<p class="false">' . $lang['no_unread_messages'] . '</p>';

	}else{

	echo '<div class="clear_blog"></div>
    <span class="blue_span">' . $lang['unread_messages'] . ' (' . intval(mysql_num_rows($sql)) . ')</span>';

	echo '<table width="100%" class="tables">
    <tr>
    <td width="20%"><strong>' . $lang['by'] . '</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($sql)) {

		$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 width="20%"><small>' . date('d.m.Y - H:i', strtotime($row['date'])) . '</small>
        </tr>';
		}

	echo '</table>';
	}
    }

	$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(!$query) {

	echo '<p class="false">' . $lang['no_read_messages'] . '</p>';

		}else{

		if(intval(mysql_num_rows($query)) == 0) {

		echo '<p class="false">' . $lang['no_read_messages'] . '</p>';

	}else{

	echo '<br><span class="blue_span">' . $lang['read_messages'] . ' (' . intval(mysql_num_rows($query)) . ')</span>';

	echo '<table width="100%" class="tables">
    <tr>
    <td width="20%"><strong>' . $lang['by_to'] . '</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($pm_row = mysql_fetch_assoc($query)) {

		$answer2 = $pm_row['reps'] - 1;

        echo '<tr>
        <td width="20%"><a href="member.php?id=' . (int)$pm_row['id'] . '">' . htmlentities($pm_row['name'], ENT_QUOTES) . '</a></td>
        <td width="50%"><a href="read.php?id=' . (int)$pm_row['msg'] . '">' . htmlentities($pm_row['title'], ENT_QUOTES) . '</a></td>
        <td width="10%">' . $answer2 . '</td>
        <td width="20%"><small>' . date('d.m.Y - H:i', strtotime($pm_row['date'])) . '</small></td>
        </tr>';
		}

    echo '</table>';

    }}

?>
Return current item: WH Social