This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/site/beta5/layout/default/ajax.inc

40 lines
1.1 KiB
PHP

<?php
function thm_getHeaderData() {
$pLib = input::$game->getLib('beta5/player');
$mLib = input::$game->getLib('beta5/msg');
$player = $_SESSION[game::sessName()]['player'];
$pi = $pLib->call('get', $player);
$newMsg = ($mLib->call('getNew', $player) > 0) ? 1 : 0;
return time() . "#{$pi['name']}#{$pi['cash']}#$newMsg#{$pi['alliance']}";
}
function thm_getHeaderPList() {
$pLib = input::$game->getLib('beta5/player');
$pl = $pLib->call('getPlanets', $_SESSION[game::sessName()]['player']);
$s = "";
foreach ($pl as $id => $n) {
$s .= ($s==""?"":"\n")."$id#$n";
}
return $s;
}
function thm_getHeaderFolders() {
$mLib = input::$game->getLib('beta5/msg');
$fl = $mLib->call('getCustomFolders', $_SESSION[game::sessName()]['player']);
$s = "";
foreach ($fl as $id => $n) {
$s .= ($s == "" ? "" : "\n") . "$id#$n";
}
return $s;
}
return array(
"func" => array('getHeaderData','getHeaderPList','getHeaderFolders'),
"init" => "thmdef_writeHeader(document.getElementById('thm-hdr-init').value);thmdef_writePlanets(document.getElementById('thm-plist-init').value);thmdef_initFolders();"
);
?>