Heimrechttausch: Sicherheitsabfrage und speichern in Historie

This commit is contained in:
Jürgen Meyer
2026-03-06 15:10:01 +01:00
parent 54965f9ef2
commit 40be14ad75
4 changed files with 35 additions and 4 deletions
@@ -10340,6 +10340,7 @@ function adminRemoveBegegnung(): void
$db = getDatabase(); $db = getDatabase();
$jInput = Factory::getContainer()->get(SiteApplication::class)->input; $jInput = Factory::getContainer()->get(SiteApplication::class)->input;
$user_id = isExternalDatabase() ? 0 : (isJson() ? getUserID() : Factory::getContainer()->get(SiteApplication::class)->getIdentity()->id);
$id = $jInput->get('id', 0, 'INT'); $id = $jInput->get('id', 0, 'INT');
$veranstaltungId = $jInput->get('veranstaltungid', 0, 'INT'); $veranstaltungId = $jInput->get('veranstaltungid', 0, 'INT');
if ($veranstaltungId == 0) die("Missing id!"); if ($veranstaltungId == 0) die("Missing id!");
@@ -10384,6 +10385,14 @@ function adminRemoveBegegnung(): void
. "\n teamspiel_gast_spielpunkte = @temp_teamspiel_heim_spielpunkte" . "\n teamspiel_gast_spielpunkte = @temp_teamspiel_heim_spielpunkte"
. "\n WHERE begegnung_id = $id"; . "\n WHERE begegnung_id = $id";
$db->setQuery($query); $db->setQuery($query);
if (!$db->execute()) {
die($db->stderr(true));
}
$query = "INSERT INTO #__sportsmanager_begegnung_historie"
. "\n (begegnung_historie_id,begegnung_id,aktion,user_id,eingetragen)"
. "\n VALUES (NULL,$id,11,$user_id,NOW());";
$db->setQuery($query);
if (!$db->execute()) { if (!$db->execute()) {
die($db->stderr(true)); die($db->stderr(true));
} }
@@ -10525,7 +10534,6 @@ function adminEditBegegnungSpielplan($bestaetigen): void
: $begegnung->spielort_id) . "\""; : $begegnung->spielort_id) . "\"";
$begegnung->spielort_name = loadResult($db, $spielortQuery); $begegnung->spielort_name = loadResult($db, $spielortQuery);
if (isJson()) { if (isJson()) {
$response = JSON_sportsmanager::adminEditBegegnungSpielplan($bestaetigen, $veranstaltung, $begegnung, $heim_team, $gast_team, $spiele, $heim_spieler, $gast_spieler, $teamspiel_modus); $response = JSON_sportsmanager::adminEditBegegnungSpielplan($bestaetigen, $veranstaltung, $begegnung, $heim_team, $gast_team, $spiele, $heim_spieler, $gast_spieler, $teamspiel_modus);
JSON_sportsmanager::JSON($response); JSON_sportsmanager::JSON($response);
@@ -11122,6 +11130,21 @@ function adminSaveBegegnungSpielplan(): void
if (!$db->execute()) { if (!$db->execute()) {
die($db->stderr(true)); die($db->stderr(true));
} }
$encrypted_pin = $db->escape($jInput->get('pin', '', 'RAW'));
$pin = decrypt($encrypted_pin, "a9cZ" . $veranstaltungId . "oDS7" . $id . "2eA");
$query = "SELECT team_id FROM #__sportsmanager_team"
. "\n WHERE pin = '$pin' AND veranstaltung_id = $veranstaltungId;";
$team_id = loadResult($db, $query);
$query = "INSERT INTO #__sportsmanager_begegnung_historie"
. "\n (begegnung_historie_id,begegnung_id,aktion,team_id,eingetragen)"
. "\n VALUES (NULL,$id,11,$team_id,NOW());";
$db->setQuery($query);
if (!$db->execute()) {
die($db->stderr(true));
}
} }
redirectSportsManagerURL('&task=' . ($bestaetigen != 0 ? ($bestaetigen == 1 ? 'admin_begegnung_spielplan_edit_bestaetigen' : 'pineingabe') : 'admin_begegnung_spielplan_edit') . '&id=' . $id . '&veranstaltungid=' . $veranstaltungId . ($bestaetigen != 0 ? '_bestaetigen' : '') . '&veranstaltungid=' . $veranstaltungId . '&id=' . $id . '&erneut_oeffnen=1' . (!empty($encrypted_pin) ? ('&epin=' . $encrypted_pin) : "") . ($aus_uebersicht ? '&aus_uebersicht=1' : '')); redirectSportsManagerURL('&task=' . ($bestaetigen != 0 ? ($bestaetigen == 1 ? 'admin_begegnung_spielplan_edit_bestaetigen' : 'pineingabe') : 'admin_begegnung_spielplan_edit') . '&id=' . $id . '&veranstaltungid=' . $veranstaltungId . ($bestaetigen != 0 ? '_bestaetigen' : '') . '&veranstaltungid=' . $veranstaltungId . '&id=' . $id . '&erneut_oeffnen=1' . (!empty($encrypted_pin) ? ('&epin=' . $encrypted_pin) : "") . ($aus_uebersicht ? '&aus_uebersicht=1' : ''));
@@ -11103,7 +11103,9 @@ static function adminVerbandsorganMitglieder($rows,$verbandsorgan): void
?> ?>
</td> </td>
<td nowrap><small><a <td nowrap><small><a
href="<?php echo SportsManagerURL('&task=admin_begegnung_heimtausch&veranstaltungid=' . $veranstaltung->veranstaltung_id . '&id=' . $row->begegnung_id); ?>"><?php echo Text::_('COM_SPORTSMANAGER_HOME_EXCHANGE'); ?></a></small> href="<?php echo SportsManagerURL('&task=admin_begegnung_heimtausch&veranstaltungid=' . $veranstaltung->veranstaltung_id . '&id=' . $row->begegnung_id); ?>"
onclick="return confirm('<?php echo Text::_('COM_SPORTSMANAGER_REALLY_SWAP_MATCH'); ?>');">
<?php echo Text::_('COM_SPORTSMANAGER_HOME_EXCHANGE'); ?></a></small>
</td> </td>
<td nowrap><small><a <td nowrap><small><a
href="<?php echo SportsManagerURL('&task=admin_begegnung_remove&veranstaltungid=' . $veranstaltung->veranstaltung_id . '&id=' . $row->begegnung_id); ?>" href="<?php echo SportsManagerURL('&task=admin_begegnung_remove&veranstaltungid=' . $veranstaltung->veranstaltung_id . '&id=' . $row->begegnung_id); ?>"
@@ -11472,6 +11474,7 @@ static function adminVerbandsorganMitglieder($rows,$verbandsorgan): void
8 => Text::_('COM_SPORTSMANAGER_MODIFIED_RESULTS'), 8 => Text::_('COM_SPORTSMANAGER_MODIFIED_RESULTS'),
9 => Text::_('COM_SPORTSMANAGER_LIVE_RESULTS'), 9 => Text::_('COM_SPORTSMANAGER_LIVE_RESULTS'),
10 => Text::_('COM_SPORTSMANAGER_REJECTED_SHIFT'), 10 => Text::_('COM_SPORTSMANAGER_REJECTED_SHIFT'),
11 => Text::_('COM_SPORTSMANAGER_SWAP_MATCH'),
default => Text::_('COM_SPORTSMANAGER_PROPOSED_APPOINTMENT'), default => Text::_('COM_SPORTSMANAGER_PROPOSED_APPOINTMENT'),
}; };
?> ?>
@@ -11572,6 +11575,7 @@ static function adminVerbandsorganMitglieder($rows,$verbandsorgan): void
?> ?>
<input type="submit" name="heimrecht_tauschen" <input type="submit" name="heimrecht_tauschen"
value="<?php echo Text::_('COM_SPORTSMANAGER_ADVANTAGE_HOME'); ?>" value="<?php echo Text::_('COM_SPORTSMANAGER_ADVANTAGE_HOME'); ?>"
onclick="return confirm('<?php echo Text::_('COM_SPORTSMANAGER_REALLY_SWAP_MATCH'); ?>');"
class="button"/> class="button"/>
<?php <?php
} }
@@ -1093,3 +1093,5 @@ COM_SPORTSMANAGER_REALLY_REMOVE_HALL_OF_FAME_YEAR="Willst Du wirklich dieses Hal
COM_SPORTSMANAGER_YEARS="Jahre" COM_SPORTSMANAGER_YEARS="Jahre"
COM_SPORTSMANAGER_ADD_HALL_OF_FAME_YEAR="Hall of Fame Jahr hinzuf&uuml;gen" COM_SPORTSMANAGER_ADD_HALL_OF_FAME_YEAR="Hall of Fame Jahr hinzuf&uuml;gen"
COM_SPORTSMANAGER_NO_ENTRY="kein Eintrag" COM_SPORTSMANAGER_NO_ENTRY="kein Eintrag"
COM_SPORTSMANAGER_REALLY_SWAP_MATCH="Willst Du wirklich das Heimrecht tauschen?"
COM_SPORTSMANAGER_SWAP_MATCH="Heimrechttausch"
@@ -1093,3 +1093,5 @@ COM_SPORTSMANAGER_REALLY_REMOVE_HALL_OF_FAME_YEAR="Are you sure you want to dele
COM_SPORTSMANAGER_YEARS="Years" COM_SPORTSMANAGER_YEARS="Years"
COM_SPORTSMANAGER_ADD_HALL_OF_FAME_YEAR="Add Hall of Fame Year" COM_SPORTSMANAGER_ADD_HALL_OF_FAME_YEAR="Add Hall of Fame Year"
COM_SPORTSMANAGER_NO_ENTRY="no entry" COM_SPORTSMANAGER_NO_ENTRY="no entry"
COM_SPORTSMANAGER_REALLY_SWAP_MATCH="Do you really want to swap the home advantage?"
COM_SPORTSMANAGER_SWAP_MATCH="Swap home advantage"