0
+ − 1
<?php
+ − 2
/*
+ − 3
Plugin Name: Private Message frontend
23
+ − 4
Plugin URI: http://enanocms.org/
0
+ − 5
Description: Provides the page Special:PrivateMessages, which is used to manage private message functions. Also handles buddy lists.
+ − 6
Author: Dan Fuhry
318
+ − 7
Version: 1.0.6
23
+ − 8
Author URI: http://enanocms.org/
0
+ − 9
*/
+ − 10
+ − 11
/*
+ − 12
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
285
+ − 13
* Version 1.0.4
0
+ − 14
* Copyright (C) 2006-2007 Dan Fuhry
+ − 15
*
+ − 16
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ − 17
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ − 18
*
+ − 19
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ − 20
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ − 21
*/
+ − 22
+ − 23
global $db, $session, $paths, $template, $plugins; // Common objects
+ − 24
+ − 25
$plugins->attachHook('base_classes_initted', '
+ − 26
global $paths;
+ − 27
$paths->add_page(Array(
+ − 28
\'name\'=>\'Private Messages\',
+ − 29
\'urlname\'=>\'PrivateMessages\',
+ − 30
\'namespace\'=>\'Special\',
+ − 31
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
+ − 32
));
+ − 33
');
+ − 34
+ − 35
function page_Special_PrivateMessages()
+ − 36
{
+ − 37
global $db, $session, $paths, $template, $plugins; // Common objects
+ − 38
if(!$session->user_logged_in) die_friendly('Access denied', '<p>You need to <a href="'.makeUrlNS('Special', 'Login/'.$paths->page).'">log in</a> to view your private messages.</p>');
+ − 39
$argv = Array();
+ − 40
$argv[] = $paths->getParam(0);
+ − 41
$argv[] = $paths->getParam(1);
+ − 42
$argv[] = $paths->getParam(2);
+ − 43
if(!$argv[0]) $argv[0] = 'InVaLiD';
+ − 44
switch($argv[0])
+ − 45
{
+ − 46
default:
+ − 47
header('Location: '.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox'));
+ − 48
break;
+ − 49
case 'View':
+ − 50
$id = $argv[1];
+ − 51
if(!preg_match('#^([0-9]+)$#', $id)) die_friendly('Message error', '<p>Invalid message ID</p>');
+ − 52
$q = $db->sql_query('SELECT p.message_from, p.message_to, p.subject, p.message_text, p.date, p.folder_name, u.signature FROM '.table_prefix.'privmsgs AS p LEFT JOIN '.table_prefix.'users AS u ON (p.message_from=u.username) WHERE message_id='.$id.'');
+ − 53
if(!$q) $db->_die('The message data could not be selected.');
+ − 54
$r = $db->fetchrow();
+ − 55
$db->free_result();
+ − 56
if( ($r['message_to'] != $session->username && $r['message_from'] != $session->username ) || $r['folder_name']=='drafts' ) die_friendly('Access denied', '<p>You are not authorized to view this message.</p>');
+ − 57
if($r['message_to'] == $session->username)
+ − 58
{
+ − 59
$q = $db->sql_query('UPDATE '.table_prefix.'privmsgs SET message_read=1 WHERE message_id='.$id.'');
+ − 60
$db->free_result();
+ − 61
if(!$q) $db->_die('Could not mark message as read');
+ − 62
}
+ − 63
$template->header();
+ − 64
userprefs_show_menu();
+ − 65
?>
+ − 66
<br />
+ − 67
<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">
+ − 68
<tr><th colspan="2">Private message from <?php echo $r['message_from']; ?></th></tr>
+ − 69
<tr><td class="row1">Subject:</td><td class="row1"><?php echo $r['subject']; ?></td></tr>
+ − 70
<tr><td class="row2">Date:</td><td class="row2"><?php echo date('M j, Y G:i', $r['date']); ?></td></tr>
+ − 71
<tr><td class="row1">Message:</td><td class="row1"><?php echo RenderMan::render($r['message_text']);
+ − 72
if($r['signature'] != '')
+ − 73
{
+ − 74
echo '<hr style="margin-left: 1em; width: 200px;" />';
+ − 75
echo RenderMan::render($r['signature']);
+ − 76
}
+ − 77
?></td></tr>
+ − 78
<tr><td colspan="2" class="row3"><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/Compose/ReplyTo/'.$id); ?>">Send reply</a> | <a href="<?php echo makeUrlNS('Special', 'PrivateMessages/Delete/'.$id); ?>">Delete message</a> | <?php if($r['folder_name'] != 'archive') { ?><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/Move/'.$id.'/Archive'); ?>">Archive message</a> | <?php } ?><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/Folder/Inbox') ?>">Return to inbox</a></td></tr>
+ − 79
</table></div>
+ − 80
<?php
+ − 81
$template->footer();
+ − 82
break;
+ − 83
case 'Move':
+ − 84
$id = $argv[1];
+ − 85
if(!preg_match('#^([0-9]+)$#', $id)) die_friendly('Message error', '<p>Invalid message ID</p>');
+ − 86
$q = $db->sql_query('SELECT message_to FROM '.table_prefix.'privmsgs WHERE message_id='.$id.'');
+ − 87
if(!$q) $db->_die('The message data could not be selected.');
+ − 88
$r = $db->fetchrow();
+ − 89
$db->free_result();
+ − 90
if($r['message_to'] != $session->username) die_friendly('Access denied', '<p>You are not authorized to alter this message.</p>');
+ − 91
$fname = $argv[2];
+ − 92
if(!$fname || ( $fname != 'Inbox' && $fname != 'Outbox' && $fname != 'Sent' && $fname != 'Drafts' && $fname != 'Archive' ) ) die_friendly('Invalid request', '<p>The folder name "'.$fname.'" is invalid.</p>');
+ − 93
$q = $db->sql_query('UPDATE '.table_prefix.'privmsgs SET folder_name=\''.strtolower($fname).'\' WHERE message_id='.$id.';');
+ − 94
$db->free_result();
+ − 95
if(!$q) $db->_die('The message was not successfully moved.');
+ − 96
die_friendly('Message status', '<p>Your message has been moved to the folder "'.$fname.'".</p><p><a href="'.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox').'">Return to inbox</a></p>');
+ − 97
break;
+ − 98
case 'Delete':
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 99
csrf_request_confirm();
0
+ − 100
$id = $argv[1];
+ − 101
if(!preg_match('#^([0-9]+)$#', $id)) die_friendly('Message error', '<p>Invalid message ID</p>');
+ − 102
$q = $db->sql_query('SELECT message_to FROM '.table_prefix.'privmsgs WHERE message_id='.$id.'');
+ − 103
if(!$q) $db->_die('The message data could not be selected.');
+ − 104
$r = $db->fetchrow();
+ − 105
if($r['message_to'] != $session->username) die_friendly('Access denied', '<p>You are not authorized to delete this message.</p>');
+ − 106
$q = $db->sql_query('DELETE FROM '.table_prefix.'privmsgs WHERE message_id='.$id.';');
+ − 107
if(!$q) $db->_die('The message was not successfully deleted.');
+ − 108
$db->free_result();
+ − 109
die_friendly('Message status', '<p>The message has been deleted.</p><p><a href="'.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox').'">Return to inbox</a></p>');
+ − 110
break;
+ − 111
case 'Compose':
+ − 112
if($argv[1]=='Send' && isset($_POST['_send']))
+ − 113
{
+ − 114
// Check each POST DATA parameter...
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 115
csrf_request_confirm();
0
+ − 116
if(!isset($_POST['to']) || ( isset($_POST['to']) && $_POST['to'] == '')) die_friendly('Sending of message failed', '<p>Please enter the username to which you want to send your message.</p>');
+ − 117
if(!isset($_POST['subject']) || ( isset($_POST['subject']) && $_POST['subject'] == '')) die_friendly('Sending of message failed', '<p>Please enter a subject for your message.</p>');
+ − 118
if(!isset($_POST['message']) || ( isset($_POST['message']) && $_POST['message'] == '')) die_friendly('Sending of message failed', '<p>Please enter a message to send.</p>');
+ − 119
$namelist = $_POST['to'];
+ − 120
$namelist = str_replace(', ', ',', $namelist);
+ − 121
$namelist = explode(',', $namelist);
+ − 122
foreach($namelist as $n) { $n = $db->escape($n); }
+ − 123
$subject = RenderMan::preprocess_text($_POST['subject']);
+ − 124
$message = RenderMan::preprocess_text($_POST['message']);
+ − 125
$base_query = 'INSERT INTO '.table_prefix.'privmsgs(message_from,message_to,date,subject,message_text,folder_name,message_read) VALUES';
+ − 126
foreach($namelist as $n)
+ − 127
{
+ − 128
$base_query .= '(\''.$session->username.'\', \''.$n.'\', '.time().', \''.$subject.'\', \''.$message.'\', \'inbox\', 0),';
+ − 129
}
+ − 130
$base_query = substr($base_query, 0, strlen($base_query)-1) . ';';
+ − 131
$result = $db->sql_query($base_query);
+ − 132
$db->free_result();
+ − 133
if(!$result) $db->_die('The message could not be sent.');
+ − 134
else die_friendly('Message status', '<p>Your message has been sent. You may edit the message if you wish; one copy for each recipient will be in your outbox until each recipient has read it. Return to your <a href="'.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox').'">inbox</a>.</p>');
+ − 135
return;
+ − 136
} elseif($argv[1]=='Send' && isset($_POST['_savedraft'])) {
+ − 137
// Check each POST DATA parameter...
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 138
csrf_request_confirm();
0
+ − 139
if(!isset($_POST['to']) || ( isset($_POST['to']) && $_POST['to'] == '')) die_friendly('Sending of message failed', '<p>Please enter the username to which you want to send your message.</p>');
+ − 140
if(!isset($_POST['subject']) || ( isset($_POST['subject']) && $_POST['subject'] == '')) die_friendly('Sending of message failed', '<p>Please enter a subject for your message.</p>');
+ − 141
if(!isset($_POST['message']) || ( isset($_POST['message']) && $_POST['message'] == '')) die_friendly('Sending of message failed', '<p>Please enter a message to send.</p>');
+ − 142
$namelist = $_POST['to'];
+ − 143
$namelist = str_replace(', ', ',', $namelist);
+ − 144
$namelist = explode(',', $namelist);
+ − 145
foreach($namelist as $n) { $n = $db->escape($n); }
+ − 146
if(count($namelist) > MAX_PMS_PER_BATCH && $session->get_permssions('mod_misc')) die_friendly('Limit exceeded', '<p>You can only send this message to a maximum of '.MAX_PMS_PER_BATCH.' users.</p>');
+ − 147
$subject = $db->escape($_POST['subject']);
+ − 148
$message = RenderMan::preprocess_text($_POST['message']);
+ − 149
$base_query = 'INSERT INTO '.table_prefix.'privmsgs(message_from,message_to,date,subject,message_text,folder_name,message_read) VALUES';
+ − 150
foreach($namelist as $n)
+ − 151
{
+ − 152
$base_query .= '(\''.$session->username.'\', \''.$n.'\', '.time().', \''.$subject.'\', \''.$message.'\', \'drafts\', 0),';
+ − 153
}
+ − 154
$base_query = substr($base_query, 0, strlen($base_query)-1) . ';';
+ − 155
$result = $db->sql_query($base_query);
+ − 156
$db->free_result();
+ − 157
if(!$result) $db->_die('The message could not be saved.');
+ − 158
} elseif(isset($_POST['_inbox'])) {
+ − 159
header('Location: '.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox'));
+ − 160
}
+ − 161
if($argv[1] == 'ReplyTo' && preg_match('#^([0-9]+)$#', $argv[2]))
+ − 162
{
+ − 163
$to = '';
+ − 164
$text = '';
+ − 165
$subj = '';
+ − 166
$id = $argv[2];
+ − 167
$q = $db->sql_query('SELECT p.message_from, p.message_to, p.subject, p.message_text, p.date, p.folder_name, u.signature FROM '.table_prefix.'privmsgs AS p LEFT JOIN '.table_prefix.'users AS u ON (p.message_from=u.username) WHERE message_id='.$id.';');
+ − 168
if(!$q) $db->_die('The message data could not be selected.');
+ − 169
$r = $db->fetchrow();
+ − 170
$db->free_result();
+ − 171
if( ($r['message_to'] != $session->username && $r['message_from'] != $session->username ) || $r['folder_name']=='drafts' ) die_friendly('Access denied', '<p>You are not authorized to view the contents of this message.</p>');
+ − 172
$subj = 'Re: ' . $r['subject'];
+ − 173
$text = "\n\n\nOn ".date('M j, Y G:i', $r['date']).", ".$r['message_from']." wrote:\n> ".str_replace("\n", "\n> ", $r['message_text']); // Way less complicated than using a regex ;-)
+ − 174
+ − 175
$tbuf = $text;
+ − 176
while( preg_match("/\n([\> ]*?)\> \>/", $text) )
+ − 177
{
+ − 178
$text = preg_replace("/\n([\> ]*?)\> \>/", '\\1>>', $text);
+ − 179
if ( $text == $tbuf )
+ − 180
break;
+ − 181
$tbuf = $text;
+ − 182
}
+ − 183
+ − 184
$to = $r['message_from'];
+ − 185
} else {
22
+ − 186
if(( $argv[1]=='to' || $argv[1]=='To' ) && $argv[2]) $to = $argv[2];
0
+ − 187
else $to = '';
+ − 188
$text = '';
+ − 189
$subj = '';
+ − 190
}
+ − 191
$template->header();
+ − 192
userprefs_show_menu();
+ − 193
echo '<form action="'.makeUrlNS('Special', 'PrivateMessages/Compose/Send').'" method="post" onsubmit="if(!submitAuthorized) return false;">';
+ − 194
?>
+ − 195
<br />
+ − 196
<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">
+ − 197
<tr><th colspan="2">Compose new private message</th></tr>
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 198
<tr><td class="row1">To:<br /><small>Separate multiple names with a single comma; you<br />can send this message to up to <b><?php echo (string)MAX_PMS_PER_BATCH; ?></b> users.</small></td><td class="row1"><?php echo $template->username_field('to', (isset($_POST['_savedraft'])) ? htmlspecialchars($_POST['to']) : $to ); ?></td></tr>
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 199
<tr><td class="row2">Subject:</td><td class="row2"><input name="subject" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo htmlspecialchars($_POST['subject']); else echo $subj; ?>" /></td></tr>
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 200
<tr><td class="row1">Message:</td><td class="row1" style="min-width: 80%;"><textarea rows="20" cols="40" name="message" style="width: 100%;"><?php if(isset($_POST['_savedraft'])) echo htmlspecialchars($_POST['message']); else echo $text; ?></textarea></td></tr>
0
+ − 201
<tr><th colspan="2"><input type="submit" name="_send" value="Send message" /> <input type="submit" name="_savedraft" value="Save as draft" /> <input type="submit" name="_inbox" value="Back to Inbox" /></th></tr>
+ − 202
</table></div>
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 203
<input type="hidden" name="cstok" value="<?php echo $session->csrf_token; ?>" />
0
+ − 204
<?php
+ − 205
echo '</form>';
+ − 206
$template->footer();
+ − 207
break;
+ − 208
case 'Edit':
+ − 209
$id = $argv[1];
+ − 210
if(!preg_match('#^([0-9]+)$#', $id)) die_friendly('Message error', '<p>Invalid message ID</p>');
+ − 211
$q = $db->sql_query('SELECT message_from, message_to, subject, message_text, date, folder_name, message_read FROM '.table_prefix.'privmsgs WHERE message_id='.$id.'');
+ − 212
if(!$q) $db->_die('The message data could not be selected.');
+ − 213
$r = $db->fetchrow();
+ − 214
$db->free_result();
+ − 215
if($r['message_from'] != $session->username || $r['message_read'] == 1 ) die_friendly('Access denied', '<p>You are not authorized to edit this message.</p>');
+ − 216
$fname = $argv[2];
+ − 217
+ − 218
if(isset($_POST['_send']))
+ − 219
{
+ − 220
// Check each POST DATA parameter...
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 221
csrf_request_confirm();
0
+ − 222
if(!isset($_POST['to']) || ( isset($_POST['to']) && $_POST['to'] == '')) die_friendly('Sending of message failed', '<p>Please enter the username to which you want to send your message.</p>');
+ − 223
if(!isset($_POST['subject']) || ( isset($_POST['subject']) && $_POST['subject'] == '')) die_friendly('Sending of message failed', '<p>Please enter a subject for your message.</p>');
+ − 224
if(!isset($_POST['message']) || ( isset($_POST['message']) && $_POST['message'] == '')) die_friendly('Sending of message failed', '<p>Please enter a message to send.</p>');
+ − 225
$namelist = $_POST['to'];
+ − 226
$namelist = str_replace(', ', ',', $namelist);
+ − 227
$namelist = explode(',', $namelist);
+ − 228
foreach($namelist as $n) { $n = $db->escape($n); }
+ − 229
$subject = RenderMan::preprocess_text($_POST['subject']);
+ − 230
$message = RenderMan::preprocess_text($_POST['message']);
+ − 231
$base_query = 'UPDATE '.table_prefix.'privmsgs SET subject=\''.$subject.'\',message_to=\''.$namelist[0].'\',message_text=\''.$message.'\',folder_name=\'inbox\' WHERE message_id='.$id.';';
+ − 232
$result = $db->sql_query($base_query);
+ − 233
$db->free_result();
+ − 234
if(!$result) $db->_die('The message could not be sent.');
+ − 235
else die_friendly('Message status', '<p>Your message has been sent. You may edit the message if you wish; one copy for each recipient will be in your outbox until each recipient has read it. Return to your <a href="'.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox').'">inbox</a>.</p>');
+ − 236
return;
+ − 237
} elseif(isset($_POST['_savedraft'])) {
+ − 238
// Check each POST DATA parameter...
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 239
csrf_request_confirm();
0
+ − 240
if(!isset($_POST['to']) || ( isset($_POST['to']) && $_POST['to'] == '')) die_friendly('Sending of message failed', '<p>Please enter the username to which you want to send your message.</p>');
+ − 241
if(!isset($_POST['subject']) || ( isset($_POST['subject']) && $_POST['subject'] == '')) die_friendly('Sending of message failed', '<p>Please enter a subject for your message.</p>');
+ − 242
if(!isset($_POST['message']) || ( isset($_POST['message']) && $_POST['message'] == '')) die_friendly('Sending of message failed', '<p>Please enter a message to send.</p>');
+ − 243
$namelist = $_POST['to'];
+ − 244
$namelist = str_replace(', ', ',', $namelist);
+ − 245
$namelist = explode(',', $namelist);
+ − 246
foreach($namelist as $n) { $n = $db->escape($n); }
+ − 247
$subject = $db->escape($_POST['subject']);
+ − 248
$message = RenderMan::preprocess_text($_POST['message']);
+ − 249
$base_query = 'UPDATE '.table_prefix.'privmsgs SET subject=\''.$subject.'\',message_to=\''.$namelist[0].'\',message_text=\''.$message.'\' WHERE message_id='.$id.';';
+ − 250
$result = $db->sql_query($base_query);
+ − 251
$db->free_result();
+ − 252
if(!$result) $db->_die('The message could not be saved.');
+ − 253
}
+ − 254
if($argv[1]=='to' && $argv[2]) $to = $argv[2];
+ − 255
else $to = '';
+ − 256
$template->header();
+ − 257
userprefs_show_menu();
+ − 258
echo '<form action="'.makeUrlNS('Special', 'PrivateMessages/Edit/'.$id).'" method="post">';
+ − 259
?>
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 260
<input type="hidden" name="cstok" value="<?php echo $session->csrf_token; ?>" />
0
+ − 261
<br />
+ − 262
<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">
+ − 263
<tr><th colspan="2">Edit draft</th></tr>
+ − 264
<tr><td class="row1">To:<br /><small>Separate multiple names with a single comma</small></td><td class="row1"><input name="to" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo $_POST['to']; else echo $r['message_to']; ?>" /></td></tr>
+ − 265
<tr><td class="row2">Subject:</td><td class="row2"><input name="subject" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo $_POST['subject']; else echo $r['subject']; ?>" /></td></tr>
+ − 266
<tr><td class="row1">Message:</td><td class="row1"><textarea rows="20" cols="40" name="message" style="width: 100%;"><?php if(isset($_POST['_savedraft'])) echo $_POST['message']; else echo $r['message_text']; ?></textarea></td></tr>
+ − 267
<tr><th colspan="2"><input type="submit" name="_send" value="Send message" /> <input type="submit" name="_savedraft" value="Save as draft" /></th></tr>
+ − 268
</table></div>
+ − 269
<?php
+ − 270
echo '</form>';
+ − 271
$template->footer();
+ − 272
break;
+ − 273
case 'Folder':
+ − 274
$template->header();
+ − 275
userprefs_show_menu();
+ − 276
switch($argv[1])
+ − 277
{
+ − 278
default:
+ − 279
echo '<p>The folder "'.$argv[1].'" does not exist. Return to your <a href="'.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox').'">inbox</a>.</p>';
+ − 280
break;
+ − 281
case 'Inbox':
+ − 282
case 'Outbox':
+ − 283
case 'Sent':
+ − 284
case 'Drafts':
+ − 285
case 'Archive':
+ − 286
?>
+ − 287
<table border="0" width="100%" cellspacing="10" cellpadding="0">
+ − 288
<tr>
+ − 289
<td style="padding: 0px; width: 120px;" valign="top" >
+ − 290
<div class="tblholder" style="width: 120px;"><table border="0" width="120" cellspacing="1" cellpadding="4">
+ − 291
<tr><th><small>Private messages</small></th></tr>
+ − 292
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Inbox'); ?>">Inbox</a> </small></td></tr>
+ − 293
<tr><td class="row2"><small><a href="<?php echo $session->append_sid('Outbox'); ?>">Outbox</a> </small></td></tr>
+ − 294
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Sent'); ?>">Sent Items</a></small></td></tr>
+ − 295
<tr><td class="row2"><small><a href="<?php echo $session->append_sid('Drafts'); ?>">Drafts</a> </small></td></tr>
+ − 296
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Archive'); ?>">Archive</a></small></td></tr>
+ − 297
<tr><th><small>Buddies</small></th></tr>
+ − 298
<tr><td class="row2"><small><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/FriendList'); ?>">Friend list</a></small></td></tr>
+ − 299
<tr><td class="row1"><small><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/FoeList'); ?>">Foe list</a></small></td></tr>
+ − 300
</table></div>
+ − 301
</td>
+ − 302
<td valign="top">
+ − 303
<?php
+ − 304
$fname = strtolower($argv[1]);
+ − 305
switch($argv[1])
+ − 306
{
+ − 307
case 'Inbox':
+ − 308
case 'Archive':
+ − 309
default:
+ − 310
$q = $db->sql_query('SELECT p.message_id, p.message_from, p.message_to, p.date, p.subject, p.message_read FROM '.table_prefix.'privmsgs AS p WHERE p.folder_name=\''.$fname.'\' AND p.message_to=\''.$session->username.'\' ORDER BY date DESC;');
+ − 311
break;
+ − 312
case 'Outbox':
+ − 313
$q = $db->sql_query('SELECT p.message_id, p.message_from, p.message_to, p.date, p.subject, p.message_read FROM '.table_prefix.'privmsgs AS p WHERE p.message_from=\''.$session->username.'\' AND message_read=0 ORDER BY date DESC;');
+ − 314
break;
+ − 315
case 'Sent':
+ − 316
$q = $db->sql_query('SELECT p.message_id, p.message_from, p.message_to, p.date, p.subject, p.message_read FROM '.table_prefix.'privmsgs AS p WHERE p.message_from=\''.$session->username.'\' AND message_read=1 ORDER BY date DESC;');
+ − 317
break;
+ − 318
case 'Drafts':
+ − 319
$q = $db->sql_query('SELECT p.message_id, p.message_from, p.message_to, p.date, p.subject, p.message_read FROM '.table_prefix.'privmsgs AS p WHERE p.folder_name=\''.$fname.'\' AND p.message_from=\''.$session->username.'\' ORDER BY date DESC;');
+ − 320
break;
+ − 321
}
+ − 322
if($argv[1] == 'Drafts' || $argv[1] == 'Outbox') $act = 'Edit';
+ − 323
else $act = 'View';
+ − 324
if(!$q) $db->_die('The private message data could not be selected.');
+ − 325
echo '<form action="'.makeUrlNS('Special', 'PrivateMessages/PostHandler').'" method="post"><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th colspan="4" style="text-align: left;">Folder: '.$argv[1].'</th></tr><tr><th class="subhead">';
+ − 326
if($fname == 'drafts' || $fname == 'Outbox') echo 'To'; else echo 'From';
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 327
?><input type="hidden" name="cstok" value="<?php echo $session->csrf_token; ?>" /><?php
0
+ − 328
echo '</th><th class="subhead">Subject</th><th class="subhead">Date</th><th class="subhead">Mark</th></tr>';
+ − 329
if($db->numrows() < 1)
+ − 330
echo '<tr><td style="text-align: center;" class="row1" colspan="4">No messages in this folder.</td></tr>';
+ − 331
else {
+ − 332
$cls = 'row2';
+ − 333
while($r = $db->fetchrow())
+ − 334
{
+ − 335
if($cls == 'row2') $cls='row1';
+ − 336
else $cls = 'row2';
+ − 337
$mto = str_replace(' ', '_', $r['message_to']);
+ − 338
$mfr = str_replace(' ', '_', $r['message_from']);
+ − 339
echo '<tr><td class="'.$cls.'"><a href="'.makeUrlNS('User', ( $fname == 'drafts') ? $mto : $mfr).'">';
+ − 340
if($fname == 'drafts' || $fname == 'outbox') echo $r['message_to']; else echo $r['message_from'];
+ − 341
echo '</a></td><td class="'.$cls.'"><a href="'.makeUrlNS('Special', 'PrivateMessages/'.$act.'/'.$r['message_id']).'">';
+ − 342
if($r['message_read'] == 0) echo '<b>';
+ − 343
echo $r['subject'];
+ − 344
if($r['message_read'] == 0) echo '</b>';
+ − 345
echo '</a></td><td class="'.$cls.'">'.date('M j, Y G:i', $r['date']).'</td><td class="'.$cls.'" style="text-align: center;"><input name="marked_'.$r['message_id'].'" type="checkbox" /></td></tr>';
+ − 346
}
+ − 347
$db->free_result();
+ − 348
}
+ − 349
echo '<tr><th style="text-align: right;" colspan="4"><input type="hidden" name="folder" value="'.$fname.'" /><input type="submit" name="archive" value="Archive selected" /> <input type="submit" name="delete" value="Delete selected" /> <input type="submit" name="deleteall" value="Delete all" /></th></tr>';
+ − 350
echo '</table></div></form>
+ − 351
<br />
+ − 352
<a href="'.makeUrlNS('Special', 'PrivateMessages/Compose/').'">New message</a>
+ − 353
</td></tr></table>';
+ − 354
break;
+ − 355
}
+ − 356
$template->footer();
+ − 357
break;
+ − 358
case 'PostHandler':
+ − 359
$fname = $db->escape(strtolower($_POST['folder']));
+ − 360
if($fname=='drafts' || $fname=='outbox')
+ − 361
{
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 362
$fname = $fname == 'outbox' ? 'inbox' : $fname;
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 363
$readsnip = $fname == 'inbox' ? ' AND message_read = 0' : '';
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 364
$q = $db->sql_query('SELECT p.message_id, p.message_from, p.message_to, p.date, p.subject FROM '.table_prefix.'privmsgs AS p WHERE p.folder_name=\''.$fname.'\' AND p.message_from=\''.$session->username.'\'' . $readsnip . ' ORDER BY date DESC;');
0
+ − 365
} else {
+ − 366
$q = $db->sql_query('SELECT p.message_id, p.message_from, p.message_to, p.date, p.subject FROM '.table_prefix.'privmsgs AS p WHERE p.folder_name=\''.$fname.'\' AND p.message_to=\''.$session->username.'\' ORDER BY date DESC;');
+ − 367
}
+ − 368
if(!$q) $db->_die('The private message data could not be selected.');
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 369
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 370
csrf_request_confirm();
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 371
0
+ − 372
if(isset($_POST['archive'])) {
+ − 373
while($row = $db->fetchrow($q))
+ − 374
{
+ − 375
if(isset($_POST['marked_'.$row['message_id']]))
+ − 376
{
+ − 377
$e = $db->sql_query('UPDATE '.table_prefix.'privmsgs SET folder_name=\'archive\' WHERE message_id='.$row['message_id'].';');
+ − 378
if(!$e) $db->_die('Message '.$row['message_id'].' was not successfully moved.');
+ − 379
$db->free_result();
+ − 380
}
+ − 381
}
+ − 382
} elseif(isset($_POST['delete'])) {
+ − 383
while($row = $db->fetchrow($q))
+ − 384
{
+ − 385
if(isset($_POST['marked_'.$row['message_id']]))
+ − 386
{
+ − 387
$e = $db->sql_query('DELETE FROM '.table_prefix.'privmsgs WHERE message_id='.$row['message_id'].';');
343
7e6537fd4730
SECURITY: Fixed several XSS vulns reported by Secunia, mostly in Private Messaging. Also backported CSRF protection API from 1.1.x, and protected Private Messaging and logout functions.
Dan Fuhry <dan@enanocms.org>
diff
changeset
+ − 388
if(!$e) $db->_die('Message '.$row['message_id'].' was not successfully removed.');
0
+ − 389
$db->free_result();
+ − 390
}
+ − 391
}
+ − 392
} elseif(isset($_POST['deleteall'])) {
+ − 393
while($row = $db->fetchrow($q))
+ − 394
{
+ − 395
$e = $db->sql_query('DELETE FROM '.table_prefix.'privmsgs WHERE message_id='.$row['message_id'].';');
+ − 396
if(!$e) $db->_die('Message '.$row['message_id'].' was not successfully moved.');
+ − 397
$db->free_result();
+ − 398
}
+ − 399
} else {
+ − 400
die_friendly('Invalid request', 'This section can only be accessed from within another Private Message section.');
+ − 401
}
+ − 402
$db->free_result($q);
+ − 403
header('Location: '.makeUrlNS('Special', 'PrivateMessages/Folder/'. substr(strtoupper($_POST['folder']), 0, 1) . substr(strtolower($_POST['folder']), 1, strlen($_POST['folder'])) ));
+ − 404
break;
+ − 405
case 'FriendList':
+ − 406
if($argv[1] == 'Add')
+ − 407
{
+ − 408
if(isset($_POST['_go']))
+ − 409
$buddyname = $_POST['buddyname'];
+ − 410
elseif($argv[2])
+ − 411
$buddyname = $argv[2];
+ − 412
else
+ − 413
die_friendly('Error adding buddy', '<p>No name specified</p>');
+ − 414
$q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE username=\''.$db->escape($buddyname).'\'');
+ − 415
if(!$q) $db->_die('The buddy\'s user ID could not be selected.');
+ − 416
if($db->numrows() < 1) echo '<h3>Error adding buddy</h3><p>The username you entered is not in use by any registered user.</p>';
+ − 417
{
+ − 418
$r = $db->fetchrow();
+ − 419
$db->free_result();
+ − 420
$q = $db->sql_query('INSERT INTO '.table_prefix.'buddies(user_id,buddy_user_id,is_friend) VALUES('.$session->user_id.', '.$r['user_id'].', 1);');
+ − 421
if(!$q) echo '<h3>Warning:</h3><p>Buddy could not be added: '.mysql_error().'</p>';
+ − 422
$db->free_result();
+ − 423
}
+ − 424
} elseif($argv[1] == 'Remove' && preg_match('#^([0-9]+)$#', $argv[2])) {
+ − 425
// Using WHERE user_id prevents users from deleting others' buddies
+ − 426
$q = $db->sql_query('DELETE FROM '.table_prefix.'buddies WHERE user_id='.$session->user_id.' AND buddy_id='.$argv[2].';');
+ − 427
$db->free_result();
+ − 428
if(!$q) echo '<h3>Warning:</h3><p>Buddy could not be deleted: '.mysql_error().'</p>';
+ − 429
if(mysql_affected_rows() < 1) echo '<h3>Warning:</h3><p>No rows were affected. Either the selected buddy ID does not exist or you tried to delete someone else\'s buddy.</p>';
+ − 430
}
+ − 431
$template->header();
+ − 432
userprefs_show_menu();
+ − 433
?>
+ − 434
<table border="0" width="100%" cellspacing="10" cellpadding="0">
+ − 435
<tr>
+ − 436
<td style="padding: 0px; width: 120px;" valign="top" >
+ − 437
<div class="tblholder" style="width: 120px;"><table border="0" width="120" cellspacing="1" cellpadding="4">
+ − 438
<tr><th><small>Private messages</small></th></tr>
+ − 439
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Inbox'); ?>">Inbox</a> </small></td></tr>
+ − 440
<tr><td class="row2"><small><a href="<?php echo $session->append_sid('Outbox'); ?>">Outbox</a> </small></td></tr>
+ − 441
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Sent'); ?>">Sent Items</a></small></td></tr>
+ − 442
<tr><td class="row2"><small><a href="<?php echo $session->append_sid('Drafts'); ?>">Drafts</a> </small></td></tr>
+ − 443
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Archive'); ?>">Archive</a></small></td></tr>
+ − 444
<tr><th><small>Buddies</small></th></tr>
+ − 445
<tr><td class="row2"><small><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/FriendList'); ?>">Friend list</a></small></td></tr>
+ − 446
<tr><td class="row1"><small><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/FoeList'); ?>">Foe list</a></small></td></tr>
+ − 447
</table></div>
+ − 448
</td>
+ − 449
<td valign="top">
+ − 450
<?php
+ − 451
$q = $db->sql_query('SELECT u.username,b.buddy_id FROM '.table_prefix.'buddies AS b LEFT JOIN '.table_prefix.'users AS u ON ( u.user_id=b.buddy_user_id ) WHERE b.user_id='.$session->user_id.' AND is_friend=1;');
+ − 452
if(!$q) $db->_die('The buddy list could not be selected.');
+ − 453
else
+ − 454
{
+ − 455
$allbuds = '';
+ − 456
echo '<br /><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th colspan="3">Buddy list for '.$session->username.'</th></tr>';
+ − 457
if($db->numrows() < 1) echo '<tr><td class="row3">No buddies in your list.</td></tr>';
+ − 458
$cls = 'row2';
+ − 459
while ( $row = $db->fetchrow() )
+ − 460
{
+ − 461
if($cls=='row2') $cls = 'row1';
+ − 462
else $cls = 'row2';
+ − 463
echo '<tr><td class="'.$cls.'"><a href="'.makeUrlNS('User', str_replace(' ', '_', $row['username'])).'" '. ( isPage($paths->nslist['User'].str_replace(' ', '_', $row['username'])) ? '' : 'class="wikilink-nonexistent" ' ) .'>'.$row['username'].'</a></td><td class="'.$cls.'"><a href="'.makeUrlNS('Special', 'PrivateMessages/Compose/to/'.str_replace(' ', '_', $row['username'])).'">Send private message</a></td><td class="'.$cls.'"><a onclick="return confirm(\'Are you sure you want to delete this user from your buddy list?\')" href="'.makeUrlNS('Special', 'PrivateMessages/FriendList/Remove/'.$row['buddy_id']).'">Remove</a></td></tr>';
+ − 464
$allbuds .= str_replace(' ', '_', $row['username']).',';
+ − 465
}
+ − 466
$db->free_result();
+ − 467
$allbuds = substr($allbuds, 0, strlen($allbuds)-1);
+ − 468
if($cls=='row2') $cls = 'row1';
+ − 469
else $cls = 'row2';
+ − 470
echo '<tr><td colspan="3" class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'PrivateMessages/Compose/to/'.$allbuds).'">Send a PM to all buddies</a></td></tr>';
+ − 471
echo '</table></div>';
+ − 472
}
+ − 473
echo '<form action="'.makeUrlNS('Special', 'PrivateMessages/FriendList/Add').'" method="post" onsubmit="if(!submitAuthorized) return false;">
+ − 474
<h3>Add a new friend</h3>';
+ − 475
echo '<p>Username: '.$template->username_field('buddyname').' <input type="submit" name="_go" value="Add" /></p>';
+ − 476
echo '</form>';
+ − 477
?>
+ − 478
</td>
+ − 479
</tr>
+ − 480
</table>
+ − 481
<?php
+ − 482
$template->footer();
+ − 483
break;
+ − 484
case 'FoeList':
+ − 485
if($argv[1] == 'Add' && isset($_POST['_go']))
+ − 486
{
+ − 487
$q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['buddyname']).'\'');
+ − 488
if(!$q) $db->_die('The buddy\'s user ID could not be selected.');
+ − 489
if($db->numrows() < 1) echo '<h3>Error adding buddy</h3><p>The username you entered is not in use by any registered user.</p>';
+ − 490
{
+ − 491
$r = $db->fetchrow();
+ − 492
$q = $db->sql_query('INSERT INTO '.table_prefix.'buddies(user_id,buddy_user_id,is_friend) VALUES('.$session->user_id.', '.$r['user_id'].', 0);');
+ − 493
if(!$q) echo '<h3>Warning:</h3><p>Buddy could not be added: '.mysql_error().'</p>';
+ − 494
}
+ − 495
$db->free_result();
+ − 496
} elseif($argv[1] == 'Remove' && preg_match('#^([0-9]+)$#', $argv[2])) {
+ − 497
// Using WHERE user_id prevents users from deleting others' buddies
+ − 498
$q = $db->sql_query('DELETE FROM '.table_prefix.'buddies WHERE user_id='.$session->user_id.' AND buddy_id='.$argv[2].';');
+ − 499
$db->free_result();
+ − 500
if(!$q) echo '<h3>Warning:</h3><p>Buddy could not be deleted: '.mysql_error().'</p>';
+ − 501
if(mysql_affected_rows() < 1) echo '<h3>Warning:</h3><p>No rows were affected. Either the selected buddy ID does not exist or you tried to delete someone else\'s buddy.</p>';
+ − 502
}
+ − 503
$template->header();
+ − 504
userprefs_show_menu();
+ − 505
?>
+ − 506
<table border="0" width="100%" cellspacing="10" cellpadding="0">
+ − 507
<tr>
+ − 508
<td style="padding: 0px; width: 120px;" valign="top" >
+ − 509
<div class="tblholder" style="width: 120px;"><table border="0" width="120" cellspacing="1" cellpadding="4">
+ − 510
<tr><th><small>Private messages</small></th></tr>
+ − 511
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Inbox'); ?>">Inbox</a> </small></td></tr>
+ − 512
<tr><td class="row2"><small><a href="<?php echo $session->append_sid('Outbox'); ?>">Outbox</a> </small></td></tr>
+ − 513
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Sent'); ?>">Sent Items</a></small></td></tr>
+ − 514
<tr><td class="row2"><small><a href="<?php echo $session->append_sid('Drafts'); ?>">Drafts</a> </small></td></tr>
+ − 515
<tr><td class="row1"><small><a href="<?php echo $session->append_sid('Archive'); ?>">Archive</a></small></td></tr>
+ − 516
<tr><th><small>Buddies</small></th></tr>
+ − 517
<tr><td class="row2"><small><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/FriendList'); ?>">Friend list</a></small></td></tr>
+ − 518
<tr><td class="row1"><small><a href="<?php echo makeUrlNS('Special', 'PrivateMessages/FoeList'); ?>">Foe list</a></small></td></tr>
+ − 519
</table></div>
+ − 520
</td>
+ − 521
<td valign="top">
+ − 522
<?php
+ − 523
$q = $db->sql_query('SELECT u.username,b.buddy_id FROM '.table_prefix.'buddies AS b LEFT JOIN '.table_prefix.'users AS u ON ( u.user_id=b.buddy_user_id ) WHERE b.user_id='.$session->user_id.' AND is_friend=0;');
+ − 524
if(!$q) $db->_die('The buddy list could not be selected.');
+ − 525
else
+ − 526
{
+ − 527
$allbuds = '';
+ − 528
echo '<br /><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th colspan="3">Foe list for '.$session->username.'</th></tr>';
+ − 529
if($db->numrows() < 1) echo '<tr><td class="row2">No foes in your list.</td></tr>';
+ − 530
$cls = 'row2';
+ − 531
while ( $row = $db->fetchrow() )
+ − 532
{
+ − 533
if($cls=='row2') $cls = 'row1';
+ − 534
else $cls = 'row2';
+ − 535
echo '<tr><td class="'.$cls.'"><a href="'.makeUrlNS('User', str_replace(' ', '_', $row['username'])).'" '. ( isPage($paths->nslist['User'].str_replace(' ', '_', $row['username'])) ? '' : 'class="wikilink-nonexistent" ' ) .'>'.$row['username'].'</a></td><td class="'.$cls.'"><a href="'.makeUrlNS('Special', 'PrivateMessages/Compose/to/'.str_replace(' ', '_', $row['username'])).'">Send private message</a></td><td class="'.$cls.'"><a onclick="return confirm(\'Are you sure you want to delete this user from your buddy list?\')" href="'.makeUrlNS('Special', 'PrivateMessages/FriendList/Remove/'.$row['buddy_id']).'">Remove</a></td></tr>';
+ − 536
$allbuds .= str_replace(' ', '_', $row['username']).',';
+ − 537
}
+ − 538
$allbuds = substr($allbuds, 0, strlen($allbuds)-1);
+ − 539
if($cls=='row2') $cls = 'row1';
+ − 540
else $cls = 'row2';
+ − 541
//echo '<tr><td colspan="3" class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'PrivateMessages/Compose/to/'.$allbuds).'">Send a PM to all buddies</a></td></tr>';
+ − 542
echo '</table></div>';
+ − 543
}
+ − 544
$db->free_result();
+ − 545
echo '<form action="'.makeUrlNS('Special', 'PrivateMessages/FoeList/Add').'" method="post" onsubmit="if(!submitAuthorized) return false;">
+ − 546
<h3>Add a new foe</h3>';
+ − 547
echo '<p>Username: '.$template->username_field('buddyname').' <input type="submit" name="_go" value="Add" /></p>';
+ − 548
echo '</form>';
+ − 549
?>
+ − 550
</td>
+ − 551
</tr>
+ − 552
</table>
+ − 553
<?php
+ − 554
$template->footer();
+ − 555
break;
+ − 556
}
+ − 557
}
+ − 558
+ − 559
?>