Пример #1
0
function messaging_get_message_details($msgID = '')
{
    global $db, $current_user, $main_smarty;
    if ($msgID == "") {
        $msgID = sanitize($_REQUEST['msgid'], 2);
    }
    //echo $msgID;
    $message = new KMessaging(true);
    $array = $message->GetMessege($msgID);
    // check to make sure this is our message
    if ($array['receiver'] == $current_user->user_id) {
        $message->MarkAsRead($msgID);
        $thisuser = new User();
        $thisuser->id = $array['sender'];
        if (!$thisuser->read()) {
            $main_smarty->assign('message', 'The person you are trying to send a message to does not exist!');
            if (messaging_fade_lightbox) {
                $main_smarty->assign('js_close', "Effect.Fade('overlay');Effect.Fade('view_message', {afterFinish: function(){document.getElementById('view_message').innerHTML='loading...';}});");
            } else {
                $main_smarty->assign('js_close', "document.getElementById('overlay').style.display = 'none';document.getElementById('view_message').style.display = 'none';document.getElementById('view_message').innerHTML='loading...';");
            }
            $main_smarty->display(messaging_tpl_path . 'error.tpl');
            die;
        }
        $array['sender_name'] = $thisuser->username;
        $thisuser = "";
        return $array;
    } else {
        $main_smarty->assign('message', 'This is not your message!');
        if (messaging_fade_lightbox) {
            $main_smarty->assign('js_close', "Effect.Fade('overlay');Effect.Fade('view_message', {afterFinish: function(){document.getElementById('view_message').innerHTML='loading...';}});");
        } else {
            $main_smarty->assign('js_close', "document.getElementById('overlay').style.display = 'none';document.getElementById('view_message').style.display = 'none';document.getElementById('view_message').innerHTML='loading...';");
        }
        $main_smarty->display(messaging_tpl_path . 'error.tpl');
        die;
    }
}
Пример #2
0
function messaging_get_message_details($msgID)
{
    global $db, $current_user, $main_smarty;
    // Method for identifying modules rather than pagename
    define('modulename_sm', 'simple_messaging');
    $main_smarty->assign('modulename_sm', modulename_sm);
    $message = new KMessaging(true);
    $array = $message->GetMessege($msgID);
    // check to make sure this is our message
    if ($array['receiver'] == $current_user->user_id) {
        $message->MarkAsRead($msgID);
        $thisuser = new User();
        $thisuser->id = $array['sender'];
        if (!$thisuser->read()) {
            $main_smarty->assign('message', 'The person you are trying to send a message to does not exist!');
            $main_smarty->display(messaging_tpl_path . 'error.tpl');
            die;
        }
        $array['sender_name'] = $thisuser->username;
        $thisuser = "";
        return $array;
    } else {
        $main_smarty->assign('message', 'This is not your message!');
        $main_smarty->display(messaging_tpl_path . 'error.tpl');
        die;
    }
}