Initial commit

This commit is contained in:
root
2020-08-17 19:16:42 -04:00
commit 61584e0eb2
600 changed files with 50518 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<?php
output_notl("<form action='mail.php?op=write' method='post'>",true);
output("`b`2Address:`b`n");
$to = translate_inline("To: ");
$search = htmlentities(translate_inline("Search"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
output_notl("`2$to <input name='to' id='to' value=\"".htmlentities(stripslashes(httpget('prepop')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
output_notl("<input type='submit' class='button' value=\"$search\">", true);
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
$from = translate_inline("From: ");
output_notl("`n`2$from <input name='from' id='from'>`n", true);
output("`7`iLeave empty to send from your account!`i");
}
rawoutput("</form>");
rawoutput("<script type='text/javascript'>document.getElementById(\"to\").focus();</script>");
?>

View File

@ -0,0 +1,60 @@
<?php
output("`b`iMail Box`i`b");
if (isset($session['message'])) {
output($session['message']);
}
$session['message']="";
$mail = db_prefix("mail");
$accounts = db_prefix("accounts");
$sql = "SELECT subject,messageid,$accounts.name,msgfrom,seen,sent FROM $mail LEFT JOIN $accounts ON $accounts.acctid=$mail.msgfrom WHERE msgto=\"".$session['user']['acctid']."\" ORDER BY seen ASC, sent DESC";
$result = db_query($sql);
$db_num_rows = db_num_rows($result);
if ($db_num_rows>0){
$no_subject = translate_inline("`i(No Subject)`i");
rawoutput("<form action='mail.php?op=process' method='post'><table>");
while($row = db_fetch_assoc($result)){
rawoutput("<tr>");
rawoutput("<td nowrap><input type='checkbox' name='msg[]' value='{$row['messageid']}'>");
rawoutput("<img src='images/".($row['seen']?"old":"new")."scroll.GIF' width='16px' height='16px' alt='".($row['seen']?"Old":"New")."'></td>");
rawoutput("<td>");
if ($row['msgfrom']==0 || !is_numeric($row['msgfrom'])){
if ($row['msgfrom'] == 0 && is_numeric($row['msgfrom'])) {
$row['name']=translate_inline("`i`^System`0`i");
} else {
$row['name']=$row['msgfrom'];
}
// Only translate the subject if it's an array, ie, it came from the game.
$row_subject = @unserialize($row['subject']);
if ($row_subject !== false) {
$row['subject'] = call_user_func_array("sprintf_translate", $row_subject);
} else {
$row['subject'] = translate_inline($row['subject']);
}
}
// In one line so the Translator doesn't screw the Html up
output_notl("<a href='mail.php?op=read&id={$row['messageid']}'>".((trim($row['subject']))?$row['subject']:$no_subject)."</a>", true);
rawoutput("</td><td><a href='mail.php?op=read&id={$row['messageid']}'>");
output_notl($row['name']);
rawoutput("</a></td><td><a href='mail.php?op=read&id={$row['messageid']}'>".date("M d, h:i a",strtotime($row['sent']))."</a></td>");
rawoutput("</tr>");
}
rawoutput("</table>");
$checkall = htmlentities(translate_inline("Check All"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
rawoutput("<input type='button' value=\"$checkall\" class='button' onClick='
var elements = document.getElementsByName(\"msg[]\");
for(i = 0; i < elements.length; i++) {
elements[i].checked = true;
}
'>");
$delchecked = htmlentities(translate_inline("Delete Checked"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
rawoutput("<input type='submit' class='button' value=\"$delchecked\">");
rawoutput("</form>");
}else{
output("`iAww, you have no mail, how sad.`i");
}
if (db_num_rows($result) == 1) {
output("`n`n`iYou currently have 1 message in your inbox.`nYou will no longer be able to receive messages from players if you have more than %s unread messages in your inbox. `nMessages are automatically deleted (read or unread) after %s days.",getsetting('inboxlimit',50),getsetting("oldmail",14));
} else {
output("`n`n`iYou currently have %s messages in your inbox.`nYou will no longer be able to receive messages from players if you have more than %s unread messages in your inbox. `nMessages are automatically deleted (read or unread) after %s days.",db_num_rows($result),getsetting('inboxlimit',50),getsetting("oldmail",14));
}
?>

View File

@ -0,0 +1,95 @@
<?php
$mail = db_prefix('mail');
$accounts = db_prefix('accounts');
$sql = "SELECT $mail.*, $accounts.name FROM $mail LEFT JOIN $accounts ON $accounts.acctid=$mail.msgfrom WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$id."\"";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
if ($row['msgfrom']==0 || !is_numeric($row['msgfrom'])){
if ($row['msgfrom'] == 0 && is_numeric($row['msgfrom'])) {
$row['name']=translate_inline("`i`^System`0`i");
} else {
$row['name']=$row['msgfrom'];
}
// No translation for subject if it's not an array
$row_subject = @unserialize($row['subject']);
if ($row_subject !== false) {
$row['subject'] = call_user_func_array("sprintf_translate", $row_subject);
}
// No translation for body if it's not an array
$row_body = @unserialize($row['body']);
if ($row_body !== false) {
$row['body'] = call_user_func_array("sprintf_translate", $row_body);
}
}
if (!$row['seen']) {
output("`b`#NEW`b`n");
}else{
output("`n");
}
output("`b`2From:`b `^%s`n",$row['name']);
output("`b`2Subject:`b `^%s`n",$row['subject']);
output("`b`2Sent:`b `^%s`n",$row['sent']);
output_notl("<img src='images/uscroll.GIF' width='182px' height='11px' alt='' align='center'>`n",true);
output_notl(str_replace("\n","`n",$row['body']));
output_notl("`n<img src='images/lscroll.GIF' width='182px' height='11px' alt='' align='center'>`n",true);
$sql = "UPDATE " . db_prefix("mail") . " SET seen=1 WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$id."\"";
db_query($sql);
invalidatedatacache("mail-{$session['user']['acctid']}");
$reply = translate_inline("Reply");
$del = translate_inline("Delete");
$unread = translate_inline("Mark Unread");
$report = translate_inline("Report to Admin");
$problem = "Abusive Email Report:\nFrom: {$row['name']}\nSubject: {$row['subject']}\nSent: {$row['sent']}\nID: {$row['messageid']}\nBody:\n{$row['body']}";
rawoutput("<table width='50%' border='0' cellpadding='0' cellspacing='5'><tr>");
if ($row['msgfrom'] > 0 && is_numeric($row['msgfrom'])) {
rawoutput("<td><a href='mail.php?op=write&replyto={$row['messageid']}' class='motd'>$reply</a></td>");
} else {
rawoutput("<td>&nbsp;</td>");
}
rawoutput("<td><a href='mail.php?op=del&id={$row['messageid']}' class='motd'>$del</a></td>
</tr><tr>
<td><a href='mail.php?op=unread&id={$row['messageid']}' class='motd'>$unread</a></td>");
// Don't allow reporting of system messages as abuse.
if ((int)$row['msgfrom']!=0) {
rawoutput("<td><a href=\"petition.php?problem=".rawurlencode($problem)."&abuse=yes\" class='motd'>$report</a></td>");
} else {
rawoutput("<td>&nbsp;</td>");
}
rawoutput("</tr><tr>");
$sql = "SELECT messageid FROM $mail WHERE msgto='{$session['user']['acctid']}' AND messageid < '$id' ORDER BY messageid DESC LIMIT 1";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$pid = $row['messageid'];
}else{
$pid = 0;
}
$sql = "SELECT messageid FROM $mail WHERE msgto='{$session['user']['acctid']}' AND messageid > '$id' ORDER BY messageid LIMIT 1";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$nid = $row['messageid'];
}else{
$nid = 0;
}
$prev = translate_inline("< Previous");
$next = translate_inline("Next >");
rawoutput("<td nowrap='true'>");
if ($pid > 0) {
rawoutput("<a href='mail.php?op=read&id=$pid' class='motd'>".htmlentities($prev, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</a>");
}else{
rawoutput(htmlentities($prev), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
}
rawoutput("</td><td nowrap='true'>");
if ($nid > 0){
rawoutput("<a href='mail.php?op=read&id=$nid' class='motd'>".htmlentities($next, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</a>");
}else{
rawoutput(htmlentities($next), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
}
rawoutput("</td>");
rawoutput("</tr></table>");
}else{
output("Eek, no such message was found!");
}
?>

View File

@ -0,0 +1,49 @@
<?php
$to = httppost('to');
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
$from = httppost('from');
if ($from == "" || is_numeric(trim($from)) || $from == "0") {
$from = $session['user']['acctid'];
}
} else {
$from = $session['user']['acctid'];
}
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE login='$to'";
$result = db_query($sql);
if(db_num_rows($result)>0){
$row1 = db_fetch_assoc($result);
if (getsetting("onlyunreadmails",true)) {
$maillimitsql = "AND seen=0";
} else {
$maillimitsql = "";
}
$sql = "SELECT count(messageid) AS count FROM " . db_prefix("mail") . " WHERE msgto='".$row1['acctid']."' $maillimitsql";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['count']>=getsetting("inboxlimit",50)) {
output("`\$You cannot send that person mail, their mailbox is full!`0`n`n");
}else{
$subject = str_replace("`n","",httppost('subject'));
$body = str_replace("`n","\n",httppost('body'));
$body = str_replace("\r\n","\n",$body);
$body = str_replace("\r","\n",$body);
$body = addslashes(substr(stripslashes($body),0,(int)getsetting("mailsizelimit",1024)));
require_once("lib/systemmail.php");
systemmail($row1['acctid'],$subject,$body,$from);
invalidatedatacache("mail-{$row1['acctid']}");
output("Your message was sent!`n");
}
}else{
output("Could not find the recipient, please try again.`n");
}
if(httppost("returnto")){
$op="read";
httpset('op','read');
$id = httppost('returnto');
httpset('id',$id);
}else{
$op="";
httpset('op', "");
}
?>

View File

@ -0,0 +1,171 @@
<?php
$subject=httppost('subject');
$body="";
$row="";
$replyto = (int)httpget('replyto');
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
$from = httppost('from');
}
if ($replyto!=""){
$mail = db_prefix("mail");
$accounts = db_prefix("accounts");
$sql = "SELECT ".$mail.".sent,".$mail.".body,".$mail.".msgfrom, ".$mail.".subject,".$accounts.".login, ".$accounts.".superuser, ".$accounts.".name FROM ".$mail." LEFT JOIN ".$accounts." ON ".$accounts.".acctid=".$mail.".msgfrom WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$replyto."\"";
$result = db_query($sql);
if ($row = db_fetch_assoc($result)){
if ($row['login']=="") {
output("You cannot reply to a system message.`n");
$row=array();
}
}else{
output("Eek, no such message was found!`n");
}
}
$to = httpget('to');
if ($to){
$sql = "SELECT login,name, superuser FROM " . db_prefix("accounts") . " WHERE login=\"$to\"";
$result = db_query($sql);
if (!($row = db_fetch_assoc($result))){
output("Could not find that person.`n");
}
}
if (is_array($row)){
if (isset($row['subject']) && $row['subject']){
if ((int)$row['msgfrom']==0){
$row['name']=translate_inline("`i`^System`0`i");
// No translation for subject if it's not an array
$row_subject = @unserialize($row['subject']);
if ($row_subject !== false) {
$row['subject'] = call_user_func_array("sprintf_translate", $row_subject);
}
// No translation for body if it's not an array
$row_body = @unserialize($row['body']);
if ($row_body !== false) {
$row['body'] = call_user_func_array("sprintf_translate", $row_body);
}
}
$subject=$row['subject'];
if (strncmp($subject,"RE: ",4) !== 0 ) {
$subject="RE: $subject";
}
}
if (isset($row['body']) && $row['body']){
$body="\n\n---".sprintf_translate(array("Original Message from %s (%s)",sanitize($row['name']),date("Y-m-d H:i:s",strtotime($row['sent']))))."---\n".$row['body'];
}
}
rawoutput("<form action='mail.php?op=send' method='post'>");
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
rawoutput("<input type='hidden' name='from' value='".htmlentities(stripslashes($from), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."'>");
}
rawoutput("<input type='hidden' name='returnto' value=\"".htmlentities(stripslashes(httpget("replyto")), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
$superusers = array();
if (($session['user']['superuser'] & SU_IS_GAMEMASTER) && $from > "") {
output("`2From: `^%s`n", $from);
}
if (isset($row['login']) && $row['login']!=""){
output_notl("<input type='hidden' name='to' id='to' value=\"".htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
output("`2To: `^%s`n",$row['name']);
if (($row['superuser'] & SU_GIVES_YOM_WARNING) && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}else{
output("`2To: ");
$to = httppost('to');
$sql = "SELECT login,name,superuser FROM accounts WHERE login = '".addslashes($to)."' AND locked = 0";
$result = db_query($sql);
$db_num_rows = db_num_rows($result);
if($db_num_rows != 1) {
$string="%";
$to_len = strlen($to);
for($x=0; $x < $to_len; ++$x) {
$string .= $to{$x}."%";
}
$sql = "SELECT login,name,superuser FROM " . db_prefix("accounts") . " WHERE name LIKE '".addslashes($string)."' AND locked=0 ORDER by login='$to' DESC, name='$to' DESC, login";
$result = db_query($sql);
$db_num_rows = db_num_rows($result);
}
if ($db_num_rows==1){
$row = db_fetch_assoc($result);
output_notl("<input type='hidden' id='to' name='to' value=\"".htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
output_notl("`^{$row['name']}`n");
if (($row['superuser'] & SU_GIVES_YOM_WARNING) && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}elseif ($db_num_rows==0){
output("`\$No one was found who matches \"%s\".`n",stripslashes($to));
output("`@Please try again.`n");
httpset('prepop', $to, true);
rawoutput("</form>");
require("lib/mail/case_address.php");
popup_footer();
}else{
output_notl("<select name='to' id='to' onchange='check_su_warning();'>",true);
$superusers = array();
while($row = db_fetch_assoc($result)) {
output_notl("<option value=\"".htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
require_once("lib/sanitize.php");
output_notl("%s", full_sanitize($row['name']));
if (($row['superuser'] & SU_GIVES_YOM_WARNING) && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}
output_notl("</select>`n",true);
}
}
rawoutput("<script type='text/javascript'>var superusers = new Array();");
foreach($superusers as $val) {
rawoutput(" superusers['".addslashes($val)."'] = true;");
}
rawoutput("</script>");
output("`2Subject:");
rawoutput("<input name='subject' value=\"".htmlentities($subject).htmlentities(stripslashes(httpget('subject')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"><br>");
rawoutput("<div id='warning' style='visibility: hidden; display: none;'>");
output("`2Notice: `^$superusermessage`n");
rawoutput("</div>");
output("`2Body:`n");
require_once("lib/forms.php");
previewfield("body", "`^", false, false, array("type"=>"textarea", "class"=>"input", "cols"=>"60", "rows"=>"9", "onKeyDown"=>"sizeCount(this);"), htmlentities($body, ENT_COMPAT, getsetting("charset", "ISO-8859-1")).htmlentities(stripslashes(httpget('body')), ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
//rawoutput("<textarea name='body' id='textarea' class='input' cols='60' rows='9' onKeyUp='sizeCount(this);'>".htmlentities($body, ENT_COMPAT, getsetting("charset", "ISO-8859-1")).htmlentities(stripslashes(httpget('body')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br>");
$send = translate_inline("Send");
rawoutput("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td><input type='submit' class='button' value='$send'></td><td align='right'><div id='sizemsg'></div></td></tr></table>");
rawoutput("</form>");
$sizemsg = "`#Max message size is `@%s`#, you have `^XX`# characters left.";
$sizemsg = translate_inline($sizemsg);
$sizemsg = sprintf($sizemsg,getsetting("mailsizelimit",1024));
$sizemsgover = "`\$Max message size is `@%s`\$, you are over by `^XX`\$ characters!";
$sizemsgover = translate_inline($sizemsgover);
$sizemsgover = sprintf($sizemsgover,getsetting("mailsizelimit",1024));
$sizemsg = explode("XX",$sizemsg);
$sizemsgover = explode("XX",$sizemsgover);
$usize1 = addslashes("<span>".appoencode($sizemsg[0])."</span>");
$usize2 = addslashes("<span>".appoencode($sizemsg[1])."</span>");
$osize1 = addslashes("<span>".appoencode($sizemsgover[0])."</span>");
$osize2 = addslashes("<span>".appoencode($sizemsgover[1])."</span>");
rawoutput("
<script type='text/javascript'>
var maxlen = ".getsetting("mailsizelimit",1024).";
function sizeCount(box){
if (box==null) return;
var len = box.value.length;
var msg = '';
if (len <= maxlen){
msg = '$usize1'+(maxlen-len)+'$usize2';
}else{
msg = '$osize1'+(len-maxlen)+'$osize2';
}
document.getElementById('sizemsg').innerHTML = msg;
}
sizeCount(document.getElementById('inputbody'));
function check_su_warning(){
var to = document.getElementById('to');
var warning = document.getElementById('warning');
if (superusers[to.value]){
warning.style.visibility = 'visible';
warning.style.display = 'inline';
}else{
warning.style.visibility = 'hidden';
warning.style.display = 'none';
}
}
check_su_warning();
</script>");
?>