| 1 | <?php |
|---|
| 2 | require_once(WCF_DIR.'lib/action/AbstractAction.class.php'); |
|---|
| 3 | |
|---|
| 4 | /** |
|---|
| 5 | * Löscht ein Rennen |
|---|
| 6 | * |
|---|
| 7 | * @author Markus Gerdelmann |
|---|
| 8 | * @copyright 2007/2008 MDMAN |
|---|
| 9 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
|---|
| 10 | * @package de.mdman.racing.league |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | class RacingLeagueDeleteRaceAction extends AbstractAction { |
|---|
| 14 | |
|---|
| 15 | public $raceID = 0; |
|---|
| 16 | public $ID = 0; |
|---|
| 17 | |
|---|
| 18 | public function execute() { |
|---|
| 19 | parent::execute(); |
|---|
| 20 | |
|---|
| 21 | if (isset($_REQUEST["raceID"])) $this->raceID = intval($_REQUEST["raceID"]); |
|---|
| 22 | |
|---|
| 23 | // hier wird ein Rennen inklusive dessen Ergebnisse gelöscht |
|---|
| 24 | if ($this->raceID > 0) { |
|---|
| 25 | $sql = "DELETE FROM `wcf".WCF_N."_racing_races` |
|---|
| 26 | WHERE `raceID` = '".escapeString($this->raceID)."' |
|---|
| 27 | "; |
|---|
| 28 | $res = WCF::getDB()->sendQuery($sql); |
|---|
| 29 | $row = WCF::getDB()->getAffectedRows($res); |
|---|
| 30 | |
|---|
| 31 | $sql = "DELETE FROM `wcf".WCF_N."_racing_results` |
|---|
| 32 | WHERE `raceID` = '".escapeString($this->raceID)."' |
|---|
| 33 | "; |
|---|
| 34 | WCF::getDB()->sendQuery($sql); |
|---|
| 35 | |
|---|
| 36 | $sql = "DELETE FROM `wcf".WCF_N."_racing_results_team` |
|---|
| 37 | WHERE `raceID` = '".escapeString($this->raceID)."' |
|---|
| 38 | "; |
|---|
| 39 | WCF::getDB()->sendQuery($sql); |
|---|
| 40 | |
|---|
| 41 | // hier werden auch Strafen fÌr das gelöschte Rennen gelöscht |
|---|
| 42 | $sql = "DELETE FROM `wcf".WCF_N."_racing_punish` |
|---|
| 43 | WHERE `raceID` = '".escapeString($this->raceID)."' |
|---|
| 44 | "; |
|---|
| 45 | WCF::getDB()->sendQuery($sql); |
|---|
| 46 | |
|---|
| 47 | if ($row > 0) { |
|---|
| 48 | WCF::getTPL()->append('userMessages', WCF::getTPL()->fetch('racingLeagueDeleteSuccess')); |
|---|
| 49 | } |
|---|
| 50 | else { |
|---|
| 51 | WCF::getTPL()->append('userMessages', WCF::getTPL()->fetch('racingLeagueDeleteError')); |
|---|
| 52 | } |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | $this->executed(); |
|---|
| 56 | |
|---|
| 57 | HeaderUtil::redirect('index.php?form=RacingLeagueRaces'.SID_ARG_2ND_NOT_ENCODED); |
|---|
| 58 | exit; |
|---|
| 59 | } |
|---|
| 60 | } |
|---|
| 61 | ?> |
|---|