| Author
|
Message: $subject
|
";
}
// Now that it has the $username set, prints out the PM header
$navigation = "
Index >
$lang[readpm] | ";
$newline = template("header.html");
eval("echo stripslashes(\"$newline\");");
echo "
$guts";
$pagetext = "$pagetext";
if (($pm[icon] == "none") or ($pm[icon] == "")) {
$icon = "";
} else {
$icon = " ";
}
if ($bg_color == "#cccccc")
{
$bg_color = "#FFFFFF";
} else {
$bg_color = "#cccccc";
}
$sql = "SELECT register, location, aim, homepage, icq, status, avatar, post_num FROM members WHERE username='$pm[username_from]'";
$member_query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
$memberinfo = mysql_fetch_array($member_query);
if ($memberinfo[avatar] != "images/blank.gif")
{
$avatar = " ";
} else {
$avatar = "";
}
$status = $memberinfo[status];
// Stars Hack
if ($memberinfo[status] == "Administrator") {
$stars = "
    ";
} elseif ($memberinfo[status] == "Moderator") {
$stars = "
   ";
} elseif ($memberinfo[status] == "Senior Member") {
$stars = "
  ";
} elseif ($memberinfo[status] == "Member") {
$stars = "
 ";
} else {
$stars = "
";
}
$profile = " ";
$email = " ";
if (($memberinfo[icq] != "") && ($memberinfo[icq] != "0"))
{
$icq = " ";
$icq_addme = " ";
}
if (($memberinfo[homepage] != "http://") && ($memberinfo[homepage] != "")){
$homepage = " ";
}
if ($memberinfo[aim] != "") {
$aim = " ";
}
$postinfo = $profile . $email . $aim . $icq . $icq_addme . $homepage;
if ($username == "$user")
{
$newline = template("pm_view_box.html");
eval("echo stripslashes(\"$newline\");");
// Prepares the jump to form
$jump = jump_to();
}
echo "|
All
times are ET (US)
|
|
";
$newline = template("footer.html");
eval("echo stripslashes(\"$newline\");");
} elseif (($action == "Send Reply") || ($action == "Send New PM") || ($action == "Forward PM")) {
$dir = opendir("images/icons");
while ($icon = readdir($dir)) {
if (is_file("images/icons/$icon") && eregi(".gif",$icon)) {
$i++;
$icons .= " ";
if ($i >= 8) {
$i = 0;
$icons .= " \n";
}
}
}
if ($action == "Send Reply") {
$sql = "SELECT username_from, subject, message FROM pm WHERE PMID='$PMID'";
$member_query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
$pm = mysql_fetch_array($member_query);
$message = "[quote]$pm[message][/quote]";
$subject = "RE: $pm[subject]";
$username_to = "$pm[username_from]";
} elseif ($action == "Forward PM") {
$sql = "SELECT subject, message FROM pm WHERE PMID='$PMID'";
$member_query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
$pm = mysql_fetch_array($member_query);
$message = "[quote]$pm[message][/quote]";
$subject = "FWD: $pm[subject]";
} else { }
if ($check_signature == "yes")
$check_signature = "checked";
$newline = template("pm_compose.html");
eval("echo stripslashes(\"$newline\");");
} elseif (($action == "Send Reply Now") || ($action == "Send New PM Now") || ($action == "Forward PM Now")) {
if ($subject == "") {
echo "Back up and please input something into the subject box!";
exit;
}
if ($message == "") {
echo "Back up and please input something into the text box!";
exit;
}
$sql = "SELECT * FROM members WHERE username='$username'";
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
$member = mysql_fetch_array($query);
if (($signature == "yes") && ($member[signature] != "")) {
$message .= "\n__________________\n" . $member[signature];
}
$recipients = split("\;", trim($username_to));
for($index=0; $index < count($recipients); $index++) {
$sql = "INSERT INTO pm (PMID, icon, username_to, username_from, date, subject, message, folder) VALUES (NULL,'".addslashes($icon)."','".addslashes(trim($recipients[$index]))."','".addslashes($UserName)."',".time().",'".addslashes($subject)."','".addslashes($message)."', 'Inbox')";
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
}
redirect("$urltoforum/index.php3?frame=index", "Your PM has been sent! You will be redirected in two seconds. If you do not wish to wait, click here now.");
} elseif ($action == "Delete") {
for ($index=0; $index < count($PMID); $index++)
{
$sql = "DELETE FROM pm WHERE PMID=$PMID[$index]";
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
}
redirect("$urltoforum/index.php3?frame=index", "PMs have been deleted! You will be redirected in two seconds. If you do not wish to wait, click here now.");
} elseif ($action == "Move") {
for ($index=0; $index < count($PMID); $index++)
{
$sql = "UPDATE pm SET folder='" . addslashes($folder) ."' WHERE PMID=$PMID[$index]";
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
}
redirect("$urltoforum/index.php3?frame=index", "PMs have been moved! You will be redirected in two seconds. If you do not wish to wait, click here now.");
} elseif ($action == "listfolders") {
$sql = "SELECT pmfolder FROM members WHERE username='$username'";
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
$pminfo = mysql_fetch_array($query);
if ($pminfo[pmfolder])
{
$folders = split("\|", trim($pminfo[pmfolder]));
for($index=0; $index < count($folders); $index++)
{
$list .= " ";
}
$list .= " ";
}
$newline = template("pm_edit_folder.html");
eval("echo stripslashes(\"$newline\");");
} elseif ($action == "editfolder") {
for ($index=0; $index < count($folder); $index++)
{
if ($folder[$index] != "")
{
$newfolder .= "$folder[$index]|";
}
}
$newfolder = substr($newfolder, 0, strlen($newfolder) - 1);
$sql = "UPDATE members SET pmfolder='$newfolder'";
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
//Checking PM not in a folder
$sql = "SELECT pmfolder FROM members WHERE username='$username'";
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
$pminfo = mysql_fetch_array($query);
if ($pminfo[pmfolder])
{
$folders = split("\|", trim($pminfo[pmfolder]));
for($index=0; $index < count($folders); $index++)
{
$sql_folder .= "folder != '$folders[$index]' AND ";
}
}
$sql = "UPDATE pm SET folder='Inbox' WHERE username_to='$username' AND " . substr($sql_folder, 0, strlen($sql_folder) - 5);
$query = mysql_db_query($database, $sql) or die(geterrdesc($sql));
redirect("$urltoforum/index.php3?frame=index", "PM Folders have been updated! You will be redirected in two seconds. If you do not wish to wait, click here now.");
} else {
echo "No action performed!";
}
exit;
?>
|