Skip to content

Commit

Permalink
Allow AdminLock for normal moderators and remove the ability to use t…
Browse files Browse the repository at this point in the history
…he vote buttons during an admin lock.
  • Loading branch information
Sleepcap committed Sep 18, 2013
1 parent 0a6c895 commit 0ea9fd5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
15 changes: 0 additions & 15 deletions admin/adminActionsRestrictedVDip.php
Expand Up @@ -48,11 +48,6 @@ public function __construct()
'description' => 'Set the orderstatus of all countries to "Ready".',
'params' => array('gameID'=>'GameID')
),
'toggleAdminLock' => array(
'name' => 'Lock/unlock a game.',
'description' => 'Lock (or unlock) a game to prevent users to enter orders.',
'params' => array('gameID'=>'GameID')
),
'delVariantGameCache' => array(
'name' => 'Clear cache of a given variant.',
'description' => 'Clear all cache files of all games from a given variant.',
Expand Down Expand Up @@ -121,16 +116,6 @@ public function clearAdvancedAccessLogs(array $params)
return 'Old advanced access logs cleared; '.$i.' records deleted.';
}

public function toggleAdminLock(array $params)
{
global $DB;
$gameID = (int)$params['gameID'];
list($status)=$DB->sql_row("SELECT adminLock FROM wD_Games WHERE id = ".$gameID);
$DB->sql_put("UPDATE wD_Games SET adminLock = '".($status == 'Yes' ? 'No' : 'Yes')."' WHERE id = ".$gameID);

return 'This game is now '.( $status == 'No' ? 'locked' : 'unlocked').'.';
}

public function RowAsString(array $row)
{
global $DB;
Expand Down
16 changes: 16 additions & 0 deletions admin/adminActionsVDip.php
Expand Up @@ -34,6 +34,11 @@ public function __construct()
'description' => 'How many days should the curent phase extend?',
'params' => array('gameID'=>'Game ID', 'extend'=>'Days to extend')
),
'toggleAdminLock' => array(
'name' => 'Lock/unlock a game.',
'description' => 'Lock (or unlock) a game to prevent users to enter orders.',
'params' => array('gameID'=>'GameID')
),
);

adminActions::$actions = array_merge(adminActions::$actions, $vDipActions);
Expand Down Expand Up @@ -136,6 +141,17 @@ public function changeGameReq(array $params)

return 'This games reliability requirements was changed to: minRating = '.$minRating.', minPhases = '.$minPhases;
}

public function toggleAdminLock(array $params)
{
global $DB;
$gameID = (int)$params['gameID'];
list($status)=$DB->sql_row("SELECT adminLock FROM wD_Games WHERE id = ".$gameID);
$DB->sql_put("UPDATE wD_Games SET adminLock = '".($status == 'Yes' ? 'No' : 'Yes')."' WHERE id = ".$gameID);

return 'This game is now '.( $status == 'No' ? 'locked' : 'unlocked').'.';
}


}
?>
2 changes: 1 addition & 1 deletion board.php
Expand Up @@ -266,7 +266,7 @@
}
else
{
$Orders = '<div id="orderDiv'.$Member->id.'">Game is currently locked by an admin (usually to fix some errors).</div>';
$Orders = '<div align="center" id="orderDiv'.$Member->id.'">Game is currently locked by an admin (usually to fix some errors).</div>';
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion board/member.php
Expand Up @@ -108,7 +108,9 @@ protected function setBackFromLeft()
public function toggleVote($voteName)
{
global $DB;


if ($this->Game->adminLock == 'Yes') return;

$voteText = $voteName;

// Unpause is stored as Pause in the database
Expand Down
5 changes: 4 additions & 1 deletion gamepanel/gameboard.php
Expand Up @@ -155,6 +155,9 @@ function votes()
!isset($this->Members->ByUserID[$User->id]) )
return '';

if ($this->adminLock == 'Yes')
return '';

$vAllowed = Members::$votes;
$vSet = $this->Members->ByUserID[$User->id]->votes;
$vPassed = $this->Members->votesPassed();
Expand All @@ -180,7 +183,7 @@ function votes()
</td>
</tr>
</table>';

return $buf . '</div>';
}

Expand Down

0 comments on commit 0ea9fd5

Please sign in to comment.