feat: Admins can see Support messages if set in config

This commit is contained in:
Martin Ambrus
2017-10-22 14:47:27 +02:00
parent e4d470693b
commit 965ba37f67
17 changed files with 65 additions and 14 deletions
@@ -271,6 +271,9 @@ define("ADMIN_EMAIL", "%AEMAIL%");
// ***** Admin Name
define("ADMIN_NAME", "%ANAME%");
// ***** Show Support Messages in Admin
define("ADMIN_RECEIVE_SUPPORT_MESSAGES", %ASUPPMSGS%);
//////////////////////////////////////////
+1
View File
@@ -99,6 +99,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%ARANK%'", $_POST['admin_rank'], $text);
$text = preg_replace("'%AEMAIL%'", $_POST['aemail'], $text);
$text = preg_replace("'%ANAME%'", $_POST['aname'], $text);
$text = preg_replace("'%ASUPPMSGS%'", ($_POST['admin_support_msgs'] == 'True' ? 'true' : 'false'), $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -36,6 +36,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$LOG_MARKET=(LOG_MARKET==false)? "false":"true";
$LOG_ILLEGAL=(LOG_ILLEGAL==false)? "false":"true";
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text);
@@ -94,6 +95,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%ARANK%'", (INCLUDE_ADMIN ? 'true' : 'false'), $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%UTRACK%'", "TRACK_USR", $text); // not in use, text only in a comment
$text = preg_replace("'%UTOUT%'", "USER_TIMEOUT", $text); // not in use, text only in a comment
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -32,6 +32,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$NEWSBOX3=(NEWSBOX3==false)? "false":"true";
$LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true";
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text);
@@ -94,6 +95,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -39,6 +39,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true";
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text);
@@ -101,6 +102,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+3
View File
@@ -19,6 +19,8 @@ $myFile = "../../config.php";
$fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\config.php");
$text = file_get_contents("constant_format.tpl");
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
// SERVER SETTINGS - we need to keep these intact
$text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text);
@@ -77,6 +79,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%ARANK%'", (INCLUDE_ADMIN ? 'true' : 'false'), $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%UTRACK%'", "TRACK_USR", $text); // not in use, text only in a comment
$text = preg_replace("'%UTOUT%'", "USER_TIMEOUT", $text); // not in use, text only in a comment
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2 -1
View File
@@ -31,7 +31,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$NEWSBOX3=(NEWSBOX3==false)? "false":"true";
$LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true";
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $_POST['error'], $text);
@@ -89,6 +89,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text);
$text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
+19 -8
View File
@@ -2239,27 +2239,38 @@ class MYSQLi_DB {
References: User ID/Message ID, Mode
***************************/
function getMessage($id, $mode) {
global $session;
list($id, $mode) = $this->escape_input((int) $id, $mode);
// update $id if we should show Support messages for Admins and we are an admin
if (
($session->access == MULTIHUNTER || $session->access == ADMIN)
&& ADMIN_RECEIVE_SUPPORT_MESSAGES
&& in_array($mode, [1,2,6,9,10,11])
) {
$id = $id . ', 1';
}
global $session;
switch($mode) {
case 1:
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target = $id and send = 0 and archived = 0 ORDER BY time DESC";
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 ORDER BY time DESC";
break;
case 2:
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner = $id ORDER BY time DESC";
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner IN($id) ORDER BY time DESC";
break;
case 3:
$q = "SELECT * FROM " . TB_PREFIX . "mdata where id = $id";
$q = "SELECT * FROM " . TB_PREFIX . "mdata where id = $id";
break;
case 4:
$q = "UPDATE " . TB_PREFIX . "mdata set viewed = 1 where id = $id AND target = $session->uid";
$q = "UPDATE " . TB_PREFIX . "mdata set viewed = 1 where id = $id AND target IN(".((($session->access == MULTIHUNTER || $session->access == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES) ? $session->uid.',1' : $session->uid).")";
break;
case 5:
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,viewed = 1 where id = $id";
break;
case 6:
$q = "SELECT * FROM " . TB_PREFIX . "mdata where target = $id and send = 0 and archived = 1";
$q = "SELECT * FROM " . TB_PREFIX . "mdata where target IN($id) and send = 0 and archived = 1";
break;
case 7:
$q = "UPDATE " . TB_PREFIX . "mdata set delowner = 1 where id = $id";
@@ -2268,13 +2279,13 @@ class MYSQLi_DB {
$q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,delowner = 1,viewed = 1 where id = $id";
break;
case 9:
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target = $id and send = 0 and archived = 0 and deltarget = 0 ORDER BY time DESC";
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 and deltarget = 0 ORDER BY time DESC";
break;
case 10:
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner = $id and delowner = 0 ORDER BY time DESC";
$q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner IN($id) and delowner = 0 ORDER BY time DESC";
break;
case 11:
$q = "SELECT * FROM " . TB_PREFIX . "mdata where target = $id and send = 0 and archived = 1 and deltarget = 0";
$q = "SELECT * FROM " . TB_PREFIX . "mdata where target IN($id) and send = 0 and archived = 1 and deltarget = 0";
break;
}
if($mode <= 3 || $mode == 6 || $mode > 8) {