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
+4
View File
@@ -394,6 +394,10 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
<td>Include Admin in Rank</td>
<td><?php if(INCLUDE_ADMIN == true){ echo "<b><font color='Green'>Enabled</font></b>"; } else if(INCLUDE_ADMIN == false){ echo "<b><font color='Red'>Disabled</font></b>"; } ?></td>
</tr>
<tr>
<td>Include Support Messages in Admin Mailbox</td>
<td><?php if(ADMIN_RECEIVE_SUPPORT_MESSAGES == true){ echo "<b><font color='Green'>Enabled</font></b>"; } else if(ADMIN_RECEIVE_SUPPORT_MESSAGES == false){ echo "<b><font color='Red'>Disabled</font></b>"; } ?></td>
</tr>
</table>
<?php
+8
View File
@@ -41,6 +41,14 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
</select>
</td>
</tr>
<td>Include Support Messages in Admin Mailbox:</td>
<td>
<select name="admin_support_msgs">
<option value="True" <?php if (ADMIN_RECEIVE_SUPPORT_MESSAGES==true) echo "selected";?>>True</option>
<option value="False" <?php if (ADMIN_RECEIVE_SUPPORT_MESSAGES==false) echo "selected";?>>False</option>
</select>
</td>
</tr>
</tbody>
</table>
<br />
+1 -1
View File
@@ -9,7 +9,7 @@
## ##
#################################################################################
$msg = $database->getMessage($_GET['nid'],3);;
$msg = $database->getMessage($_GET['nid'],3);
if($msg)
{ ?>
<link href="../<?php echo GP_LOCATE; ?>lang/en/lang.css?f4b7d" rel="stylesheet" type="text/css">
@@ -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) {
+1
View File
@@ -46,6 +46,7 @@ martinambrus changes:
34. mass messages sent out under Support rather than Multihunter (we should not be scaring people :D)
35. fixed displaying of current Quest in Admin
36. fixed OK message in Admin when resetting All Players' PLUS
37. new config option to show Support messages in Admin's mailbox
Shadowss changes:
+1 -1
View File
@@ -1,4 +1,4 @@
x<div id="content" class="messages">
<div id="content" class="messages">
<h1>Messages</h1>
<?php
include("menu.tpl");
+3
View File
@@ -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
@@ -65,6 +65,7 @@ class Process {
$text = preg_replace("'%CONNECTT%'", $_POST['connectt'], $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("'%SUBDOM%'", $_POST['subdom'], $text);
$text = preg_replace("'%LOGBUILD%'", $_POST['log_build'], $text);
$text = preg_replace("'%LOGTECH%'", $_POST['log_tech'], $text);
+10 -1
View File
@@ -251,6 +251,7 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
<td><span class="f9 c6">Admin email:</span></td>
<td><input type="text" name="aemail" id="aemail" value=""></td>
</tr>
<tr>
<td><span class="f9 c6">Show admin in stats:</span></td>
<td>
<select name="admin_rank">
@@ -259,7 +260,15 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
</select>
</td>
</tr>
<tr>
<tr>
<td><span class="f9 c6">Include Support Messages in Admin Mailbox:</span></td>
<td>
<select name="admin_support_msgs">
<option value="True" selected="selected">True</option>
<option value="False">False</option>
</select>
</td>
</tr>
</table>
</p>
<p>
+2 -2
View File
@@ -1,7 +1,7 @@
- allow writing messages as Support if Admin and showing Support messages in inbox
- cannot delete a single medal in admin
- add back buttons to Admin where there are not (like editing a user)
- disallow installation if existing data are in place, or world map would end up screwed and villages not showing (because there can be multiple villages/oasis generated for one square then)
- allow to redirect Support messages to admin's nickname (for when there's only a single admin and doesn't like switching between Support and themselves)
- disallow installation if existing data are in place, or world map would end up screwed and villages not showing (because there can be multiple villages/oasis generated for one square then)
- quest image should glow red when new task is ready to be read (now it's only red when page is refreshed)
- check aliance invitation accepting - apparently it doesn't work too well on first try?
- normalize forum tables - varchar is used for numeric values and is joined with int field