Commit 91a0b248 authored by Stuart John Watson's avatar Stuart John Watson

index's populate now correctlly respects domaining[C

parent f589d60d
......@@ -179,6 +179,11 @@ if ($accessLevel == "GAME_ACCESS" || ($accessLevel == "AS_BEFORE" && $oldLevel =
}
}
//Get other payload data
chdir("games");
include "_manager.php";
$services = getGameStatus();
header('Content-Type: application/json');
//Echo response
echo json_encode([
......@@ -187,7 +192,7 @@ echo json_encode([
username => $authdUser,
extraPayload => [
onlineUsers => $onlineUsers,
services => []
services => $services
]
]);
......
......@@ -4,7 +4,7 @@
"sauerbraten"
];
function getGameStatus($includeTemplate){
function getGameStatus($templateHeader = FALSE,$templateFooter = FALSE){
global $GAMES_TO_INCLUDE;
$gameInfo = [];
......@@ -12,12 +12,14 @@
include "$game.php";
$a = "$game\\getInfo";
$gameInfo[$game] = $a();
if ($includeTemplate){
if ($templateHeader !== FALSE){
echo $templateHeader;
echo "<div data-target=\"$game\">";
echo file_get_contents("$game.html");
echo "</div>";
echo $templateFooter;
}
}
return $gameInfo;
}
var_dump(getGameStatus(1));
?>
......@@ -5,9 +5,13 @@
<dd>
<span data-target="players_on"></span>/<span data-target="players_max"></span>
</dd>
<dt>Version:</dt>
<dt>Game Mode:</dt>
<dd>
<span data-target="version"></span>
<span data-target="gameMode"></span>
</dd>
<dt>Map:</dt>
<dd>
<span data-target="map"></span>
</dd>
</dl>
......
......@@ -88,38 +88,15 @@
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body">
<?php
chdir('games');
include '_manager.php';
getGameStatus(1);
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body">
<h2>OpenTTD - <font color="green">Online</font></h2>
<p>
</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body">
<h2>Cube 2: Sauerbraten - <font color="green">Online</font></h2>
<p>
</p>
</div>
</div>
</div>
<div class="row" data-target="services">
<?php
chdir('games');
include '_manager.php';
getGameStatus(
'<div class="col-md-4"><div class="panel panel-default"><div class="panel-body">',
'</div></div></div>'
);
?>
</div>
</div>
<footer>
......@@ -158,7 +135,7 @@
domain = $("body")
}
$.each(data,function(key,value){
var target = $("body").find("[data-target='"+key+"']");
var target = domain.find("[data-target='"+key+"']");
if (target.length == 0){
console.warn("failed to find target",key,"under",domain);
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment