diff --git a/Admin/Templates/config.tpl b/Admin/Templates/config.tpl index fac16bf0..2e03c971 100644 --- a/Admin/Templates/config.tpl +++ b/Admin/Templates/config.tpl @@ -394,6 +394,10 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); Include Admin in Rank Enabled"; } else if(INCLUDE_ADMIN == false){ echo "Disabled"; } ?> + + Include Support Messages in Admin Mailbox + Enabled"; } else if(ADMIN_RECEIVE_SUPPORT_MESSAGES == false){ echo "Disabled"; } ?> + + Include Support Messages in Admin Mailbox: + + + +
diff --git a/Admin/Templates/msg.tpl b/Admin/Templates/msg.tpl index 081064d4..381c2ae6 100644 --- a/Admin/Templates/msg.tpl +++ b/Admin/Templates/msg.tpl @@ -9,7 +9,7 @@ ## ## ################################################################################# -$msg = $database->getMessage($_GET['nid'],3);; +$msg = $database->getMessage($_GET['nid'],3); if($msg) { ?> diff --git a/GameEngine/Admin/Mods/constant_format.tpl b/GameEngine/Admin/Mods/constant_format.tpl index 315c5a4d..f2166b5c 100755 --- a/GameEngine/Admin/Mods/constant_format.tpl +++ b/GameEngine/Admin/Mods/constant_format.tpl @@ -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%); + ////////////////////////////////////////// diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php index 5d3e1e65..8777db2d 100755 --- a/GameEngine/Admin/Mods/editAdminInfo.php +++ b/GameEngine/Admin/Mods/editAdminInfo.php @@ -99,6 +99,7 @@ $fh = fopen($myFile, 'w') or die("


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); diff --git a/GameEngine/Admin/Mods/editExtraSet.php b/GameEngine/Admin/Mods/editExtraSet.php index 55e1198c..12fcd0be 100755 --- a/GameEngine/Admin/Mods/editExtraSet.php +++ b/GameEngine/Admin/Mods/editExtraSet.php @@ -36,6 +36,7 @@ $fh = fopen($myFile, 'w') or die("


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("


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); diff --git a/GameEngine/Admin/Mods/editLogSet.php b/GameEngine/Admin/Mods/editLogSet.php index 7785a8ca..504c1020 100755 --- a/GameEngine/Admin/Mods/editLogSet.php +++ b/GameEngine/Admin/Mods/editLogSet.php @@ -32,6 +32,7 @@ $fh = fopen($myFile, 'w') or die("


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("


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); diff --git a/GameEngine/Admin/Mods/editNewsboxSet.php b/GameEngine/Admin/Mods/editNewsboxSet.php index a05b94ab..dfde541e 100755 --- a/GameEngine/Admin/Mods/editNewsboxSet.php +++ b/GameEngine/Admin/Mods/editNewsboxSet.php @@ -39,6 +39,7 @@ $fh = fopen($myFile, 'w') or die("


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("


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); diff --git a/GameEngine/Admin/Mods/editPlusSet.php b/GameEngine/Admin/Mods/editPlusSet.php index 187adb93..6caa567f 100644 --- a/GameEngine/Admin/Mods/editPlusSet.php +++ b/GameEngine/Admin/Mods/editPlusSet.php @@ -19,6 +19,8 @@ $myFile = "../../config.php"; $fh = fopen($myFile, 'w') or die("


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("


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); diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index 38973ff4..b8d55b28 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -31,7 +31,7 @@ $fh = fopen($myFile, 'w') or die("


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("


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); diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 81caa057..bec9317c 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -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) { diff --git a/README b/README index 59565635..2d89c35f 100644 --- a/README +++ b/README @@ -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: diff --git a/Templates/Message/inbox.tpl b/Templates/Message/inbox.tpl index 7b55cc71..4e8a945b 100644 --- a/Templates/Message/inbox.tpl +++ b/Templates/Message/inbox.tpl @@ -1,4 +1,4 @@ -x
+

Messages

Error creating constant.php Admin email: + Show admin in stats: - + + Include Support Messages in Admin Mailbox: + + + +

diff --git a/todo.txt b/todo.txt index 2833c08a..6913c7fe 100644 --- a/todo.txt +++ b/todo.txt @@ -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