from the site, where this extra is included!
// -> use absolute path if you have it included in files with different directories!
// (e.g. /home/www/htdocs/mysite.com/vwar/)
// -> if included in your _header.php/_footer.php, it is normally: './'
// -> if not, use: './../'
$vwar_xroot = "./../";
// define number of lastactions
// limits display to x last actions
$numlastactions = 5;
// include header- & footer-information (1=enabled / 0=disabled)
$include = 0;
// ######################################################################################
// ################################### display lastactions ############################
// check, if we need to get some global vars or if we need to include them
if (!defined ("VWAR_COMMON_INCLUDED"))
{
$vwar_root = $vwar_xroot;
require_once ($vwar_root . "includes/functions_common.php");
}
if ($include == 1)
{
include_once($vwar_root . "_header.php");
}
?>
query_first("
SELECT COUNT(warid) AS numwars
FROM vwar".$n."
WHERE status = '1'
" . getPublicMatchtypes(1)
);
$numlastwars = $result['numwars'];
if ($numlastwars > 0)
{
// cache scores
if(!isset($scorecache))
{
$scorecache = createScoreCache();
}
$result = $vwardb->query("
SELECT vwar".$n.".warid, resultbylocations, dateline,
vwar".$n.".oppid, oppircchannel, oppircnetwork, oppnameshort, gameicon, gamename
FROM vwar".$n.", vwar".$n."_matchtype, vwar".$n."_gametype, vwar".$n."_opponents, vwar".$n."_games
WHERE vwar".$n.".oppid = vwar".$n."_opponents.oppid
AND vwar".$n.".gametypeid = vwar".$n."_gametype.gametypeid
AND vwar".$n."_matchtype.matchtypeid = vwar".$n.".matchtypeid
AND status = '1'
AND vwar".$n.".gameid = vwar".$n."_games.gameid
" . getPublicMatchtypes(1) . "
GROUP BY warid
ORDER BY dateline DESC
LIMIT 0, $numlastactions
");
while ($row = $vwardb->fetch_array($result))
{
dbSelect($row);
if (!isset($commentcache))
{
// get number of comments
$commentcache = array();
$result2 = $vwardb->query("
SELECT sourceid, COUNT(commentid) AS numcomments
FROM vwar".$n."_comments
WHERE frompage = 'war'
GROUP BY sourceid");
while($tmp = $vwardb->fetch_array($result2))
{
$commentcache[$tmp["sourceid"]] = $tmp["numcomments"];
}
$vwardb->free_result($result2);
unset($tmp);
}
$row['numcomments'] = $commentcache[$row["warid"]];
$row['numcomments'] = empty($row['numcomments']) ? 0 : $row['numcomments'];
$ownscoretotal = 0;
$oppscoretotal = 0;
$ownscoretotalbylocations = 0;
$oppscoretotalbylocations = 0;
$numcomments = $row['numcomments'];
if ($row['gameicon'] != "" && file_exists($vwar_root . "images/gameicons/" . $row['gameicon']))
{
$gameicon = makeimgtag($urltovwar . "images/gameicons/" . $row['gameicon'], $row['gamename']);
} else {
$gameicon="";
}
?>
vs.
|
$oppscoretotal) $scorecolor = $colorwon;
else if ($ownscoretotal == $oppscoretotal) $scorecolor = $colordraw;
}
if ($row['resultbylocations'] == 1)
{
$oppscoretotalbylocations = $scorecache[$row["warid"]]['loppscoretotal'];
$ownscoretotalbylocations = $scorecache[$row["warid"]]['lownscoretotal'];
if ($showcoloredresults == 1)
{
if ($ownscoretotalbylocations < $oppscoretotalbylocations)
{
$scorecolor = $colorlost;
$matchstatus = makeimgtag($urltovwar . "images/lost.gif");
}
else if ($ownscoretotalbylocations > $oppscoretotalbylocations)
{
$scorecolor = $colorwon;
$matchstatus = makeimgtag($urltovwar . "images/won.gif");
}
else if ($ownscoretotalbylocations == $oppscoretotalbylocations)
{
$scorecolor = $colordraw;
$matchstatus = makeimgtag($urltovwar . "images/draw.gif");
}
}
if ($showrealresults == 0)
{
$ownscoretotal = $ownscoretotalbylocations;
$oppscoretotal = $oppscoretotalbylocations;
}
}
if ($ownscoretotal > $oppscoretotal) $matchstatus = makeimgtag($urltovwar . "images/won.gif");
else if ($ownscoretotal < $oppscoretotal) $matchstatus = makeimgtag($urltovwar . "images/lost.gif");
else if ($ownscoretotal == $oppscoretotal) $matchstatus = makeimgtag($urltovwar . "images/draw.gif");
?>
:
|
» |
» details
[ ]
|
free_result($result);
}
else
{
?>
No Last Actions |