Exemplo n.º 1
0
            buckys_redirect('/messages_inbox.php', MSG_MESSAGE_REMOVED, MSG_TYPE_SUCCESS);
        }
        exit;
    }
    //Delete Message Foreer
    if ($_POST['action'] == 'delete_forever') {
        if (!BuckysMessage::deleteMessagesForever($_POST['messageID'])) {
            buckys_redirect('/messages_inbox.php', "Error: " . $db->getLastError(), MSG_TYPE_ERROR);
        } else {
            buckys_redirect('/messages_inbox.php', MSG_MESSAGE_REMOVED, MSG_TYPE_SUCCESS);
        }
        exit;
    }
}
if (isset($_GET['message'])) {
    $message = BuckysMessage::getMessage($_GET['message']);
}
if (!isset($_GET['message']) || !$message) {
    buckys_redirect('/messages_inbox.php');
}
//Make Message as read
BuckysMessage::changeMessageStatus($message['messageID'], 'read');
//Getting Next Message ID and Prev Message ID
if ($message['is_trash'] == 1) {
    $msgType = 'trash';
} else {
    if ($message['receiver'] == $userID) {
        $msgType = 'inbox';
    } else {
        if ($message['sender'] == $userID) {
            $msgType = 'sent';
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
//If the user is not logged in, redirect to the index page
if (!($userID = buckys_is_logged_in())) {
    buckys_redirect('/index.php');
}
if (isset($_GET['to'])) {
    $receiver = BuckysUser::getUserData($_GET['to']);
}
if (isset($_GET['reply'])) {
    $replyTo = BuckysMessage::getMessage($_GET['reply']);
}
if (isset($_POST['action'])) {
    //Check the user id is same with the current logged user id
    if ($_POST['userID'] != $userID) {
        echo 'Invalid Request!';
        exit;
    }
    //Save Address
    if ($_POST['action'] == 'compose_message') {
        //Show Results
        header('Content-type: application/xml');
        if (!BuckysMessage::composeMessage($_POST)) {
            render_result_xml(['status' => 'error', 'message' => buckys_get_messages()]);
        } else {
            render_result_xml(['status' => 'success', 'message' => buckys_get_messages()]);
        }
        exit;
    }
}
    }
    //Delete Message Foreer
    if ($_POST['action'] == 'delete_forever') {
        if (!BuckysMessage::deleteMessagesForever($_POST['messageID'])) {
            buckys_redirect('/messages_inbox.php', "Error: " . $db->getLastError(), MSG_TYPE_ERROR);
        } else {
            buckys_redirect('/messages_inbox.php', MSG_MESSAGE_REMOVED, MSG_TYPE_SUCCESS);
        }
        exit;
    }
}
$messageID = buckys_escape_query_integer(isset($_GET['message']) ? $_GET['message'] : null);
if (!$messageID) {
    buckys_redirect('/messages_inbox.php');
}
$message = BuckysMessage::getMessage($messageID);
//If the current user is morderator and this message has been reported
if (!$message && buckys_check_user_acl(USER_ACL_MODERATOR) && BuckysReport::isReported($messageID, 'message')) {
    //Getting Message
    $message = BuckysMessage::getMessageById($messageID);
    $msgType = 'reported';
}
if (!$message) {
    buckys_redirect('/messages_inbox.php');
}
if (!isset($msgType)) {
    //Make Message as read
    BuckysMessage::changeMessageStatus($message['messageID'], 'read');
    //Getting Next Message ID and Prev Message ID
    if ($message['is_trash'] == 1) {
        $msgType = 'trash';