forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createmessage.php
148 lines (117 loc) · 4.21 KB
/
createmessage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
require_once('db.inc.php');
$user = RA_ReadCookie( 'RA_User' );
$cookieRaw = RA_ReadCookie( 'RA_Cookie' );
if( RA_ReadCookieCredentials( $user, $points, $truePoints, $unreadMessageCount, $permissions, Permissions::Registered ) )
{
if( getAccountDetails( $user, $userDetails ) == FALSE )
{
// Immediate redirect if we cannot validate user!
header( "Location: http://" . AT_HOST . "?e=accountissue" );
exit;
}
}
else
{
// Immediate redirect if we cannot validate cookie!
header( "Location: http://" . AT_HOST . "?e=notloggedin" );
exit;
}
$messageTo = seekGET( 't', '' );
$messageContextID = seekGET( 'i', -1 );
$messageOutgoingPayload = seekGET( 'p', '' );
$messageContextTitle = seekGET( 's', '' );
$messageContextPayload = '';
$messageContextData = NULL;
if( $messageContextID != -1 )
{
$messageContextData = GetMessage( $user, $messageContextID );
$messageContextTitle = "RE: " . $messageContextData['Title'];
$messageContextPayload = $messageContextData['Payload'];
$messageContextPayload = stripslashes( $messageContextPayload );
$messageContextPayload = nl2br( $messageContextPayload );
}
$pageTitle = "Send Message";
$errorCode = seekGET('e');
RenderDocType();
?>
<head>
<?php RenderSharedHeader( $user ); ?>
<?php RenderTitleTag( $pageTitle, $user ); ?>
<?php RenderGoogleTracking(); ?>
</head>
<body>
<script>
$(function() {
$(':submit').click(function(e) {
$('.requiredinput').each(function() {
if ($(this).val().length == 0) {
$(this).effect("highlight", {}, 2000);
e.preventDefault();
}
});
});
// Focus on the first relevant field
if( $('#messagedest').val().length == 0 )
$('#messagedest').focus();
else
$("#commentTextarea").focus();
});
function onUserChange()
{
var target = $('#messagedest').val();
if( target.length > 2 )
$('.searchusericon').attr( 'src', '/UserPic/' + target + '.png' );
}
$( document ).ready( onUserChange );
</script>
<?php RenderTitleBar( $user, $points, $truePoints, $unreadMessageCount, $errorCode ); ?>
<?php RenderToolbar( $user, $permissions ); ?>
<div id="mainpage">
<div id='leftcontainer'>
<div id="forums" class="left">
<?php
echo "<div class='navpath'>";
echo "<a href='inbox.php'>Inbox</a>";
echo " » <b>Send Message</b></a>";
echo "</div>";
echo "<h2 class='longheader'>New Message</h2>";
if( $messageContextData !== NULL )
{
echo "In reply to ";
echo GetUserAndTooltipDiv( $messageContextData['UserFrom'], NULL, NULL, NULL, NULL, FALSE );
echo " who wrote:</br></br>";
echo "<div class='topiccommenttext'>" . parseTopicCommentPHPBB( $messageContextPayload ) . "</div>";
}
echo "<table class='smalltable'>";
echo "<tbody>";
echo "<form class='messageform' action='requestsendmessage.php' method='post'>";
echo "<input type='hidden' value='$user' name='u'></input>";
echo "<input type='hidden' value='$cookieRaw' name='c'></input>";
$destUser = strlen( $messageTo > 2 ) ? $messageTo : '_User';
echo "<tr class='alt'>";
echo "<td>User:</td>";
echo "<td><input type='text' value='$messageTo' name='d' id='messagedest' onblur='onUserChange(); return false;' class='requiredinput searchuser'></input></td>";
echo "<td style='width:10%'><img style='float:right' class='searchusericon' src='/UserPic/$destUser.png' width='64' height='64'/></td>";
echo "</tr>";
echo "<tr>" . "<td>Title: </td><td colspan='2'><input class='requiredinput fullwidth' type='text' value='$messageContextTitle' name='t'></input></td></tr>";
echo "<tr class='alt'>" . "<td>Message:</td><td colspan='2'>";
RenderPHPBBIcons();
echo "<textarea id='commentTextarea' class='requiredinput fullwidth forum messageTextarea' style='height:160px' rows='5' cols='61' name='m'>$messageOutgoingPayload</textarea></td></tr>";
echo "<tr>" . "<td></td><td colspan='2' class='fullwidth'><input style='float:right' type='submit' value='Send Message' size='37'/></td></tr>";
echo "</form>";
echo "</tbody>";
echo "</table>";
?>
<br/>
</div> <!-- -->
</div> <!-- leftcontainer -->
<div id='rightcontainer'>
<?php
RenderScoreLeaderboardComponent( $user, $points, TRUE );
?>
</div> <!-- rightcontainer -->
</div>
<?php RenderFooter(); ?>
</body>
</html>