Example #1
0
                    $cols[$b] = 1;
                }
            }
        }
    }
} else {
    // So now we sort each team into order
    sortrank($hplayer, $pars->Rankfuzz);
    sortrank($aplayer, $pars->Rankfuzz);
    //  Now assign colours either WBW or BWB
    $cols[0] = rand(1, 2);
    $cols[1] = 3 - $cols[0];
    $cols[2] = $cols[0];
}
// If matchdate has changed, fix it
$newdate = new Matchdate();
$newdate->frompost();
$newslack = $_POST["slackd"];
// Fix changed date
if ($newdate->unequal($mtch->Date) || $newslack != $mtch->Slackdays) {
    $mtch->Date = $newdate;
    $mtch->Slackdays = $newslack;
    $mtch->dateupdate();
}
// Set up game details according to who is white/black
// col=1 means "home" player is white otherwise black
function setgteams($g, $col, $hteam, $ateam, $hplay, $aplay)
{
    global $hcapable, $hred;
    // Force colour to white for stronger player if handicaps apply and rank
    // difference is greater than handicap reduction
Example #2
0
include 'php/matchdate.php';
include 'php/game.php';
$div = $_POST['div'];
if (strlen($div) == 0) {
    $mess = "No division?";
    include 'php/wrongentry.php';
    exit(0);
}
$hteam = $_POST['hteam'];
$ateam = $_POST['ateam'];
$slack = $_POST['slackd'];
if (strlen($hteam) == 0 || strlen($ateam) == 0) {
    $mess = "Missing teams?";
    include 'php/wrongentry.php';
}
$dat = new Matchdate();
$dat->frompost();
$mtch = new Match(0, $div);
$mtch->set_hometeam($hteam);
$mtch->set_awayteam($ateam);
$mtch->Date = $dat;
$mtch->Slackdays = $slack;
try {
    // Fetch the team details not because we need them, but
    // so as to check for garbled team names.
    $mtch->fetchteams();
    $mtch->create();
    // That sets the match ind in $mtch which the updmatch call uses later.
} catch (MatchException $e) {
    $mess = $e->getMessage();
    include 'php/dataerror.php';
Example #3
0
<title>No opponent</title>
<link href="/league/bgaleague-style.css" type="text/css" rel="stylesheet"></link>
</head>
<body class="il">
<h1>No opponent</h1>
<p>Sorry but I failed to work out who your opponent was.</p>
<p>Problem was {$msg}.</p>
<p>Please start again from the top by <a href="index.php">clicking here</a>.</p>
</body>
</html>

EOT;
    exit(0);
}
$mycolour = $_GET["col"];
$dat = new Matchdate();
$dat->fromget();
$myres = $_GET["r"];
$myrt = $_GET["rt"];
$g = new Game(0, 0, $player->ILdiv, 'I');
$g->Date = $dat;
$result = $myres;
if ($mycolour == 'B') {
    $g->Wplayer = $opp;
    $g->Bplayer = $player;
    $wkgs = $opp->KGS;
    $bkgs = $player->KGS;
    if ($myres == 'W') {
        $result = 'B';
    } elseif ($myres == 'L') {
        $result = 'W';
Example #4
0
include 'php/team.php';
include 'php/teammemb.php';
include 'php/match.php';
include 'php/matchdate.php';
include 'php/game.php';
include 'php/news.php';
$g = new Game();
try {
    $g->frompost();
    $g->fetchdets();
} catch (GameException $e) {
    $mess = $e->getMessage();
    include 'php/wrongentry.php';
    exit(0);
}
$date_played = new Matchdate();
$date_played->frompost();
$sgfdata = "";
$fn = $_FILES["sgffile"];
if ($fn['error'] == UPLOAD_ERR_OK && preg_match('/.*\\.sgf$/i', $fn['name']) && $fn['size'] > 0) {
    $sgfdata = file_get_contents($fn['tmp_name']);
}
if ($date_played->unequal($g->Date)) {
    $g->reset_date($date_played);
}
$mtch = $g->set_result($_POST["result"], $_POST["resulttype"]);
if (strlen($sgfdata) != 0) {
    $g->set_sgf($sgfdata);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Example #5
0
<p>
Adding result for Game between
<?php 
print <<<EOT
<b>{$g->Wplayer->display_name(false)}</b>
({$g->Wplayer->display_rank()}) of
{$g->Wteam->display_name()} as White and
<b>{$g->Bplayer->display_name(false)}</b>
({$g->Bplayer->display_rank()}) of
{$g->Bteam->display_name()} as Black.
</p>
<form name="resform" action="addresult2.php" method="post" enctype="multipart/form-data">
{$g->save_hidden()}
<p>
EOT;
$today = new Matchdate();
$today->dateopt("Game was played on");
print <<<EOT
</p>
<p>Please note that if the game is adjourned or crosses midnight, KGS normally stores the date it was <i>started</i> so please use that.</p>
<p><b>If you got the colours the wrong way round, please click <a href="javascript:checkreverse('{$g->urlof()}')">here</a>.</b></p>
<p>
Result was
<select name="result" size="0">
<option value="W">White Win</option>
<option value="B">Black Win</option>
<option value="J">Jigo</option>
</select>
by
<select name="resulttype" size="0">
<option value="N">Not known</option>
Example #6
0
EOT;
?>
</p>
<p>To enter the individual league match result, please complete the form below:
</p>
<form action="addilresultb2.php" method="post" enctype="multipart/form-data" name="ilresf" onsubmit="javascript: return checkform();">
<?php 
print $player->save_hidden("pl");
?>
<table cellpadding="2" cellspacing="5" border="0">
<tr>
	<td>Match was played on</td>
	<td>
<?php 
$dat = new Matchdate();
$dat->dateopt("");
?>
	</td>
</tr>
<tr><td></td><td>NB Date <b>started</b> if it crosses midnight</td></tr>
<tr>
	<td>Opponent was</td>
	<td><select name="opp">
<?php 
$pl = list_players_ildiv($player->ILdiv);
foreach ($pl as $p) {
    if ($p->is_same($player)) {
        continue;
    }
    $p->fetchdets();
Example #7
0
//   along with this program.  If not, see <http://www.gnu.org/licenses/>.
include 'php/session.php';
include 'php/checklogged.php';
include 'php/matchdate.php';
$div = $_GET["div"];
if (strlen($div) == 0) {
    include 'php/wrongentry.php';
    exit(0);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<?php 
$Title = "Initialise Matches for Division {$div}";
include 'php/head.php';
$md = new Matchdate();
$md->set_season();
print <<<EOT
<body>
<h1>Initialise Matches for division {$div}</h1>
<form action="matchinit.php" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="div" value="{$div}">
<p>
EOT;
$md->dateopt('Starting date');
?>
</p>
<p>Allocate matches every
<select name="mintnum" size="0">
<option value="1" selected>1</option>
<option value="2">2</option>
Example #8
0
if (strlen($Sname) == 0) {
    include 'php/wrongentry.php';
    exit(0);
}
include 'php/promoreleg.php';
if (count($messages) > 0) {
    $mess = "Not ready to do end-of-season";
    include 'php/wrongentry.php';
    exit(0);
}
// Create the Season
// Set the name and dates
$Seas = new Season();
$Seas->Name = $Sname;
$earliest = new Matchdate();
$latest = new Matchdate();
$ret = mysql_query("select matchdate from lgmatch order by matchdate limit 1");
if ($ret && mysql_num_rows($ret) > 0) {
    $row = mysql_fetch_array($ret);
    if ($row) {
        $earliest->enctime($row[0]);
    }
}
$ret = mysql_query("select matchdate from lgmatch order by matchdate desc limit 1");
if ($ret && mysql_num_rows($ret) > 0) {
    $row = mysql_fetch_array($ret);
    if ($row) {
        $latest->enctime($row[0]);
    }
}
$Seas->Startdate = $earliest;
Example #9
0
<h1>Promotion and Relegation / Archive</h1>
<?php 
if (count($messages) > 0) {
    print <<<EOT
<p>
Sorry but we cannot proceed with the promotion / relegation and archive because of
the following:
</p>

EOT;
    foreach ($messages as $mess) {
        print "<p>{$mess}</p>\n";
    }
} else {
    $earliest = new Matchdate();
    $latest = new Matchdate();
    $seasnum = 1;
    $ret = mysql_query("select matchdate from lgmatch order by matchdate limit 1");
    if ($ret && mysql_num_rows($ret) > 0) {
        $row = mysql_fetch_array($ret);
        if ($row) {
            $earliest->enctime($row[0]);
        }
    }
    $ret = mysql_query("select matchdate from lgmatch order by matchdate desc limit 1");
    if ($ret && mysql_num_rows($ret) > 0) {
        $row = mysql_fetch_array($ret);
        if ($row) {
            $latest->enctime($row[0]);
        }
    }