示例#1
0
function ReportToLadder($matchId, $teamLeft, $teamRight, $winner1, $winner2, $loser1, $loser2, $scoreLeft, $scoreRight, $scoreLeftExt, $scoreRightExt, $patchId, $log, $finished)
{
    // Settings correct?
    $sql = "SELECT matchTime FROM six_matches_info WHERE matchId={$matchId} AND type=";
    if ($finished) {
        $sql .= "'F'";
    } else {
        $sql .= "'U'";
    }
    $log->logInfo('ReportToLadder: sql=' . $sql);
    $matchTime = 1;
    $res = mysql_query($sql);
    if ($row = mysql_fetch_array($res)) {
        $matchTime = $row['matchTime'];
        $log->logInfo('ReportToLadder: six_matches_info.matchTime=' . $matchTime);
    }
    if ($matchTime != 1) {
        $log->logInfo('ReportToLadder: Not reporting match #' . $matchId . ' - MatchTime is set to ' . $matchTime);
    } else {
        // new match -> save the old one
        $winnerTeam = 0;
        $loserTeam = 0;
        // teams known?
        $sql = "SELECT st.ladderTeamId FROM six_teams st " . "WHERE st.patchId=" . $patchId . " AND st.sixTeamId=" . $teamLeft;
        $log->logInfo('ReportToLadder: sql=' . $sql);
        $res = mysql_query($sql);
        if (mysql_num_rows($res) > 0) {
            $row = mysql_fetch_array($res);
            $winnerTeam = $row[0];
        }
        $sql = "SELECT st.ladderTeamId FROM six_teams st " . "WHERE st.patchId=" . $patchId . " AND st.sixTeamId=" . $teamRight;
        $log->logInfo('ReportToLadder: sql=' . $sql);
        $res = mysql_query($sql);
        if (mysql_num_rows($res) > 0) {
            $row = mysql_fetch_array($res);
            $loserTeam = $row[0];
        }
        $commentSuffix = "";
        if ($scoreLeftExt > $scoreLeft || $scoreRightExt > $scoreRight) {
            $commentSuffix = " (score after regular time)";
        }
        if ($finished) {
            $commentPrefix = "Sixserver Game";
        } else {
            $commentPrefix = "Unfinished Sixserver Game";
        }
        $gamesplayedplayer = 0;
        $gamesmaxdayplayer = 6;
        if (empty($winner2) && empty($loser2)) {
            // check max. games
            $dateday = date("d/m/Y");
            $sql = "SELECT game_id FROM weblm_games " . "WHERE ((winner = '{$winner1}' and loser = '{$loser1}') OR (winner = '{$loser1}' and loser = '{$winner1}')) " . "AND deleted='no' and dateday = '{$dateday}'";
            $result = mysql_query($sql);
            $gamesplayedplayer = mysql_num_rows($result);
        }
        $log->logInfo("ReportToLadder: matchId=" . $matchId . " winner1=" . $winner1 . " loser1=" . $loser1 . " winner2=" . $winner2 . " loser2=" . $loser2 . " teamLeft=" . $teamLeft . " teamRight=" . $teamRight . " scoreLeft=" . $scoreLeft . " scoreRight=" . $scoreRight . " finished=" . $finished);
        $log->logInfo("ReportToLadder: gamesmaxdayplayer=" . $gamesmaxdayplayer . " gamesplayedplayer=" . $gamesplayedplayer);
        if ($gamesplayedplayer >= $gamesmaxdayplayer) {
            $log->logInfo("ReportToLadder: limit reached, not reporting game");
        } else {
            ReportGame($winner1, $winner2, $loser1, $loser2, time(), $commentPrefix . ' #' . $matchId . $commentSuffix, null, $scoreLeft, $scoreRight, 'B', 5, 'H', $winnerTeam, $loserTeam, $matchId);
        }
    }
    if ($finished) {
        $sql = "UPDATE six_matches SET reported=1, played_on=played_on WHERE id=" . $matchId;
    } else {
        $sql = "UPDATE six_matches_status SET reported=1, updated=updated WHERE id=" . $matchId;
    }
    $log->logInfo("ReportToLadder: " . $sql);
    $res = mysql_query($sql);
}
示例#2
0
				                             $gameid = $row['game_id'];
			                             	 $timeago = formatAgoSpan($row['date']);
			                             	 $error.= "<p>A similar draw with the same teams was reported ".$timeago.' ago. Please check <b><a href="/games.php?gameId='.$gameid.
			                             	 	'" target="_blank">Game #'.$gameid.'</a></b> to check if your report is correct, then submit again.</p>';
			                             	 $drawOverride = true;
			                             }
			                             
	                             }
	                             
	                             if (empty($error)) {
		                             $replayname = '';
		                             if ($approvegames != "yes") { 
		                                 $rec = 'no';
		                                 $gameid = 'null';
		                                 $report = ReportGame($winnername, $winnername2, $losername, $losername2, $date, $comment, 
										 	$gameid, $winnerresult, $loserresult, $host, 
										 	$fairness, $version, $winnerteamId, $loserteamId, NULL);
		                                 if ($report == 3) {
		                                 	
		                                     $gamesleft = $gamesmaxday - $gamesplayedday-1;
		                                     $gamesplayerleft = $gamesmaxdayplayer - $gamesplayedplayer-1;
											 
											 updateTeamladders();
											 
											 if (strlen($comment) < 11) {
											 	echo "<p><b>Your game comment is very short.</b> Please try to make game reports more enjoyable to read and supply a better description of the game next time.</p>";
											 }
		                                     echo "<p>You can play <b>";
		                                     echo $gamesleft;
		
		                                     echo "</b> more game(s) today and <b>";