mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-15 17:16:08 +00:00
feat: Admins can see Support messages if set in config
This commit is contained in:
@@ -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%);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user