} // Update scores stats $match->match_scores_update(); // Automatically Update Players stats only if Match Approval is Disabled if ($event->getField('MatchesApproval') == eb_UC_NONE) { switch ($event->getMatchPlayersType()) { case 'Players': $match->match_players_update(); break; case 'Teams': $match->match_teams_update(); break; default: } } $event->setFieldDB('IsChanged', 1); // Save the replay $target_path = "uploads/"; $target_file = $target_path . basename($name); move_uploaded_file($tmpname, $target_file); $raw_name = urlencode($name); $target_file = $target_path . basename($raw_name); $media_type = 'Replay'; $media_path = $target_file; $submitter = USERID; $match->add_media($submitter, $media_path, $media_type); header("Location: matchinfo.php?matchid={$match_id}"); exit; } } else { // Not a SC2 Replay
$update_matchupsfile = 0; $can_manage = 0; if (check_class($pref['eb_mod_class'])) { $can_manage = 1; } if (USERID == $event->getField('Owner')) { $can_manage = 1; } if ($action == 'create' && check_class($pref['eb_events_create_class'])) { $can_manage = 1; } if ($can_manage == 0) { header("Location: ./eventinfo.php?eventid={$event_id}"); exit; } $event->setFieldDB('IsChanged', 1); if (isset($_POST['eventpublish'])) { /* Event Status */ $event->setFieldDB('Status', 'signup'); //echo "-- eventpublish --<br />"; header("Location: eventmanage.php?eventid={$event_id}"); exit; } if (isset($_POST['eventchangeowner'])) { $event_owner = $_POST['eventowner']; /* Event Owner */ $event->setFieldDB('Owner', $event_owner); //echo "-- eventchangeowner --<br />"; header("Location: eventmanage.php?eventid={$event_id}"); exit; }
} if ($time > $event->getField('StartDateTime') || $eMaxNumberPlayers != 0 && $nbr_players_checked_in >= $eMaxNumberPlayers) { $checkin_end = true; } } else { // no checkin if ($time > $event->getField('StartDateTime')) { $checkin_end = true; } } if ($checkin_end == true) { $eventStatus = 'active'; if ($event->getField('FixturesEnable') == TRUE) { $event->brackets(true); } $event->setFieldDB('IsChanged', 1); } } if ($time > $event->getField('EndDateTime') && $event->getField('EndDateTime') != 0 && $eventStatus != 'finished') { $eventStatus = 'finished'; if ($type == "One Player Ladder" || $type == "Team Ladder") { $q = "SELECT " . TBL_PLAYERS . ".*" . " FROM " . TBL_PLAYERS . " WHERE (" . TBL_PLAYERS . ".Event = '{$event_id}')" . " AND (" . TBL_PLAYERS . ".Rank = '1')"; $result = $sql->db_Query($q); $nbr_players_rank_1 = mysql_numrows($result); //echo "nbr_players_rank_1: $nbr_players_rank_1<br>"; if ($nbr_players_rank_1 == 1) { $pid = mysql_result($result, 0, TBL_PLAYERS . ".PlayerID"); $q_Awards = "INSERT INTO " . TBL_AWARDS . "(Player,Type,timestamp)\r\n\t\t\tVALUES ({$pid},'PlayerRankFirst',{$time}+2)"; $result_Awards = $sql->db_Query($q_Awards); // gold if (is_gold_system_active() && $event->getField('GoldWinningEvent') > 0) {
function deleteMatchScores() { global $sql; /* Event Info */ $event_id = $this->fields['Event']; $event = new Event($event_id); switch ($event->getMatchPlayersType()) { case 'Players': $this->deletePlayersMatchScores(); break; case 'Teams': $this->deleteTeamsMatchScores(); break; default: } $event->setFieldDB('IsChanged', 1); }
function addMember($user, $notify) { global $sql; global $time; $div_id = $this->fields['DivisionID']; $game_id = $this->fields['Game']; $q = "SELECT " . TBL_USERS . ".*" . " FROM " . TBL_USERS . " WHERE (" . TBL_USERS . ".user_id = '{$user}')"; $result = $sql->db_Query($q); $Name = mysql_result($result, 0, TBL_USERS . ".user_name"); $UniqueGameID = ""; $gamerID = updateGamer($user, $game_id, $Name, $UniqueGameID); $q = " INSERT INTO " . TBL_MEMBERS . "(Division,User,timestamp)\r\n\t\tVALUES ({$div_id},{$user},{$time})"; $sql->db_Query($q); // User will automatically be signed up to all current events this division participates in $q_2 = "SELECT " . TBL_TEAMS . ".*, " . TBL_EVENTS . ".*" . " FROM " . TBL_TEAMS . ", " . TBL_EVENTS . " WHERE (" . TBL_TEAMS . ".Division = '{$div_id}')" . " AND (" . TBL_TEAMS . ".Event = " . TBL_EVENTS . ".EventID)" . " AND (" . TBL_EVENTS . ".Status != 'finished')"; $result_2 = $sql->db_Query($q_2); $num_rows_2 = mysql_numrows($result_2); if ($num_rows_2 > 0) { for ($j = 0; $j < $num_rows_2; $j++) { $event_id = mysql_result($result_2, $j, TBL_EVENTS . ".EventID"); $event = new Event($event_id); $team_id = mysql_result($result_2, $j, TBL_TEAMS . ".TeamID"); $team_banned = mysql_result($result_2, $j, TBL_TEAMS . ".Banned"); // Verify there is no other player for that user/event/team $q = "SELECT COUNT(*) as NbrPlayers" . " FROM " . TBL_PLAYERS . " WHERE (Event = '{$event_id}')" . " AND (Team = '{$team_id}')" . " AND (User = "******")"; $result = $sql->db_Query($q); $row = mysql_fetch_array($result); $nbrplayers = $row['NbrPlayers']; if ($nbrplayers == 0) { $q = " INSERT INTO " . TBL_PLAYERS . "(Event,Gamer,Team,ELORanking,TS_mu,TS_sigma,G2_r,G2_RD,G2_sigma,Joined,Banned)\r\n\t\t\t\t\tVALUES ({$event_id}, {$gamerID}, {$team_id}, " . $event->getField('ELO_default') . ", " . $event->getField('TS_default_mu') . ", " . $event->getField('TS_default_sigma') . "," . $event->fields['G2_default_r'] . "," . $event->fields['G2_default_RD'] . "," . $event->fields['G2_default_sigma'] . ",{$time}, {$team_banned})"; $sql->db_Query($q); $event->setFieldDB('IsChanged', 1); } } } if ($notify) { list($cname, $ctag, $cid) = $this->getClanInfo(); $sendto = $user; $subject = SITENAME . " " . $cname; $message = EB_CLANM_L39 . $username . EB_CLANM_L40 . $cname . EB_CLANM_L41 . EB_CLANM_L43; sendNotification($sendto, $subject, $message, $fromid = 0); // Send email $message = EB_CLANM_L39 . $username . EB_CLANM_L39 . $cname . EB_CLANM_L42 . SITEURLBASE . e_PLUGIN_ABS . "ebattles/claninfo.php?clanid=" . $cid . EB_CLANM_L43; require_once e_HANDLER . "mail.php"; sendemail($useremail, $subject, $message); } }