diff --git a/phpBB/db/mysql_schema.sql b/phpBB/db/mysql_schema.sql
index ed4be29726..9b07973b97 100644
--- a/phpBB/db/mysql_schema.sql
+++ b/phpBB/db/mysql_schema.sql
@@ -248,14 +248,14 @@ CREATE TABLE phpbb_privmsgs (
privmsgs_id int(11) NOT NULL auto_increment,
privmsgs_type tinyint(4) DEFAULT '0' NOT NULL,
privmsgs_subject varchar(255) DEFAULT '0' NOT NULL,
- privmsgs_from_groupid int(11) DEFAULT '0' NOT NULL,
- privmsgs_to_groupid int(11) DEFAULT '0' NOT NULL,
+ privmsgs_from_userid int(11) DEFAULT '0' NOT NULL,
+ privmsgs_to_userid int(11) DEFAULT '0' NOT NULL,
privmsgs_date int(11) DEFAULT '0' NOT NULL,
privmsgs_ip varchar(8) NOT NULL,
privmsgs_bbcode_uid int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (privmsgs_id),
- KEY privmsgs_from_groupid (privmsgs_from_groupid),
- KEY privmsgs_to_groupid (privmsgs_to_groupid)
+ KEY privmsgs_from_userid (privmsgs_from_userid),
+ KEY privmsgs_to_userid (privmsgs_to_userid)
);
@@ -501,19 +501,3 @@ CREATE TABLE phpbb_words (
replacement varchar(100) NOT NULL,
PRIMARY KEY (word_id)
);
-
-# --------------------------------------------------------
-#
-# Table structure for table 'phpbb_auto_prune'
-#
-DROP TABLE IF EXISTS phpbb_auto_prune;
-
-CREATE TABLE phpbb_auto_prune (
- prune_id int(10) NOT NULL auto_increment,
- forum_id int(11) NOT NULL,
- prune_days int(3) NOT NULL,
- last_pruned int(11),
- admin_id int(11) NOT NULL,
- PRIMARY KEY (prune_id)
-);
-
diff --git a/phpBB/db/postgres_schema.sql b/phpBB/db/postgres_schema.sql
index 075756cfc0..41ddce0a67 100644
--- a/phpBB/db/postgres_schema.sql
+++ b/phpBB/db/postgres_schema.sql
@@ -266,15 +266,15 @@ CREATE TABLE phpbb_privmsgs (
privmsgs_id int4 DEFAULT nextval('phpbb_privmsgs_id_seq'::text) NOT NULL,
privmsgs_type int2 DEFAULT '0' NOT NULL,
privmsgs_subject varchar(255) DEFAULT '0' NOT NULL,
- privmsgs_from_groupid int4 DEFAULT '0' NOT NULL,
- privmsgs_to_groupid int4 DEFAULT '0' NOT NULL,
+ privmsgs_from_userid int4 DEFAULT '0' NOT NULL,
+ privmsgs_to_userid int4 DEFAULT '0' NOT NULL,
privmsgs_date int4 DEFAULT '0' NOT NULL,
privmsgs_ip varchar(8) NOT NULL,
privmsgs_bbcode_uid int4 DEFAULT '0' NOT NULL,
CONSTRAINT phpbb_privmsgs_pkey PRIMARY KEY (privmsgs_id)
);
-CREATE INDEX privmsgs_from_groupid_index ON phpbb_privmsgs (privmsgs_from_groupid);
-CREATE INDEX privmsgs_to_groupid_index ON phpbb_privmsgs (privmsgs_to_groupid);
+CREATE INDEX privmsgs_from_userid_index ON phpbb_privmsgs (privmsgs_from_userid);
+CREATE INDEX privmsgs_to_userid_index ON phpbb_privmsgs (privmsgs_to_userid);
/* --------------------------------------------------------
diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php
index a91fd7211d..0d6ab5ad44 100755
--- a/phpBB/language/lang_english.php
+++ b/phpBB/language/lang_english.php
@@ -198,6 +198,14 @@ $lang['To'] = "To";
$lang['Date'] = "Date";
$lang['Mark'] = "Mark";
+$lang['No_to_user'] = "You must specify a username to send this message";
+$lang['No_such_user'] = "Sorry but no such user exists";
+
+$lang['Message_sent'] = "Your message has been sent";
+
+$lang['to_return_inbox'] = " to return to your Inbox"; // This follows a "Click HERE ... "
+$lang['to_return_index'] = " to return to the Forum Index"; // This follows a "Click HERE ... "
+
//
// Profiles/Registration
//
diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php
index a40c5c1312..b07b594f6e 100644
--- a/phpBB/privmsg.php
+++ b/phpBB/privmsg.php
@@ -283,8 +283,6 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
$attach_sig = (isset($HTTP_POST_VARS['attach_sig'])) ? $HTTP_POST_VARS['attach_sig'] : $userdata['user_attachsig'];
$preview = (isset($HTTP_POST_VARS['preview'])) ? TRUE : FALSE;
- $username = (isset($HTTP_POST_VARS['username'])) ? $HTTP_POST_VARS['username'] : "";
-
if($mode == "reply" || $mode == "edit")
{
if(!empty($HTTP_GET_VARS[POST_POST_URL]))
@@ -298,7 +296,7 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
}
}
- if!empty($HTTP_GET_VARS[POST_USERS_URL]))
+ if(!empty($HTTP_GET_VARS[POST_USERS_URL]) && !$preview && empty($HTTP_POST_VARS['submit']))
{
$sql = "SELECT username
FROM " . USERS_TABLE . "
@@ -310,9 +308,18 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
}
else
{
- list($username) = $db->sql_fetchrow($result);
+ list($to_username) = $db->sql_fetchrow($result);
+ $to_username = stripslashes($to_username);
}
}
+ else if(!empty($HTTP_POST_VARS['to_username']))
+ {
+ $to_username = stripslashes($HTTP_POST_VARS['to_username']);
+ }
+ else
+ {
+ $to_username = "";
+ }
if($HTTP_POST_VARS['submit'] || $preview)
{
@@ -361,6 +368,9 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
$smile_on = ($disable_smilies) ? FALSE : TRUE;
$message = prepare_message($HTTP_POST_VARS['message'], $html_on, $bbcode_on, $smile_on, $uid);
+ $message = preg_replace('##si', '</TEXTAREA>', $message);
+
+ $uid = make_bbcode_uid();
if($attach_sig && !empty($userdata['user_sig']))
{
@@ -371,6 +381,7 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
{
// do stripslashes incase magic_quotes is on.
$message = stripslashes($HTTP_POST_VARS['message']);
+ $message = preg_replace('##si', '</TEXTAREA>', $message);
}
}
else
@@ -383,9 +394,20 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
$error_msg .= $lang['Empty_msg'];
}
- if(!empty($HTTP_POST_VARS['to_userid']))
+ if(!empty($HTTP_POST_VARS['to_username']))
{
- $to_user_id = $HTTP_POST_VARS['to_userid'];
+ $sql = "SELECT user_id
+ FROM " . USERS_TABLE . "
+ WHERE username = '" . addslashes($to_username) . "'";
+ if(!$result = $db->sql_query($sql))
+ {
+ $error = TRUE;
+ $error_msg = $lang['No_such_user'];
+ }
+ else
+ {
+ list($to_userid) = $db->sql_fetchrow($result);
+ }
}
else
{
@@ -397,10 +419,12 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
$error_msg .= $lang['No_to_user'];
}
- if($HTTP_POST_VARS['submit'] && !$preview)
+ if($HTTP_POST_VARS['submit'] && !$preview && $mode == "post")
{
+ $msg_time = get_gmt_ts();
+
$sql = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_bbcode_uid)
- VALUES (" . PRIVMSGS_SENT_MAIL . ", '" . stripslashes($privmsg['privmsgs_subject']) . "', " . $privmsg['privmsgs_from_userid'] . ", " . $privmsg['privmsgs_to_userid'] . ", " . $privmsg['privmsgs_date'] . ", '" . $privmsg['privmsgs_ip'] . "', '" . $privmsg['privmsgs_bbcode_uid'] . "')";
+ VALUES (" . PRIVMSGS_NEW_MAIL . ", '$subject', " . $userdata['user_id'] . ", $to_userid, $msg_time, '$user_ip', '$uid')";
if(!$pm_sent_status = $db->sql_query($sql))
{
error_die(SQL_QUERY, "Could not insert private message sent info.", __LINE__, __FILE__);
@@ -410,16 +434,26 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
$privmsg_sent_id = $db->sql_nextid($pm_sent_status);
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_text)
- VALUES ($privmsg_sent_id, '" . stripslashes($privmsg['privmsgs_text']) . "')";
+ VALUES ($privmsg_sent_id, '$message')";
if(!$pm_sent_text_status = $db->sql_query($sql))
{
error_die(SQL_QUERY, "Could not insert private message sent text.", __LINE__, __FILE__);
}
+
+ include('includes/page_header.'.$phpEx);
+
+ $msg = $lang['Message_sent'] . "
" . $lang['Click'] . " " . $lang['Here'] . " " . $lang['to_return_inbox'] . "
" . $lang['Click'] . " " . $lang['Here'] . " ". $lang['to_return_index'];
+
+ $template->set_filenames(array(
+ "reg_header" => "error_body.tpl")
+ );
+ $template->assign_vars(array(
+ "ERROR_MESSAGE" => $msg)
+ );
+ $template->pparse("reg_header");
+
+ include('includes/page_tail.'.$phpEx);
}
-
-
-
-
}
}
@@ -548,9 +582,13 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
$post_a = $lang['Edit_Post'];
}
+ $subject_input = '';
+ $message_input = '';
+
$hidden_form_fields = "";
$template->assign_vars(array(
+ "S_USERNAME_INPUT" => "",
"SUBJECT_INPUT" => $subject_input,
"MESSAGE_INPUT" => $message_input,
"HTML_STATUS" => $html_status,
diff --git a/phpBB/templates/PSO/privmsgs_posting_body.tpl b/phpBB/templates/PSO/privmsgs_posting_body.tpl
new file mode 100644
index 0000000000..ece5490bc5
--- /dev/null
+++ b/phpBB/templates/PSO/privmsgs_posting_body.tpl
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+ {S_TIMEZONE} |
+ {JUMPBOX} |
+
+
\ No newline at end of file