mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
fix(admin): let editPlus subtract Plus/bonus days as the form advertises (#254)
This commit is contained in:
@@ -71,7 +71,7 @@ if($id){
|
||||
<input type="hidden" name="uid" value="<?php echo $uid;?>">
|
||||
<input type="hidden" name="id" value="<?php echo $id;?>">
|
||||
|
||||
<div class="info-box">ℹ️ The values add up. Put 5 to add 5 days.</div>
|
||||
<div class="info-box">ℹ️ The values add up. Put 5 to add 5 days, -5 to remove 5 days.</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>📊 Current Active Bonuses</h3>
|
||||
|
||||
@@ -64,7 +64,9 @@ if (!$user) {
|
||||
foreach ($bonusDuration as $key => $add) {
|
||||
$current = (int)($user[$key] ?? 0);
|
||||
$base = $current < $time ? $time : $current;
|
||||
$bonusDuration[$key] = $add > 0 ? $base + $add : $current;
|
||||
// A negative value subtracts days (the form advertises "Add / Remove Days").
|
||||
// 0 leaves the current expiry untouched; the clamp below caps it at "expired".
|
||||
$bonusDuration[$key] = $add != 0 ? $base + $add : $current;
|
||||
if ($bonusDuration[$key] < $time) {
|
||||
$bonusDuration[$key] = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user