From fa3e3352bc1b150f67f65d9e27a1e65396a41583 Mon Sep 17 00:00:00 2001 From: jmo1121109 Date: Wed, 1 May 2019 21:58:03 -0400 Subject: [PATCH 1/3] Adding-Missed-Turns Add excused missed turns to the site. Full detail log of changes coming later. --- admin/adminActions.php | 95 +++++++++- admin/adminActionsForms.php | 48 +++-- admin/adminActionsRestricted.php | 93 +++++++--- admin/adminStatusLists.php | 4 +- board.php | 2 +- board/chatbox.php | 7 +- board/member.php | 34 ++-- css/desktopOnly/gamepanel.css | 70 +++---- css/desktopOnly/global.css | 1 - css/gamepanel.css | 6 +- css/global.css | 1 - gamecreate.php | 54 +++--- gamemaster/game.php | 282 ++++++++++++++++++----------- gamemaster/member.php | 19 +- gamemaster/members.php | 291 ++++++++++++++++++++++++------ gamepanel/game.php | 7 +- gamepanel/member.php | 92 ++++++---- gamesearch/search.php | 5 +- gamesearch/searchItemSettings.php | 13 ++ global/definitions.php | 2 +- header.php | 31 ++-- install/1.49-1.50/readme.txt | 9 + install/1.49-1.50/update.sql | 31 ++++ lib/html.php | 9 +- locales/English/gamecreate.php | 24 +++ message.php | 21 ++- objects/game.php | 33 ++-- objects/member.php | 12 +- objects/members.php | 36 +++- objects/user.php | 104 +++++++++-- profile.php | 192 ++++++++++---------- 31 files changed, 1124 insertions(+), 504 deletions(-) create mode 100644 install/1.49-1.50/readme.txt create mode 100644 install/1.49-1.50/update.sql diff --git a/admin/adminActions.php b/admin/adminActions.php index b625b7590..5a022c6f8 100755 --- a/admin/adminActions.php +++ b/admin/adminActions.php @@ -80,6 +80,11 @@ class adminActions extends adminActionsForms 'description' => 'Stops a player from joining or creating new games for that many days. To remove a temp ban, enter 0 days', 'params' => array('userID'=>'User ID', 'ban'=>'Days') ), + 'modExcuseDelay' => array( + 'name' => 'Mod Excuse Missed Turn', + 'description' => 'Enter the user to excuse and the ID of the missed turn to excuse (found on RR breakdown page)', + 'params' => array('userID'=>'User ID', 'excuseID'=>'Excuse ID','reason'=>'Reason') + ), 'banUser' => array( 'name' => 'Ban a user', 'description' => 'Bans a user, setting his games to civil disorder, and removing his points.', @@ -198,6 +203,26 @@ class adminActions extends adminActionsForms 'description' => 'Sets the given user ID to be the director of the given game ID (set to 0 to remove someone as game director). This will give them mod capabilities for this game.', 'params' => array('gameID'=>'Game ID','userID'=>'User ID'), + ), + 'excusedMissedTurnsIncreaseAll' => array( + 'name' => 'Excused Missed Turns - Add for All', + 'description' => 'Adds 1 excused missed turn to all members in the game.', + 'params' => array('gameID'=>'Game ID'), + ), + 'excusedMissedTurnsDecreaseAll' => array( + 'name' => 'Excused Missed Turns - Remove for All', + 'description' => 'Removes 1 excused missed turn for all members in the game. If the user(s) do not have excused turns left nothing will happen.', + 'params' => array('gameID'=>'Game ID'), + ), + 'excusedMissedTurnsIncrease' => array( + 'name' => 'Excused Missed Turns - Add', + 'description' => 'Adds 1 excused missed turn to a specific user in a game.', + 'params' => array('gameID'=>'Game ID','userID'=>'User ID'), + ), + 'excusedMissedTurnsDecrease' => array( + 'name' => 'Excused Missed Turns - Remove', + 'description' => 'Removes 1 excused missed turn for a specific user in a game. If the user(s) do not have excused turns left nothing will happen.', + 'params' => array('gameID'=>'Game ID','userID'=>'User ID'), ) ); @@ -1097,11 +1122,27 @@ public function tempBan(array $params) $userID = (int)$params['userID']; $days = (int)$params['ban']; - $DB->sql_put("UPDATE wD_Users SET tempBan = ". ( time() + ($days * 86400) )." WHERE id=".$userID); - if ($days == 0) + User::tempBanUser($userID, $days); + if ($days == 0) return 'This user is now unblocked and can join and create games again.'; - return 'This user is now blocked from joining and creating games for '.$days.' days.'; + return 'This user is now blocked from joining, rejoining, and creating games for '.$days.' days.'; + } + public function modExcuseDelay(array $params) + { + global $DB; + + $userID = (int)$params['userID']; + $excuseID = (int)$params['excuseID']; + + if( !isset($params['reason']) || strlen($params['reason'])==0 ) + return l_t('Couldn\'t ban user; no reason was given.'); + + $modReason = $DB->msg_escape($params['reason']); + + $DB->sql_put("UPDATE wD_MissedTurns SET modExcused = 1, modExcusedReason = '".$modReason."' WHERE id=".$excuseID); + + return 'This user\'s missed turn has been excused.'; } public function givePoints(array $params) { @@ -1163,6 +1204,54 @@ public function setDirector(array $params) return l_t("The specified user ID has been assigned as the director for this game."); } + + public function excusedMissedTurnsIncreaseAll(array $params) + { + global $DB; + + $gameID = (int)$params['gameID']; + + $DB->sql_put("UPDATE wD_Members SET excusedMissedTurns = excusedMissedTurns + 1 WHERE gameID = ".$gameID); + return l_t("All users in this game have been given an extra excused missed turn."); + } + + public function excusedMissedTurnsDecreaseAll(array $params) + { + global $DB; + + $gameID = (int)$params['gameID']; + + $DB->sql_put("UPDATE wD_Members SET excusedMissedTurns = excusedMissedTurns - 1 WHERE gameID = ".$gameID." and excusedMissedTurns > 0"); + return l_t("All users in this game have had an extra excused missed turn removed."); + } + + public function excusedMissedTurnsIncrease(array $params) + { + global $DB; + + $userIDtoUpdate = (int)$params['userID']; + $gameID = (int)$params['gameID']; + + if ($userIDtoUpdate > 0) + { + $DB->sql_put("UPDATE wD_Members SET excusedMissedTurns = excusedMissedTurns + 1 WHERE gameID = ".$gameID." and userID = ".$userIDtoUpdate); + return l_t("UserID: ".$userIDtoUpdate." has been given an extra excused missed turn in this game."); + } + } + + public function excusedMissedTurnsDecrease(array $params) + { + global $DB; + + $userIDtoUpdate = (int)$params['userID']; + $gameID = (int)$params['gameID']; + + if ($userIDtoUpdate > 0) + { + $DB->sql_put("UPDATE wD_Members SET excusedMissedTurns = excusedMissedTurns - 1 WHERE gameID = ".$gameID." and userID = ".$userIDtoUpdate." and excusedMissedTurns > 0"); + return l_t("UserID: ".$userIDtoUpdate." has had an extra excused missed turn removed in this game."); + } + } } ?> diff --git a/admin/adminActionsForms.php b/admin/adminActionsForms.php index ca018fab6..9bc146b51 100755 --- a/admin/adminActionsForms.php +++ b/admin/adminActionsForms.php @@ -66,7 +66,7 @@ private static function form($actionName, array $params, $description="") print ''; if ( isset($_REQUEST['globalPostID']) ) print ''; - + if ($description) print '
  • '.l_t($description).'
  • '; @@ -84,10 +84,20 @@ private static function form($actionName, array $params, $description="") else $defaultValue = ''; - print '
  • - : - -
  • '; + if ($paramCode == 'message') + { + print '
  • + : + +
  • '; + } + else + { + print '
  • + : + +
  • '; + } } print '
  • @@ -127,19 +137,19 @@ private static function save($name, array $paramValues, $details) $DB->sql_put("INSERT INTO wD_AdminLog ( name, userID, time, details, params ) VALUES ( '".$name."', ".$User->id.", ".time().", '".$details."', '".$paramValues."' )"); } - + /** * Defines the PHP script which the forms will target; will either be board.php or admincp.php * @var string */ public static $target; - + /** * A reference to the static array of actions * @var array */ public $actionsList; - + /** * For the given task display the form, and run the task if data entered from the corresponding form * @@ -329,11 +339,11 @@ public static function printActionLinks( array $actionCodes ) if( defined("INBOARD") ) { // We're running in Director mode from within board.php - + $adminActions = new adminActionsTD(); adminActionsForms::$target = "board.php?gameID=".$Game->id; $adminActions->actionsList = adminActionsTD::$actions; - + print '

    '.l_t('Director action forms').'

    '; // For each task display the form, and run the task if data entered from the corresponding form print '