/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    global $short_date_format;
    $messageID = (int) $_GET['message'];
    $memberID = (int) $_COOKIE['memberID'];
    $sender_sql = "SELECT `Sender` FROM `Messages` WHERE `Recipient` = '{$memberID}' AND `ID` = '{$messageID}'";
    $sender_arr = db_arr($sender_sql);
    $senderID = (int) $sender_arr['Sender'];
    $message_sql = "SELECT m.`Text`, m.`Subject`, DATE_FORMAT( m.`Date`, '{$short_date_format}' ) AS `Date`, p.Status FROM `Messages` AS m LEFT JOIN Profiles AS p ON m.Sender = p.ID  WHERE m.`ID` = '{$messageID}' AND `Recipient` = '{$memberID}'";
    // Did you find me, Smoge? I see you...
    $message_arr = db_arr($message_sql);
    $ret = '';
    $ret .= '<div class="profile_ditails_block">';
    $ret .= ProfileDetails($senderID);
    $ret .= '<div class="clear_both"></div>';
    $ret .= '</div>';
    $ret .= '<div class="m_block">';
    $ret .= '<div class="m_subject_date">';
    $ret .= '<div class="name">';
    $ret .= _t('_Date') . ':';
    $ret .= '</div>';
    $ret .= '<div class="value">';
    $ret .= $message_arr['Date'];
    $ret .= '</div>';
    $ret .= '<div class="name">';
    $ret .= _t('_Subject') . ':';
    $ret .= '</div>';
    $ret .= '<div class="value">';
    $ret .= process_smiles(process_line_output($message_arr['Subject']));
    $ret .= '</div>';
    $ret .= '</div>';
    $ret .= '<div class="m_text">';
    $ret .= process_html_output($message_arr['Text'], 150);
    $ret .= '</div>';
    $ret .= '<div class="clear_both"></div>';
    $ret .= '</div>';
    if ($message_arr['Status'] == 'Active') {
        $ret .= '<div class="reply">';
        $ret .= '<a href="' . $site['url'] . 'compose.php?ID=' . $senderID . '&messageID=' . $messageID . '&amp;subject=' . process_smiles(process_line_output($message_arr['Subject'])) . '">Reply</a>';
        $ret .= '</div>';
        $ret .= '<div class="reply">';
        $ret .= "<a onClick=\"javascript:window.open( 'list_pop.php?action=spam&ID=" . $senderID . "', '', 'width=500,height=200,menubar=no,status=no,resizeable=no,scrollbars=no,toolbar=no,location=no' );\" href=\"javascript:void(0)\">" . _t('_Spam report') . "</a>";
        $ret .= '</div>';
        $ret .= '<div class="reply">';
        $ret .= '<a href="messages_inbox.php?action=delete&message=' . $messageID . '">' . _t('_Delete') . '</a>';
        $ret .= '</div>';
        $ret .= '<div class="clear_both"></div>';
    } else {
        $ret .= '';
    }
    //$ret .= '</div>';
    //####################################################
    $ret .= '<div style="position:relative; height:20px;"></div>';
    $ret .= PageCorespondence($memberID, $senderID);
    $ret .= '<div class="clear_both"></div>';
    return $ret;
}
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    $messageID = (int) $_GET['message'];
    $memberID = (int) $_COOKIE['memberID'];
    $sender_sql = "SELECT `Recipient` FROM `Messages` WHERE `Sender` = '{$memberID}' AND `ID` = '{$messageID}'";
    $sender_arr = db_arr($sender_sql);
    $senderID = $sender_arr['Recipient'];
    $message_sql = "SELECT m.`Text`, m.`Subject`, DATE_FORMAT( m.`Date`, '%Y-%m-%d' ) AS `Date`, p.Status FROM `Messages` AS m LEFT JOIN Profiles AS p ON m.Recipient = p.ID WHERE m.`ID` = '{$messageID}'";
    // AND`Sender` = '$senderID'";
    $message_arr = db_arr($message_sql);
    $ret = '';
    $ret .= '<div class="profile_ditails_block">';
    $ret .= ProfileDetails($senderID);
    $ret .= '<div class="clear_both"></div>';
    $ret .= '</div>';
    $ret .= '<div class="m_block">';
    $ret .= '<div class="m_subject_date">';
    $ret .= '<div class="name">';
    $ret .= _t('_Date') . ':';
    $ret .= '</div>';
    $ret .= '<div class="value">';
    $ret .= $message_arr['Date'];
    $ret .= '</div>';
    $ret .= '<div class="name">';
    $ret .= _t('_Subject') . ':';
    $ret .= '</div>';
    $ret .= '<div class="value">';
    $ret .= process_smiles(process_line_output($message_arr['Subject']));
    $ret .= '</div>';
    $ret .= '</div>';
    $ret .= '<div class="m_text">';
    $ret .= process_html_output($message_arr['Text'], 80);
    $ret .= '</div>';
    $ret .= '<div class="clear_both"></div>';
    $ret .= '</div>';
    //$ret .= '<div class="reply_block">';
    if ($message_arr['Status'] == 'Active') {
        $ret .= '<div class="reply">';
        $ret .= '<a href="' . $site['url'] . 'compose.php?ID=' . $senderID . '">Write new Message</a>';
        $ret .= '</div>';
        $ret .= '<div class="clear_both"></div>';
    } else {
        $ret .= '';
    }
    //####################################################
    $ret .= '<div style="position:relative; height:20px;"></div>';
    $ret .= PageCorespondence($memberID, $senderID);
    $ret .= '<div class="clear_both"></div>';
    return $ret;
}