<% LanguageParser.IncludeSection "pm" '///Check if user has logged in if inside <> 1 then objDAL.Disconnect Response.Redirect "default.asp" end if '/// Delete Function Private Function Delete(byval id) 'First look if the sender has deleted this in his outbox incase not just mark this as deleted by reciver Dim strSQL, arrDelete strSQL = "SELECT pmDelete, pmFromId FROM aspbb_PM WHERE pmId={0}" objDAL.open arrDelete, strSQL, array(id) If not eof(arrDelete) then If arrDelete(0,0) = 0 then If arrDelete(1,0) = userid then 'pmDelete 2 means sender deleted message strSQL = "UPDATE aspbb_PM SET pmDelete=2 WHERE pmId={0}" ELse 'pmDelete 1 means reciver deleted message strSQL = "UPDATE aspbb_PM SET pmDelete=1, pmStatus=1 WHERE pmId={0}" End if Else 'if pmDelete isnt 0 and we are reading that can only mean that the other part deleted it from his 'inbox/outbox so we just wipe it out of the database. strSQL = "DELETE FROM aspbb_PM WHERE pmID ={0}" End if objDAL.Execute strSQL, array(id) Else End if End Function '/// Delete message 'Delete requested if it matches userid If len(Request.QueryString("delete")) <> 0 then Delete(Request.QueryString("delete")) objDAL.Disconnect Response.Redirect("inbox.asp") End if '/// Delete multiple messages With Request i = 0 Dim Item For each Item in .Form If .Form(Item) <> "0" Then Delete(.form(Item)) End if i=i+1 next If i > 0 then objDAL.Disconnect Response.Redirect("inbox.asp") End if End With '/// Read message If len(Request.QueryString("read")) <> 0 then %> <% =langMSG %> <% dim arrRead, intRead intRead = Request.QueryString("read") strSQL = "SELECT pmSubject, pmText, pmFromId, pmId FROM aspbb_PM WHERE pmToId={0} AND pmId={1} OR pmFromID={0} AND pmId={1}" objDAL.open arrRead, strSQL, array(userid,intRead) If not EOF(arrRead) then %>
<% =Server.HTMLEncode(arrRead(0,0)) %>
<% =ASPBBCode(arrRead(1,0),0) %>

<% If arrRead(2,0) <> userid Then 'Only show reply if the user didnt create this message %> <% =langReply %>   <% End if %> <% =langDelete %>
<% 'Mark message as read if we dont read it in our sent items box if arrRead(2,0) <> userid then strSQL = "UPDATE aspbb_PM SET pmStatus=1 WHERE pmID={0} AND pmStatus<>2" objDAL.Execute strSQL, array(intRead) End If else 'EOF(arrRead) Someone made a mistake. It wasnt me but I guess we need to clean the mess up %>
<% =LanguageParser.GetKey("errors", "ErrorGeneral") %>
<% =LanguageParser.GetKey("errors", "ErrorPM") %>
<% End if Response.Write "
" End if '/// Display inbox %> <% =langInbox %> <% dim arrInbox, i, strImage strSQL = "SELECT aspbb_PM.pmStatus, aspbb_PM.pmId, aspbb_members.mid, aspbb_members.muser, aspbb_PM.pmDate, aspbb_PM.pmSubject FROM aspbb_PM INNER JOIN aspbb_members ON aspbb_members.mid=aspbb_PM.pmFromId WHERE aspbb_PM.pmToId={0} AND aspbb_PM.pmDelete<>1 ORDER BY aspbb_PM.pmDate DESC" objDAL.open arrInbox, strSQL, array(userid) If not EOF(arrInbox) then For i = 0 to Ubound(arrInbox,2) Select case arrInbox(0,i) case "0" strImage = "mail" case "1" strImage = "mailopen" case "2" strImage = "mailreply" End Select If i mod 2 then With Response .Write "" & vbNewLine .Write "" & vbNewLine .Write "" & vbNewLine .Write "" & vbnewline End With Else With Response .Write "" & vbNewLine .Write "" & vbNewLine .Write "" & vbNewLine .Write "" & vbnewline End With End If Next End If %>
<% =langStatus %> <% =langSubject %> <% =langFrom %> <% =langDate %>
" & arrInbox(5,i) & "" & arrInbox(3,i) & "" & uTimeStamp(arrInbox(4,i)) & "
" & arrInbox(5,i) & "" & arrInbox(3,i) & "" & uTimeStamp(arrInbox(4,i)) & "
<% =langDelSelected %>

<% '/// Sent messages If Request.QueryString("showsent") = "true" then strSQL = "SELECT aspbb_PM.pmId, aspbb_PM.pmSubject, aspbb_PM.pmToId, aspbb_members.mid, aspbb_PM.pmDate, aspbb_members.muser FROM aspbb_PM INNER JOIN aspbb_members ON aspbb_members.mid=aspbb_PM.pmToId WHERE aspbb_PM.pmFromId={0} AND aspbb_PM.pmDelete<>2 ORDER BY aspbb_PM.pmDate DESC" dim arrSent objDAL.open arrSent, strSQL, array(userid) If not EOF(arrSent) then With Response .write "" & langSentMsgs & "" .write "" & vbnewline .write "" For i=0 to Ubound(arrSent,2) If i mod 2 Then .write "" & vbNewLine .write "" & vbNewLine .write "" & vbNewLine Else .write "" & vbNewLine .write "" & vbNewLine .write "" & vbNewLine End if Next .write "" .write "
" & langSubject &"" & langTo &"" & langDate &"
" & arrSent(1,i) & "" & arrSent(5,i) & "" & uTimeStamp(arrSent(4,i)) & "
" & arrSent(1,i) & "" & arrSent(5,i) & "" & uTimeStamp(arrSent(4,i)) & "
" & langDelSelected &"
" End with End if Else strSQL = "SELECT COUNT(*) AS intResult FROM aspbb_PM WHERE pmFromId={0} AND pmDelete<>2" intResult = cInt(objDAL.GetValue(strSQL, array(userid))) If intResult <> 0 Then Response.Write ""& langSentMsgs & " ("& intResult &")" Else Response.Write langNoSent End if End if %>

<% =langInformation %>
<% =langNewPM %>
<% =langReadPM %>
<% =langReplyPM %>