public static function matchActions($IS_LOCAL_ADMIN) { // Admin actions made? if (isset($_GET['action']) && $IS_LOCAL_ADMIN) { $match = new Match((int) $_GET['mid']); switch ($_GET['action']) { case 'lock': status($match->setLocked(true)); break; case 'unlock': status($match->setLocked(false)); break; case 'delete': status($match->delete()); break; case 'reset': status($match->reset()); break; } } else { if (isset($_GET['action'])) { status(false, 'Sorry, you do not have permission to do that.'); } } }
require_once e_PLUGIN . "ebattles/include/main.php"; require_once e_PLUGIN . "ebattles/include/match.php"; require_once e_PLUGIN . "ebattles/include/event.php"; /******************************************************************* ********************************************************************/ require_once HEADERF; global $sql; $text = ''; /* Event Name */ $event_id = intval($_GET['eventid']); if (!$event_id) { header("Location: ./events.php"); exit; } if (!isset($_POST['deletematch'])) { $text .= '<br />' . EB_MATCHDEL_L2 . '<br />'; } else { $event = new Event($event_id); $match_id = $_POST['matchid']; $match = new Match($match_id); $match->delete(); if ($event->getField('FixturesEnable') == TRUE) { $event->brackets(true); } $text .= '<br />' . EB_MATCHDEL_L3 . '<br />'; header("Location: eventinfo.php?eventid={$event_id}"); } $text .= '<br />' . EB_MATCHDEL_L4 . ' [<a href="' . e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $event_id . '">' . EB_MATCHDEL_L5 . '</a>]<br />'; $ns->tablerender(EB_MATCHDEL_L1, $text); require_once FOOTERF; exit;
function deleteTeamMatches($team_id) { global $sql; $q = "SELECT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_SCORES . ".Team = '{$team_id}')"; $result = $sql->db_Query($q); $num_matches = mysql_numrows($result); echo "<br>team_id {$team_id}"; echo "<br>num_matches {$num_matches}"; if ($num_matches != 0) { for ($j = 0; $j < $num_matches; $j++) { set_time_limit(10); $match_id = mysql_result($result, $j, TBL_MATCHS . ".MatchID"); $match = new Match($match_id); $match->delete(); } } }