Added full source code
This commit is contained in:
commit
33f8586698
1377 changed files with 123808 additions and 0 deletions
scripts/site/beta5
handlers
admin.incalliance.incallies.inccomms.incdiplomacy.incempire.incenemylist.incfleets.incforums.incmanual.incmap.incmarket.incmessage.incmoney.incnorealloc.incnplanet.incoverview.incplanet.incplanetnf.incplanets.incplay.incpreferences.incprobes.incrank.incrat.incresearch.inctechtrade.incticks.incuniverse.inc
layout
classic
cripes
default
invert
output
admin.en.inc
page.incadmin/en
acmgmt.inckicklst.inckickreq.inclkcat.inclklist.inclklk.inclkrep.inclksadd.inclksub.incmain.incpnlist.incspam.inc
alliance.en.incallies.en.inccomms.en.incdiplomacy.en.incempire.en.incenemylist.en.incfleets.en.incforums.en.incforums/en
category.inccatnotfound.incforum.incforumnopost.incforumnotfound.inclatest.incoverview.incpost.incpostnotfound.incsearch.incsresposts.incsrestopics.inctopic.inctopicnotfound.inc
manual.en.incmanual/en
map.en.incmarket.en.incmessage.en.incmoney.en.incnorealloc.en.incnplanet.en.incoverview.en.incplanet.en.incplanetnf.en.incplanets.en.incpreferences.en.incprobes.en.incrank.en.incrat.en.incresearch.en.inctechtrade.incticks.en.incuniverse.en.inc
698
scripts/site/beta5/handlers/admin.inc
Normal file
698
scripts/site/beta5/handlers/admin.inc
Normal file
|
@ -0,0 +1,698 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
var $needsAuth = true;
|
||||
|
||||
private function logAdm($text) {
|
||||
logText("*** ADMIN {$_SESSION['login']} $text");
|
||||
}
|
||||
|
||||
function isAdmin() {
|
||||
$this->accounts = $this->game->getLib('main/account');
|
||||
return $this->accounts->call('isAdmin', $_SESSION['userid']);
|
||||
}
|
||||
|
||||
|
||||
function manualUpdate() {
|
||||
$this->logAdm("is regenerating the manual");
|
||||
$manual = $this->game->getLib('main/manual');
|
||||
$x = $manual->call('readXMLFile', config::$main['scriptdir'] . '/../manual/beta5/en/main.lwdoc');
|
||||
if (is_array($x)) {
|
||||
$manual->call('updateSections', $x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleKickReq(&$input, &$data) {
|
||||
if (is_null($input['kr'])) {
|
||||
return false;
|
||||
} elseif (!is_null($input['cancel'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$data['error'] = 0;
|
||||
$data['name'] = trim($input['p']);
|
||||
$data['reason'] = trim($input['r']);
|
||||
|
||||
$a = $this->accounts->call('getUser', $data['name']);
|
||||
if (is_null($a) || $a['status'] == 'KICKED' || $a['admin'] == 't') {
|
||||
$data['error'] = 1;
|
||||
} elseif (strlen($data['reason']) < 10) {
|
||||
$data['error'] = 2;
|
||||
} else {
|
||||
$r = $this->accounts->call('requestKick', $_SESSION['userid'], $a['id'], $data['reason']);
|
||||
$data['error'] = $r ? 0 : 3;
|
||||
if ($r) {
|
||||
$this->logAdm("is requesting to kick {$data['name']}");
|
||||
}
|
||||
}
|
||||
|
||||
return ($data['error'] == 0);
|
||||
}
|
||||
|
||||
|
||||
function handlePNCommand($command, $id) {
|
||||
$pd = $this->planets->call('byId', $id);
|
||||
if (is_null($pd)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pLog = "planet '{$pd['name']}' (#$id)";
|
||||
if (!is_null($pd['owner'])) {
|
||||
$pLog .= " owned by player {$pd['owner']}";
|
||||
}
|
||||
|
||||
if ($command == "v") {
|
||||
$this->b5adm->call('validatePlanetName', $id);
|
||||
$this->logAdm("validated $pLog");
|
||||
$this->db->query("UPDATE credits SET credits_obtained = credits_obtained + 200 WHERE account = {$_SESSION['userid']}");
|
||||
} elseif ($command == "r") {
|
||||
$this->b5adm->call('resetPlanet', $id, $_SESSION[game::sessName()]['player']);
|
||||
$this->logAdm("reset $pLog");
|
||||
} elseif ($command == "w") {
|
||||
$this->b5adm->call('sendPlanetWarning', $id, $_SESSION[game::sessName()]['player']);
|
||||
$this->logAdm("warned $pLog");
|
||||
$this->db->query("UPDATE credits SET credits_obtained = credits_obtained + 200 WHERE account = {$_SESSION['userid']}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handlePlanetNames(&$input, &$data) {
|
||||
$this->db = $this->game->db;
|
||||
if (!is_null($input['pc'])) {
|
||||
$this->planets = $this->game->getLib("beta5/planet");
|
||||
$this->handlePNCommand($input['pc'], (int) $input['id']);
|
||||
}
|
||||
|
||||
list($mode, $q) = $this->b5adm->call('getPlanetsModList', $input['m']);
|
||||
if ($input['m'] == 'o') {
|
||||
$this->logAdm("is accessing the complete planet list");
|
||||
}
|
||||
$perPage = 30;
|
||||
$lines = dbCount($q);
|
||||
$mod = $lines % $perPage;
|
||||
$pages = ($lines - $mod) / $perPage + ($mod > 0 ? 1 : 0);
|
||||
|
||||
$page = (int) $input['p'];
|
||||
if ($page < 0 || $pages == 0) {
|
||||
$page = 0;
|
||||
} elseif ($page >= $pages) {
|
||||
$page = $pages - 1;
|
||||
}
|
||||
|
||||
$data['list'] = array();
|
||||
$this->players = $this->game->getLib('beta5/player');
|
||||
for ($i = 0; $i < ($page + 1) * $perPage && $i < $lines; $i ++) {
|
||||
$r = dbFetchHash($q);
|
||||
if ($i >= $page * $perPage) {
|
||||
if (!is_null($r['owner'])) {
|
||||
$r['oname'] = $this->players->call('getName', $r['owner']);
|
||||
}
|
||||
array_push($data['list'], $r);
|
||||
}
|
||||
}
|
||||
|
||||
$data['mode'] = $mode;
|
||||
$data['pages'] = $pages;
|
||||
$data['page'] = $page;
|
||||
}
|
||||
|
||||
|
||||
function handleKickList(&$input, &$data) {
|
||||
if (is_null($input['i']) || is_null($input['a'])) {
|
||||
$data['lists'] = $this->accounts->call('getKickList');
|
||||
return;
|
||||
}
|
||||
|
||||
$kr = $this->accounts->call('getKickRequest', (int)$input['i']);
|
||||
if (is_null($kr) || ($kr['requested_by'] == $_SESSION['userid'] && $input['a'] == 1) || $kr['status'] != 'P') {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($input['a'] == 1) {
|
||||
$this->accounts->call('terminate', $kr['to_kick'], 'KICKED', $kr['reason']);
|
||||
$this->logAdm("accepted request to kick account #{$kr['to_kick']}");
|
||||
}
|
||||
$this->accounts->call('kickRequestHandled', $kr['id'], $_SESSION['userid'], $input['a'] == 1);
|
||||
|
||||
$data['lists'] = $this->accounts->call('getKickList');
|
||||
}
|
||||
|
||||
|
||||
function linkMainList() {
|
||||
$categories = $this->lib->call('getCategories');
|
||||
for ($i=0;$i<count($categories);$i++) {
|
||||
$categories[$i]['links'] = $this->lib->call('getLinks', $categories[$i]['id']);
|
||||
}
|
||||
|
||||
return array("lklist", $categories);
|
||||
}
|
||||
|
||||
|
||||
function checkCat(&$title, &$desc, $id = null) {
|
||||
$title = preg_replace('/\s+/', ' ', trim($title));
|
||||
$desc = preg_replace('/\s+/', ' ', trim($desc));
|
||||
if (strlen($title) < 5) {
|
||||
return 1;
|
||||
} elseif (strlen($title) > 64) {
|
||||
return 2;
|
||||
} elseif (!$this->lib->call('checkCategoryName', $title, $id)) {
|
||||
return 3;
|
||||
} elseif ($desc != '' && strlen($desc) < 10) {
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function linkMainAddCat(&$input) {
|
||||
if ($input['cancel'] != "") {
|
||||
return $this->linkMainList();
|
||||
}
|
||||
if ($input['r'] != 1) {
|
||||
return array('lkcat', array());
|
||||
}
|
||||
$title = $input['title'];
|
||||
$desc = $input['desc'];
|
||||
$error = $this->checkCat($title, $desc);
|
||||
|
||||
if ($error) {
|
||||
return array('lkcat', array(
|
||||
'title' => $title,
|
||||
'desc' => $desc,
|
||||
'error' => $error,
|
||||
));
|
||||
}
|
||||
$this->lib->call('createCategory', $title, ($desc == "" ? null : $desc));
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
|
||||
function linkMainEditCat(&$input) {
|
||||
if ($input['cancel'] != "") {
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
$id = (int)$input['cid'];
|
||||
$cat = $this->lib->call('getCategory', $id);
|
||||
if (is_null($cat)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($input['r'] != 1) {
|
||||
return array('lkcat', array(
|
||||
'id' => $id,
|
||||
'title' => $cat['title'],
|
||||
'desc' => $cat['description']
|
||||
));
|
||||
}
|
||||
|
||||
$title = $input['title'];
|
||||
$desc = $input['desc'];
|
||||
$error = $this->checkCat($title, $desc, $id);
|
||||
|
||||
if ($error) {
|
||||
return array('lkcat', array(
|
||||
'id' => $id,
|
||||
'title' => $title,
|
||||
'desc' => $desc,
|
||||
'error' => $error,
|
||||
));
|
||||
}
|
||||
$this->lib->call('changeCategory', $id, $title, $desc);
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
|
||||
function linkMainDelCat(&$input) {
|
||||
$id = (int)$input['cid'];
|
||||
$cat = $this->lib->call('getCategory', $id);
|
||||
if (!is_null($cat)) {
|
||||
$this->lib->call('deleteCategory', $id);
|
||||
}
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
|
||||
function linkMainMoveCat($id, $up) {
|
||||
$cat = $this->lib->call('getCategory', $id);
|
||||
if (!is_null($cat)) {
|
||||
$this->lib->call('moveCategory', $id, $up);
|
||||
}
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
|
||||
function checkLink(&$title, &$url, &$desc, $id = null) {
|
||||
$title = preg_replace('/\s+/', ' ', trim($title));
|
||||
$url = preg_replace('/\s+/', ' ', trim($url));
|
||||
$desc = preg_replace('/\s+/', ' ', trim($desc));
|
||||
if (strlen($title) < 5) {
|
||||
return 1;
|
||||
} elseif (strlen($title) > 64) {
|
||||
return 2;
|
||||
} elseif ($desc != '' && strlen($desc) < 10) {
|
||||
return 6;
|
||||
} elseif (!preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?(\/.*)?$/i', $url, $m)) {
|
||||
return 3;
|
||||
} else {
|
||||
list($junk, $proto, $hostname, $port) = $m;
|
||||
if (!preg_match('/^\d+\.\d+\.\d+\.\d+$/', $hostname)) {
|
||||
$ip = gethostbyname($hostname);
|
||||
if ($ip === $hostname) {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
if (!$this->lib->call('checkLink', $url, $id)) {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function linkMainAddLink(&$input) {
|
||||
if ($input['cancel'] != "") {
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
$cid = (int) $input['cid'];
|
||||
$cat = $this->lib->call('getCategory', $cid);
|
||||
if (is_null($cat)) {
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
if ($input['r'] != 1) {
|
||||
return array('lklk', array(
|
||||
'cid' => $cid
|
||||
));
|
||||
}
|
||||
$title = $input['title'];
|
||||
$url = $input['url'];
|
||||
$desc = $input['desc'];
|
||||
$error = $this->checkLink($title, $url, $desc);
|
||||
|
||||
if ($error) {
|
||||
return array('lklk', array(
|
||||
'cid' => $cid,
|
||||
'title' => $title,
|
||||
'url' => $url,
|
||||
'desc' => $desc,
|
||||
'error' => $error,
|
||||
));
|
||||
}
|
||||
$this->lib->call('addLink', $cid, $title, ($desc == "" ? null : $desc), $url);
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
|
||||
function linkMainEditLink(&$input) {
|
||||
if ($input['cancel'] != "") {
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
$lid = (int) $input['lid'];
|
||||
$lnk = $this->lib->call('getLink', $lid);
|
||||
if (is_null($lnk)) {
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
if ($input['r'] != 1) {
|
||||
return array('lklk', array(
|
||||
'id' => $lid,
|
||||
'title' => $lnk['title'],
|
||||
'url' => $lnk['url'],
|
||||
'desc' => $lnk['description']
|
||||
));
|
||||
}
|
||||
|
||||
$title = $input['title'];
|
||||
$url = $input['url'];
|
||||
$desc = $input['desc'];
|
||||
$error = $this->checkLink($title, $url, $desc, $lid);
|
||||
|
||||
if ($error) {
|
||||
return array('lklk', array(
|
||||
'id' => $lid,
|
||||
'title' => $title,
|
||||
'url' => $url,
|
||||
'desc' => $desc,
|
||||
'error' => $error,
|
||||
));
|
||||
}
|
||||
$this->lib->call('changeLink', $lid, $title, $url, ($desc == "" ? null : $desc));
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
|
||||
function linkMainDelLink(&$input) {
|
||||
$id = (int)$input['lid'];
|
||||
$lnk = $this->lib->call('getLink', $id);
|
||||
if (!is_null($lnk)) {
|
||||
$this->lib->call('deleteLink', $id);
|
||||
}
|
||||
return $this->linkMainList();
|
||||
}
|
||||
|
||||
|
||||
function linkMain(&$input) {
|
||||
$this->lib = $this->game->getLib('main/links');
|
||||
switch ($input['ac']) :
|
||||
case '0': return $this->linkMainAddCat($input);
|
||||
case '1': return $this->linkMainAddLink($input);
|
||||
case '2': return $this->linkMainEditCat($input);
|
||||
case '3': return $this->linkMainDelCat($input);
|
||||
case '4': return $this->linkMainMoveCat((int)$input['cid'], true);
|
||||
case '5': return $this->linkMainMoveCat((int)$input['cid'], false);
|
||||
case '10': return $this->linkMainEditLink($input);
|
||||
case '11': return $this->linkMainDelLink($input);
|
||||
default: return $this->linkMainList();
|
||||
endswitch;
|
||||
}
|
||||
|
||||
|
||||
function linkReports(&$input) {
|
||||
$lib = $this->game->getLib('main/links');
|
||||
$acc = $this->game->getLib('main/account');
|
||||
|
||||
if ($input['id'] != '') {
|
||||
$id = (int) $input['id'];
|
||||
$lnk = $lib->call('getLink', $id);
|
||||
if (!is_null($lnk)) {
|
||||
if ($input['dl'] == 1) {
|
||||
$lib->call('deleteLink', $id);
|
||||
} elseif ($input['dr'] == 1) {
|
||||
$lib->call('deleteReports', $id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$links = array();
|
||||
$reports = $lib->call('getBrokenReports');
|
||||
foreach ($reports as $rep) {
|
||||
if (is_null($links[$rep['link']])) {
|
||||
$links[$rep['link']] = $lib->call('getLink', $rep['link']);
|
||||
$links[$rep['link']]['category'] = $lib->call('getCategory', $links[$rep['link']]['category']);
|
||||
$links[$rep['link']]['reporters'] = array();
|
||||
}
|
||||
array_push($links[$rep['link']]['reporters'], utf8entities($acc->call('getUserName', $rep['reported_by'])));
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
|
||||
function linkSubmissions(&$input) {
|
||||
$lib = $this->game->getLib('main/links');
|
||||
$acc = $this->game->getLib('main/account');
|
||||
|
||||
if ($input['su'] != '') {
|
||||
if ($input['sid'] == '') {
|
||||
$lib->call('deleteSubmissions', $input['su']);
|
||||
} elseif ($input['cid'] == '') {
|
||||
$sub = $lib->call('getSubmission', $input['su'], (int)$input['sid']);
|
||||
if (!is_null($sub)) {
|
||||
$cats = $lib->call('getCategories');
|
||||
return array('lksadd', array(
|
||||
"sub" => $sub,
|
||||
"cats" => $cats
|
||||
));
|
||||
}
|
||||
} elseif ($input['cancel'] == '') {
|
||||
$sub = $lib->call('getSubmission', $input['su'], (int)$input['sid']);
|
||||
$cat = $lib->call('getCategory', (int)$input['cid']);
|
||||
if (!(is_null($sub) || is_null($cat))) {
|
||||
$d = $sub['description'];
|
||||
$lib->call('addLink', $cat['id'], $sub['title'], $d == "" ? null : $d, $sub['url']);
|
||||
$lib->call('deleteSubmissions', $sub['url']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$subs = $lib->call('getSubmissions');
|
||||
$urls = array();
|
||||
foreach ($subs as $sub) {
|
||||
if (!is_array($urls[$sub['url']])) {
|
||||
$urls[$sub['url']] = array();
|
||||
}
|
||||
array_push($urls[$sub['url']], array(
|
||||
"sid" => $sub['submitted_by'],
|
||||
"submitter" => utf8entities($acc->call('getUserName', $sub['submitted_by'])),
|
||||
"title" => utf8entities($sub['title']),
|
||||
"description" => utf8entities($sub['description'])
|
||||
));
|
||||
}
|
||||
|
||||
return array('lksub', $urls);
|
||||
}
|
||||
|
||||
|
||||
function manageAccounts(&$input) {
|
||||
$aName = $input['an'];
|
||||
if ($aName == '') {
|
||||
return array("account" => '');
|
||||
}
|
||||
|
||||
// Get account data
|
||||
$account = $this->accounts->call('getUser', $aName);
|
||||
if (is_null($account)) {
|
||||
return array(
|
||||
"account" => $aName,
|
||||
"notfound" => true
|
||||
);
|
||||
}
|
||||
$rv = array(
|
||||
"account" => $account['name'],
|
||||
"status" => $account['status'],
|
||||
"email" => $account['email'],
|
||||
"admin" => $account['admin'] == 't',
|
||||
"conf_code" => $account['conf_code'],
|
||||
"password" => $account['password']
|
||||
);
|
||||
|
||||
if ($input['sa'] || $rv['admin']) {
|
||||
$this->logAdm("is inspecting account {$account['name']}");
|
||||
return $rv;
|
||||
}
|
||||
|
||||
$this->db = $this->game->db;
|
||||
if ($input['mma'] && strcasecmp($input['ma'], $account['email'])) {
|
||||
// Change email address
|
||||
$rv['email'] = $nMail = strtolower($input['ma']);
|
||||
if (!preg_match('/^[A-Za-z0-9_\.\-\+]+@([A-Za-z0-9_\.\-\+]+)+\.[A-Za-z]{2,6}/', $nMail)) {
|
||||
$rv['mailerr'] = 1;
|
||||
return $rv;
|
||||
}
|
||||
|
||||
$q = $this->db->query("SELECT name FROM main.account WHERE LOWER(email)='"
|
||||
. addslashes($nMail) . "'");
|
||||
if ($q && dbCount($q)) {
|
||||
$rv['mailerr'] = 2;
|
||||
list($rv['oacc']) = dbFetchArray($q);
|
||||
return $rv;
|
||||
} elseif (!$q) {
|
||||
$rv['mailerr'] = 3;
|
||||
return $rv;
|
||||
}
|
||||
|
||||
$q = $this->db->query("UPDATE main.account SET email='" . addslashes($nMail)
|
||||
. "' WHERE id={$account['id']}");
|
||||
if (!$q) {
|
||||
$rv['mailerr'] = 3;
|
||||
} else {
|
||||
$this->logAdm("changed email for account {$account['name']}");
|
||||
$rv['mailerr'] = -1;
|
||||
}
|
||||
return $rv;
|
||||
} elseif ($input['mpw'] && strcmp($input['pw'], $account['password'])) {
|
||||
// Change password
|
||||
$rv['password'] = $nPass = strtolower($input['pw']);
|
||||
if (strlen($nPass) < 4) {
|
||||
$rv['passerr'] = 1;
|
||||
return $rv;
|
||||
}
|
||||
|
||||
$q = $this->db->query("UPDATE main.account SET password='" . addslashes($nPass)
|
||||
. "' WHERE id={$account['id']}");
|
||||
if (!$q) {
|
||||
$rv['passerr'] = 2;
|
||||
} else {
|
||||
$this->logAdm("changed password for account {$account['name']}");
|
||||
$rv['passerr'] = -1;
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
|
||||
return $rv;
|
||||
}
|
||||
|
||||
|
||||
private function getSpamFormData($in) {
|
||||
$action = is_null($in['e'])
|
||||
? (is_null($in['p'])
|
||||
? (is_null($in['cc']) ? 'none' : 'cancel')
|
||||
: 'preview')
|
||||
: 'post';
|
||||
$subject = $in['sub'];
|
||||
$txt = $in['txt'];
|
||||
$allGames = ($in['ag'] == '1');
|
||||
return array($action,$subject,$txt,$allGames);
|
||||
}
|
||||
|
||||
private function checkSpamData($s, &$t) {
|
||||
$maxNL = 500; $maxNC = 100;
|
||||
|
||||
if (strlen($s) < 2) {
|
||||
$e = 1;
|
||||
} elseif (strlen($s) > 100) {
|
||||
$e = 2;
|
||||
} elseif (strlen($t) < 3) {
|
||||
$e = 3;
|
||||
} else {
|
||||
$ot = $t; $nt = ""; $nl = 0;
|
||||
while ($ot != '' && $nl < $maxNL) {
|
||||
$p = strpos($ot, '\n');
|
||||
if ($p !== false && $p < $maxNC) {
|
||||
$nt .= substr($ot, 0, $p+1);
|
||||
$ot = substr($ot, $p+1);
|
||||
} else if (strlen($ot) < $maxNC) {
|
||||
$nt .= $ot;
|
||||
$ot = "";
|
||||
} else {
|
||||
$s = substr($ot, 0, $maxNC);
|
||||
$p = strrpos($s, ' ');
|
||||
$ot = substr($ot, $maxNC);
|
||||
$nt .= $s;
|
||||
if ($p === false) {
|
||||
$nt .= "\n";
|
||||
}
|
||||
}
|
||||
$nl ++;
|
||||
}
|
||||
|
||||
if ($nl >= $maxNL) {
|
||||
$e = 4;
|
||||
} else {
|
||||
$t = $nt;
|
||||
$e = 0;
|
||||
}
|
||||
}
|
||||
return $e;
|
||||
}
|
||||
|
||||
|
||||
private function handleSpam($input) {
|
||||
list($action, $subject, $text, $allGames) = $this->getSpamFormData($input);
|
||||
|
||||
if ($action == 'cancel') {
|
||||
return array('main', array());
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'sub' => $subject,
|
||||
'txt' => $text,
|
||||
'prev' => '',
|
||||
'err' => 0,
|
||||
'ag' => $allGames
|
||||
);
|
||||
if ($action == 'none') {
|
||||
return array('spam', $data);
|
||||
}
|
||||
|
||||
$data['err'] = $err = $this->checkSpamData($subject, $text);
|
||||
if ($err) {
|
||||
return array('spam', $data);
|
||||
}
|
||||
|
||||
if ($action == 'preview') {
|
||||
$fLib = $this->game->getLib('main/forums');
|
||||
$data['prev'] = $fLib->call('substitute', $text, 't', 'f');
|
||||
return array('spam', $data);
|
||||
}
|
||||
|
||||
// Send the spam
|
||||
if ($data['ag']) {
|
||||
$this->logAdm("is sending spam '$subject' in all games");
|
||||
foreach (config::getGames() as $game) {
|
||||
if ($game->name == 'main') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$status = $game->status();
|
||||
if ($status == 'FINISHED' || $status == 'PRE') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aLib = $game->getLib('admin/beta5');
|
||||
$aLib->call('sendSpam', $_SESSION['userid'], $subject, $text);
|
||||
}
|
||||
} else {
|
||||
$this->logAdm("is sending spam '$subject' in game {$this->game->text}");
|
||||
$aLib = $this->game->getLib('admin/beta5');
|
||||
$aLib->call('sendSpam', $_SESSION['userid'], $subject, $text);
|
||||
}
|
||||
|
||||
return array('main', array());
|
||||
}
|
||||
|
||||
|
||||
function handle($input) {
|
||||
if (!$this->isAdmin()) {
|
||||
$this->logAdm("is a rat bastard who tried to use the admin page!");
|
||||
$this->output = "rat";
|
||||
return;
|
||||
}
|
||||
|
||||
$this->b5adm = $this->game->getLib("admin/beta5");
|
||||
|
||||
$this->output = "admin";
|
||||
$d = array();
|
||||
switch ($input['c']) :
|
||||
case 'k':
|
||||
if ($this->handleKickReq($input, $d)) {
|
||||
$sp = "main";
|
||||
} else {
|
||||
$sp = "kickreq";
|
||||
}
|
||||
break;
|
||||
case 'kl':
|
||||
$this->handleKickList($input, $d);
|
||||
$sp = "kicklst";
|
||||
break;
|
||||
case 'p':
|
||||
$this->handlePlanetNames($input, $d);
|
||||
$sp = "pnlist";
|
||||
break;
|
||||
case 'lk':
|
||||
list($sp, $d) = $this->linkMain($input);
|
||||
break;
|
||||
case 'lkr':
|
||||
$d = $this->linkReports($input);
|
||||
$sp = "lkrep";
|
||||
break;
|
||||
case 'lks':
|
||||
list($sp, $d) = $this->linkSubmissions($input);
|
||||
break;
|
||||
case 'a':
|
||||
$sp = 'acmgmt';
|
||||
$d = $this->manageAccounts($input);
|
||||
break;
|
||||
case 's':
|
||||
list($sp, $d) = $this->handleSpam($input);
|
||||
break;
|
||||
case 'm':
|
||||
$this->manualUpdate();
|
||||
default:
|
||||
$sp = "main";
|
||||
$d = array();
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
$this->data = array(
|
||||
"subpage" => $sp,
|
||||
"data" => $d
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
1266
scripts/site/beta5/handlers/alliance.inc
Normal file
1266
scripts/site/beta5/handlers/alliance.inc
Normal file
File diff suppressed because it is too large
Load diff
237
scripts/site/beta5/handlers/allies.inc
Normal file
237
scripts/site/beta5/handlers/allies.inc
Normal file
|
@ -0,0 +1,237 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
public $needsAuth = true;
|
||||
public $ajax = array(
|
||||
'init' => "makeAlliesTooltips();\ninitPage();",
|
||||
'func' => array(
|
||||
'getTrusted', 'moveAllies', 'removeAllies', 'addAlly',
|
||||
'removeRAllies', 'removeBanRAllies',
|
||||
'removeBans', 'addBan'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
/********************
|
||||
* GETTING THE LIST *
|
||||
********************/
|
||||
|
||||
/** This method generates the AJAX data for the lists returned
|
||||
* by the getTrustedAllies() action.
|
||||
*/
|
||||
private function formatData($taData) {
|
||||
$result = array();
|
||||
array_push($result, count($taData['allies']) . "#" . count($taData['reverse'])
|
||||
. "#" . count($taData['blacklist']));
|
||||
|
||||
foreach ($taData['allies'] as $data) {
|
||||
array_push($result, "{$data['id']}#" . utf8entities($data['name']));
|
||||
}
|
||||
|
||||
foreach ($taData['reverse'] as $id => $data) {
|
||||
array_push($result, "$id#{$data['level']}#" . utf8entities($data['name']));
|
||||
}
|
||||
|
||||
foreach ($taData['blacklist'] as $id => $name) {
|
||||
array_push($result, "$id#" . utf8entities($name));
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
|
||||
/** AJAX callback that returns the list of trusted allies, the
|
||||
* reverse list as well as the blacklist.
|
||||
*/
|
||||
public function getTrusted() {
|
||||
$taData = $this->game->action('getTrustedAllies', $_SESSION[game::sessName()]['player']);
|
||||
return $this->formatData($taData);
|
||||
}
|
||||
|
||||
|
||||
/*******************
|
||||
* MANAGING ALLIES *
|
||||
*******************/
|
||||
|
||||
/** AJAX callback to add an ally to the player's list.
|
||||
*/
|
||||
public function addAlly($name) {
|
||||
$result = $this->game->action('addTrustedAlly', $_SESSION[game::sessName()]['player'], $name);
|
||||
if (is_array($result)) {
|
||||
return $this->formatData($result);
|
||||
}
|
||||
|
||||
switch ($result) :
|
||||
case beta5_addTrustedAlly::playerNotFound: $error = -1; break;
|
||||
case beta5_addTrustedAlly::playerOnVacation: $error = 200; break;
|
||||
case beta5_addTrustedAlly::noAllyName: $error = 1; break;
|
||||
case beta5_addTrustedAlly::invalidAllyName: $error = 0; break;
|
||||
case beta5_addTrustedAlly::allyNotFound: $error = 2; break;
|
||||
case beta5_addTrustedAlly::allyIsPlayer: $error = 3; break;
|
||||
case beta5_addTrustedAlly::allyIsEnemy: $error = 6; break;
|
||||
case beta5_addTrustedAlly::playerBlacklisted: $error = 9; break;
|
||||
case beta5_addTrustedAlly::allyAlreadyListed: $error = 4; break;
|
||||
case beta5_addTrustedAlly::maxPlayerTrust: $error = 14; break;
|
||||
case beta5_addTrustedAlly::maxAllyTrust: $error = 5; break;
|
||||
endswitch;
|
||||
|
||||
return "ERR#$error";
|
||||
}
|
||||
|
||||
|
||||
/*************************
|
||||
* MANAGING REVERSE LIST *
|
||||
*************************/
|
||||
|
||||
/** AJAX callback to remove a player from his allies' lists.
|
||||
*/
|
||||
public function removeRAllies($list) {
|
||||
$result = $this->game->action('removeTrustingAllies', $_SESSION[game::sessName()]['player'],
|
||||
explode('#', $list));
|
||||
if (is_array($result)) {
|
||||
return $this->formatData($result);
|
||||
}
|
||||
|
||||
switch ($result) :
|
||||
case beta5_removeTrustingAllies::playerNotFound: $error = -1; break;
|
||||
case beta5_removeTrustingAllies::playerOnVacation: $error = 200; break;
|
||||
case beta5_removeTrustingAllies::trustingPlayerNotFound: $error = 7; break;
|
||||
endswitch;
|
||||
return "ERR#$error";
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* MANAGING BLACKLIST *
|
||||
**********************/
|
||||
|
||||
public function addBan($name) {
|
||||
$result = $this->game->action('banTrustingAlly', $_SESSION[game::sessName()]['player'], $name);
|
||||
if (is_array($result)) {
|
||||
return $this->formatData($result);
|
||||
}
|
||||
|
||||
switch ($result) :
|
||||
case beta5_banTrustingAlly::playerNotFound: $error = -1; break;
|
||||
case beta5_banTrustingAlly::playerOnVacation: $error = 200; break;
|
||||
case beta5_banTrustingAlly::emptyName: $error = 11; break;
|
||||
case beta5_banTrustingAlly::invalidName: $error = 15; break;
|
||||
case beta5_banTrustingAlly::targetNotFound: $error = 2; break;
|
||||
case beta5_banTrustingAlly::targetIsPlayer: $error = 13; break;
|
||||
case beta5_banTrustingAlly::alreadyBanned: $error = 12; break;
|
||||
endswitch;
|
||||
return "ERR#$error";
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------- OLD CODE BELOW!!!!
|
||||
|
||||
public function findLevels($list) {
|
||||
$al = explode('#', $list);
|
||||
$l = gameAction('getPlayerAllies', $_SESSION[game::sessName()]['player']);
|
||||
$ll = array();
|
||||
$i = 0;
|
||||
$c = count($l);
|
||||
foreach ($al as $id)
|
||||
{
|
||||
for ($j=0;$j<$c&&$l[$j]['id']!=$id;$j++) ;
|
||||
if ($j<$c)
|
||||
array_push($ll,$j);
|
||||
$i ++;
|
||||
if ($i == 5)
|
||||
break;
|
||||
}
|
||||
return $ll;
|
||||
}
|
||||
|
||||
public function moveAllies($list, $dir) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$levels = $this->findLevels($list);
|
||||
sort($levels);
|
||||
if (!count($levels))
|
||||
return $this->getTrusted();
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
if ($dir == "0")
|
||||
{
|
||||
$l = gameAction('getPlayerAllies', $pid);
|
||||
if ($levels[0] == count($l) - 1)
|
||||
return $this->getTrusted();
|
||||
$levels = array_reverse($levels);
|
||||
}
|
||||
elseif ($levels[0] == 0)
|
||||
return $this->getTrusted();
|
||||
|
||||
$act = 'moveAlly' . (($dir == "0") ? "Down" : "Up");
|
||||
foreach ($levels as $l)
|
||||
gameAction($act, $pid, $l);
|
||||
|
||||
return $this->getTrusted();
|
||||
}
|
||||
|
||||
public function removeAllies($list) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$levels = $this->findLevels($list);
|
||||
if (count($levels)) {
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
foreach ($levels as $l)
|
||||
gameAction('removeAlly', $pid, $l);
|
||||
gameAction('reorderPlayerAllies', $pid);
|
||||
}
|
||||
return $this->getTrusted();
|
||||
}
|
||||
|
||||
public function removeBanRAllies($list) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$tb = gameAction('getPlayerIsAlly', $_SESSION[game::sessName()]['player']);
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$al = explode('#', $list);
|
||||
foreach ($al as $opid) {
|
||||
if (is_null($tb[$opid]))
|
||||
return "ERR#7";
|
||||
elseif (gameAction('checkTAListBan', $pid, $opid))
|
||||
return "ERR#8";
|
||||
}
|
||||
foreach ($al as $opid) {
|
||||
gameAction('removeAlly', $opid, $tb[$opid]['level']);
|
||||
gameAction('reorderPlayerAllies', $opid);
|
||||
gameAction('addTAListBan', $pid, $opid);
|
||||
}
|
||||
return $this->getTrusted();
|
||||
}
|
||||
|
||||
public function removeBans($list) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$tb = gameAction('getTAListBans', $pid);
|
||||
$al = explode('#', $list);
|
||||
foreach ($al as $opid)
|
||||
if (is_null($tb[$opid]))
|
||||
return "ERR#10";
|
||||
foreach ($al as $opid)
|
||||
gameAction('delTAListBan', $pid, $opid);
|
||||
return $this->getTrusted();
|
||||
}
|
||||
|
||||
|
||||
/** Main webpage handler.
|
||||
*/
|
||||
public function handle($input) {
|
||||
$this->data = $this->getTrusted();
|
||||
$this->output = "allies";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
57
scripts/site/beta5/handlers/comms.inc
Normal file
57
scripts/site/beta5/handlers/comms.inc
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
|
||||
public $needsAuth = true;
|
||||
public $ajax = array(
|
||||
'func' => array('getCommsData'),
|
||||
'init' => "makeCommsTooltips();\ninitPage();"
|
||||
);
|
||||
|
||||
public function getCommsData() {
|
||||
// Get the data
|
||||
$data = $this->game->action('getCommsOverview', $_SESSION[game::sessName()]['player']);
|
||||
|
||||
// Issue first line: nCFolders#nGenCats#nAForums
|
||||
$result = array();
|
||||
array_push($result, count($data['folders']['CUS']) . "#" . count($data['forums']['general'])
|
||||
. "#" . count($data['forums']['alliance']));
|
||||
|
||||
// Messages in default folders
|
||||
$dFld = array('IN', 'INT', 'OUT');
|
||||
foreach ($dFld as $f) {
|
||||
array_push($result, join('#', $data['folders'][$f]));
|
||||
}
|
||||
|
||||
// Custom folders
|
||||
foreach ($data['folders']['CUS'] as $id => $folder) {
|
||||
$folder[2] = utf8entities($folder[2]);
|
||||
array_unshift($folder, $id);
|
||||
array_push($result, join('#', $folder));
|
||||
}
|
||||
|
||||
// Forums
|
||||
foreach ($data['forums']['general'] as $cat) {
|
||||
array_push($result, "{$cat['id']}#{$cat['type']}#" . count($cat['forums'])
|
||||
. "#" . utf8entities($cat['title']));
|
||||
|
||||
foreach ($cat['forums'] as $f) {
|
||||
$f[3] = utf8entities($f[3]);
|
||||
array_push($result, join('#', $f));
|
||||
}
|
||||
}
|
||||
foreach ($data['forums']['alliance'] as $f) {
|
||||
$f[3] = utf8entities($f[3]);
|
||||
array_push($result, join('#', $f));
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
public function handle($input) {
|
||||
$this->data = $this->getCommsData();
|
||||
$this->output = "comms";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
115
scripts/site/beta5/handlers/diplomacy.inc
Normal file
115
scripts/site/beta5/handlers/diplomacy.inc
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
'func' => array('getInformation'),
|
||||
'init' => "makeDiplomacyTooltips();\ninitPage();"
|
||||
);
|
||||
|
||||
function getAllianceRanking($tag) {
|
||||
if (! $this->rkLib) {
|
||||
$this->rkLib = input::$game->getLib('main/rankings');
|
||||
}
|
||||
$rt = $this->rkLib->call('getType', "a_general");
|
||||
$r = $this->rkLib->call('get', $rt, $tag);
|
||||
if (!$r) {
|
||||
return array('','');
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function getInformation()
|
||||
{
|
||||
$out = array();
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$pinf = gameAction('getPlayerInfo', $pid);
|
||||
if (!is_null($pinf['arid']))
|
||||
{
|
||||
$ainf = gameAction('getAllianceInfo', $pinf['arid']);
|
||||
$s = "1#" . $ainf['nplanets'] . '#' . $ainf['avgx'] . '#' . $ainf['avgy'];
|
||||
list($points,$ranking) = $this->getAllianceRanking($ainf['tag']);
|
||||
$s .= "#$ranking#$points";
|
||||
array_push($out, $s);
|
||||
array_push($out, utf8entities($pinf['alliance_req']));
|
||||
array_push($out, utf8entities($pinf['aname']));
|
||||
$alinf = gameAction('getPlayerName', $ainf['leader']);
|
||||
array_push($out, utf8entities($alinf));
|
||||
}
|
||||
elseif (!is_null($pinf['aid']))
|
||||
{
|
||||
$ainf = gameAction('getAllianceInfo', $pinf['aid']);
|
||||
$pr = gameAction('getAlliancePrivileges', $pid);
|
||||
|
||||
$s = "2#" . $ainf['nplanets'] . '#' . $ainf['avgx'] . '#' . $ainf['avgy'];
|
||||
list($points,$ranking) = $this->getAllianceRanking($ainf['tag']);
|
||||
$s .= "#$ranking#$points#";
|
||||
$s .= $pr['is_leader'] . "#" . (count($pr['f_read']) + count($pr['f_mod']));
|
||||
array_push($out, $s);
|
||||
array_push($out, utf8entities($pinf['alliance']));
|
||||
array_push($out, utf8entities($pinf['aname']));
|
||||
if (!$pr['is_leader'])
|
||||
{
|
||||
array_push($out, utf8entities(gameAction('getPlayerName', $ainf['leader'])));
|
||||
if (is_null($pinf['a_grade']))
|
||||
array_push($out, "-");
|
||||
else
|
||||
{
|
||||
$rkl = gameAction('getAllianceRanks', $pinf['aid']);
|
||||
array_push($out, $rkl[$pinf['a_grade']]);
|
||||
}
|
||||
}
|
||||
|
||||
$fl = gameAction('getAllianceForumsComplete', $pinf['aid']);
|
||||
foreach ($fl as $fd)
|
||||
{
|
||||
$fid = $fd['id'];
|
||||
if (!(in_array($fid, $pr['f_read']) || in_array($fid, $pr['f_mod'])))
|
||||
continue;
|
||||
$tot = $fd['topics'];
|
||||
$unread = $tot - gameAction('getReadTopics', $fid, $pid);
|
||||
array_push($out, "$fid#$tot#$unread#".utf8entities($fd['title']));
|
||||
}
|
||||
}
|
||||
else
|
||||
array_push($out, "0");
|
||||
|
||||
$pm = gameAction('getAllMessages', $pid, 'IN');
|
||||
$pmn = gameAction('getNewMessages', $pid, 'IN');
|
||||
$it = gameAction('getAllMessages', $pid, 'INT');
|
||||
$itn = gameAction('getNewMessages', $pid, 'INT');
|
||||
|
||||
$rook = !gameAction('isPlayerRestrained', $pid);
|
||||
if ($rook)
|
||||
{
|
||||
$rol = gameAction('getResearchOffers', $pid);
|
||||
$now = time(); $nrec = 0; $sentTo = "";
|
||||
foreach ($rol as $roffer)
|
||||
{
|
||||
if ($now - $roffer['time'] > 86400)
|
||||
break;
|
||||
if ($roffer['type'] == "S")
|
||||
$sentTo = utf8entities($roffer['player']);
|
||||
elseif ($roffer['status'] == "P")
|
||||
$nrec ++;
|
||||
}
|
||||
}
|
||||
else
|
||||
$nrec=$sentTo="";
|
||||
|
||||
array_push($out, join('#', gameAction('getDiploSummary', $pid)));
|
||||
array_push($out, "$pm#$pmn#$it#$itn");
|
||||
array_push($out, ($rook ? 1 : 0) . "#$nrec#$sentTo");
|
||||
|
||||
return join("\n", $out);
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$this->data = $this->getInformation();
|
||||
$this->output = "diplomacy";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
43
scripts/site/beta5/handlers/empire.inc
Normal file
43
scripts/site/beta5/handlers/empire.inc
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
public $needsAuth = true;
|
||||
public $ajax = array(
|
||||
"func" => array("getEmpireData"),
|
||||
"init" => "makeEmpireTooltips();\nempire_write(document.getElementById('init-data').value);"
|
||||
);
|
||||
|
||||
|
||||
public function getEmpireData() {
|
||||
$data = $this->game->action('getEmpireOverview', $_SESSION[game::sessName()]['player']);
|
||||
if (is_null($data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$s = "";
|
||||
foreach ($data['planets'] as $id => $n) {
|
||||
$s .= ($s == "" ? "" : "#") . "$id#$n";
|
||||
}
|
||||
|
||||
$str = join('#', $data['planetStats'])
|
||||
. "\n$s\n{$data['fleetStats']['fleets']}#{$data['fleetStats']['battle']}#"
|
||||
. "{$data['fleetStats']['power']}#{$data['fleetStats']['upkeep']}#"
|
||||
. "{$data['fleetStats']['at_home']}#{$data['fleetStats']['home_battle']}#"
|
||||
. "{$data['fleetStats']['foreign']}#{$data['fleetStats']['foreign_battle']}#"
|
||||
. "{$data['fleetStats']['moving']}#{$data['fleetStats']['waiting']}#"
|
||||
. "{$data['fleetStats']['gaships']}#{$data['fleetStats']['fighters']}#"
|
||||
. "{$data['fleetStats']['cruisers']}#{$data['fleetStats']['bcruisers']}\n"
|
||||
. "{$data['techStats']['points']}#" . join('#', $data['techStats']['budget'])
|
||||
. "#{$data['techStats']['new']}#{$data['techStats']['foreseen']}\n"
|
||||
. "{$data['income']}#{$data['profit']}";
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function handle($input) {
|
||||
$this->data = $this->getEmpireData();
|
||||
$this->output = "empire";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
89
scripts/site/beta5/handlers/enemylist.inc
Normal file
89
scripts/site/beta5/handlers/enemylist.inc
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
'init' => "makeEnemyListTooltips();\ninitList();",
|
||||
'func' => array('getEnemies', 'removeEnemies', 'addEnemy'),
|
||||
);
|
||||
|
||||
function getEnemies()
|
||||
{
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$rs = array();
|
||||
|
||||
$epl = gameAction('getEnemyPlayers', $pid);
|
||||
foreach ($epl as $id => $name)
|
||||
array_push($rs, "0#$id#".utf8entities($name));
|
||||
|
||||
$eal = gameAction('getEnemyAlliances', $pid);
|
||||
foreach ($eal as $id => $name)
|
||||
array_push($rs, "1#$id#".utf8entities($name));
|
||||
|
||||
return join("\n", $rs);
|
||||
}
|
||||
|
||||
function removeEnemies($type, $list) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$l = explode('#', $list);
|
||||
$action = 'removeEnemy' . ($type == "1" ? 'Alliance' : 'Player');
|
||||
foreach ($l as $eid) {
|
||||
gameAction($action, $pid, (int)$eid);
|
||||
}
|
||||
return $this->getEnemies();
|
||||
}
|
||||
|
||||
function addEnemy($type, $name) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
if ($type != "0" && $type != "1") {
|
||||
return "ERR#0";
|
||||
}
|
||||
$name = preg_replace('/\s+/', ' ', trim($name));
|
||||
if ($name == "")
|
||||
return "ERR#1";
|
||||
elseif (($type == 0 && strlen($name) > 15) || ($type == 1 && strlen($name) > 5))
|
||||
return "ERR#0";
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
if ($type == 0 && $this->game->params['victory'] == 0 && strtolower($name) == 'ai>peacekeepers') {
|
||||
return "ERR#9";
|
||||
}
|
||||
$eid = gameAction($type == 0 ? "getPlayer" : "getAlliance", $name);
|
||||
if (is_null($eid))
|
||||
return "ERR#" . ($type == 0 ? 2 : 3);
|
||||
|
||||
$list = array_keys(gameAction('getEnemy'. ($type == 0 ? 'Players' : 'Alliances'), $pid));
|
||||
if (in_array($eid, $list))
|
||||
return "ERR#" . ($type == 0 ? 4 : 5);
|
||||
|
||||
if ($type == 0 && $eid == $pid)
|
||||
return "ERR#6";
|
||||
elseif ($type == 0 && gameAction('isPlayerAlly', $pid, $eid))
|
||||
return "ERR#8";
|
||||
elseif ($type == 1)
|
||||
{
|
||||
$pinf = gameAction('getPlayerInfo', $pid);
|
||||
if (!is_null($pinf['aid']) && $pinf['aid'] == $eid)
|
||||
return "ERR#7";
|
||||
}
|
||||
|
||||
gameAction('addEnemy' . ($type == 0 ? 'Player' : 'Alliance'), $pid, $eid);
|
||||
|
||||
return $this->getEnemies();
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$this->data = $this->getEnemies();
|
||||
$this->output = "enemylist";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
1003
scripts/site/beta5/handlers/fleets.inc
Normal file
1003
scripts/site/beta5/handlers/fleets.inc
Normal file
File diff suppressed because it is too large
Load diff
1072
scripts/site/beta5/handlers/forums.inc
Normal file
1072
scripts/site/beta5/handlers/forums.inc
Normal file
File diff suppressed because it is too large
Load diff
85
scripts/site/beta5/handlers/manual.inc
Normal file
85
scripts/site/beta5/handlers/manual.inc
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
var $needsAuth = true;
|
||||
var $ajax = array();
|
||||
var $lang = null;
|
||||
var $lib = null;
|
||||
var $page = null;
|
||||
var $searchText = "";
|
||||
|
||||
function pageNotFound() {
|
||||
$this->subPage = "notfound";
|
||||
}
|
||||
|
||||
function getFirstPage() {
|
||||
$fPage = $this->lib->call('getFirstPage', $this->lang);
|
||||
if (is_null($fPage)) {
|
||||
$this->pageNotFound();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->page = $this->lib->call('getPage', $fPage);
|
||||
if (is_null($this->page)) {
|
||||
$this->pageNotFound();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->subPage = "page";
|
||||
}
|
||||
|
||||
function getPage($name) {
|
||||
$secId = $this->lib->call('getSectionId', $this->lang, $name);
|
||||
if (is_null($secId)) {
|
||||
$this->pageNotFound();
|
||||
return;
|
||||
}
|
||||
|
||||
$pageId = $this->lib->call('getPageId', $secId);
|
||||
if (is_null($pageId)) {
|
||||
$this->pageNotFound();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->page = $this->lib->call('getPage', $pageId);
|
||||
if (is_null($this->page)) {
|
||||
$this->pageNotFound();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->subPage = "page";
|
||||
}
|
||||
|
||||
function getSearchPage($text) {
|
||||
$this->searchText = $text;
|
||||
|
||||
if (is_array(tracking::$data['man_search']) && tracking::$data['man_search']['text'] != $text) {
|
||||
tracking::$data['man_search'] = null;
|
||||
}
|
||||
if (!is_array(tracking::$data['man_search'])) {
|
||||
tracking::$data['man_search'] = array(
|
||||
"text" => $text,
|
||||
"results" => $this->lib->call('search', $text, $this->lang, $this->version)
|
||||
);
|
||||
}
|
||||
$this->data = tracking::$data['man_search'];
|
||||
$this->subPage = "search";
|
||||
}
|
||||
|
||||
function handle($input) {
|
||||
$this->lang = getLanguage();
|
||||
$this->lib = $this->game->getLib('main/manual');
|
||||
|
||||
if ($input['ss'] != '') {
|
||||
$this->getSearchPage($input['ss']);
|
||||
} elseif ($input['p'] != '') {
|
||||
$p = preg_replace('/[^A-Za-z0-9_\-]/', '', $input['p']);
|
||||
$this->getPage($p);
|
||||
} else {
|
||||
$this->getFirstPage();
|
||||
}
|
||||
$this->output = "manual";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
146
scripts/site/beta5/handlers/map.inc
Normal file
146
scripts/site/beta5/handlers/map.inc
Normal file
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
"func" => array(
|
||||
"getMapParams", "updateData", "findName", "getPlayerPlanets"
|
||||
),
|
||||
"method"=> array(
|
||||
"updateData" => "POST",
|
||||
),
|
||||
"init" => "makeMapTooltips();\nx_getMapParams(mapInit);"
|
||||
);
|
||||
|
||||
function getMapParams()
|
||||
{
|
||||
$s = $_SESSION[game::sessName()]['map'] . "\n" . $this->findName($_SESSION[game::sessName()]['map_ctr']);
|
||||
$s2 = $this->getPlayerPlanets();
|
||||
if ($s2 != "")
|
||||
$s .= "\n$s2";
|
||||
return $s;
|
||||
}
|
||||
|
||||
function getPlayerPlanets()
|
||||
{
|
||||
$as = array();
|
||||
$pl = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
foreach ($pl as $id => $name)
|
||||
array_push($as, "$id#$name");
|
||||
return join("\n", $as);
|
||||
}
|
||||
|
||||
function findName($n)
|
||||
{
|
||||
$n = trim($n);
|
||||
$a = gameAction('getPlanetByName', $n);
|
||||
if (is_null($a))
|
||||
return "ERR";
|
||||
$o = ($a['owner'] == $_SESSION[game::sessName()]['player']) ? 0 : 1;
|
||||
$i = $o ? $a['name'] : $a['id'];
|
||||
return $a['x']."#".$a['y']."#$o#$i";
|
||||
}
|
||||
|
||||
function updateData($rlist)
|
||||
{
|
||||
if ($rlist == "")
|
||||
return "";
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$pinf = gameAction('getPlayerInfo', $pid);
|
||||
$tag = $pinf['aid'] ? $pinf['alliance'] : "";
|
||||
|
||||
$l = explode('#', $rlist);
|
||||
$rs = array();
|
||||
foreach ($l as $rdata)
|
||||
{
|
||||
list($xt,$yt,$md5) = explode(',', $rdata);
|
||||
$x = (int)$xt; $y = (int)$yt;
|
||||
|
||||
$sys = gameAction('getSystemAt', $x, $y);
|
||||
if (is_null($sys)) {
|
||||
if ($md5 != "-") {
|
||||
array_push($rs, "#$x#$y");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($sys['nebula'] > 0) {
|
||||
$mmd5 = md5(serialize($sys));
|
||||
if ($md5 == $mmd5)
|
||||
continue;
|
||||
array_push($rs, "{$sys['id']}#$x#$y#$mmd5#{$sys['nebula']}#0");
|
||||
$zones = gameAction('getSystemPlanets', $sys['id']);
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
array_push($rs, "{$zones[$i]['id']}#" . ($zones[$i]['status'] - 1)
|
||||
. "#{$zones[$i]['name']}");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (input::$game->params['victory']) {
|
||||
case 0:
|
||||
$sys['prot'] = ($sys['prot'] > 0) ? 1 : 0;
|
||||
break;
|
||||
case 1:
|
||||
$sys['prot'] = 0;
|
||||
break;
|
||||
case 2:
|
||||
$sys['prot'] = input::$game->getLib('beta5/ctf')->call('isTarget', $sys['id']) ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
$sys['planets'] = gameAction('getSystemPlanets', $sys['id']);
|
||||
for ($i = 0; $i < 6; $i ++) {
|
||||
if ($sys['planets'][$i]['owner'] == $pid)
|
||||
$r = 2;
|
||||
elseif ($tag != "" && $sys['planets'][$i]['tag'] == $tag)
|
||||
$r = 1;
|
||||
else
|
||||
$r = 0;
|
||||
$sys['planets'][$i]['relation'] = $r;
|
||||
}
|
||||
|
||||
$mmd5 = md5(serialize($sys));
|
||||
if ($md5 == $mmd5) {
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($rs, "{$sys['id']}#$x#$y#$mmd5#{$sys['nebula']}#{$sys['prot']}");
|
||||
for ($i = 0; $i < 6; $i ++) {
|
||||
$p = $sys['planets'][$i];
|
||||
$s = $p['id']."#".$p['status']."#".$p['relation']."#".$p['tag'];
|
||||
array_push($rs, $s);
|
||||
array_push($rs, $p['name']);
|
||||
}
|
||||
}
|
||||
|
||||
return join("\n", $rs);
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$ctrMap = null;
|
||||
switch ($input['menu']):
|
||||
case 'p':
|
||||
$_SESSION[game::sessName()]['map'] = 0;
|
||||
if ($input['ctr'] != '' && !is_null($mc = gameAction('getPlanetById', (int)$input['ctr'])))
|
||||
$ctrMap = $mc['name'];
|
||||
break;
|
||||
case 'a': $_SESSION[game::sessName()]['map'] = 1; break;
|
||||
case 'l': $_SESSION[game::sessName()]['map'] = 2; break;
|
||||
endswitch;
|
||||
if (is_null($_SESSION[game::sessName()]['map']))
|
||||
$_SESSION[game::sessName()]['map'] = 0;
|
||||
|
||||
if (is_null($ctrMap))
|
||||
$_SESSION[game::sessName()]['map_ctr'] = gameAction('getFirstPlanet', $_SESSION[game::sessName()]['player']);
|
||||
else
|
||||
$_SESSION[game::sessName()]['map_ctr'] = $ctrMap;
|
||||
|
||||
$this->output = "map";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
463
scripts/site/beta5/handlers/market.inc
Normal file
463
scripts/site/beta5/handlers/market.inc
Normal file
|
@ -0,0 +1,463 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
'func' => array(
|
||||
'getPublicOffers', 'moveMap', 'cancelSale', 'placeBid',
|
||||
'buyPublic', 'getPrivateOffers', 'buyPrivate', 'declinePrivate',
|
||||
'getSentOffers'
|
||||
),
|
||||
'init' => 'initMarket();'
|
||||
);
|
||||
|
||||
//--------------------
|
||||
// Public offers
|
||||
|
||||
function findName($n)
|
||||
{
|
||||
$n = trim($n);
|
||||
$a = gameAction('getPlanetByName', $n);
|
||||
if (is_null($a))
|
||||
return null;
|
||||
$o = ($a['owner'] == $_SESSION[game::sessName()]['player']) ? 0 : 1;
|
||||
$i = $o ? $a['name'] : $a['id'];
|
||||
return array($o + 1, $i, $a['x'], $a['y']);
|
||||
}
|
||||
|
||||
function getPlayerPlanets()
|
||||
{
|
||||
$pl = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$as = array(count($pl));
|
||||
foreach ($pl as $id => $name)
|
||||
array_push($as, "$id#$name");
|
||||
return $as;
|
||||
}
|
||||
|
||||
function getPublicOffers() {
|
||||
$page = &$this->sessData('page'); $page = 0;
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pinfo = gameAction('getPlayerInfo', $player);
|
||||
$result = array();
|
||||
|
||||
// Get map configuration
|
||||
$map = &$this->sessData('po_map');
|
||||
if (!is_array($map)) {
|
||||
$pname = gameAction('getFirstPlanet', $player);
|
||||
list($type,$param,$x,$y) = $this->findName($pname);
|
||||
$map = array(
|
||||
'type' => $type,
|
||||
'x' => $x,
|
||||
'y' => $y,
|
||||
'param' => $param,
|
||||
'dist' => 1
|
||||
);
|
||||
} elseif ($map['type'] == 1) {
|
||||
$pi = gameAction('getPlanetOwner', $map['param']);
|
||||
if ($pi['owner'] != $player) {
|
||||
$pi['type'] = 2;
|
||||
$pi['param'] = $pi['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// Add map data to the output array
|
||||
array_push($result, $map['type']."#".$map['x']."#".$map['y']."#".$map['dist'].($map['type'] == 0 ? '' : ('#'.utf8entities($map['param']))));
|
||||
$result = array_merge($result, $this->getPlayerPlanets());
|
||||
|
||||
// Get selected system data
|
||||
$sys = gameAction('getSystemAt', $map['x'], $map['y']);
|
||||
if (is_null($sys)) {
|
||||
array_push($result, "-1#0");
|
||||
} else {
|
||||
switch ($this->game->params['victory']) {
|
||||
case 0:
|
||||
$sys['prot'] = ($sys['prot'] > 0) ? 1 : 0;
|
||||
break;
|
||||
case 1:
|
||||
$sys['prot'] = 0;
|
||||
break;
|
||||
case 2:
|
||||
$sys['prot'] = input::$game->getLib('beta5/ctf')->call('isTarget', $sys['id']) ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
$pLev = gameAction('getProtectionLevel', $player);
|
||||
array_push($result, $sys['nebula']."#".$sys['prot']);
|
||||
$plist = gameAction('getSystemPlanets', $sys['id']);
|
||||
foreach ($plist as $pi) {
|
||||
$s = $pi['id']."#".$pi['status']."#".($pi['owner'] == $player ? '1' : '0') . '#';
|
||||
$s .= ($pinfo['aid'] && $pi['owner'] != $player && $pinfo['alliance'] == $pi['tag']) ? '1' : '0';
|
||||
array_push($result, $s . "#" . utf8entities($pi['name']));
|
||||
}
|
||||
}
|
||||
|
||||
// Look for sales
|
||||
$pIds = gameAction('getPlanetsAround', $map['x'], $map['y'], $map['dist']);
|
||||
if (count($pIds))
|
||||
{
|
||||
$sales = gameAction('getSales', $pIds);
|
||||
$pSales = $fSales = array();
|
||||
for ($i=0;$i<count($sales);$i++)
|
||||
if (is_null($sales[$i]['planet']))
|
||||
array_push($fSales, $i);
|
||||
else
|
||||
array_push($pSales, $i);
|
||||
array_push($result, count($pSales)."#".count($fSales));
|
||||
$sellers = array();
|
||||
|
||||
// Planet sales, with or without fleets
|
||||
for ($i=0;$i<count($pSales);$i++)
|
||||
{
|
||||
$o = $sales[$pSales[$i]];
|
||||
$p = $o['planet'];
|
||||
if (!in_array($o['player'],$sellers))
|
||||
array_push($sellers, $o['player']);
|
||||
|
||||
$s = $o['id']."#".$o['expires']."#".$p['id']."#".$o['player']."#".$p['x']."#".$p['y']."#".($p['orbit']+1)."#".$o['price']."#";
|
||||
$s .= ($o['auction']=='t'?1:0)."#".$p['pop']."#".$p['turrets']."#".$p['fact']."#".(is_null($o['fleet'])?0:1)."#".utf8entities($p['name']);
|
||||
array_push($result, $s);
|
||||
if (is_null($o['fleet']))
|
||||
continue;
|
||||
|
||||
$f = $o['fleet'];
|
||||
array_push($result, $f['id']."#".$f['sg']."#".$f['sf']."#".$f['sc']."#".$f['sb']);
|
||||
}
|
||||
|
||||
// Fleet sales
|
||||
for ($i=0;$i<count($fSales);$i++)
|
||||
{
|
||||
$o = $sales[$fSales[$i]];
|
||||
$f = $o['fleet'];
|
||||
if (!in_array($o['player'],$sellers))
|
||||
array_push($sellers, $o['player']);
|
||||
|
||||
$s = $o['id']."#".$o['expires']."#".$f['id']."#".$o['player']."#".$f['x']."#".$f['y']."#".($f['orbit']+1)."#".$f['pid']."#".$o['price']."#";
|
||||
$s .= ($o['auction']=='t'?1:0)."#".$f['sg']."#".$f['sf']."#".$f['sc']."#".$f['sb']."#".utf8entities($f['pname']);
|
||||
array_push($result, $s);
|
||||
}
|
||||
|
||||
// Current owners
|
||||
foreach ($sellers as $sid)
|
||||
{
|
||||
$pinf = gameAction('getPlayerInfo', $sid, true);
|
||||
array_push($result, "$sid#" . ($player==$sid?1:0) . "#" . $pinf['quit'] . "#" . utf8entities($pinf['name']));
|
||||
}
|
||||
}
|
||||
else
|
||||
// No sales
|
||||
array_push($result, "0#0");
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
function moveMap($type,$parm,$dist) {
|
||||
$map = &$this->sessData('po_map');
|
||||
|
||||
$type = (int)$type;
|
||||
if ($type < 0 || $type > 2) {
|
||||
$type = 0;
|
||||
}
|
||||
$dist = (int)$dist;
|
||||
if ($dist < 1 || $dist > 7) {
|
||||
$dist = 1;
|
||||
}
|
||||
$map['dist'] = $dist;
|
||||
|
||||
switch ($type) :
|
||||
case 0:
|
||||
list($x,$y) = split('#',$parm);
|
||||
$map['x'] = (int)$x;
|
||||
$map['y'] = (int)$y;
|
||||
$map['type'] = 0;
|
||||
break;
|
||||
case 1:
|
||||
$a = gameAction('getPlanetById', (int)$parm);
|
||||
if (!is_null($a)) {
|
||||
$map['x'] = $a['x'];
|
||||
$map['y'] = $a['y'];
|
||||
$map['param'] = (int)$parm;
|
||||
$map['type'] = 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$a = $this->findName($parm);
|
||||
if (!is_null($a)) {
|
||||
list($map['type'],$map['param'],$map['x'],$map['y']) = $a;
|
||||
}
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
return $this->getPublicOffers();
|
||||
}
|
||||
|
||||
function cancelSale($id) {
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
|
||||
if ($pLib->call('isOnVacation', $player)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $player)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
gameAction('cancelSale', $_SESSION[game::sessName()]['player'], (int)$id);
|
||||
return $this->getMarketData();
|
||||
}
|
||||
|
||||
function placeBid($id, $bid) {
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
|
||||
if ($pLib->call('isOnVacation', $player)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $player)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
$r = gameAction('placeBid', $_SESSION[game::sessName()]['player'], (int)$id, (int)$bid);
|
||||
if ($r != '')
|
||||
return "ERR#$r";
|
||||
return $this->getPublicOffers();
|
||||
}
|
||||
|
||||
function buyPublic($offer) {
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
|
||||
if ($pLib->call('isOnVacation', $player)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $player)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
$r = gameAction('buy', $_SESSION[game::sessName()]['player'], (int)$offer);
|
||||
if ($r != '')
|
||||
return "ERR#$r";
|
||||
return $this->getPublicOffers();
|
||||
}
|
||||
|
||||
|
||||
//--------------------
|
||||
// Private offers
|
||||
|
||||
function getPrivateOffers() {
|
||||
$page = &$this->sessData('page'); $page = 1;
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pinfo = gameAction('getPlayerInfo', $player);
|
||||
$result = array();
|
||||
|
||||
// Get offers and history
|
||||
$offers = gameAction('getDirectSales', $player);
|
||||
$history = gameAction('getSalesHistoryTo', $player);
|
||||
$sellers = array();
|
||||
array_push($result, count($offers) . "#" . count($history));
|
||||
|
||||
// Generate offers list
|
||||
foreach ($offers as $o)
|
||||
{
|
||||
$f = $o['fleet'];
|
||||
$p = $o['planet'];
|
||||
if (!in_array($o['player'], $sellers))
|
||||
array_push($sellers, $o['player']);
|
||||
|
||||
$cs = is_null($p) ? $f : $p;
|
||||
$rs = array($o['id'], $o['player'], $o['price'], $cs['x'], $cs['y'], $cs['orbit']+1);
|
||||
array_push($rs, is_null($p) ? '' : $p['id']);
|
||||
array_push($rs, is_null($f) ? '' : $f['id']);
|
||||
array_push($rs, $o['started']); array_push($rs, $o['expires']);
|
||||
array_push($rs, utf8entities(is_null($p) ? $f['pname'] : $p['name']));
|
||||
array_push($result, join('#', $rs));
|
||||
|
||||
if (!is_null($f))
|
||||
{
|
||||
$rs = array($f['sg'], $f['sf'], $f['sc'], $f['sb']);
|
||||
array_push($result, join('#', $rs));
|
||||
}
|
||||
|
||||
if (!is_null($p))
|
||||
{
|
||||
$rs = array($p['pop'], $p['turrets'], $p['fact']);
|
||||
array_push($result, join('#', $rs));
|
||||
}
|
||||
}
|
||||
|
||||
// Generate history list
|
||||
foreach ($history as $o)
|
||||
{
|
||||
if (!in_array($o['from_player'], $sellers))
|
||||
array_push($sellers, $o['from_player']);
|
||||
$price = is_null($o['sell_price']) ? $o['price'] : $o['sell_price'];
|
||||
$hf = ($o['is_planet'] == 'f') || ($o['f_gaships'] + $o['f_fighters'] + $o['f_cruisers'] + $o['f_bcruisers'] != 0);
|
||||
$pinf = gameAction('getPlanetById', $o['p_id']);
|
||||
$rs = array(
|
||||
$o['from_player'], $price, $pinf['x'], $pinf['y'], $pinf['orbit']+1,
|
||||
($o['is_planet'] == 't' ? 1 : 0), $hf?1:0,
|
||||
$o['started'], $o['end_mode'], $o['ended'], utf8entities($o['p_name'])
|
||||
);
|
||||
array_push($result, join("#", $rs));
|
||||
|
||||
if ($hf)
|
||||
array_push($result, $o['f_gaships']."#".$o['f_fighters']."#".$o['f_cruisers']."#".$o['f_bcruisers']);
|
||||
if ($o['is_planet'] == 't')
|
||||
array_push($result, $o['p_pop']."#".$o['p_turrets']."#".$o['p_factories']);
|
||||
}
|
||||
|
||||
// Player names and status
|
||||
foreach ($sellers as $sid)
|
||||
{
|
||||
$pinf = gameAction('getPlayerInfo', $sid, true);
|
||||
array_push($result, "$sid#" . $pinf['quit'] . "#" . utf8entities($pinf['name']));
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
function buyPrivate($offer) {
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
|
||||
if ($pLib->call('isOnVacation', $player)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $player)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
$r = gameAction('buy', $_SESSION[game::sessName()]['player'], (int)$offer);
|
||||
if ($r != '')
|
||||
return "ERR#$r";
|
||||
return $this->getPrivateOffers();
|
||||
}
|
||||
|
||||
function declinePrivate($offer) {
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
|
||||
if ($pLib->call('isOnVacation', $player)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $player)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
if (!gameAction('isDirectOffer', $_SESSION[game::sessName()]['player'], (int)$offer)) {
|
||||
return "ERR#0";
|
||||
}
|
||||
gameAction('declinePrivate', (int)$offer);
|
||||
return $this->getPrivateOffers();
|
||||
}
|
||||
|
||||
|
||||
//--------------------
|
||||
// Sent offers
|
||||
|
||||
function getSentOffers() {
|
||||
$page = &$this->sessData('page'); $page = 2;
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pinfo = gameAction('getPlayerInfo', $player);
|
||||
$result = array();
|
||||
|
||||
// Get offers and history
|
||||
$offers = gameAction('getSentOffers', $player);
|
||||
$history = gameAction('getSalesHistoryFrom', $player);
|
||||
$buyers = array();
|
||||
array_push($result, count($offers) . "#" . count($history));
|
||||
|
||||
// Generate offers list
|
||||
foreach ($offers as $o) {
|
||||
$f = $o['fleet'];
|
||||
$p = $o['planet'];
|
||||
if ($o['to_player'] != '' && !in_array($o['to_player'], $buyers))
|
||||
array_push($buyers, $o['to_player']);
|
||||
|
||||
$cs = is_null($p) ? $f : $p;
|
||||
$rs = array($o['id'], $o['mode'], $o['price'], $o['to_player'], $cs['x'], $cs['y'], $cs['orbit'] + 1, is_null($p) ? 0 : 1, is_null($f) ? 0 : 1);
|
||||
array_push($rs, $o['started']); array_push($rs, $o['expires']);
|
||||
array_push($rs, utf8entities(is_null($p) ? $f['pname'] : $p['name']));
|
||||
array_push($result, join('#', $rs));
|
||||
|
||||
if (!is_null($f)) {
|
||||
$rs = array($f['sg'], $f['sf'], $f['sc'], $f['sb']);
|
||||
array_push($result, join('#', $rs));
|
||||
}
|
||||
|
||||
if (!is_null($p)) {
|
||||
$rs = array($p['pop'], $p['turrets'], $p['fact']);
|
||||
array_push($result, join('#', $rs));
|
||||
}
|
||||
}
|
||||
|
||||
// Generate history list
|
||||
foreach ($history as $o) {
|
||||
if ($o['to_player'] != '' && !in_array($o['to_player'], $buyers))
|
||||
array_push($buyers, $o['to_player']);
|
||||
$price = is_null($o['sell_price']) ? $o['price'] : $o['sell_price'];
|
||||
$hf = ($o['is_planet'] == 'f') || ($o['f_gaships'] + $o['f_fighters'] + $o['f_cruisers'] + $o['f_bcruisers'] != 0);
|
||||
$pinf = gameAction('getPlanetById', $o['p_id']);
|
||||
$rs = array(
|
||||
$pinf['x'], $pinf['y'], $pinf['orbit'] + 1, $o['mode'], ($o['is_planet'] == 't' ? 1 : 0),
|
||||
$hf?1:0, $o['to_player'], $price,
|
||||
$o['started'], $o['end_mode'], $o['ended'], utf8entities($o['p_name'])
|
||||
);
|
||||
array_push($result, join("#", $rs));
|
||||
|
||||
if ($hf)
|
||||
array_push($result, $o['f_gaships']."#".$o['f_fighters']."#".$o['f_cruisers']."#".$o['f_bcruisers']);
|
||||
if ($o['is_planet'] == 't')
|
||||
array_push($result, $o['p_pop']."#".$o['p_turrets']."#".$o['p_factories']);
|
||||
}
|
||||
|
||||
// Player names and status
|
||||
foreach ($buyers as $sid) {
|
||||
$pinf = gameAction('getPlayerInfo', $sid, true);
|
||||
array_push($result, "$sid#" . $pinf['quit'] . "#" . utf8entities($pinf['name']));
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
|
||||
//--------------------
|
||||
// Standard output
|
||||
|
||||
function &sessData($name)
|
||||
{
|
||||
if (!is_array($_SESSION[game::sessName()]['market']))
|
||||
$_SESSION[game::sessName()]['market'] = array('page' => 0);
|
||||
if (!isset($_SESSION[game::sessName()]['market'][$name]))
|
||||
$_SESSION[game::sessName()]['market'][$name] = null;
|
||||
return $_SESSION[game::sessName()]['market'][$name];
|
||||
}
|
||||
|
||||
function getMarketData()
|
||||
{
|
||||
switch ($this->sessData('page')) :
|
||||
case 0: $s = $this->getPublicOffers(); break;
|
||||
case 1: $s = $this->getPrivateOffers(); break;
|
||||
case 2: $s = $this->getSentOffers(); break;
|
||||
default: $s = ""; break;
|
||||
endswitch;
|
||||
return $s;
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$page = &$this->sessData('page');
|
||||
switch ($input['p']) :
|
||||
case 'p': $page = 0; break;
|
||||
case 'r': $page = 1; break;
|
||||
case 's': $page = 2; break;
|
||||
endswitch;
|
||||
|
||||
$r = gameAction('isPlayerRestrained', $_SESSION[game::sessName()]['player']);
|
||||
if ($r > 0)
|
||||
$this->data = $r;
|
||||
else
|
||||
$this->data = array(
|
||||
"page" => $page,
|
||||
"pdata" => $this->getMarketData()
|
||||
);
|
||||
$this->output = "market";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
492
scripts/site/beta5/handlers/message.inc
Normal file
492
scripts/site/beta5/handlers/message.inc
Normal file
|
@ -0,0 +1,492 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
var $engines = array('page', 'rpc', 'css', 'js', 'redirect');
|
||||
var $defaultEngine = 'page';
|
||||
|
||||
var $needsAuth = true;
|
||||
var $ajaxPOST = true;
|
||||
var $ajax = array(
|
||||
"func" => array(
|
||||
"sendMessage", "setSortParameters", "setMessagesPerPage",
|
||||
"getFolderSettings", "getMessageList", "getTargetName",
|
||||
"getMessageText", "updateFolders", "deleteMessages",
|
||||
"moveMessages", "renameFolder", "addFolder", "deleteFolders",
|
||||
"flushFolders", "switchThreaded"
|
||||
),
|
||||
"init" => "makeMessagesTooltips();\ninitMessages();"
|
||||
);
|
||||
|
||||
|
||||
function getFolderSettings($n, $cid)
|
||||
{
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
if (!in_array($n, $nok))
|
||||
return "";
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
if ($n=="CUS" && is_null($fl[$cid]))
|
||||
return "";
|
||||
|
||||
$pn = $n;
|
||||
if ($n == "CUS")
|
||||
$pn .= "!$cid";
|
||||
$rs = "";
|
||||
$p = prefs::get("beta5/$pn!nmsg");
|
||||
$rs .= ($p == "" ? 20 : $p) . "#";
|
||||
$p = prefs::get("beta5/$pn!orderby");
|
||||
$rs .= ($p == "" ? "date" : $p) . "#";
|
||||
$p = prefs::get("beta5/$pn!direction");
|
||||
$rs .= ($p == "" ? 0 : $p) . "#";
|
||||
$p = prefs::get("beta5/$pn!threaded");
|
||||
$rs .= ($p == "" ? 1 : $p);
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
function getMessageList($n, $cid, $alst)
|
||||
{
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
if (!in_array($n, $nok))
|
||||
return "";
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
if ($n=="CUS" && is_null($fl[$cid]))
|
||||
return "";
|
||||
|
||||
$list = gameAction('getMessageHeaders', $pid, $n, $cid);
|
||||
$s = "";
|
||||
|
||||
$al = array();
|
||||
if (trim($alst) != "")
|
||||
{
|
||||
$alc = explode('#', $alst);
|
||||
$cmid = array_keys($list);
|
||||
foreach ($alc as $mid)
|
||||
{
|
||||
if ($mid == "" || (int)$mid != $mid)
|
||||
continue;
|
||||
array_push($al, $mid);
|
||||
if (in_array($mid, $cmid))
|
||||
continue;
|
||||
if ($s != "")
|
||||
$s .= "\n";
|
||||
$s .= "-#$mid";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($list as $id => $hdr)
|
||||
{
|
||||
if (in_array($id, $al))
|
||||
continue;
|
||||
if ($s != "")
|
||||
$s .= "\n";
|
||||
$s .= "+#$id#".$hdr['received']."#".$hdr['status']."#";
|
||||
$s .= $hdr['slink']."#".$hdr['rlink'].'#'.$hdr['replink'];
|
||||
$s .= "#" . $hdr['replyTo'] . "\n";
|
||||
$s .= $hdr['from'] . "\n";
|
||||
$s .= $hdr['to'] . "\n";
|
||||
$s .= $hdr['subject'];
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
function sendMessage($t, $rec, $sub, $msg, $replyId)
|
||||
{
|
||||
$e = false;
|
||||
$errs = array(0,0,0);
|
||||
$rec = trim($rec);
|
||||
$sub = trim($sub);
|
||||
$msg = trim($msg);
|
||||
|
||||
if ($rec == "")
|
||||
{
|
||||
$errs['rec'] = 1;
|
||||
$e = true;
|
||||
}
|
||||
elseif ($t == 0)
|
||||
{
|
||||
$rid = gameAction('getPlayer', $rec);
|
||||
if (is_null($rid))
|
||||
{
|
||||
$errs[0] = 2;
|
||||
$e = true;
|
||||
}
|
||||
else
|
||||
$sendAction = 'Player';
|
||||
}
|
||||
elseif ($t == 1)
|
||||
{
|
||||
$pinf = gameAction('getPlanetByName', $rec);
|
||||
if (is_null($pinf))
|
||||
{
|
||||
$errs[0] = 2;
|
||||
$e = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$rid = $pinf['id'];
|
||||
$sendAction = 'Planet';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$rid = gameAction('getAlliance', $rec);
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
if (is_null($rid))
|
||||
{
|
||||
$errs[0] = 2;
|
||||
$e = true;
|
||||
}
|
||||
elseif ($rid == $pinf['aid'])
|
||||
$sendAction = 'Alliance';
|
||||
else
|
||||
$sendAction = 'Diplomacy';
|
||||
}
|
||||
|
||||
if ($sub == "")
|
||||
{
|
||||
$errs[1] = 1;
|
||||
$e = true;
|
||||
}
|
||||
elseif (strlen($sub) > 64)
|
||||
{
|
||||
$errs[1] = 2;
|
||||
$e = true;
|
||||
}
|
||||
|
||||
if ($msg == "")
|
||||
{
|
||||
$errs[2] = 1;
|
||||
$e = true;
|
||||
}
|
||||
|
||||
if ($replyId == -1)
|
||||
$replyId = null;
|
||||
|
||||
if (!$e)
|
||||
gameAction("sendMessage$sendAction", $_SESSION[game::sessName()]['player'], $rid, $sub, $msg, $replyId);
|
||||
|
||||
return $e ? join('#', $errs) : "OK";
|
||||
}
|
||||
|
||||
function getFolderParms($i)
|
||||
{
|
||||
$cf = -1;
|
||||
$ftype = null;
|
||||
switch ($i['f'])
|
||||
{
|
||||
case 'I':
|
||||
$ftype = 'IN';
|
||||
break;
|
||||
case 'O':
|
||||
$ftype = 'OUT';
|
||||
break;
|
||||
case 'T':
|
||||
$ftype = 'INT';
|
||||
break;
|
||||
case 'C':
|
||||
if (is_null($this->cFolders[$i['cf']]))
|
||||
$ftype = null;
|
||||
else
|
||||
{
|
||||
$ftype = 'CUS';
|
||||
$cf = $i['cf'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_null($ftype))
|
||||
return "#-1";
|
||||
|
||||
return "#$ftype#$cf";
|
||||
}
|
||||
|
||||
function setSortParameters($n, $cid, $se, $so)
|
||||
{
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
if (!in_array($n, $nok))
|
||||
return;
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
if ($n=="CUS" && is_null($fl[$cid]))
|
||||
return;
|
||||
|
||||
$seOk = array('st', 'sub', 'date', 'from', 'to');
|
||||
if (!in_array($se, $seOk))
|
||||
return;
|
||||
|
||||
$pn = $n;
|
||||
if ($n == "CUS")
|
||||
$pn .= "!$cid";
|
||||
prefs::set("beta5/$pn!orderby", $se);
|
||||
prefs::set("beta5/$pn!direction", ($so=="1")?"1":"0");
|
||||
}
|
||||
|
||||
function setMessagesPerPage($n, $cid, $mpp)
|
||||
{
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
if (!in_array($n, $nok))
|
||||
return;
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
if ($n=="CUS" && is_null($fl[$cid]))
|
||||
return;
|
||||
|
||||
if ($mpp == "" || (int)$mpp != $mpp || $mpp<1 || $mpp>5)
|
||||
return;
|
||||
|
||||
$pn = $n;
|
||||
if ($n == "CUS")
|
||||
$pn .= "!$cid";
|
||||
prefs::set("beta5/$pn!nmsg", $mpp * 10);
|
||||
}
|
||||
|
||||
function switchThreaded($n, $cid)
|
||||
{
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
if (!in_array($n, $nok))
|
||||
return;
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
if ($n=="CUS" && is_null($fl[$cid]))
|
||||
return;
|
||||
|
||||
$pn = $n;
|
||||
if ($n == "CUS")
|
||||
$pn .= "!$cid";
|
||||
$p = prefs::get("beta5/$pn!threaded");
|
||||
prefs::set("beta5/$pn!threaded", ($p == "1") ? "0" : "1");
|
||||
}
|
||||
|
||||
function getTargetName($type, $id)
|
||||
{
|
||||
$type = (int)$type;
|
||||
$id = (int)$id;
|
||||
$rv = "";
|
||||
switch ($type) :
|
||||
case 0:
|
||||
$rv = gameAction('getPlayerName', $id);
|
||||
break;
|
||||
case 1:
|
||||
$pinf = gameAction('getPlanetById', $id);
|
||||
if (!is_null($pinf))
|
||||
$rv = $pinf['name'];
|
||||
break;
|
||||
case 2:
|
||||
$pinf = gameAction('getAllianceInfo', $id);
|
||||
if (!is_null($pinf))
|
||||
$rv = $pinf['tag'];
|
||||
break;
|
||||
endswitch;
|
||||
return $rv;
|
||||
}
|
||||
|
||||
function getMessageText($mId)
|
||||
{
|
||||
$mId = (int)$mId;
|
||||
$pl = $_SESSION[game::sessName()]['player'];
|
||||
$msg = gameAction('getCompleteMessage', $mId, $pl);
|
||||
if (is_null($mId) || $msg['player'] != $pl)
|
||||
return "";
|
||||
$s = $msg['ftype'] . '#' . (is_null($msg['cfid']) ? 0 : $msg['cfid']) . '#' . $msg['id'];
|
||||
$s .= "\n" . $msg['subject'];
|
||||
if ($msg['text'])
|
||||
{
|
||||
$s .= "\n" . $msg['text'];
|
||||
gameAction('setMessageRead', $mId);
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
function updateFolders()
|
||||
{
|
||||
$pl = $_SESSION[game::sessName()]['player'];
|
||||
$flist = "IN##" . gameAction('getNewMessages', $pl, 'IN');
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'IN') . "\n\n";
|
||||
$flist .= "INT##" . gameAction('getNewMessages', $pl, 'INT');
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'INT') . "\n\n";
|
||||
$flist .= "OUT##" . gameAction('getNewMessages', $pl, 'OUT');
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'OUT') . "\n";
|
||||
$fl = gameAction('getCustomFolders', $pl);
|
||||
foreach ($fl as $id => $name)
|
||||
{
|
||||
$flist .= "\nCUS#$id#" . gameAction('getNewMessages', $pl, 'CUS', $id);
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'CUS', $id);
|
||||
$flist .= "\n".utf8entities($name);
|
||||
}
|
||||
|
||||
return $flist;
|
||||
}
|
||||
|
||||
function deleteMessages($n, $cid, $dList, $aList)
|
||||
{
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
if (!in_array($n, $nok))
|
||||
return;
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
if ($n=="CUS" && is_null($fl[$cid]))
|
||||
return;
|
||||
|
||||
$dl = explode("#", $dList);
|
||||
foreach ($dl as $mid)
|
||||
{
|
||||
if ($mid == "" || (int)$mid != $mid)
|
||||
continue;
|
||||
gameAction('deleteMessage', $mid, $pid);
|
||||
}
|
||||
return $this->getMessageList($n, $cid, $aList);
|
||||
}
|
||||
|
||||
function moveMessages($n, $cid, $tn, $tcid, $mList, $aList)
|
||||
{
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
if (!in_array($n, $nok))
|
||||
return;
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
if ($n=="CUS" && is_null($fl[$cid]))
|
||||
return;
|
||||
|
||||
if ( !in_array($tn, $nok)
|
||||
|| ($tn=="CUS" && is_null($fl[$tcid]))
|
||||
)
|
||||
return $this->getMessageList($n, $cid, $aList);
|
||||
|
||||
$dl = explode("#", $mList);
|
||||
foreach ($dl as $mid)
|
||||
{
|
||||
if ($mid == "" || (int)$mid != $mid)
|
||||
continue;
|
||||
gameAction('moveMessage', $mid, $pid, $tn, $tcid);
|
||||
}
|
||||
return $this->getMessageList($n, $cid, $aList);
|
||||
}
|
||||
|
||||
function renameFolder($fid, $name)
|
||||
{
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
$name = trim($name);
|
||||
if (is_null($fl[$fid]) || $name == "" || strlen($name) > 32)
|
||||
return $this->updateFolders();
|
||||
gameAction('renameCustomFolder', $fid, $name);
|
||||
return $this->updateFolders();
|
||||
}
|
||||
|
||||
function addFolder($name)
|
||||
{
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
$name = trim($name);
|
||||
if ($name == "" || strlen($name) > 32 || count($fl) >= 15 || in_array($name, array_values($fl)))
|
||||
return $this->updateFolders();
|
||||
gameAction('createCustomFolder', $pid, $name);
|
||||
return $this->updateFolders();
|
||||
}
|
||||
|
||||
function deleteFolders($lst)
|
||||
{
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
$dl = explode('#', $lst);
|
||||
foreach ($dl as $id)
|
||||
{
|
||||
if (is_null($fl[$id]))
|
||||
continue;
|
||||
gameAction('deleteCustomFolder', $pid, $id);
|
||||
}
|
||||
return $this->updateFolders();
|
||||
}
|
||||
|
||||
function flushFolders($lst)
|
||||
{
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$fl = gameAction('getCustomFolders', $pid);
|
||||
$dl = explode('#', $lst);
|
||||
$nok = array('IN','OUT','INT','CUS');
|
||||
foreach ($dl as $idc)
|
||||
{
|
||||
list($n, $id) = explode('!', $idc);
|
||||
if (!in_array($n, $nok) || ($n == "CUS" && is_null($fl[$id])))
|
||||
continue;
|
||||
gameAction('flushFolder', $pid, $n, $id);
|
||||
}
|
||||
return $this->updateFolders();
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$pl = $_SESSION[game::sessName()]['player'];
|
||||
$this->cFolders = gameAction('getCustomFolders', $pl);
|
||||
|
||||
// Generate complete folder list
|
||||
$flist = "IN##" . gameAction('getNewMessages', $pl, 'IN');
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'IN') . "\n\n";
|
||||
$flist .= "INT##" . gameAction('getNewMessages', $pl, 'INT');
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'INT') . "\n\n";
|
||||
$flist .= "OUT##" . gameAction('getNewMessages', $pl, 'OUT');
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'OUT') . "\n";
|
||||
foreach ($this->cFolders as $id => $name)
|
||||
{
|
||||
$flist .= "\nCUS#$id#" . gameAction('getNewMessages', $pl, 'CUS', $id);
|
||||
$flist .= "#" . gameAction('getAllMessages', $pl, 'CUS', $id);
|
||||
$flist .= "\n".utf8entities($name);
|
||||
}
|
||||
|
||||
switch ($input['a']) :
|
||||
case 'c':
|
||||
$dInit = "Compose";
|
||||
$type = $input['ct'];
|
||||
$id = $input['id'];
|
||||
if ($type != '' && $id != '')
|
||||
$dInit .= "#$type#$id#";
|
||||
break;
|
||||
case 'f':
|
||||
$dInit = "Browse";
|
||||
$dInit .= $this->getFolderParms($input);
|
||||
break;
|
||||
case 'mf':
|
||||
$dInit = "Folders";
|
||||
break;
|
||||
default:
|
||||
$dInit = "Compose";
|
||||
break;
|
||||
endswitch;
|
||||
$this->data = array(
|
||||
"dinit" => $dInit,
|
||||
"flist" => $flist
|
||||
);
|
||||
$this->output = "message";
|
||||
}
|
||||
|
||||
function redirect($input) {
|
||||
if (is_null($_SESSION['userid'])) {
|
||||
return "message";
|
||||
}
|
||||
|
||||
$this->msgs = $this->game->getLib('beta5/msg');
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
if ($this->msgs->call('getNew', $player, 'IN')) {
|
||||
return "message?a=f&f=I";
|
||||
} elseif ($this->msgs->call('getNew', $player, 'INT')) {
|
||||
return "message?a=f&f=T";
|
||||
}
|
||||
l::FIXME("check messages in other folders");
|
||||
return "message";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
131
scripts/site/beta5/handlers/money.inc
Normal file
131
scripts/site/beta5/handlers/money.inc
Normal file
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
"func" => array(
|
||||
"getCash", "getCashDetails", "transferFunds"
|
||||
),
|
||||
"init" => "makeMoneyTooltips();\nx_getCash(displayCash); x_getCashDetails(displayPage);"
|
||||
);
|
||||
|
||||
function getCash() {
|
||||
$pi = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
return $pi['cash'];
|
||||
}
|
||||
|
||||
function getCashDetails() {
|
||||
$pr = gameAction('isPlayerRestrained', $_SESSION[game::sessName()]['player']);
|
||||
$str = "$pr";
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
$str .= "#" . (gameAction('isOnVacation', $_SESSION[game::sessName()]['player']) ? 1 : 0);
|
||||
$income = $upkeep = 0;
|
||||
|
||||
$ppl = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$str .= "#" . count($ppl);
|
||||
$strp = "";
|
||||
foreach ($ppl as $id => $name)
|
||||
{
|
||||
$info = gameAction('getPlanetById', $id);
|
||||
if ($strp != "")
|
||||
$strp .= "\n";
|
||||
$strp .= "$name\n$id#";
|
||||
$m = gameAction('getPlanetIncome', $info['owner'], $info['pop'], $info['happiness'], $info['ifact'], $info['mfact'], $info['turrets'], $info['corruption']);
|
||||
$income += $m[0];
|
||||
$strp .= join('#', $m);
|
||||
$strp .= '#' . $info['ifact'];
|
||||
}
|
||||
|
||||
$pfl = gameAction('getPlayerFleets', $_SESSION[game::sessName()]['player']);
|
||||
$str .= "#" . count($pfl);
|
||||
$strf = "";
|
||||
foreach ($pfl as $id => $name)
|
||||
{
|
||||
$info = gameAction('getFleet', $id);
|
||||
if ($strf != "")
|
||||
$strf .= "\n";
|
||||
$strf .= "$name\n";
|
||||
if (is_null($info['move']) && is_null($info['wait']))
|
||||
{
|
||||
$pinf = gameAction('getPlanetById', $info['location']);
|
||||
$strf .= $pinf['name'] . "\n$id#0#0";
|
||||
}
|
||||
elseif (is_null($info['move']))
|
||||
{
|
||||
$pinf = gameAction('getPlanetById', $info['wait']['drop_point']);
|
||||
$strf .= $pinf['name'] . "\n$id#0#" . $info['wait']['time_left'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pinf = gameAction('getPlanetById', $info['move']['m_to']);
|
||||
$strf .= $pinf['name'] . "\n$id#" . $info['move']['time_to_arrival'] . "#";
|
||||
$strf .= (is_null($info['wait']) ? 0 : $info['wait']['time_left']);
|
||||
}
|
||||
$u = gameAction('getFleetUpkeep', $_SESSION[game::sessName()]['player'],
|
||||
$info['gaships'], $info['fighters'], $info['cruisers'], $info['bcruisers']);
|
||||
$upkeep += $u;
|
||||
$strf .= "#$u";
|
||||
}
|
||||
|
||||
$profit = $income - $upkeep;
|
||||
$str .= "#$income#$upkeep#$profit\n$strp\n$strf";
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function transferFunds($target, $amount) {
|
||||
if ((int)$amount != $amount || $amount <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($target == "") {
|
||||
return 2;
|
||||
}
|
||||
|
||||
$sid = $_SESSION[game::sessName()]['player'];
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
$tid = $pLib->call('getPlayerId', $target);
|
||||
if (is_null($tid)) {
|
||||
return 3;
|
||||
}
|
||||
if ($sid == $tid) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
if ($pLib->call('isRestrained', $tid)) {
|
||||
return 5;
|
||||
}
|
||||
if ($pLib->call('isRestrained', $sid)) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
$sourcePLevel = $pLib->call('getProtectionLevel', $sid);
|
||||
if ($sourcePLevel) {
|
||||
return 7;
|
||||
}
|
||||
$targetPLevel = $pLib->call('getProtectionLevel', $tid);
|
||||
if ($targetPLevel) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
$p = gameAction('getPlayerInfo', $sid);
|
||||
if ($p['cash'] < $amount) {
|
||||
return 9;
|
||||
}
|
||||
|
||||
$vac = $this->game->getLib('beta5/player');
|
||||
if ($vac->call('isOnVacation', $sid) || $vac->call('isOnVacation', $tid)) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
gameAction('transferFunds', $sid, $tid, $amount);
|
||||
return 0;
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$this->output = "money";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
13
scripts/site/beta5/handlers/norealloc.inc
Normal file
13
scripts/site/beta5/handlers/norealloc.inc
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array();
|
||||
|
||||
function handle($input) {
|
||||
$this->output = "norealloc";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
59
scripts/site/beta5/handlers/nplanet.inc
Normal file
59
scripts/site/beta5/handlers/nplanet.inc
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
|
||||
function checkName($n)
|
||||
{
|
||||
if (strlen($n) > 15)
|
||||
return 1;
|
||||
if (preg_match('/[^A-Za-z0-9_\.\-\+@\/'."'".' ]/', $n))
|
||||
return 2;
|
||||
if ( preg_match('/^\s/', $n)
|
||||
|| preg_match('/\s$/', $n)
|
||||
)
|
||||
return 3;
|
||||
if (preg_match('/\s\s+/', $n))
|
||||
return 4;
|
||||
if (strlen($n) < 2)
|
||||
return 5;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function handle($input) {
|
||||
if ($this->game->params['norealloc'] == 1) {
|
||||
$this->output = 'norealloc';
|
||||
return;
|
||||
}
|
||||
|
||||
$this->output = 'nplanet';
|
||||
$pl = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
if (count($pl))
|
||||
{
|
||||
$this->data = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($input['name'] == '')
|
||||
{
|
||||
$this->data = array('ok' => false, 'err' => 0, 'name' => '');
|
||||
return;
|
||||
}
|
||||
$pErr = $this->checkName($input['name']);
|
||||
if (!$pErr)
|
||||
{
|
||||
$p = gameAction('getPlanetByName', $input['name']);
|
||||
if (!is_null($p))
|
||||
$pErr = 6;
|
||||
}
|
||||
if ($pErr)
|
||||
{
|
||||
$this->data = array('ok' => false, 'err' => $pErr, 'name' => $input['name']);
|
||||
return;
|
||||
}
|
||||
|
||||
$nplanet = gameAction('reassignPlanet', $_SESSION[game::sessName()]['player'], $input['name']);
|
||||
$this->data = array('ok' => true, 'name' => $input['name'], 'id' => $nplanet);
|
||||
}
|
||||
}
|
87
scripts/site/beta5/handlers/overview.inc
Normal file
87
scripts/site/beta5/handlers/overview.inc
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
public $needsAuth = true;
|
||||
public $ajax = array(
|
||||
'func' => array('getOverview', 'switchOvMode', 'breakProtection'),
|
||||
'init' => "makeOverviewTooltips();\ninitPage();"
|
||||
);
|
||||
|
||||
public function getOverview() {
|
||||
$overview = $this->game->action('getOverview', $_SESSION[game::sessName()]['player'],
|
||||
getLanguage());
|
||||
$result = array($_SESSION[game::sessName()]['ov_complete'] ? "1" : "0");
|
||||
|
||||
// Protection level
|
||||
array_push($result, $overview['protection']);
|
||||
|
||||
// Communications overview
|
||||
$data = $overview['comms'];
|
||||
array_push($result, count($data['folders']['CUS']) . "#" . count($data['forums']['general'])
|
||||
. "#" . count($data['forums']['alliance']) . "#" . $data['forums']['allianceID']);
|
||||
|
||||
// Messages in default folders
|
||||
$dFld = array('IN', 'INT', 'OUT');
|
||||
foreach ($dFld as $f) {
|
||||
array_push($result, join('#', $data['folders'][$f]));
|
||||
}
|
||||
|
||||
// Custom folders
|
||||
foreach ($data['folders']['CUS'] as $id => $folder) {
|
||||
$folder[2] = utf8entities($folder[2]);
|
||||
array_unshift($folder, $id);
|
||||
array_push($result, join('#', $folder));
|
||||
}
|
||||
|
||||
// Forums
|
||||
foreach ($data['forums']['general'] as $cat) {
|
||||
array_push($result, "{$cat['id']}#{$cat['type']}#" . count($cat['forums'])
|
||||
. "#" . utf8entities($cat['title']));
|
||||
|
||||
foreach ($cat['forums'] as $f) {
|
||||
$f[3] = utf8entities($f[3]);
|
||||
array_push($result, join('#', $f));
|
||||
}
|
||||
}
|
||||
foreach ($data['forums']['alliance'] as $f) {
|
||||
$f[3] = utf8entities($f[3]);
|
||||
array_push($result, join('#', $f));
|
||||
}
|
||||
|
||||
// Empire overview
|
||||
$data = $overview['empire'];
|
||||
array_push($result, join('#', $data['planetStats']));
|
||||
array_push($result, "{$data['fleetStats']['power']}#{$data['fleetStats']['fleets']}"
|
||||
. "#{$data['fleetStats']['battle']}");
|
||||
array_push($result, "{$data['income']}#{$data['fleetStats']['upkeep']}");
|
||||
array_push($result, $data['techStats']['new']);
|
||||
|
||||
// Universe overview
|
||||
$data = $overview['universe'];
|
||||
array_push($result, $data['summary'][0] . "#" . $data['summary'][2] . "#" . $data['summary'][0]);
|
||||
array_push($result, join("#", $data['rankings']));
|
||||
array_push($result, time());
|
||||
foreach ($data['ticks'] as $tick) {
|
||||
array_push($result, join('#', $tick));
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
public function breakProtection() {
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
$pLib->call('breakProtection', $_SESSION[game::sessName()]['player'], 'BRK');
|
||||
return $this->getOverview();
|
||||
}
|
||||
|
||||
public function switchOvMode() {
|
||||
$_SESSION[game::sessName()]['ov_complete'] = ! $_SESSION[game::sessName()]['ov_complete'];
|
||||
}
|
||||
|
||||
public function handle($input) {
|
||||
$this->data = $this->getOverview();;
|
||||
$this->output = "overview";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
670
scripts/site/beta5/handlers/planet.inc
Normal file
670
scripts/site/beta5/handlers/planet.inc
Normal file
|
@ -0,0 +1,670 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
"func" => array(
|
||||
"getPlanetList", "getPlanetData", "addToQueue",
|
||||
"factoryAction", "replaceItems", "flushQueue",
|
||||
"moveItems", "deleteItems", "rename",
|
||||
"planetSale", "cancelSale", "abandon",
|
||||
"cancelAbandon", "blowItUp", "cancelDestruction",
|
||||
"getSellableFleets", "destroyTurrets"
|
||||
),
|
||||
"init" => "initPlanetPage();"
|
||||
);
|
||||
|
||||
function getPlanetList() {
|
||||
$l = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$str = count($l);
|
||||
foreach ($l as $id => $name)
|
||||
$str .= "\n$id#$name";
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getPlanetData($id) {
|
||||
// Get planet data
|
||||
$id = (int)$id;
|
||||
$info = gameAction('getPlanetById', $id);
|
||||
if (is_null($info)) {
|
||||
return "";
|
||||
}
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
// Build result array
|
||||
$result = array(
|
||||
"{$info['status']}#$id#{$info['x']}#{$info['y']}#" . ($info['orbit']+1)
|
||||
. "#" . utf8entities($info['name'])
|
||||
);
|
||||
|
||||
// Get probe report
|
||||
$probeData = null; // FIXME
|
||||
|
||||
// Build fleets summary
|
||||
$ownFleets = array_keys(gameAction('getFleetsAt', $id, $pid));
|
||||
$allFleets = array_keys(gameAction('getFleetsAt', $id));
|
||||
$ownSum = 0;
|
||||
if (count($ownFleets) || $info['owner'] == $pid)
|
||||
{
|
||||
$attSum = 0;
|
||||
$defSum = 0;
|
||||
$ownMode = ($info['owner'] == $pid ? 1 : null);
|
||||
foreach ($allFleets as $fid)
|
||||
{
|
||||
$finf = gameAction('getFleet', $fid);
|
||||
if ($finf['owner'] == $pid)
|
||||
{
|
||||
if (is_null($ownMode))
|
||||
$ownMode = ($finf['attacking'] == 't') ? 2 : 1;
|
||||
$ownSum += gameAction('getFleetPower', $finf['owner'], 0, $finf['gaships'], $finf['fighters'], $finf['cruisers'], $finf['bcruisers']);
|
||||
}
|
||||
elseif ($finf['attacking'] == 't')
|
||||
$attSum += gameAction('getFleetPower', $finf['owner'], 0, $finf['gaships'], $finf['fighters'], $finf['cruisers'], $finf['bcruisers']);
|
||||
else
|
||||
$defSum += gameAction('getFleetPower', $finf['owner'], 0, $finf['gaships'], $finf['fighters'], $finf['cruisers'], $finf['bcruisers']);
|
||||
}
|
||||
if (is_null($ownMode))
|
||||
$ownMode = 0;
|
||||
array_push($result, "$ownMode#$ownSum#$attSum#$defSum");
|
||||
}
|
||||
elseif (!is_null($probeData))
|
||||
{
|
||||
// FIXME: get fleets data from probe report
|
||||
}
|
||||
else
|
||||
array_push($result, "0###");
|
||||
|
||||
// If the planet has been destroyed or is a nebula, we're done
|
||||
if ($info['status'] != 0)
|
||||
return join("\n", $result);
|
||||
|
||||
// Get owner and player data
|
||||
$isOwn = ($info['owner'] == $pid);
|
||||
$owner = is_null($info['owner']) ? null : gameAction('getPlayerInfo', $info['owner']);
|
||||
$player = $isOwn ? $owner : gameAction('getPlayerInfo', $pid);
|
||||
$protected = is_null($owner) ? false : (
|
||||
$this->game->getLib('beta5/player')->call('getProtectionLevel', $info['owner']) > 0
|
||||
);
|
||||
$plPriv = gameAction('getAlliancePrivileges', $pid);
|
||||
$vacation = ($isOwn && $info['vacation'] != 'NO ')
|
||||
|| (!$isOwn && $info['vacation'] == 'YES ');
|
||||
|
||||
// Build planet summary:
|
||||
// - isOwner
|
||||
$s = ($isOwn ? 1 : 0) . "#" . ($vacation ? 1 : 0) . "#" . ($protected ? 1 : 0) . "#";
|
||||
|
||||
// - turrets
|
||||
if ($isOwn || $ownSum || ($player['aid'] == $owner['aid'] && $plPriv['list_access'] == 3))
|
||||
$s .= $info['turrets'];
|
||||
elseif (!is_null($probeData))
|
||||
$s .= ""; //FIXME: use probe report
|
||||
$s .= "#";
|
||||
// - population
|
||||
if ($isOwn || $ownSum)
|
||||
$s .= $info['pop'];
|
||||
elseif (!is_null($probeData))
|
||||
$s .= ""; //FIXME: use probe report
|
||||
else
|
||||
$s .= "";
|
||||
$s .= "#";
|
||||
// - factories
|
||||
if (!$isOwn && $player['aid'] == $owner['aid'] && $plPriv['list_access'] == 3)
|
||||
$s .= ((int)$info['ifact'] + (int)$info['mfact']);
|
||||
elseif (!is_null($probeData)) // FIXME: don't include it if the probe got the exact amounts
|
||||
$s .= ""; // FIXME: use probe report
|
||||
$s .= "#";
|
||||
if ($isOwn)
|
||||
$s .= $info['ifact'] . "#" . $info['mfact'];
|
||||
elseif (!is_null($probeData)) // FIXME: only include it if the probe got the exact amounts
|
||||
$s .= "#"; // FIXME: use probe report
|
||||
else
|
||||
$s .= "#";
|
||||
$s .= "#";
|
||||
// - happiness
|
||||
if ($isOwn)
|
||||
$s .= $info['happiness'];
|
||||
elseif (!is_null($probeData))
|
||||
$s .= ""; // FIXME: use probe report
|
||||
$s .= "#";
|
||||
// - corruption
|
||||
if ($isOwn)
|
||||
$s .= round($info['corruption'] / 320);
|
||||
elseif (!is_null($probeData))
|
||||
$s .= ""; // FIXME: use probe report
|
||||
$s .= "#";
|
||||
// - profit
|
||||
if ($isOwn) {
|
||||
$m = gameAction('getPlanetIncome', $info['owner'], $info['pop'], $info['happiness'], $info['ifact'], $info['mfact'], $info['turrets'], $info['corruption']);
|
||||
$s .= $m[0];
|
||||
}
|
||||
$s .= "#";
|
||||
// - alliance tag
|
||||
$s .= $owner['alliance'];
|
||||
array_push($result, $s);
|
||||
|
||||
// We're done if we're not the owner
|
||||
if (!$isOwn)
|
||||
return join("\n", $result);
|
||||
$rules = gameAction('loadPlayerRules', $pid);
|
||||
|
||||
// Current action
|
||||
if (!is_null($info['bh_prep']))
|
||||
$s = "2#".($info['bh_prep'] + 1);
|
||||
elseif (!is_null($info['abandon']))
|
||||
$s = "3#".($info['abandon']);
|
||||
else
|
||||
{
|
||||
$offer = gameAction('getPlanetSale', $id);
|
||||
if (is_null($offer))
|
||||
{
|
||||
$restr = gameAction('isPlayerRestrained', $pid);
|
||||
$np = gameAction('getRealPlanetCount', $pid);
|
||||
$canSell = ($restr == 0) && ($np > 1);
|
||||
$q = dbQuery("SELECT bh_unhappiness FROM player WHERE id=$pid");
|
||||
list($bhu) = dbFetchArray($q);
|
||||
$q = dbQuery("SELECT COUNT(*) FROM planet WHERE owner=$pid AND bh_prep IS NOT NULL");
|
||||
list($bhp) = dbFetchArray($q);
|
||||
$canBlow = ($np > 1) && ($rules['planet_destruction'] > 0) && ($bhu < 20) && ($bhp < 4);
|
||||
if ($canBlow && $this->game->params['victory'] == 2) {
|
||||
// Prevent planets from being destroyed in CTF games
|
||||
$ctfLib = $this->game->getLib('beta5/ctf');
|
||||
$canBlow = !($ctfLib->call('isTarget', $info['system']));
|
||||
}
|
||||
|
||||
$s = "0#" . $info['rename'] . "#" . ($canSell ? 1 : 0) . "#" . ($canBlow ? 1 : 0) . "#" . ($np > 1 ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$s = "1#" . (is_null($offer['finalized']) ? 0 : ($info['sale'] + 1));
|
||||
$s .= "#" . $offer['sold_to'] . "#";
|
||||
if (!is_null($offer['sold_to']))
|
||||
$s .= utf8entities(gameAction('getPlayerName', $offer['sold_to']));
|
||||
}
|
||||
}
|
||||
array_push($result, $s);
|
||||
|
||||
// Capabilities and prices
|
||||
$s = $rules['military_level'] . "#" . $rules['if_cost'] . "#" . $rules['mf_cost'] . "#" . $rules['bh_cost'] . "#";
|
||||
$s .= $rules['build_cost_turret'] . "#" . $rules['build_cost_gaship'] . "#" . $rules['build_cost_fighter'];
|
||||
$s .= "#" . $rules['build_cost_cruiser'] . "#" . $rules['build_cost_bcruiser'];
|
||||
array_push($result, $s);
|
||||
|
||||
// Build queue
|
||||
$bq = gameAction('getBuildQueue', $id);
|
||||
foreach ($bq as $bqi)
|
||||
array_push($result, $bqi["type"] . "#" . $bqi['quantity'] . "#" . $bqi['time'] . "#" . $bqi['ctime']);
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
function factoryAction($pid, $act, $nb, $type) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
if ((int)$nb != $nb || $nb <= 0) {
|
||||
return "ERR#3";
|
||||
}
|
||||
|
||||
$t = ($type == '1') ? "m" : "i";
|
||||
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
if (!in_array($pid, $ids)) {
|
||||
return "ERR#-1";
|
||||
}
|
||||
|
||||
if ($act != "1") {
|
||||
$planets = $this->game->getLib('beta5/planet');
|
||||
$err = $planets->call('checkBuildFactories', $pid, $nb, $t);
|
||||
if ($err) {
|
||||
return "ERR#" . ($err + 23);
|
||||
}
|
||||
} else {
|
||||
$err = gameAction('checkDestroyFactories', $pid, $nb, $t);
|
||||
if ($err) {
|
||||
return "ERR#" . ($err + 7);
|
||||
}
|
||||
}
|
||||
|
||||
gameAction(($act == "1") ? "destroyFactories" : "buildFactories", $pid, $nb, $t);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function addToQueue($pid, $nb, $type) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
if ((int)$nb != $nb || $nb <= 0) {
|
||||
return "ERR#2";
|
||||
}
|
||||
|
||||
$r = gameAction('loadPlayerRules', $_SESSION[game::sessName()]['player']);
|
||||
$type = (int)$type;
|
||||
if ($type < 0 || $type > $r['military_level'] + 2)
|
||||
return "ERR#1";
|
||||
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
|
||||
$types = array('turret', 'gaship', 'fighter', 'cruiser', 'bcruiser');
|
||||
$cost = $r['build_cost_'.$types[$type]] * $nb;
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
if ($pinf['cash'] < $cost)
|
||||
return "ERR#0";
|
||||
gameAction('addToBuildQueue', $pid, $nb, $type);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function replaceItems($pid, $items, $nb, $type) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
if ((int)$nb != $nb || $nb <= 0)
|
||||
return "ERR#2";
|
||||
$r = gameAction('loadPlayerRules', $_SESSION[game::sessName()]['player']);
|
||||
if ($type < 0 || $type > $r['military_level'] + 2)
|
||||
return "ERR#1";
|
||||
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
|
||||
$lst = explode('#', $items);
|
||||
if (!count($lst))
|
||||
return "ERR#5";
|
||||
foreach ($lst as $it)
|
||||
if (!preg_match('/^[0-9]+$/', $it))
|
||||
return "ERR#-2";
|
||||
|
||||
$types = array('turret', 'gaship', 'fighter', 'cruiser', 'bcruiser');
|
||||
$icost = $r['build_cost_'.$types[$type]] * $nb;
|
||||
$sum = gameAction('getReplacementCost', $pid, $lst, $icost);
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
if ($pinf['cash'] < $sum)
|
||||
return "ERR#0";
|
||||
gameAction('replaceItems', $pid, $lst, $nb, $type);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function moveItems($pid, $items, $dir) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
|
||||
$lst = explode('#', $items);
|
||||
if (!count($lst))
|
||||
return 5;
|
||||
foreach ($lst as $li)
|
||||
if (!preg_match('/^[0-9]+$/', $li))
|
||||
return "ERR#-2";
|
||||
|
||||
sort($lst);
|
||||
if ($dir != '1')
|
||||
{
|
||||
$bql = gameAction('getQueueLength', $pid);
|
||||
if ($lst[0] >= $bql - 1)
|
||||
return "ERR#8";
|
||||
$lst = array_reverse($lst);
|
||||
}
|
||||
elseif ($lst[0] == 0)
|
||||
return "ERR#7";
|
||||
|
||||
$ga = ($dir == '1') ? "Up" : "Down";
|
||||
foreach ($lst as $it)
|
||||
gameAction('moveItem' . $ga, $pid, $it);
|
||||
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function deleteItems($pid, $sel) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
|
||||
$items = explode('#', $sel);
|
||||
if (!count($items))
|
||||
return "ERR#5";
|
||||
foreach ($items as $i)
|
||||
{
|
||||
if (!preg_match('/^[0-9]+$/', $i))
|
||||
continue;
|
||||
gameAction('deleteBuildQueueItem', $pid, $i);
|
||||
}
|
||||
gameAction('reorderBuildQueue', $pid);
|
||||
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function flushQueue($pid) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
gameAction('flushBuildQueue', $pid);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function rename($pid, $name) {
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$playerLib = $this->game->getLib('beta5/player');
|
||||
|
||||
if ($playerLib->call('isOnVacation', $player)) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$plp = $playerLib->call('getPlanets', $player);
|
||||
$ids = array_keys($plp);
|
||||
if (!in_array($pid, $ids)) {
|
||||
return "ERR#-1";
|
||||
}
|
||||
|
||||
$n = trim($name);
|
||||
$err = $this->game->getLib()->call('checkPlanetName', $n);
|
||||
if ($err) {
|
||||
if ($err == 6) {
|
||||
return "ERR#38";
|
||||
}
|
||||
return "ERR#". ($err + 12);
|
||||
}
|
||||
|
||||
$planetLib = $this->game->getLib('beta5/planet');
|
||||
$salesLib = $this->game->getLib('beta5/sale');
|
||||
|
||||
$info = $planetLib->call('byId', $pid);
|
||||
$offer = $salesLib->call('getPlanetSale', $pid);
|
||||
if (is_null($info['abandon']) && is_null($info['bh_prep']) && $info['rename'] && is_null($offer)) {
|
||||
$planetLib->call('rename', $pid, $n);
|
||||
}
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function planetSale($pid, $mode, $player, $price, $expires, $fleets) {
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
if (gameAction('isOnVacation', $cPlayer)) {
|
||||
return "ERR#200";
|
||||
} elseif (gameAction('getProtectionLevel', $cPlayer)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
$info = gameAction('getPlanetById', $pid);
|
||||
$offer = gameAction('getPlanetSale', $pid);
|
||||
if (!(is_null($info['abandon']) && is_null($info['bh_prep']) && is_null($offer)))
|
||||
return "ERR#-1";
|
||||
$restr = gameAction('isPlayerRestrained', $cPlayer);
|
||||
$np = gameAction('getRealPlanetCount', $cPlayer);
|
||||
if ($restr > 0 || $np <= 1)
|
||||
return "ERR#-1";
|
||||
|
||||
$mode = (int)$mode;
|
||||
if ($mode < 0 || $mode > 3)
|
||||
return "ERR#-1";
|
||||
|
||||
if ($mode < 2)
|
||||
{
|
||||
$player = trim($player);
|
||||
if ($player == '')
|
||||
return "ERR#1";
|
||||
$tPid = gameAction('getPlayer', $player);
|
||||
if (is_null($tPid))
|
||||
return "ERR#4";
|
||||
elseif ($tPid == $cPlayer) {
|
||||
return "ERR#6";
|
||||
} elseif (gameAction('getProtectionLevel', $tPid)) {
|
||||
return "ERR#5";
|
||||
}
|
||||
}
|
||||
else
|
||||
$tPid = null;
|
||||
|
||||
if ($mode != 0)
|
||||
{
|
||||
$price = (int)$price;
|
||||
if ($price <= 0)
|
||||
return "ERR#2";
|
||||
}
|
||||
else
|
||||
$price = 0;
|
||||
|
||||
$expOk = array(0, 6, 12, 24, 48, 72, 96, 120);
|
||||
$expires = (int)$expires;
|
||||
if (!in_array($expires,$expOk))
|
||||
return "ERR#-1";
|
||||
elseif ($mode == 3 && $expires == 0)
|
||||
return "ERR#3";
|
||||
|
||||
// Check fleets
|
||||
if ($fleets != "")
|
||||
{
|
||||
$sFleets = split('#', $fleets);
|
||||
$flist = array_keys(gameAction('getFleetsAt', $pid, $cPlayer));
|
||||
foreach ($sFleets as $fid)
|
||||
{
|
||||
if (!in_array($fid, $flist))
|
||||
return "ERR#7";
|
||||
$f = gameAction('getFleet', $fid);
|
||||
if ($f['can_move'] != 'Y' || !is_null($fleet['sale_info']) || !is_null($fleet['sale']))
|
||||
return "ERR#8";
|
||||
}
|
||||
}
|
||||
else
|
||||
$sFleets = array();
|
||||
|
||||
// Merge fleets
|
||||
if (count($sFleets) > 1)
|
||||
{
|
||||
$tmp = gameAction('mergeFleets', $sFleets, array($cPlayer), '');
|
||||
$fleet = $tmp[0];
|
||||
}
|
||||
elseif (count($sFleets))
|
||||
$fleet = $sFleets[0];
|
||||
else
|
||||
$fleet = null;
|
||||
|
||||
gameAction('newSale', $cPlayer, ($mode>1), ($mode == 3), $expires, $price, $tPid, $pid, $fleet);
|
||||
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function abandon($pid) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
$info = gameAction('getPlanetById', $pid);
|
||||
$offer = gameAction('getPlanetSale', $pid);
|
||||
if (!(is_null($info['abandon']) && is_null($info['bh_prep']) && is_null($offer)))
|
||||
return "ERR#-1";
|
||||
$np = gameAction('getRealPlanetCount', $cPlayer);
|
||||
if ($np <= 1)
|
||||
return "ERR#-1";
|
||||
|
||||
gameAction('setPlanetAbandon', $pid);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function cancelAbandon($pid) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
$info = gameAction('getPlanetById', $pid);
|
||||
if (is_null($info['abandon']))
|
||||
return "ERR#-1";
|
||||
|
||||
gameAction('setPlanetAbandon', $pid, false);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function cancelSale($pid) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
$offer = gameAction('getPlanetSale', $pid);
|
||||
if (is_null($offer))
|
||||
return "ERR#-1";
|
||||
|
||||
if (is_null($offer['finalized']))
|
||||
gameAction('cancelSale', $cPlayer, $offer['id']);
|
||||
elseif (!gameAction('cancelTransfer', $cPlayer, $offer['id']))
|
||||
return "ERR#18";
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function blowItUp($pid) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids)) {
|
||||
return "ERR#-1";
|
||||
}
|
||||
|
||||
$info = gameAction('getPlanetById', $pid);
|
||||
$offer = gameAction('getPlanetSale', $pid);
|
||||
if (!(is_null($info['abandon']) && is_null($info['bh_prep']) && is_null($offer))) {
|
||||
return "ERR#-1";
|
||||
}
|
||||
|
||||
$rules = gameAction('loadPlayerRules', $cPlayer);
|
||||
$np = gameAction('getRealPlanetCount', $cPlayer);
|
||||
|
||||
$q = dbQuery("SELECT bh_unhappiness FROM player WHERE id=$cPlayer");
|
||||
list($bhu) = dbFetchArray($q);
|
||||
$q = dbQuery("SELECT COUNT(*) FROM planet WHERE owner=$pid AND bh_prep IS NOT NULL");
|
||||
list($bhp) = dbFetchArray($q);
|
||||
|
||||
$canBlow = ($np > 1) && ($rules['planet_destruction'] > 0) && ($bhu < 20) && ($bhp < 4);
|
||||
if ($canBlow && $this->game->params['victory'] == 2) {
|
||||
// Prevent planets from being destroyed in CTF games
|
||||
$ctfLib = $this->game->getLib('beta5/ctf');
|
||||
$canBlow = !($ctfLib->call('isTarget', $info['system']));
|
||||
}
|
||||
|
||||
if (! $canBlow) {
|
||||
return "ERR#-1";
|
||||
}
|
||||
|
||||
gameAction('setPlanetBoom', $pid);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function cancelDestruction($pid) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
$info = gameAction('getPlanetById', $pid);
|
||||
if (is_null($info['bh_prep']))
|
||||
return "ERR#-1";
|
||||
|
||||
gameAction('setPlanetBoom', $pid, false);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function getSellableFleets($pid)
|
||||
{
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
$fleets = array_keys(gameAction('getFleetsAt', $pid, $cPlayer));
|
||||
$rv = array();
|
||||
foreach ($fleets as $fid)
|
||||
{
|
||||
$f = gameAction('getFleet', $fid);
|
||||
if ($f['can_move'] != 'Y' || !is_null($fleet['sale_info']) || !is_null($fleet['sale']))
|
||||
continue;
|
||||
$s = "$fid#" . $f['gaships'] . "#" . $f['fighters'] . "#" . $f['cruisers'] . "#" . $f['bcruisers'] . "#";
|
||||
$s .= gameAction('getFleetPower', $cPlayer, 0, $f['gaships'], $f['fighters'], $f['cruisers'], $f['bcruisers']) . "#";
|
||||
$s .= utf8entities($f['name']);
|
||||
array_push($rv, $s);
|
||||
}
|
||||
return join("\n", $rv);
|
||||
}
|
||||
|
||||
function destroyTurrets($pid, $turrets) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$cPlayer = $_SESSION[game::sessName()]['player'];
|
||||
$ids = array_keys(gameAction('getPlayerPlanets', $cPlayer));
|
||||
if (!in_array($pid, $ids))
|
||||
return "ERR#-1";
|
||||
$turrets = (int)$turrets;
|
||||
if ($turrets <= 0)
|
||||
return "ERR#19";
|
||||
$err = gameAction('destroyTurrets', $pid, $turrets);
|
||||
if ($err > 0)
|
||||
return "ERR#" . ($err + 19);
|
||||
return $this->getPlanetData($pid);
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
if (!preg_match('/^[0-9]+$/', $input['id'])) {
|
||||
logText("****** BUG? Planet not found: '{$input['id']}' (from {$_SERVER['HTTP_REFERER']})", LOG_DEBUG);
|
||||
$this->output = "planetnf";
|
||||
return;
|
||||
}
|
||||
$info = gameAction('getPlanetById', $input['id']);
|
||||
if (is_null($info))
|
||||
{
|
||||
$this->output = "planetnf";
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data = array(
|
||||
'id' => $input['id'],
|
||||
'plist' => $this->getPlanetList(),
|
||||
'pdata' => $this->getPlanetData($input['id'])
|
||||
);
|
||||
$this->output = "planet";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
13
scripts/site/beta5/handlers/planetnf.inc
Normal file
13
scripts/site/beta5/handlers/planetnf.inc
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array();
|
||||
|
||||
function handle($input) {
|
||||
$this->output = "planetnf";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
311
scripts/site/beta5/handlers/planets.inc
Normal file
311
scripts/site/beta5/handlers/planets.inc
Normal file
|
@ -0,0 +1,311 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
"func" => array(
|
||||
"getInitVals", "getPlanetList", "setMode",
|
||||
"setCumulative", "getMilitaryLevel",
|
||||
"flushQueues", "addToQueues", "factoryAction",
|
||||
"deleteItems", "moveItems", "replaceItems"
|
||||
),
|
||||
"init" => "makePlanetsTooltips();\nx_getInitVals(initGetMode);"
|
||||
);
|
||||
|
||||
function getPlanetList() {
|
||||
$str = "";
|
||||
$l = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
foreach ($l as $id => $name) {
|
||||
$info = gameAction('getPlanetById', $id);
|
||||
if ($str != "")
|
||||
$str .= "\n";
|
||||
$str .= "$id#" . $info["x"] . "#" . $info["y"] . "#" . ($info['orbit'] + 1);
|
||||
$str .= "#" . $info["pop"] . '#' . $info['happiness'];
|
||||
$str .= "#" . $info["ifact"] . '#' . $info['turrets'];
|
||||
$str .= "#" . $info["mfact"] . '#';
|
||||
$m = gameAction('getPlanetIncome', $info['owner'], $info['pop'], $info['happiness'], $info['ifact'], $info['mfact'], $info['turrets'], $info['corruption']);
|
||||
$str .= $m[0] . "#" . round($info['corruption'] / 320);
|
||||
$str .= "\n$name\n";
|
||||
|
||||
$bq = gameAction('getBuildQueue', $id);
|
||||
$bqs = '';
|
||||
foreach ($bq as $bqi)
|
||||
{
|
||||
if ($bqs != "")
|
||||
$bqs .= "#";
|
||||
$bqs .= $bqi["type"] . "#" . $bqi['quantity'] . "#" . $bqi['time'] . "#" . $bqi['ctime'];
|
||||
}
|
||||
$str .= $bqs;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getInitVals() {
|
||||
$vac = gameAction('isOnVacation', $_SESSION[game::sessName()]['player']);
|
||||
|
||||
if (is_null($_SESSION[game::sessName()]['quick_builder']) || $vac) {
|
||||
$_SESSION[game::sessName()]['quick_builder'] = false;
|
||||
}
|
||||
if (is_null($_SESSION[game::sessName()]['plist_cumulative'])) {
|
||||
$_SESSION[game::sessName()]['plist_cumulative'] = true;
|
||||
}
|
||||
return ($_SESSION[game::sessName()]['quick_builder'] ? "1" : "0") . '#' . ($_SESSION[game::sessName()]['plist_cumulative'] ? "1" : "0")
|
||||
. "#" . ($vac ? 1 : 0);
|
||||
}
|
||||
|
||||
function setMode($val) {
|
||||
$vac = gameAction('isOnVacation', $_SESSION[game::sessName()]['player']);
|
||||
$_SESSION[game::sessName()]['quick_builder'] = ($val == "1" && !$vac);
|
||||
}
|
||||
|
||||
function setCumulative($val) {
|
||||
$_SESSION[game::sessName()]['plist_cumulative'] = ($val == "1");
|
||||
}
|
||||
|
||||
function getMilitaryLevel() {
|
||||
$r = gameAction('loadPlayerRules', $_SESSION[game::sessName()]['player']);
|
||||
if (is_null($r))
|
||||
return "0";
|
||||
return $r['military_level'];
|
||||
}
|
||||
|
||||
function flushQueues($planets) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return 13;
|
||||
}
|
||||
|
||||
$pl = explode('#', $planets);
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
foreach ($pl as $pid) {
|
||||
if (!in_array($pid, $ids)) {
|
||||
continue;
|
||||
}
|
||||
gameAction('flushBuildQueue', $pid);
|
||||
}
|
||||
return "OK";
|
||||
}
|
||||
|
||||
function addToQueues($planets, $nb, $type) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return 13;
|
||||
}
|
||||
|
||||
if ((int)$nb != $nb || $nb <= 0) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
$r = gameAction('loadPlayerRules', $_SESSION[game::sessName()]['player']);
|
||||
if ($type < 0 || $type > $r['military_level'] + 2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$pl = explode('#', $planets);
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
foreach ($pl as $pid) {
|
||||
if (!in_array($pid, $ids)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$types = array('turret', 'gaship', 'fighter', 'cruiser', 'bcruiser');
|
||||
$cost = $r['build_cost_'.$types[$type]] * $nb * count($pl);
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
if ($pinf['cash'] < $cost) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
foreach ($pl as $pid) {
|
||||
gameAction('addToBuildQueue', $pid, $nb, $type);
|
||||
}
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
function factoryAction($planets, $act, $nb, $type) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return 13;
|
||||
}
|
||||
|
||||
if ((int)$nb != $nb || $nb <= 0) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
$t = ($type == '1') ? "m" : "i";
|
||||
$r = gameAction('loadPlayerRules', $_SESSION[game::sessName()]['player']);
|
||||
|
||||
$pl = explode('#', $planets);
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
foreach ($pl as $pid) {
|
||||
if (!in_array($pid, $ids)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($act != "1") {
|
||||
// Check cash first
|
||||
$cost = $nb * $r[$t . 'f_cost'] * count($pl) ;
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
if ($pinf['cash'] < $cost) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
// Now check other planet details
|
||||
$planets = $this->game->getLib('beta5/planet');
|
||||
foreach ($pl as $pid) {
|
||||
$err = $planets->call('checkBuildFactories', $pid, $nb, $t);
|
||||
if ($err) {
|
||||
return $err + 13;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($pl as $pid) {
|
||||
$err = gameAction('checkDestroyFactories', $pid, $nb, $t);
|
||||
if ($err) {
|
||||
return $err + 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ga = ($act == "1") ? "destroyFactories" : "buildFactories";
|
||||
foreach ($pl as $pid) {
|
||||
gameAction($ga, $pid, $nb, $t);
|
||||
}
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
function deleteItems($items) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return 13;
|
||||
}
|
||||
|
||||
$lst = explode('#', $items);
|
||||
$items = array();
|
||||
foreach ($lst as $i) {
|
||||
array_push($items, explode('-', $i));
|
||||
}
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
|
||||
$pll = array();
|
||||
foreach ($items as $i)
|
||||
{
|
||||
list($pl, $it) = $i;
|
||||
if (!(in_array($pl, $ids) && preg_match('/^[0-9]+$/', $it)))
|
||||
continue;
|
||||
if (!in_array($pl, $pll))
|
||||
array_push($pll, $pl);
|
||||
gameAction('deleteBuildQueueItem', $pl, $it);
|
||||
}
|
||||
foreach ($pll as $pid)
|
||||
gameAction('reorderBuildQueue', $pid);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
function replaceItems($items, $nb, $type) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return 13;
|
||||
}
|
||||
|
||||
if ((int)$nb != $nb || $nb <= 0)
|
||||
return 2;
|
||||
$r = gameAction('loadPlayerRules', $_SESSION[game::sessName()]['player']);
|
||||
if ($type < 0 || $type > $r['military_level'] + 2)
|
||||
return -1;
|
||||
|
||||
$lst = explode('#', $items);
|
||||
$rList = array();
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
foreach ($lst as $li)
|
||||
{
|
||||
list($pl,$it) = explode('-', $li);
|
||||
if (!is_array($rList[$pl]))
|
||||
{
|
||||
if (!in_array($pl, $ids))
|
||||
return -1;
|
||||
$rList[$pl] = array();
|
||||
}
|
||||
if (!preg_match('/^[0-9]+$/', $it))
|
||||
return -1;
|
||||
array_push($rList[$pl], $it);
|
||||
}
|
||||
|
||||
$types = array('turret', 'gaship', 'fighter', 'cruiser', 'bcruiser');
|
||||
$icost = $r['build_cost_'.$types[$type]] * $nb;
|
||||
|
||||
$ids = array_keys($rList);
|
||||
$sum = 0;
|
||||
foreach ($ids as $pl)
|
||||
$sum += gameAction('getReplacementCost', $pl, $rList[$pl], $icost);
|
||||
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
if ($pinf['cash'] < $sum)
|
||||
return 4;
|
||||
|
||||
foreach ($ids as $pl)
|
||||
gameAction('replaceItems', $pl, $rList[$pl], $nb, $type);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
function moveItems($items, $dir) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return 13;
|
||||
}
|
||||
|
||||
$lst = explode('#', $items);
|
||||
$rList = array();
|
||||
$plp = gameAction('getPlayerPlanets', $_SESSION[game::sessName()]['player']);
|
||||
$ids = array_keys($plp);
|
||||
foreach ($lst as $li)
|
||||
{
|
||||
list($pl,$it) = explode('-', $li);
|
||||
if (!is_array($rList[$pl]))
|
||||
{
|
||||
if (!in_array($pl, $ids))
|
||||
return -1;
|
||||
$rList[$pl] = array();
|
||||
}
|
||||
if (!preg_match('/^[0-9]+$/', $it))
|
||||
return -1;
|
||||
array_push($rList[$pl], $it);
|
||||
}
|
||||
|
||||
$ids = array_keys($rList);
|
||||
foreach ($ids as $pl)
|
||||
{
|
||||
sort($rList[$pl]);
|
||||
if ($dir != '1')
|
||||
{
|
||||
$bql = gameAction('getQueueLength', $pl);
|
||||
if ($rList[$pl][0] >= $bql - 1)
|
||||
return 12;
|
||||
$rList[$pl] = array_reverse($rList[$pl]);
|
||||
}
|
||||
elseif ($rList[$pl][0] == 0)
|
||||
return 11;
|
||||
}
|
||||
|
||||
$ga = ($dir == '1') ? "Up" : "Down";
|
||||
foreach ($ids as $pl)
|
||||
{
|
||||
foreach ($rList[$pl] as $it)
|
||||
gameAction('moveItem' . $ga, $pl, $it);
|
||||
}
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
function handle($input) {
|
||||
$this->output = "planets";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
245
scripts/site/beta5/handlers/play.inc
Normal file
245
scripts/site/beta5/handlers/play.inc
Normal file
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
var $engines = array('redirect', 'xml');
|
||||
var $defaultEngine = 'redirect';
|
||||
|
||||
|
||||
private function getRanking($type, $name) {
|
||||
$rt = $this->rankings->call('getType', $type);
|
||||
$r = $this->rankings->call('get', $rt, $name);
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
private function player($id) {
|
||||
$pinf = $this->players->call('get', $id);
|
||||
|
||||
// Basic player data
|
||||
$data = new data_node('Player');
|
||||
$data->setAttribute('id', $id);
|
||||
$data->setAttribute('name', $pinf['name']);
|
||||
$data->setAttribute('cash', $pinf['cash']);
|
||||
|
||||
// Alliance
|
||||
if ($pinf['aid'] || $pinf['arid']) {
|
||||
$aData = new data_leaf('Alliance');
|
||||
if ($pinf['aid']) {
|
||||
$aData->setAttribute('inalliance', 1);
|
||||
$tag = $pinf['alliance'];
|
||||
} else {
|
||||
$aData->setAttribute('inalliance', 0);
|
||||
$tag = $pinf['alliance_req'];
|
||||
}
|
||||
$aData->setAttribute('tag', $tag);
|
||||
$data->addContents($aData);
|
||||
}
|
||||
|
||||
// Rankings
|
||||
$data->addContents($rankings = new data_node('Rankings'));
|
||||
$rankings->setAttribute('players', $this->beta5->call('getPlayerCount'));
|
||||
$rkTypes = array(
|
||||
'p_general' => 'General',
|
||||
'p_civ' => 'Civilian',
|
||||
'p_financial' => 'Financial',
|
||||
'p_military' => 'Military',
|
||||
'p_round' => 'Overall Round',
|
||||
'p_idr' => 'Inflicted Damage'
|
||||
);
|
||||
foreach ($rkTypes as $type => $name) {
|
||||
$r = $this->getRanking($type, $pinf['name']);
|
||||
if (!$r) {
|
||||
continue;
|
||||
}
|
||||
$rt = new data_leaf('Ranking', "$name Ranking");
|
||||
$rt->setAttribute('points', $r['points']);
|
||||
$rt->setAttribute('rank', $r['ranking']);
|
||||
$rankings->addContents($rt);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
private function empire($pid) {
|
||||
$empire = new data_node('Empire');
|
||||
|
||||
// Planet statistics
|
||||
$empire->addContents($planets = new data_node('Planets'));
|
||||
$pld = $this->planets->call('getStats', $pid);
|
||||
$planets->setAttribute('count', $pld[0]);
|
||||
$planets->setAttribute('avgHap', $pld[1]);
|
||||
$planets->setAttribute('totPop', $pld[2]);
|
||||
$planets->setAttribute('avgPop', $pld[3]);
|
||||
$planets->setAttribute('totFac', $pld[4]);
|
||||
$planets->setAttribute('avgFac', $pld[5]);
|
||||
$planets->setAttribute('totTur', $pld[6]);
|
||||
$planets->setAttribute('avgTur', $pld[7]);
|
||||
$planets->setAttribute('siege', $pld[8]);
|
||||
$planets->setAttribute('avgCor', $pld[9]);
|
||||
|
||||
// Planet list and income
|
||||
$income = 0;
|
||||
if ($pld[0] > 0) {
|
||||
$planets->addContents($plist = new data_node('List'));
|
||||
$l = $this->players->call('getPlanets', $pid);
|
||||
foreach ($l as $id => $name) {
|
||||
$p = new data_leaf('Planet', $name);
|
||||
$p->setAttribute('id', $id);
|
||||
$plist->addContents($p);
|
||||
|
||||
$info = $this->planets->call('byId', $id);
|
||||
$m = $this->planets->call('getIncome', $pid, $info['pop'], $info['happ'], $info['ifact'], $info['mfact'], $info['turrets'], $info['corruption']);
|
||||
$income += $m[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Fleets
|
||||
$empire->addContents($fleets = new data_node('Fleets'));
|
||||
$fs = $this->fleets->call('getStats', $pid);
|
||||
$fleets->setAttribute('count', $fs['fleets']);
|
||||
$fleets->setAttribute('inBattle', $fs['battle']);
|
||||
$copy = array('power', 'gaships', 'fighters', 'cruisers', 'bcruisers');
|
||||
foreach ($copy as $name) {
|
||||
$fleets->setAttribute($name, $fs[$name]);
|
||||
}
|
||||
|
||||
// Income and upkeep
|
||||
$empire->addContents($budget = new data_node('Budget'));
|
||||
$budget->setAttribute('income', $income);
|
||||
$budget->setAttribute('upkeep', $fs['upkeep']);
|
||||
$budget->setAttribute('profit', $income - $fs['upkeep']);
|
||||
|
||||
// Research
|
||||
$empire->addContents($research = new data_node('Research'));
|
||||
$research->setAttribute('points', $this->techs->call('getPoints', $pid));
|
||||
$research->setAttribute('new', count($this->techs->call('getTopics', $pid, 0)));
|
||||
$research->setAttribute('foreseen', count($this->techs->call('getTopics', $pid, -1)) / 2);
|
||||
|
||||
// Research budget
|
||||
$research->addContents($rBudget = new data_node('RBudget'));
|
||||
$rb = $this->techs->call('getBudget', $pid);
|
||||
$attrs = array('fundamental', 'military', 'civilian');
|
||||
for ($i=0;$i<count($attrs);$i++) {
|
||||
$rBudget->setAttribute($attrs[$i], $rb[$i]);
|
||||
}
|
||||
|
||||
return $empire;
|
||||
}
|
||||
|
||||
|
||||
private function ticks() {
|
||||
$lib = $this->game->getLib('main');
|
||||
$tinf = $lib->call('getTicks', getLanguage());
|
||||
|
||||
$ticks = new data_node('Ticks');
|
||||
foreach ($tinf as $tid => $td) {
|
||||
if (!$td['game']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ticks->addContents($tick = new data_leaf('Tick', $td['name']));
|
||||
$tick->setAttribute('first', $td['first']);
|
||||
$tick->setAttribute('interval', $td['interval']);
|
||||
if ($td['last']) {
|
||||
$tick->setAttribute('last', $td['last']);
|
||||
}
|
||||
}
|
||||
|
||||
return $ticks;
|
||||
}
|
||||
|
||||
|
||||
private function communications($pid) {
|
||||
$comms = new data_node('Communications');
|
||||
$comms->addContents($messages = new data_node('Messages'));
|
||||
$comms->addContents($forums = new data_node('Forums'));
|
||||
|
||||
// Get custom folders and forum structure
|
||||
$cfold = $this->msgs->call('getCustomFolders', $pid);
|
||||
$cats = $this->forums->call('getStructure', $pid);
|
||||
|
||||
// Messages in default folders
|
||||
$dfld = array('IN', 'INT', 'OUT');
|
||||
foreach ($dfld as $f) {
|
||||
$messages->addContents($node = new data_leaf('DefaultFolder'));
|
||||
$node->setAttribute('id', $f);
|
||||
$node->setAttribute('all', $this->msgs->call('getAll', $pid, $f));
|
||||
$node->setAttribute('new', $this->msgs->call('getNew', $pid, $f));
|
||||
}
|
||||
|
||||
// Custom folders
|
||||
foreach ($cfold as $cfid => $cfn) {
|
||||
$messages->addContents($node = new data_leaf('CustomFolder', utf8_encode($cfn)));
|
||||
$node->setAttribute('id', $cfid);
|
||||
$node->setAttribute('all', $this->msgs->call('getAll', $pid, 'CUS', $cfid));
|
||||
$node->setAttribute('new', $this->msgs->call('getNew', $pid, 'CUS', $cfid));
|
||||
}
|
||||
|
||||
// Forums
|
||||
foreach ($cats as $c) {
|
||||
if (!count($c['forums'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($c['type'] == 'A') {
|
||||
$forums->addContents($category = new data_node('AllianceForums'));
|
||||
} else {
|
||||
$forums->addContents($category = new data_node('GeneralForums'));
|
||||
$category->addContents($cdesc = new data_leaf('Description', utf8_encode($c['title'])));
|
||||
$cdesc->setAttribute('id', $c['id']);
|
||||
$cdesc->setAttribute('type', $c['type']);
|
||||
}
|
||||
foreach ($c['forums'] as $f) {
|
||||
$category->addContents($forum = new data_leaf('Forum', utf8_encode($f['title'])));
|
||||
$forum->setAttribute('id', $f['id']);
|
||||
$forum->setAttribute('topics', $f['topics']);
|
||||
$forum->setAttribute('unread', $f['unread']);
|
||||
}
|
||||
}
|
||||
|
||||
return $comms;
|
||||
}
|
||||
|
||||
|
||||
function xml($input) {
|
||||
if (!$_SESSION['authok']) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
$this->beta5 = $this->game->getLib('beta5');
|
||||
$this->forums = $this->game->getLib('beta5/forums');
|
||||
$this->fleets = $this->game->getLib('beta5/fleet');
|
||||
$this->msgs = $this->game->getLib('beta5/msg');
|
||||
$this->planets = $this->game->getLib('beta5/planet');
|
||||
$this->players = $this->game->getLib('beta5/player');
|
||||
$this->rankings = $this->game->getLib('main/rankings');
|
||||
$this->techs = $this->game->getLib('beta5/tech');
|
||||
|
||||
$data = new data_node('Overview');
|
||||
$data->setAttribute('serverTime', time());
|
||||
|
||||
$data->addContents($this->player($pid));
|
||||
$data->addContents($this->empire($pid));
|
||||
$data->addContents($this->ticks());
|
||||
$data->addContents($this->communications($pid));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
function redirect($input) {
|
||||
$this->accounts = $this->game->getLib('main/account');
|
||||
|
||||
if (!is_null($_SESSION['userid'])) {
|
||||
$isAdmin = $this->accounts->call('isAdmin', $_SESSION['userid']);
|
||||
} else {
|
||||
$isAdmin = false;
|
||||
}
|
||||
return $isAdmin ? "admin" : "overview";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
142
scripts/site/beta5/handlers/preferences.inc
Normal file
142
scripts/site/beta5/handlers/preferences.inc
Normal file
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array();
|
||||
|
||||
function checkMail($a) {
|
||||
return preg_match(
|
||||
'/^[A-Za-z0-9_\.\-\+]+@([A-Za-z0-9_\.\-\+]+)+\.[A-Za-z]{2,6}/',
|
||||
$a
|
||||
);
|
||||
}
|
||||
|
||||
function checkPassword($op, $np, $cp) {
|
||||
$q = dbQuery("SELECT password FROM account WHERE id=".$_SESSION['userid']);
|
||||
if (!$q) {
|
||||
$this->passError = 1;
|
||||
return;
|
||||
}
|
||||
list($rop) = dbFetchArray($q);
|
||||
if ($rop != $op)
|
||||
$this->passError = 2;
|
||||
elseif ($np != $cp)
|
||||
$this->passError = 3;
|
||||
elseif (strlen($np) < 4)
|
||||
$this->passError = 4;
|
||||
elseif (strlen($np) > 64)
|
||||
$this->passError = 5;
|
||||
elseif ($np == $_SESSION['login'])
|
||||
$this->passError = 6;
|
||||
else
|
||||
{
|
||||
$p = addslashes($np);
|
||||
$op = addslashes($rop);
|
||||
dbQuery(
|
||||
"INSERT INTO pass_change (account, old_pass, new_pass) "
|
||||
. "VALUES({$_SESSION['userid']}, '$op', '$p')"
|
||||
);
|
||||
$q = dbQuery("UPDATE account SET password='$p' WHERE id=".$_SESSION['userid']);
|
||||
if (!$q) {
|
||||
$this->passError = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkFormData($input)
|
||||
{
|
||||
$pLang = array('fr', 'en');
|
||||
if (in_array($input['lang'], $pLang))
|
||||
prefs::set('main/language', $input['lang']);
|
||||
|
||||
$pCol = array('red','green','blue','yellow','grey','purple');
|
||||
if (in_array($input['col'], $pCol))
|
||||
prefs::set('main/colour', $input['col']);
|
||||
|
||||
$themes = array('default','invert','classic','cripes');
|
||||
if (in_array($input['thm'], $themes)) {
|
||||
prefs::set('beta5/theme', $input['thm']);
|
||||
if ($input['thm'] == 'cripes') {
|
||||
$input['tt'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/^[0-4]$/', $input['fs']))
|
||||
prefs::set('main/font_size', $input['fs']);
|
||||
|
||||
if ($this->checkMail($input['mail']))
|
||||
dbQuery("UPDATE account SET email='".$input['mail']."' WHERE id=".$_SESSION['userid']);
|
||||
else
|
||||
$this->mailError = preg_replace('/"/', '"', $input['mail']);
|
||||
|
||||
$tt = (int)$input['tt'];
|
||||
if ($tt >= 0 && $tt <= 6)
|
||||
prefs::set('main/tooltips', $tt);
|
||||
|
||||
if (preg_match('/^[1-5]0$/', $input['tpp']))
|
||||
prefs::set('main/forums_ntopics', $input['tpp']);
|
||||
if (preg_match('/^[1-5]0$/', $input['mpp']))
|
||||
prefs::set('main/forums_nitems', $input['mpp']);
|
||||
prefs::set('main/smileys', ($input['gsm'] == "1")?"1":"0");
|
||||
prefs::set('main/forum_code', ($input['gft'] == "1")?"1":"0");
|
||||
prefs::set('main/forums_threaded', ($input['fdm'] == "1")?"1":"0");
|
||||
prefs::set('main/forums_reversed', ($input['fmo'] == "1")?"1":"0");
|
||||
|
||||
$fsig = preg_replace('/ +/', ' ', trim($input['fsig']));
|
||||
if (strlen($fsig) <= 255)
|
||||
prefs::set('main/forums_sig', $input['fsig']);
|
||||
|
||||
if ($input['opass'] != "")
|
||||
$this->checkPassword($input['opass'], $input['npass'], $input['cpass']);
|
||||
}
|
||||
|
||||
function handleQuit() {
|
||||
if (gameAction('isFinished')) {
|
||||
return;
|
||||
}
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
$pinf = gameAction('getPlayerInfo', $pid);
|
||||
if (!is_null($pinf['qts']))
|
||||
gameAction('cancelPlayerQuit', $pid);
|
||||
else
|
||||
gameAction('setPlayerQuit', $pid);
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
if (!is_null($input['quit']))
|
||||
$this->handleQuit();
|
||||
elseif ($input['col'] != "")
|
||||
$this->checkFormData($input);
|
||||
|
||||
$q = dbQuery("SELECT email FROM account WHERE id=".$_SESSION['userid']);
|
||||
list($email) = dbFetchArray($q);
|
||||
$pinf = gameAction('getPlayerInfo', $_SESSION[game::sessName()]['player']);
|
||||
|
||||
$this->data = array(
|
||||
"lang" => getLanguage(),
|
||||
"mail" => $email,
|
||||
"col" => prefs::get('main/colour', 'red'),
|
||||
"fs" => prefs::get('main/font_size', 2),
|
||||
"err1" => $this->mailError,
|
||||
"err2" => $this->passError,
|
||||
"tpp" => prefs::get('main/forums_ntopics', 20),
|
||||
"mpp" => prefs::get('main/forums_nitems', 20),
|
||||
"gsm" => (prefs::get('main/smileys', 1) == 1),
|
||||
"gft" => (prefs::get('main/forum_code', 1) == 1),
|
||||
"fdm" => (prefs::get('main/forums_threaded', 1) == 1),
|
||||
"fmo" => (prefs::get('main/forums_reversed', 1) == 1),
|
||||
"fsig" => prefs::get('main/forums_sig', ""),
|
||||
"tt" => prefs::get('main/tooltips', 2),
|
||||
"thm" => prefs::get('beta5/theme', 'default'),
|
||||
"quit" => $pinf['qts'],
|
||||
"name" => $this->game->text,
|
||||
"lok" => !(gameAction('isFinished') || $this->game->params['victory'])
|
||||
);
|
||||
|
||||
$this->output = "preferences";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
260
scripts/site/beta5/handlers/probes.inc
Normal file
260
scripts/site/beta5/handlers/probes.inc
Normal file
|
@ -0,0 +1,260 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $bcnCost = 50000;
|
||||
var $bcnPow = 3;
|
||||
var $ajax = array(
|
||||
"func" => array(
|
||||
'getPageData',
|
||||
// 'setEmpirePolicy', 'togglePlanetPolicy', 'setPlanetPolicy',
|
||||
'upgradeBeacon'
|
||||
),
|
||||
"init" => "initPage();"
|
||||
);
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Probes policy control
|
||||
|
||||
function setEmpirePolicy($element, $value)
|
||||
{
|
||||
$element = (int)$element; $value = (int)$value;
|
||||
if ($element < 0 || $value < 0 || $element > 3 || $value > 2)
|
||||
return "ERR#1";
|
||||
|
||||
// Get empire policy
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$ePolicy = gameAction('getPlayerPolicy', $player);
|
||||
if (is_null($ePolicy))
|
||||
return "ERR#0";
|
||||
|
||||
// Set new value
|
||||
$ePolicy{$element} = $value;
|
||||
gameAction('setPlayerPolicy', $player, $ePolicy);
|
||||
|
||||
return "1\n$ePolicy";
|
||||
}
|
||||
|
||||
function togglePlanetPolicy($planet)
|
||||
{
|
||||
// Get planet information
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$planet = (int)$planet;
|
||||
$pinf = gameAction('getPlanetById', $planet);
|
||||
if (is_null($pinf))
|
||||
return "ERR#1";
|
||||
elseif ($pinf['owner'] != $player)
|
||||
return "ERR#2";
|
||||
|
||||
// Get planet policy
|
||||
$pPolicy = gameAction('getPlanetPolicy', $planet);
|
||||
if (is_null($pPolicy))
|
||||
{
|
||||
$ePolicy = gameAction('getPlayerPolicy', $player);
|
||||
if (is_null($ePolicy))
|
||||
return "ERR#0";
|
||||
$pPolicy = $ePolicy;
|
||||
}
|
||||
else
|
||||
$pPolicy = null;
|
||||
gameAction('setPlanetPolicy', $planet, $pPolicy);
|
||||
|
||||
return "2\n$planet#$pPolicy";
|
||||
}
|
||||
|
||||
function setPlanetPolicy($planet, $element, $value)
|
||||
{
|
||||
// Check parameters
|
||||
$element = (int)$element; $value = (int)$value;
|
||||
if ($element < 0 || $value < 0 || $element > 3 || $value > 2)
|
||||
return "ERR#1";
|
||||
|
||||
// Get planet information
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$planet = (int)$planet;
|
||||
$pinf = gameAction('getPlanetById', $planet);
|
||||
if (is_null($pinf))
|
||||
return "ERR#1";
|
||||
elseif ($pinf['owner'] != $player)
|
||||
return "ERR#2";
|
||||
|
||||
// Get planet policy
|
||||
$pPolicy = gameAction('getPlanetPolicy', $planet);
|
||||
if (is_null($pPolicy))
|
||||
return "ERR#1";
|
||||
$pPolicy{$element} = $value;
|
||||
gameAction('setPlanetPolicy', $planet, $pPolicy);
|
||||
|
||||
return "2\n$planet#$pPolicy";
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Beacon management functions
|
||||
|
||||
function getPlanetBeaconData($pid, $maxTech)
|
||||
{
|
||||
// Get the planet's data
|
||||
$pinf = gameAction('getPlanetById', $pid);
|
||||
$pinf['orbit'] ++;
|
||||
$mainData = "$pid#{$pinf['x']}#{$pinf['y']}#{$pinf['orbit']}#{$pinf['beacon']}#";
|
||||
|
||||
// Compute the price to upgrade if that applies
|
||||
if ($pinf['beacon'] < $maxTech)
|
||||
$price = $this->bcnCost * pow($this->bcnPow, $pinf['beacon']);
|
||||
else
|
||||
$price = "";
|
||||
$mainData .= "$price#" . ($pinf['built_probe'] == 't' ? 1 : 0) . "#";
|
||||
|
||||
// If the beacon can spot fleets standing by in Hyperspace, check for them
|
||||
$reqLevel = $this->game->params['fakebeacons'] ? 1 : 2;
|
||||
$hsFleets = array();
|
||||
if ($pinf['beacon'] >= $reqLevel) {
|
||||
$hsFleetsRaw = $this->game->getLib('beta5/planet')->call('getDetectedFleets', $pid);
|
||||
foreach ($hsFleetsRaw as $fleet) {
|
||||
$str = "{$fleet['i_level']}#{$fleet['fl_size']}#{$fleet['fl_owner']}#{$fleet['owner']}";
|
||||
array_push($hsFleets, $str);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the return value
|
||||
$mainData .= count($hsFleets) . "#" . count($mvFleets) . "#" . utf8entities($pinf['name']);
|
||||
$rv = array($mainData);
|
||||
if (count($hsFleets)) {
|
||||
$rv = array_merge($rv, $hsFleets);
|
||||
}
|
||||
|
||||
return $rv;
|
||||
}
|
||||
|
||||
function upgradeBeacon($pid) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pid = (int)$pid;
|
||||
|
||||
// Check the planet's existance, ownership and beacon/probe status
|
||||
$pinf = gameAction('getPlanetById', $pid);
|
||||
if (is_null($pinf) || $pinf['built_probe'] == 't')
|
||||
return "ERR#0";
|
||||
else if ($pinf['owner'] != $player)
|
||||
return "ERR#1";
|
||||
|
||||
// Check the player's tech level
|
||||
$rules = gameAction('loadPlayerRules', $player);
|
||||
if ($pinf['beacon'] == $rules['hs_beacon_level'])
|
||||
return "ERR#0";
|
||||
|
||||
// Check the player's cash
|
||||
$plinf = gameAction('getPlayerInfo', $player);
|
||||
$price = $this->bcnCost * pow($this->bcnPow, $pinf['beacon']);
|
||||
if ($plinf['cash'] < $price)
|
||||
return "ERR#2";
|
||||
|
||||
// Upgrade the beacon
|
||||
dbQuery("UPDATE planet SET beacon=beacon+1,built_probe=".dbBool(1)." WHERE id=$pid");
|
||||
dbQuery("UPDATE player SET cash=cash-$price WHERE id=$player");
|
||||
|
||||
// Generate the return value
|
||||
$rv = $this->getPlanetBeaconData($pid, $rules['hs_beacon_level']);
|
||||
array_unshift($rv, 1);
|
||||
return join("\n", $rv);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Complete data generation for sub-pages
|
||||
|
||||
function getPageData($name)
|
||||
{
|
||||
$page = $this->setPage($name);
|
||||
switch ($page)
|
||||
{
|
||||
//case "policy": return $this->getPolicyData();
|
||||
case "beacons": return $this->getBeaconsData();
|
||||
//case "build": return $this->getBuildData();
|
||||
//case "data": return $this->getProbesData();
|
||||
}
|
||||
}
|
||||
|
||||
function getPolicyData()
|
||||
{
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
// Get empire policy
|
||||
$ePolicy = gameAction('getPlayerPolicy', $player);
|
||||
if (is_null($ePolicy))
|
||||
return "ERR#0";
|
||||
|
||||
// Get the player's planet-specific policies
|
||||
$pPolicies = gameAction('getPlayerPlanets', $player);
|
||||
foreach ($pPolicies as $id => $junk)
|
||||
{
|
||||
$pinf = gameAction('getPlanetById', $id);
|
||||
$pPolicies[$id] = array(
|
||||
$pinf['x'], $pinf['y'], $pinf['orbit'] + 1,
|
||||
gameAction('getPlanetPolicy', $id),
|
||||
utf8entities($pinf['name'])
|
||||
);
|
||||
}
|
||||
|
||||
// Generate output
|
||||
$rv = array(0, count($pPolicies) . "#" . $ePolicy);
|
||||
if (count($pPolicies))
|
||||
{
|
||||
foreach ($pPolicies as $id => $pPolicy)
|
||||
array_push($rv, "$id#" . join("#", $pPolicy));
|
||||
}
|
||||
|
||||
return join("\n", $rv);
|
||||
}
|
||||
|
||||
function getBeaconsData()
|
||||
{
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
// Get the player's beacon technology level
|
||||
$rules = gameAction('loadPlayerRules', $player);
|
||||
$beaconTech = $rules['hs_beacon_level'];
|
||||
|
||||
// Get the data regarding all of the player's planets
|
||||
$pl = gameAction('getPlayerPlanets', $player);
|
||||
$rv = array(0, "$beaconTech#" . count($pl));
|
||||
foreach ($pl as $id => $name) {
|
||||
$rv = array_merge($rv, $this->getPlanetBeaconData($id, $beaconTech));
|
||||
}
|
||||
|
||||
return join("\n", $rv);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Sub-pages and session
|
||||
|
||||
function setPage($name)
|
||||
{
|
||||
//$okPages = array('policy', 'beacons', 'build', 'data');
|
||||
$okPages = array('beacons');
|
||||
if (!in_array($name, $okPages))
|
||||
$name = $okPages[0];
|
||||
return ($_SESSION[game::sessName()]['probe_page'] = $name);
|
||||
}
|
||||
|
||||
function getPage()
|
||||
{
|
||||
if (is_null($_SESSION[game::sessName()]['probe_page']))
|
||||
$_SESSION[game::sessName()]['probe_page'] = 'beacons';
|
||||
return $_SESSION[game::sessName()]['probe_page'];
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$this->data = $this->getPage();
|
||||
$this->output = "probes";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
266
scripts/site/beta5/handlers/rank.inc
Normal file
266
scripts/site/beta5/handlers/rank.inc
Normal file
|
@ -0,0 +1,266 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
'func' => array(
|
||||
'setPage', 'getPlayerData',
|
||||
'getGeneralRankings', 'getDetailedRankings',
|
||||
'getAllianceRankings', 'getRoundRankings',
|
||||
'getDamageRankings'
|
||||
),
|
||||
'init' => "makeRanksTooltips();\ninitPage();"
|
||||
);
|
||||
|
||||
function getRanking($type,$name) {
|
||||
if (! $this->rkLib) {
|
||||
$this->rkLib = input::$game->getLib('main/rankings');
|
||||
}
|
||||
$rt = $this->rkLib->call('getType', $type);
|
||||
$r = $this->rkLib->call('get', $rt, $name);
|
||||
if (!$r) {
|
||||
return array('','');
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function getPlayerData($md5)
|
||||
{
|
||||
$pname = gameAction('getPlayerName', $_SESSION[game::sessName()]['player']);
|
||||
$gr = $this->getRanking('p_general', $pname);
|
||||
$cr = $this->getRanking('p_civ', $pname);
|
||||
$mr = $this->getRanking('p_military', $pname);
|
||||
$fr = $this->getRanking('p_financial', $pname);
|
||||
$or = $this->getRanking('p_round', $pname);
|
||||
$ir = $this->getRanking('p_idr', $pname);
|
||||
$a = array(
|
||||
$gr['points'], $gr['ranking'], $cr['points'], $cr['ranking'],
|
||||
$mr['points'], $mr['ranking'], $fr['points'], $fr['ranking'],
|
||||
$or['points'], $or['ranking'], $ir['points'], $ir['ranking']
|
||||
);
|
||||
$nmd5 = md5(serialize($a));
|
||||
if ($md5 == $nmd5)
|
||||
return "KEEP";
|
||||
array_unshift($a, $nmd5);
|
||||
return join('#', $a);
|
||||
}
|
||||
|
||||
function setPage($page)
|
||||
{
|
||||
$pok = array('Summary','General','Details','Alliance','Round', 'Damage');
|
||||
if (in_array($page,$pok))
|
||||
$_SESSION[game::sessName()]['rkpage'] = $page;
|
||||
return $_SESSION[game::sessName()]['rkpage'];
|
||||
}
|
||||
|
||||
function getGeneralRankings($param, $md5) {
|
||||
// Listing configuration
|
||||
$conf = array(
|
||||
"perPage" => array(5, 10, 15, 20, 25),
|
||||
"sortable" => array(
|
||||
"player" => SORT_STRING,
|
||||
"rank" => SORT_NUMERIC,
|
||||
),
|
||||
"searchModes" => array("player"),
|
||||
"output" => array(
|
||||
"isMe", "rank", "points", "player_real"
|
||||
)
|
||||
);
|
||||
|
||||
// Get the data
|
||||
$players = array();
|
||||
$myName = gameAction('getPlayerName', $_SESSION[game::sessName()]['player']);
|
||||
if (! $this->rkLib) {
|
||||
$this->rkLib = input::$game->getLib('main/rankings');
|
||||
}
|
||||
$rt = $this->rkLib->call('getType', "p_general");
|
||||
$rl = $this->rkLib->call('getAll', $rt);
|
||||
foreach ($rl as $r)
|
||||
array_push($players, array(
|
||||
"player" => strtolower($r['id']),
|
||||
"player_real" => $r['id'],
|
||||
"rank" => $r['ranking'],
|
||||
"points" => $r['points'],
|
||||
"isMe" => ($r['id'] == $myName) ? 1 : 0
|
||||
));
|
||||
|
||||
return gameAction('generateListing', $players, $conf, $param, $md5);
|
||||
}
|
||||
|
||||
function getDetailedRankings($param, $md5) {
|
||||
// Listing configuration
|
||||
$conf = array(
|
||||
"perPage" => array(5, 10, 15, 20, 25),
|
||||
"sortable" => array(
|
||||
"player" => SORT_STRING,
|
||||
"civRank" => SORT_NUMERIC,
|
||||
"milRank" => SORT_NUMERIC,
|
||||
"finRank" => SORT_NUMERIC,
|
||||
),
|
||||
"searchModes" => array("player"),
|
||||
"output" => array(
|
||||
"isMe", "civRank", "civPoints",
|
||||
"milRank", "milPoints", "finRank",
|
||||
"finPoints", "player_real"
|
||||
)
|
||||
);
|
||||
|
||||
// Get the data
|
||||
$players = array();
|
||||
$myName = gameAction('getPlayerName', $_SESSION[game::sessName()]['player']);
|
||||
if (! $this->rkLib) {
|
||||
$this->rkLib = input::$game->getLib('main/rankings');
|
||||
}
|
||||
$rt = $this->rkLib->call('getType', "p_civ");
|
||||
$rl = $this->rkLib->call('getAll', $rt);
|
||||
foreach ($rl as $r)
|
||||
$players[$r['id']] = array(
|
||||
"player" => strtolower($r['id']),
|
||||
"player_real" => $r['id'],
|
||||
"civRank" => $r['ranking'],
|
||||
"civPoints" => $r['points'],
|
||||
"isMe" => ($r['id'] == $myName) ? 1 : 0
|
||||
);
|
||||
|
||||
$rt = $this->rkLib->call('getType', "p_military");
|
||||
$rl = $this->rkLib->call('getAll', $rt);
|
||||
foreach ($rl as $r) {
|
||||
$players[$r['id']]['milRank'] = $r['ranking'];
|
||||
$players[$r['id']]['milPoints'] = $r['points'];
|
||||
}
|
||||
|
||||
$rt = $this->rkLib->call('getType', "p_financial");
|
||||
$rl = $this->rkLib->call('getAll', $rt);
|
||||
foreach ($rl as $r) {
|
||||
$players[$r['id']]['finRank'] = $r['ranking'];
|
||||
$players[$r['id']]['finPoints'] = $r['points'];
|
||||
}
|
||||
|
||||
$data = array();
|
||||
foreach ($players as $id => $d)
|
||||
array_push($data, $d);
|
||||
|
||||
return gameAction('generateListing', $data, $conf, $param, $md5);
|
||||
}
|
||||
|
||||
function getAllianceRankings($param, $md5) {
|
||||
// Listing configuration
|
||||
$conf = array(
|
||||
"perPage" => array(5, 10, 15, 20, 25),
|
||||
"sortable" => array(
|
||||
"alliance" => SORT_STRING,
|
||||
"rank" => SORT_NUMERIC,
|
||||
),
|
||||
"searchModes" => array("alliance"),
|
||||
"output" => array(
|
||||
"rank", "points", "alliance_real"
|
||||
)
|
||||
);
|
||||
|
||||
// Get the data
|
||||
$data = array();
|
||||
if (! $this->rkLib) {
|
||||
$this->rkLib = input::$game->getLib('main/rankings');
|
||||
}
|
||||
$rt = $this->rkLib->call('getType', "a_general");
|
||||
$rl = $this->rkLib->call('getAll', $rt);
|
||||
foreach ($rl as $r)
|
||||
array_push($data, array(
|
||||
"alliance" => strtolower($r['id']),
|
||||
"alliance_real" => $r['id'],
|
||||
"rank" => $r['ranking'],
|
||||
"points" => $r['points']
|
||||
));
|
||||
|
||||
return gameAction('generateListing', $data, $conf, $param, $md5);
|
||||
}
|
||||
|
||||
function getRoundRankings($param, $md5) {
|
||||
// Listing configuration
|
||||
$conf = array(
|
||||
"perPage" => array(5, 10, 15, 20, 25),
|
||||
"sortable" => array(
|
||||
"player" => SORT_STRING,
|
||||
"rank" => SORT_NUMERIC,
|
||||
),
|
||||
"searchModes" => array("player"),
|
||||
"output" => array(
|
||||
"isMe", "rank", "points", "player_real"
|
||||
)
|
||||
);
|
||||
|
||||
// Get the data
|
||||
$players = array();
|
||||
$myName = gameAction('getPlayerName', $_SESSION[game::sessName()]['player']);
|
||||
if (! $this->rkLib) {
|
||||
$this->rkLib = input::$game->getLib('main/rankings');
|
||||
}
|
||||
$rt = $this->rkLib->call('getType', "p_round");
|
||||
$rl = $this->rkLib->call('getAll', $rt);
|
||||
foreach ($rl as $r)
|
||||
array_push($players, array(
|
||||
"player" => strtolower($r['id']),
|
||||
"player_real" => $r['id'],
|
||||
"rank" => $r['ranking'],
|
||||
"points" => $r['points'],
|
||||
"isMe" => ($r['id'] == $myName) ? 1 : 0
|
||||
));
|
||||
|
||||
return gameAction('generateListing', $players, $conf, $param, $md5);
|
||||
}
|
||||
|
||||
function getDamageRankings($param, $md5) {
|
||||
// Listing configuration
|
||||
$conf = array(
|
||||
"perPage" => array(5, 10, 15, 20, 25),
|
||||
"sortable" => array(
|
||||
"player" => SORT_STRING,
|
||||
"rank" => SORT_NUMERIC,
|
||||
),
|
||||
"searchModes" => array("player"),
|
||||
"output" => array(
|
||||
"isMe", "rank", "points", "player_real"
|
||||
)
|
||||
);
|
||||
|
||||
// Get the data
|
||||
$players = array();
|
||||
$myName = gameAction('getPlayerName', $_SESSION[game::sessName()]['player']);
|
||||
if (! $this->rkLib) {
|
||||
$this->rkLib = input::$game->getLib('main/rankings');
|
||||
}
|
||||
$rt = $this->rkLib->call('getType', "p_idr");
|
||||
$rl = $this->rkLib->call('getAll', $rt);
|
||||
foreach ($rl as $r)
|
||||
array_push($players, array(
|
||||
"player" => strtolower($r['id']),
|
||||
"player_real" => $r['id'],
|
||||
"rank" => $r['ranking'],
|
||||
"points" => $r['points'],
|
||||
"isMe" => ($r['id'] == $myName) ? 1 : 0
|
||||
));
|
||||
|
||||
return gameAction('generateListing', $players, $conf, $param, $md5);
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
switch ($input['p']):
|
||||
case 's': $_SESSION[game::sessName()]['rkpage'] = 'Summary'; break;
|
||||
case 'g': $_SESSION[game::sessName()]['rkpage'] = 'General'; break;
|
||||
case 'd': $_SESSION[game::sessName()]['rkpage'] = 'Details'; break;
|
||||
case 'a': $_SESSION[game::sessName()]['rkpage'] = 'Alliance'; break;
|
||||
case 'o': $_SESSION[game::sessName()]['rkpage'] = 'Round'; break;
|
||||
case 'i': $_SESSION[game::sessName()]['rkpage'] = 'Damage'; break;
|
||||
default:
|
||||
if (is_null($_SESSION[game::sessName()]['rkpage']))
|
||||
$_SESSION[game::sessName()]['rkpage'] = 'Summary';
|
||||
break;
|
||||
endswitch;
|
||||
$this->data = $_SESSION[game::sessName()]['rkpage'];
|
||||
$this->output = "rank";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
11
scripts/site/beta5/handlers/rat.inc
Normal file
11
scripts/site/beta5/handlers/rat.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
var $needsAuth = true;
|
||||
|
||||
function handle($input) {
|
||||
$this->output = "rat";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
272
scripts/site/beta5/handlers/research.inc
Normal file
272
scripts/site/beta5/handlers/research.inc
Normal file
|
@ -0,0 +1,272 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
"func" => array(
|
||||
'getMode', 'setMode', 'getDescriptions',
|
||||
'getTopicsData', 'getLawsData', 'getAttributionsData',
|
||||
'implementTechnology', 'switchLaw', 'validateBudget',
|
||||
'getDiplomacyData', 'sendOffer', 'acceptOffer',
|
||||
'declineOffer'
|
||||
),
|
||||
"init" => "makeResearchTooltips(); x_getMode(initResearchPage);"
|
||||
);
|
||||
|
||||
function guessResearchMode($i)
|
||||
{
|
||||
switch ($i['p']) :
|
||||
case 't': $_SESSION[game::sessName()]['respage_mode'] = 'Topics'; break;
|
||||
case 'l': $_SESSION[game::sessName()]['respage_mode'] = 'Laws'; break;
|
||||
case 'b': $_SESSION[game::sessName()]['respage_mode'] = 'Attributions'; break;
|
||||
case 'd': $_SESSION[game::sessName()]['respage_mode'] = 'Diplomacy'; break;
|
||||
endswitch;
|
||||
if (is_null($_SESSION[game::sessName()]['respage_mode']))
|
||||
$_SESSION[game::sessName()]['respage_mode'] = 'Topics';
|
||||
return $_SESSION[game::sessName()]['respage_mode'];
|
||||
}
|
||||
|
||||
function getMode()
|
||||
{
|
||||
if (is_null($_SESSION[game::sessName()]['respage_mode']))
|
||||
return $this->guessResearchMode(array());
|
||||
return $_SESSION[game::sessName()]['respage_mode'];
|
||||
}
|
||||
|
||||
function setMode($nm)
|
||||
{
|
||||
$pm = array('Topics', 'Laws', 'Attributions', 'Diplomacy');
|
||||
if (!in_array($nm, $pm))
|
||||
return $this->guessResearchMode(array());
|
||||
|
||||
$_SESSION[game::sessName()]['respage_mode'] = $nm;
|
||||
return $nm;
|
||||
}
|
||||
|
||||
function getDescriptions($lst)
|
||||
{
|
||||
$l = getLanguage();
|
||||
$a = split('#', $lst);
|
||||
$s = "";
|
||||
foreach ($a as $id)
|
||||
{
|
||||
if ((int)$id != $id)
|
||||
continue;
|
||||
$ns = gameAction('getResearchData', $l, $id);
|
||||
if ($ns == "")
|
||||
continue;
|
||||
if ($s != "")
|
||||
$s .= "\n";
|
||||
$s .= $ns;
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
function getTopicsData()
|
||||
{
|
||||
$pl = $_SESSION[game::sessName()]['player'];
|
||||
$impl = gameAction('getResearchTopics', $pl, 1);
|
||||
$disp = gameAction('getResearchTopics', $pl, 0);
|
||||
$brkt = gameAction('getResearchTopics', $pl, -1);
|
||||
return join("#", $impl) . "!" . join("#", $disp) . "!" . join("#", $brkt);
|
||||
}
|
||||
|
||||
function implementTechnology($id) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
if ((int)$id != $id) {
|
||||
logText("(CHEAT) research/implement received weird ID from user {$_SESSION['userid']}");
|
||||
return "ERR#1";
|
||||
}
|
||||
return (gameAction('implementTechnology', $_SESSION[game::sessName()]['player'], $id) ? "OK" : "ERR#0");
|
||||
}
|
||||
|
||||
function getLawsData() {
|
||||
return join('#', gameAction('getLaws', $_SESSION[game::sessName()]['player']));
|
||||
}
|
||||
|
||||
function switchLaw($id) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
if ((int)$id != $id) {
|
||||
return "ERR#1";
|
||||
}
|
||||
return (gameAction('switchLaw', $_SESSION[game::sessName()]['player'], $id) ? "OK" : "ERR#0");
|
||||
}
|
||||
|
||||
function getAttributionsData() {
|
||||
$pl = $_SESSION[game::sessName()]['player'];
|
||||
$a = array(gameAction('getResearchPoints', $pl));
|
||||
$b = gameAction('getResearchBudget', $pl);
|
||||
$a = array_merge($a, $b);
|
||||
return join('#', $a);
|
||||
}
|
||||
|
||||
function validateBudget($b) {
|
||||
if (gameAction('isOnVacation', $_SESSION[game::sessName()]['player'])) {
|
||||
return "ERR#200";
|
||||
}
|
||||
|
||||
$a = split('#', $b);
|
||||
if (count($a) != 3) {
|
||||
return "ERR#0";
|
||||
}
|
||||
$s = 0;
|
||||
for ($i=0;$i<count($a);$i++) {
|
||||
$s += $a[$i];
|
||||
if ((int)$a[$i] != $a[$i] || $a[$i] < 0 || $s > 100) {
|
||||
return "ERR#0";
|
||||
}
|
||||
}
|
||||
gameAction('setResearchBudget', $_SESSION[game::sessName()]['player'], $a);
|
||||
return "OK";
|
||||
}
|
||||
|
||||
function getDiplomacyData()
|
||||
{
|
||||
$pl = $_SESSION[game::sessName()]['player'];
|
||||
$pr = gameAction('isPlayerRestrained', $pl);
|
||||
if ($pr > 0)
|
||||
return $pr;
|
||||
|
||||
$impl = gameAction('getResearchTopics', $pl, 1);
|
||||
$impl = array_merge($impl, gameAction('getResearchTopics', $pl, 0));
|
||||
$time = $this->game->ticks['day']->interval - $this->game->ticks['hour']->interval * 2;
|
||||
$s1 = $time . "\n" . join('#',$impl);
|
||||
$laws = gameAction('getLaws', $pl);
|
||||
for ($i=0;$i<count($laws);$i+=2)
|
||||
{
|
||||
if ($s1 != "")
|
||||
$s1 .= "#";
|
||||
$s1 .= $laws[$i];
|
||||
}
|
||||
|
||||
$ol = gameAction('getResearchOffers', $pl);
|
||||
$str = "";
|
||||
foreach ($ol as $o)
|
||||
{
|
||||
$str .= "\n".$o['id']."#".$o['type']."#".$o['status']."#".$o['price']."#".$o['tech']."#".$o['time'];
|
||||
$str .= "#".$o['pending']."\n".$o['player'];
|
||||
}
|
||||
if ($str == "")
|
||||
$str = "\n";
|
||||
$str = $s1.$str;
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function sendOffer($ty, $tid, $pname, $pr) {
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
$cpid = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
if ($pLib->call('isOnVacation', $cpid)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $cpid)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
$pname = trim($pname);
|
||||
if ($pname == "") {
|
||||
return "ERR#2";
|
||||
}
|
||||
|
||||
$tpid = $pLib->call('getPlayerId', $pname);
|
||||
if (is_null($tpid)) {
|
||||
return "ERR#4";
|
||||
} elseif ($tpid == $cpid) {
|
||||
return "ERR#6";
|
||||
}
|
||||
|
||||
$tLib = $this->game->getLib('beta5/tech');
|
||||
if ($ty == 0) {
|
||||
$tid = null;
|
||||
} elseif ($ty == 1) {
|
||||
$tid = (int)$tid;
|
||||
if (!$tLib->call('has', $cpid, $tid)) {
|
||||
logText("*** CHEAT? research::sendOffer: player $cpid trying to send tech $tid");
|
||||
return "ERR#5";
|
||||
}
|
||||
} else {
|
||||
logText("*** CHEAT? research::sendOffer: player $cpid, received invalid status '$ty'");
|
||||
return "ERR#8";
|
||||
}
|
||||
|
||||
if ("$pr" != (int)$pr || $pr < 0) {
|
||||
return "ERR#3";
|
||||
}
|
||||
if ($tLib->call('checkOffer', $cpid)) {
|
||||
logText("*** CHEAT? research::sendOffer: player $cpid has already sent an offer");
|
||||
return "ERR#9";
|
||||
}
|
||||
|
||||
if ($pLib->call('isOnVacation', $tpid)) {
|
||||
return "ERR#7";
|
||||
} elseif ($pLib->call('getProtectionLevel', $tpid)) {
|
||||
return "ERR#10";
|
||||
}
|
||||
|
||||
$tLib->call('makeOffer', $cpid, $tpid, $tid, $pr);
|
||||
|
||||
return $this->getDiplomacyData();
|
||||
}
|
||||
|
||||
function acceptOffer($oid) {
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
if ($pLib->call('isOnVacation', $pid)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $pid)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
$oid = (int)$oid;
|
||||
$a = gameAction('acceptResearchOffer', $pid, $oid);
|
||||
if ($a)
|
||||
return "ERR#$a";
|
||||
return $this->getDiplomacyData();
|
||||
}
|
||||
|
||||
function declineOffer($oid) {
|
||||
$pLib = $this->game->getLib('beta5/player');
|
||||
$pid = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
if ($pLib->call('isOnVacation', $pid)) {
|
||||
return "ERR#200";
|
||||
} elseif ($pLib->call('getProtectionLevel', $pid)) {
|
||||
return "ERR#201";
|
||||
}
|
||||
|
||||
$oid = (int)$oid;
|
||||
$a = gameAction('declineResearchOffer', $pid, $oid);
|
||||
if ($a)
|
||||
return "ERR#$a";
|
||||
return $this->getDiplomacyData();
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
switch ($input['mode']) :
|
||||
case 't':
|
||||
$this->setMode('Topics');
|
||||
break;
|
||||
case 'l':
|
||||
$this->setMode('Laws');
|
||||
break;
|
||||
case 'b':
|
||||
$this->setMode('Attributions');
|
||||
break;
|
||||
case 'd':
|
||||
$this->setMode('Diplomacy');
|
||||
break;
|
||||
default:
|
||||
$this->guessResearchMode($input);
|
||||
endswitch;
|
||||
$this->output = "research";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
490
scripts/site/beta5/handlers/techtrade.inc
Normal file
490
scripts/site/beta5/handlers/techtrade.inc
Normal file
|
@ -0,0 +1,490 @@
|
|||
<?php
|
||||
|
||||
|
||||
class page_handler {
|
||||
|
||||
/* Engine data */
|
||||
public $needsAuth = true;
|
||||
public $ajax = array(
|
||||
"func" => array(
|
||||
// General information
|
||||
"getGeneralInfo", "getTechList",
|
||||
// Main page
|
||||
"getSubmitPage", "submitList", "sendOffer",
|
||||
// Requests page
|
||||
"getRequestsPage", "submitRequests",
|
||||
// Alliance-wide listing
|
||||
"getAllianceList", "setListOptions",
|
||||
// Viewing orders
|
||||
"getCurrentOrders",
|
||||
// Changing orders
|
||||
"getChangeOrdersData", "submitOrders"
|
||||
),
|
||||
"init" => "new TechTrade(document.getElementById('init-data').value)"
|
||||
);
|
||||
|
||||
/* Valid pages */
|
||||
static private $subPages = array(
|
||||
"Submit", "Req", "ViewList", "SOrders", "VOrders"
|
||||
);
|
||||
|
||||
/* Libraries */
|
||||
private $pLib;
|
||||
private $aLib;
|
||||
private $rLib;
|
||||
|
||||
/* Player information */
|
||||
private $player;
|
||||
private $pInfo;
|
||||
private $vacation;
|
||||
private $alliance;
|
||||
private $hasRequests;
|
||||
private $accessLevel;
|
||||
|
||||
/** This function initialises the libraries
|
||||
* and checks the current player's privileges
|
||||
* with regards to technology trading.
|
||||
*/
|
||||
private function init() {
|
||||
// Get libraries
|
||||
$this->pLib = $this->game->getLib('beta5/player');
|
||||
$this->aLib = $this->game->getLib('beta5/alliance');
|
||||
$this->rLib = $this->game->getLib('beta5/tech');
|
||||
|
||||
// Get player information
|
||||
$this->player = $_SESSION[game::sessName()]['player'];
|
||||
$this->pInfo = $this->pLib->call('get', $this->player);
|
||||
$this->vacation = $this->pLib->call('isOnVacation', $this->player);
|
||||
$this->alliance = $this->pInfo['aid'];
|
||||
$alInfo = $this->aLib->call('get', $this->alliance);
|
||||
$this->hasRequests = ($alInfo['enable_tt'] == 'R');
|
||||
if (is_null($this->alliance)) {
|
||||
$this->accessLevel = 0;
|
||||
} else {
|
||||
$privileges = $this->aLib->call('getPrivileges', $this->player);
|
||||
$this->accessLevel = $privileges['tech_trade'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** This method tries to set the current sub-page being viewed, accounting for
|
||||
* the user's privileges.
|
||||
*/
|
||||
private function currentPage($page = null) {
|
||||
// If we're not trying to change page or if we're trying to set an invalid page,
|
||||
// fetch the current page from the session.
|
||||
if (is_null($page) || !in_array($page, self::$subPages)) {
|
||||
$page = $_SESSION[game::sessName()]['tt_page'];
|
||||
}
|
||||
|
||||
// Check privileges
|
||||
switch ($page) {
|
||||
case 'Submit': $ok = ($this->accessLevel > 0); break;
|
||||
case 'Req': $ok = ($this->accessLevel > 1 && $this->hasRequests); break;
|
||||
case 'ViewList': $ok = ($this->accessLevel > 2); break;
|
||||
case 'SOrders': $ok = ($this->accessLevel > 3); break;
|
||||
case 'VOrders': $ok = ($this->accessLevel > 3); break;
|
||||
default: $ok = false; break;
|
||||
}
|
||||
|
||||
// If the privileges are invalid, set the page
|
||||
if (!$ok) {
|
||||
if ($this->accessLevel == 0) {
|
||||
$page = 'NoAccess';
|
||||
} else {
|
||||
$page = 'Submit';
|
||||
}
|
||||
}
|
||||
|
||||
return ($_SESSION[game::sessName()]['tt_page'] = $page);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* General information retrieval *
|
||||
***************************************************************************************/
|
||||
|
||||
/** This AJAX function reads the information about the player and returns
|
||||
* it. It allows the page to "know" what to display.
|
||||
*/
|
||||
public function getGeneralInfo() {
|
||||
// Initialise the handler
|
||||
$this->init();
|
||||
|
||||
// Get the current page
|
||||
$page = $this->currentPage();
|
||||
|
||||
$requests = ($this->hasRequests ? 1 : 0);
|
||||
return "$page#{$this->accessLevel}#$requests#{$this->alliance}#" . ($this->vacation ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
/** This AJAX function returns the complete list of technologies as pairs
|
||||
* of ID / Name lines.
|
||||
*/
|
||||
public function getTechList() {
|
||||
// Prevent people from loading the list just for the sake of it
|
||||
if ($_SESSION[game::sessName()]['tt_list']) {
|
||||
return "";
|
||||
}
|
||||
$_SESSION[game::sessName()]['tt_list'] = true;
|
||||
|
||||
// Initialise the handler and get the language
|
||||
$this->init();
|
||||
$language = getLanguage();
|
||||
|
||||
// Get the list
|
||||
$techList = $this->rLib->call('getAll', $language);
|
||||
|
||||
// Create the result
|
||||
$result = array();
|
||||
foreach ($techList as $id => $data) {
|
||||
$line = array($id, count($data['deps']));
|
||||
$line = array_merge($line, $data['deps']);
|
||||
array_push($line, utf8entities($data['name']));
|
||||
array_push($result, join('#', $line));
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* Submission / view orders page *
|
||||
***************************************************************************************/
|
||||
|
||||
/** This is the actual method that generates the output for the submission page.
|
||||
*/
|
||||
private function __submitPage() {
|
||||
$result = array();
|
||||
|
||||
// Get last submission date
|
||||
list($canSubmit, $lastSubmission, $nextSubmission) = $this->aLib->call(
|
||||
'getTechSubmission', $this->player);
|
||||
array_push($result, ($canSubmit ? 1 : 0) . "#$lastSubmission#$nextSubmission");
|
||||
|
||||
// Get orders
|
||||
list($sendWhat, $toWhom, $sDate, $oDate) = $this->aLib->call('getTechOrder', $this->player, true);
|
||||
if ($toWhom) {
|
||||
$toName = $this->pLib->call('getName', $toWhom);
|
||||
if (!$oDate) {
|
||||
$canSend = !($this->vacation || $this->rLib->call('checkOffer', $this->player)) ? 1 : 0;
|
||||
} else {
|
||||
$canSend = 0;
|
||||
}
|
||||
array_push($result, "$sDate#$oDate#$canSend#$sendWhat#$toWhom#" . utf8entities($toName));
|
||||
} else {
|
||||
array_push($result, "-");
|
||||
}
|
||||
|
||||
list($getWhat, $fromWhom, $sDate, $oDate) = $this->aLib->call('getTechOrder', $this->player, false);
|
||||
if ($fromWhom) {
|
||||
$fromName = $this->pLib->call('getName', $fromWhom);
|
||||
array_push($result, "$sDate#$oDate#$getWhat#$fromWhom#" . utf8entities($fromName));
|
||||
} else {
|
||||
array_push($result, "-");
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
|
||||
/** This AJAX function returns the contents for the submission page.
|
||||
*/
|
||||
public function getSubmitPage() {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('Submit');
|
||||
if ($page != 'Submit') {
|
||||
return "FU";
|
||||
}
|
||||
|
||||
return $this->__submitPage();
|
||||
}
|
||||
|
||||
|
||||
/** This AJAX function submits a player's technology list to his alliance
|
||||
*/
|
||||
public function submitList() {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('Submit');
|
||||
if ($page != 'Submit') {
|
||||
return "FU";
|
||||
}
|
||||
$result = array();
|
||||
|
||||
// Check if the player can submit
|
||||
list($canSubmit, $lastSubmission, $nextSubmission) = $this->aLib->call(
|
||||
'getTechSubmission', $this->player);
|
||||
if ($this->vacation || ! $canSubmit) {
|
||||
return $this->__submitPage();
|
||||
}
|
||||
|
||||
// Submit the list
|
||||
$this->aLib->call('submitTechList', $this->player);
|
||||
return $this->__submitPage();
|
||||
}
|
||||
|
||||
|
||||
/** This AJAX function causes a player to obey his tech trading order.
|
||||
*/
|
||||
public function sendOffer() {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('Submit');
|
||||
if ($page != 'Submit') {
|
||||
return "FU";
|
||||
}
|
||||
$result = array();
|
||||
|
||||
// Check if the player can submit
|
||||
list($sendWhat, $toWhom, $sDate, $oDate) = $this->aLib->call('getTechOrder', $this->player, true);
|
||||
if ($toWhom) {
|
||||
$canSend = !($oDate || $this->vacation || $this->rLib->call('checkOffer', $this->player));
|
||||
if ($canSend) {
|
||||
$this->rLib->call('makeOffer', $this->player, $toWhom, $sendWhat, 0);
|
||||
$this->aLib->call('obeyOrder', $this->player);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->__submitPage();
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* Player requests page *
|
||||
***************************************************************************************/
|
||||
|
||||
/** This method generates the actual requests page data.
|
||||
*/
|
||||
private function __requestsPage() {
|
||||
// Get requests
|
||||
$requests = $this->aLib->call('getTechRequests', $this->player);
|
||||
|
||||
// Get techs the player could request
|
||||
$requestable = $this->rLib->call('getAvailableTechs', $this->player);
|
||||
|
||||
return join('#', $requests) . "\n" . join('#', $requestable);
|
||||
}
|
||||
|
||||
|
||||
/** This AJAX function returns the contents for the requests page.
|
||||
*/
|
||||
public function getRequestsPage() {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('Req');
|
||||
if ($page != 'Req') {
|
||||
return "FU";
|
||||
}
|
||||
|
||||
// Make sure the requests have been updated
|
||||
$this->aLib->call('updateRequests', $this->player);
|
||||
return $this->__requestsPage();
|
||||
}
|
||||
|
||||
/** This AJAX function updates a player's technology requests.
|
||||
*/
|
||||
public function submitRequests($requests = "") {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('Req');
|
||||
if ($page != 'Req') {
|
||||
return "FU";
|
||||
}
|
||||
|
||||
// Parse the list
|
||||
$requestable = $this->rLib->call('getAvailableTechs', $this->player);
|
||||
$rawList = explode('#', $requests);
|
||||
$list = array();
|
||||
foreach ($rawList as $techID) {
|
||||
$techID = (int) $techID;
|
||||
if (in_array($techID, $list) || !in_array($techID, $requestable)) {
|
||||
continue;
|
||||
}
|
||||
array_push($list, $techID);
|
||||
}
|
||||
|
||||
// Make sure the requests have been updated
|
||||
$this->aLib->call('setTechRequests', $this->player, $list);
|
||||
return $this->__requestsPage();
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* Alliance tech list page *
|
||||
***************************************************************************************/
|
||||
|
||||
public function __allianceList() {
|
||||
// Get the list itself
|
||||
$aList = $this->aLib->call('getTechList', $this->alliance, $this->hasRequests);
|
||||
|
||||
// Generate the output string
|
||||
$result = array(count($aList));
|
||||
foreach ($aList as $player => $techData) {
|
||||
array_push($result, "$player#{$techData['vacation']}#{$techData['submitted']}#"
|
||||
. "{$techData['restrict']}#" . count($techData['list']) . "#"
|
||||
. utf8entities($this->pLib->call('getName', $player)));
|
||||
|
||||
foreach ($techData['list'] as $tech => $status) {
|
||||
array_push($result, "$tech#$status");
|
||||
}
|
||||
|
||||
if (is_null($techData['requests'])) {
|
||||
array_push($result, "");
|
||||
} else {
|
||||
array_push($result, join('#', $techData['requests']));
|
||||
}
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
public function getAllianceList($oldMD5 = "") {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('ViewList');
|
||||
if ($page != 'ViewList') {
|
||||
return "FU";
|
||||
}
|
||||
|
||||
$rVal = $this->__allianceList();
|
||||
$newMD5 = md5($rVal);
|
||||
$nTechs = prefs::get("beta5/ttTechs", 10);
|
||||
$nPlayers = prefs::get("beta5/ttPlayers", 3);
|
||||
return ($oldMD5 == $newMD5) ? "NC" : "$newMD5\n$nTechs#$nPlayers\n$rVal";
|
||||
}
|
||||
|
||||
public function setListOptions($playersPerPage, $techsPerPage) {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('ViewList');
|
||||
if ($page != 'ViewList') {
|
||||
return;
|
||||
}
|
||||
|
||||
$ppp = min(10, max(2, (int) $playersPerPage));
|
||||
prefs::set("beta5/ttPlayers", $ppp);
|
||||
|
||||
$tpp = min(8, max(1, floor((int) $techsPerPage / 10))) * 10;
|
||||
prefs::set("beta5/ttTechs", $tpp);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* Order viewing and management *
|
||||
***************************************************************************************/
|
||||
|
||||
private function __getOrders() {
|
||||
// Get list of orders
|
||||
$orders = $this->aLib->call('getTechOrders', $this->alliance, $this->hasRequests);
|
||||
|
||||
// Generate output
|
||||
$result = array();
|
||||
foreach ($orders as $player => $pRecord) {
|
||||
$pName = $this->pLib->call('getName', $player);
|
||||
array_push($result, "$player#{$pRecord['sendTo']}#{$pRecord['sendTech']}"
|
||||
."#{$pRecord['sendSub']}#{$pRecord['sendDone']}"
|
||||
. "#{$pRecord['recvFrom']}#{$pRecord['recvTech']}"
|
||||
. "#{$pRecord['recvSub']}#{$pRecord['recvDone']}#" . utf8entities($pName));
|
||||
}
|
||||
|
||||
return join("\n", $result);
|
||||
}
|
||||
|
||||
public function getCurrentOrders($oldMD5 = "") {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('VOrders');
|
||||
if ($page != 'VOrders') {
|
||||
return;
|
||||
}
|
||||
|
||||
$rVal = $this->__getOrders();
|
||||
$newMD5 = md5($rVal);
|
||||
return ($oldMD5 == $newMD5) ? "NC" : "$newMD5\n$rVal";
|
||||
}
|
||||
|
||||
|
||||
public function getChangeOrdersData($oldMD5 = "") {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('SOrders');
|
||||
if ($page != 'SOrders') {
|
||||
return "FU";
|
||||
}
|
||||
|
||||
list($lastSet, $nextSet) = $this->aLib->call('getLatestTechOrders', $this->alliance);
|
||||
$rVal = "$lastSet#$nextSet";
|
||||
if ($nextSet == 0) {
|
||||
$rVal .= "\n" . $this->__allianceList();
|
||||
}
|
||||
|
||||
$newMD5 = md5($rVal);
|
||||
return ($oldMD5 == $newMD5) ? "NC" : "$newMD5\n$rVal";
|
||||
}
|
||||
|
||||
|
||||
public function submitOrders($orderString) {
|
||||
// Initialise page
|
||||
$this->init();
|
||||
$page = $this->currentPage('SOrders');
|
||||
if ($page != 'SOrders') {
|
||||
return "FU";
|
||||
}
|
||||
|
||||
// If the order string is not empty, extract orders
|
||||
$pfx = '';
|
||||
if ($orderString != '') {
|
||||
$oList = explode('!', $orderString);
|
||||
$orders = array();
|
||||
foreach ($oList as $oText) {
|
||||
$order = explode('#', $oText);
|
||||
if (count($order) != 3) {
|
||||
$pfx = "ERR";
|
||||
break;
|
||||
}
|
||||
|
||||
$order[0] = (int)$order[0];
|
||||
$order[1] = (int)$order[1];
|
||||
$order[2] = (int)$order[2];
|
||||
|
||||
$id = array_shift($order);
|
||||
if (array_key_exists($id, $orders)) {
|
||||
$pfx = "ERR";
|
||||
break;
|
||||
}
|
||||
$orders[$id] = $order;
|
||||
}
|
||||
if ($pfx == '') {
|
||||
$pfx = $this->aLib->call('submitTechOrders', $this->alliance, $orders) ? '' : 'ERR';
|
||||
}
|
||||
} else {
|
||||
$pfx = 'ERR';
|
||||
}
|
||||
|
||||
list($lastSet, $nextSet) = $this->aLib->call('getLatestTechOrders', $this->alliance);
|
||||
$rVal = "$lastSet#$nextSet";
|
||||
if ($nextSet == 0) {
|
||||
$rVal .= "\n" . $this->__allianceList();
|
||||
}
|
||||
$pfx .= md5($rVal);
|
||||
return "$pfx\n$rVal";
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* Main page handler *
|
||||
***************************************************************************************/
|
||||
|
||||
public function handle($input) {
|
||||
$_SESSION[game::sessName()]['tt_list'] = false;
|
||||
$this->output = "techtrade";
|
||||
$this->data = $this->getGeneralInfo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
32
scripts/site/beta5/handlers/ticks.inc
Normal file
32
scripts/site/beta5/handlers/ticks.inc
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
class page_handler
|
||||
{
|
||||
var $needsAuth = true;
|
||||
var $ajax = array(
|
||||
'init' => 'readInitString()',
|
||||
'func' => array('updateTicks')
|
||||
);
|
||||
|
||||
function updateTicks()
|
||||
{
|
||||
$tickLib = $this->game->getLib('main');
|
||||
$tinf = $tickLib->call('getTicks', getLanguage());
|
||||
$now = time();
|
||||
$dt = array($now);
|
||||
foreach ($ticks as $tid => $td)
|
||||
if ($td['game'])
|
||||
array_push($dt, "$tid#" . $td['last']);
|
||||
return join('#', $dt);
|
||||
}
|
||||
|
||||
function handle($input)
|
||||
{
|
||||
$lang = getLanguage();
|
||||
$tickLib = $this->game->getLib('main');
|
||||
$this->data = $tickLib->call('getTicks', getLanguage());
|
||||
$this->output = "ticks";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
31
scripts/site/beta5/handlers/universe.inc
Normal file
31
scripts/site/beta5/handlers/universe.inc
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
class page_handler {
|
||||
public $needsAuth = true;
|
||||
public $ajax = array(
|
||||
'func' => array('getInformation'),
|
||||
'init' => 'initPage();'
|
||||
);
|
||||
|
||||
public function getInformation() {
|
||||
$universe = $this->game->action('getUniverseOverview',
|
||||
$_SESSION[game::sessName()]['player'], getLanguage()
|
||||
);
|
||||
|
||||
$ticks = array();
|
||||
foreach ($universe['ticks'] as $tick) {
|
||||
array_push($ticks, join('#', $tick));
|
||||
}
|
||||
|
||||
$main = array(join('#', $universe['summary']), join('#', $universe['rankings']), time());
|
||||
|
||||
return join("\n", array_merge($main, $ticks));
|
||||
}
|
||||
|
||||
public function handle($input) {
|
||||
$this->data = $this->getInformation();
|
||||
$this->output = "universe";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
19
scripts/site/beta5/layout/classic/ajax.inc
Normal file
19
scripts/site/beta5/layout/classic/ajax.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?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']}";
|
||||
}
|
||||
|
||||
|
||||
return array(
|
||||
"func" => array('getHeaderData'),
|
||||
"init" => "thmcls_writeHeader(document.getElementById('thm-hdr-init').value);"
|
||||
);
|
||||
|
||||
?>
|
0
scripts/site/beta5/layout/classic/footer.en.inc
Normal file
0
scripts/site/beta5/layout/classic/footer.en.inc
Normal file
72
scripts/site/beta5/layout/classic/header.en.inc
Normal file
72
scripts/site/beta5/layout/classic/header.en.inc
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
$game = input::$game;
|
||||
$accounts = $game->getLib('main/account');
|
||||
$players = $game->getLib('beta5/player');
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
?>
|
||||
<div style="visibility:hidden;display:none"><form action="?" onsubmit="return false"><textarea id="thm-hdr-init"><?
|
||||
|
||||
echo thm_getHeaderData();
|
||||
|
||||
?></textarea></form></div>
|
||||
<table cellspacing='0' cellpadding='0'>
|
||||
<tr><td><table class='player' cellspacing='0' cellpadding='0'><tr>
|
||||
<td class='player'><span<?=tooltip('Your player name as well as the tag of the alliance you are a member of.');?>>Player <b id='jspname'></b><span id='jsalliance'></span></td>
|
||||
<td style="width: 20%;text-align:center"><?php
|
||||
|
||||
if ($accounts->call('isAdmin', $_SESSION['userid'])) {
|
||||
echo "<a href='admin'>Administration</a>";
|
||||
} else {
|
||||
echo " ";
|
||||
}
|
||||
|
||||
?></td>
|
||||
<td class='stime'><span<?=tooltip('Date and time on the Legacy Worlds server; this gives you a reference which allows you to synchronize your actions with players from the other side of the Earth.');?>>Server time: <span id='jsservtm'></span></span></td>
|
||||
</tr></table></td></tr>
|
||||
<tr><td><table class='topmenu'>
|
||||
<tr>
|
||||
<td colspan="2"><a href="overview"><h1>Overview</h1></a></td>
|
||||
<td colspan="2"><a href="fleets"><h1>Fleets</h1></a></td>
|
||||
<td colspan="2"><a href="alliance"><h1>Alliance</h1></a></td>
|
||||
<td colspan="2" id="msgmenu"><a href="message?a=f&f=I"><h1>Messages</h1></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><a href="planets"><h1>Planets</h1></a></td>
|
||||
<td colspan="2"><a href="research"><h1>Research</h1></a></td>
|
||||
<td colspan="2"><a href="market"><h1>Marketplace</h1></a></td>
|
||||
<td colspan="2"><a href="forums"><h1>Forums</h1></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom"><a href="money"><h1>Money</h1></a></td>
|
||||
<td class="bottom"><a href="probes"><h1>Beacons</h1></a></td>
|
||||
<td class="bottom"><a href="map"><h1>Maps</h1></a></td>
|
||||
<td class="bottom"><a href="rank"><h1>Rankings</h1></a></td>
|
||||
<td class="bottom"><a href="enemylist"><h1>Enemies</h1></a></td>
|
||||
<td class="bottom"><a href="allies"><h1>Allies</h1></a></td>
|
||||
<td class="bottom"><a href="preferences"><h1>Preferences</h1></a></td>
|
||||
<td class="bottom"><a href="<?=makeLink('logout', 'main')?>"><h1>Log out</h1></a></td>
|
||||
</tr>
|
||||
</table></td></tr>
|
||||
<tr><td><table><tr>
|
||||
<td class="funds"><span<?=tooltip('The money you currently own.')?>>Current funds: <b id='jscash'></b></span></td>
|
||||
<td style="width:34%;text-align:center;color:red;font-weight:bold;padding:5px 5px 5px 0px" id="hdrvmode"><?php
|
||||
|
||||
$pinf = $players->call('get', $player);
|
||||
if ($accounts->call('getQuitCountdown', $_SESSION['userid'])) {
|
||||
echo "CLOSING ACCOUNT";
|
||||
} else if (!is_null($pinf['qts'])) {
|
||||
echo "LEAVING GAME";
|
||||
} else if ($players->call('isOnVacation', $player)) {
|
||||
echo "ON VACATION";
|
||||
} else if ($players->call('getProtectionLevel', $player)) {
|
||||
echo "UNDER PROTECTION";
|
||||
} else {
|
||||
echo " ";
|
||||
}
|
||||
|
||||
?></td>
|
||||
<td style="width:33%;text-align:right; padinng: 5px 5px 5px 0px"><i>Game: <?=$game->text?></i></td>
|
||||
</tr></table></td></tr>
|
||||
</table>
|
19
scripts/site/beta5/layout/cripes/ajax.inc
Normal file
19
scripts/site/beta5/layout/cripes/ajax.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?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']}";
|
||||
}
|
||||
|
||||
|
||||
return array(
|
||||
"func" => array('getHeaderData'),
|
||||
"init" => "thmcrp_writeHeader(document.getElementById('thm-hdr-init').value);"
|
||||
);
|
||||
|
||||
?>
|
1
scripts/site/beta5/layout/cripes/footer.en.inc
Normal file
1
scripts/site/beta5/layout/cripes/footer.en.inc
Normal file
|
@ -0,0 +1 @@
|
|||
<div style="color:black;background-color:black">[...] if you think this game is a 'copy' of any other game, then you are mistaken, and you should seek psycological help [...] -- El Christoph</div>
|
102
scripts/site/beta5/layout/cripes/header.en.inc
Normal file
102
scripts/site/beta5/layout/cripes/header.en.inc
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
function getCripesBanner() {
|
||||
$c = prefs::get('main/colour', 'purple');
|
||||
return getStatic("beta5/pics/that-other-theme-$c.png");
|
||||
}
|
||||
|
||||
function getCripesTech() {
|
||||
$c = prefs::get('main/colour', 'purple');
|
||||
if (input::$IE) {
|
||||
$ext = "gif";
|
||||
} else {
|
||||
$ext = "png";
|
||||
}
|
||||
return getStatic("beta5/pics/lw-tot-tech-$c.$ext");
|
||||
}
|
||||
|
||||
function getCripesLink($name, $title, $colspan, $width, $class = '', $id = "") {
|
||||
$cPage = handler::$h->output;
|
||||
return "<td" . ($colspan > 1 ? " colspan='$colspan'" : "") . ($class == "" ? "" : " class='$class'")
|
||||
. ($id == "" ? "" : " id='$id'")
|
||||
. " style='width: $width' onclick='location.href=\"$name\"'><a href=\"$name\"><h1"
|
||||
. ($cPage == $name ? " class='crpsel'" : "") . ">$title</h1></a></td>\n";
|
||||
}
|
||||
|
||||
$game = input::$game;
|
||||
$accounts = $game->getLib('main/account');
|
||||
$players = $game->getLib('beta5/player');
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
|
||||
?>
|
||||
<div style="visibility:hidden;display:none"><form action="?" onsubmit="return false"><textarea id="thm-hdr-init"><?
|
||||
|
||||
echo thm_getHeaderData();
|
||||
|
||||
?></textarea></form></div>
|
||||
<div style="background-color:black;background-image: url(<?=getCripesBanner()?>); background-repeat: no-repeat; height: 82px;margin: 0px;padding:22px 0px 60px 30px">
|
||||
<table class='crpmenu' cellpadding="0" cellspacing="1">
|
||||
<tr>
|
||||
<td rowspan="6" class="crptech"><a href="research"><img src="<?=getCripesTech()?>" alt="Research" style="border: none"/></a></td>
|
||||
<td rowspan="6" style="width:30px"> </td>
|
||||
<?php
|
||||
if ($accounts->call('isAdmin', $_SESSION['userid'])) {
|
||||
?>
|
||||
<td colspan="2" class="stime"> </td>
|
||||
<?php
|
||||
print getCripesLink('admin', 'Administration', 2, '180px');
|
||||
} else {
|
||||
?>
|
||||
<td colspan="4" class="stime"> </td>
|
||||
<?php
|
||||
}
|
||||
|
||||
?></td>
|
||||
<td colspan="4" class="stime">Server time: <span id='jsservtm'></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?=getCripesLink('overview', 'Overview', 2, '180px')?>
|
||||
<?=getCripesLink('empire', 'Empire', 2, '180px')?>
|
||||
<?=getCripesLink('alliance', 'Alliance', 2, '180px')?>
|
||||
<?=getCripesLink('forums', 'Forums', 2, '180px')?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?=getCripesLink('planets', 'Planets', 2, '180px')?>
|
||||
<?=getCripesLink('market', 'Market', 2, '180px')?>
|
||||
<?=getCripesLink('map', 'Galactic maps', 2, '180px')?>
|
||||
<?=getCripesLink('rank', 'Rankings', 2, '180px')?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?=getCripesLink('fleets', 'Fleets', 2, '180px')?>
|
||||
<?=getCripesLink('probes', 'Beacons', 2, '180px')?>
|
||||
<?=getCripesLink('enemylist', 'Enemy list', 2, '180px')?>
|
||||
<?=getCripesLink('allies', 'Trusted allies', 2, '180px')?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?=getCripesLink('message', "<span id='jspname'></span><span id='jsalliance'></span>", 2, '180px', 'crpmsg', 'msgmenu')?>
|
||||
<?=getCripesLink('money', "Cash: <span id='jscash'></span>", 2, '180px', 'crpcash')?>
|
||||
<?=getCripesLink('preferences', "Preferences", 2, '180px', 'crpbt')?>
|
||||
<?=getCripesLink(makeLink('logout', 'main'), "Logout", 1, '90px', 'crpbt')?>
|
||||
<?=getCripesLink('manual', "Help", 1, '90px', 'crpbt')?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" style="font-weight: bold;text-align:center"><?php
|
||||
|
||||
$pinf = $players->call('get', $player);
|
||||
if ($accounts->call('getQuitCountdown', $_SESSION['userid'])) {
|
||||
echo "CLOSING ACCOUNT";
|
||||
} else if (!is_null($pinf['qts'])) {
|
||||
echo "LEAVING GAME";
|
||||
} else if ($players->call('isOnVacation', $player)) {
|
||||
echo "ON VACATION";
|
||||
} else if ($players->call('getProtectionLevel', $player)) {
|
||||
echo "UNDER PROTECTION";
|
||||
} else {
|
||||
echo " ";
|
||||
}
|
||||
|
||||
?></td>
|
||||
<td colspan="3" class="stime" style="text-align:right"><a href="<?=makeLink('index', 'main')?>">Account</a> - <i><?=$game->text?></i></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
40
scripts/site/beta5/layout/default/ajax.inc
Normal file
40
scripts/site/beta5/layout/default/ajax.inc
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?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();"
|
||||
);
|
||||
|
||||
?>
|
0
scripts/site/beta5/layout/default/footer.en.inc
Normal file
0
scripts/site/beta5/layout/default/footer.en.inc
Normal file
239
scripts/site/beta5/layout/default/header.en.inc
Normal file
239
scripts/site/beta5/layout/default/header.en.inc
Normal file
|
@ -0,0 +1,239 @@
|
|||
<?php
|
||||
|
||||
|
||||
function menuTopLevelBegin($t, $l, $tt = null) {
|
||||
static $b5menu = 0;
|
||||
if (is_string($tt)) {
|
||||
$te = " onmouseover=\"return escape('" . utf8entities($tt,ENT_QUOTES) . "')\"";
|
||||
} else {
|
||||
$te = "";
|
||||
}
|
||||
echo "<td><ul class='tmenu'><li class='tmenu'";
|
||||
if (input::$IE) {
|
||||
echo " onMouseOver='this.obc=this.style.backgroundColor;this.style.backgroundColor=\"black\";thmdef_ieDisplay(\"b5tl$b5menu\")'";
|
||||
echo " onMouseOut='this.style.backgroundColor=this.obc;thmdef_ieHide(\"b5tl$b5menu\")'";
|
||||
}
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "><a class='tmenu' href='$l'$te>$t</a><ul class='tmenu' id='b5tl$b5menu'>\n";
|
||||
$b5menu ++;
|
||||
}
|
||||
|
||||
function menuTopLevelEnd() {
|
||||
echo "</ul></li></ul></td>\n";
|
||||
}
|
||||
|
||||
function menuTopLevelEntry($t, $l, $tt = null) {
|
||||
$te = is_string($tt) ? tooltip($tt) : "";
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "<td><ul class='tmenu'><li class='tmenu'><a class='tmenu' href='$l'$te>$t</a></li></ul></td>\n";
|
||||
}
|
||||
|
||||
function menuEntry($t, $l, $tt = null) {
|
||||
$te = is_string($tt) ? tooltip($tt) : "";
|
||||
echo "<li class='tmenu'";
|
||||
if (input::$IE) {
|
||||
echo " onMouseOver='this.obc=this.style.backgroundColor;this.style.backgroundColor=\"black\";' onMouseOut='this.style.backgroundColor=this.obc'";
|
||||
}
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "><a class='tmenu' href='$l'$te>$t</a></li>\n";
|
||||
}
|
||||
|
||||
function menuSubBegin($t, $l, $tt = null, $sid = null) {
|
||||
$te = is_string($tt) ? tooltip($tt) : "";
|
||||
$id = ($sid == "") ? "" : " id='$sid'";
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "<li class='tmenu'><a class='tmenu' href='$l'$te>$t</a><ul class='tmenu'$id>\n";
|
||||
}
|
||||
|
||||
function menuSubEnd() {
|
||||
echo "</ul></li>\n";
|
||||
}
|
||||
|
||||
function drawIcon($n, $d) {
|
||||
$src = getStatic("beta5/pics/icons/$n." . (input::$IE ? 'gif' : 'png'));
|
||||
echo "<img class='icon' src='$src' alt=\"". utf8entities($d) .'" />';
|
||||
}
|
||||
|
||||
function drawTitle() {
|
||||
$n = handler::$h->output;
|
||||
$c = prefs::get('main/colour', 'purple');
|
||||
$src = getStatic("beta5/pics/ttl/def/en/$c/$n.gif");
|
||||
if (!is_null($src)) {
|
||||
echo "<img class='title' src='$src' alt=\"$n\" />";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$game = input::$game;
|
||||
$accounts = $game->getLib('main/account');
|
||||
$players = $game->getLib('beta5/player');
|
||||
$alliance = $game->getLib('beta5/alliance');
|
||||
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pInfo = $players->call('get', $player);
|
||||
if ($pInfo['aid']) {
|
||||
$privileges = $alliance->call('getPrivileges', $player);
|
||||
$techTrade = ($privileges['tech_trade'] > 0);
|
||||
} else {
|
||||
$techTrade = false;
|
||||
}
|
||||
$protected = $players->call('getProtectionLevel', $player);
|
||||
|
||||
|
||||
?>
|
||||
<div style="visibility:hidden;display:none"><form action="?" onsubmit="return false"><textarea id="thm-hdr-init"><?
|
||||
|
||||
echo thm_getHeaderData();
|
||||
|
||||
?></textarea><textarea id="thm-plist-init"><?
|
||||
|
||||
echo thm_getHeaderPList();
|
||||
|
||||
?></textarea></form></div>
|
||||
<table class='topframe' cellspacing='0' cellpadding='0'>
|
||||
<tr><td><table class='player' cellspacing='0' cellpadding='0'><tr>
|
||||
<td class='player'><span<?=tooltip('Your player name as well as the tag of the alliance you are a member of.');?>>Player <b id='jspname'></b><span id='jsalliance'></span></td>
|
||||
<td class='funds'><span<?=tooltip('The money you currently own.')?>>Current funds: <b id='jscash'></b></span></td>
|
||||
<td class='stime'><span<?=tooltip('Date and time on the Legacy Worlds server; this gives you a reference which allows you to synchronize your actions with players from the other side of the Earth.');?>>Server Time: <span id='jsservtm'></span></span></td>
|
||||
</tr></table></td></tr>
|
||||
<tr><td class='topmenu'><table cellspacing='0' cellpadding='0'><tr>
|
||||
<td><table cellspacing='0' cellpadding='0' class='topmenu'><tr>
|
||||
<?php
|
||||
menuTopLevelBegin('Overview', 'overview', 'This page gives an overview of the state of your empire.');
|
||||
menuEntry('Preferences', 'preferences', 'Change the way pages are displayed and modify in-game preferences.');
|
||||
menuEntry('My Account', makeLink('index','main'), 'Go back to your account management page.');
|
||||
menuEntry('Log out', makeLink('logout','main'), 'Log out from the game.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Empire', 'empire', 'Overview of your planets, fleets, and research.');
|
||||
if (input::$IE) {
|
||||
menuEntry('Planets', 'planets', 'Displays an overview of your planets and allows you to manipulate all of their build queues.');
|
||||
} else {
|
||||
menuSubBegin('Planets', 'planets', 'Displays an overview of your planets and allows you to manipulate all of their build queues.', 'jspmenu');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Fleets', 'fleets', 'Fleet management');
|
||||
menuEntry('Beacons', 'probes', 'Allows you to manage hyperspace beacons on your planets');
|
||||
if (input::$IE) {
|
||||
menuEntry('Research', 'research', 'Implement new technologies, enact and revoke laws, balance your research budget and exchange technologies and scientific knowlege with other empires.');
|
||||
} else {
|
||||
menuSubBegin('Research', 'research', 'Implement new technologies, enact and revoke laws, balance your research budget and exchange technologies and scientific knowlege with other empires.');
|
||||
menuEntry('Topics', 'research?p=t', 'Implement new technologies, view foreseen breakthroughs and already implemented technologies.');
|
||||
menuEntry('Laws', 'research?p=l', 'Enact and revoke laws.');
|
||||
menuEntry('Budget', 'research?p=b', 'Balance your research budget between fundamental, military and civilian research.');
|
||||
menuEntry('Diplomacy', 'research?p=d', 'Give or sell technologies and scientific knowledge with other empires, and examine offers made to you');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Money', 'money', 'This page shows the money you earn on the planets you own as well as the money you spend to maintain your fleets and infrastructure.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Diplomacy', 'diplomacy', 'Overview of your current diplomatic relations.');
|
||||
menuEntry('Alliance', 'alliance', 'Create, join, inspect, manage or spy on alliances.');
|
||||
if ($techTrade) {
|
||||
menuEntry('Tech. trading', 'techtrade', 'Alliance technology trading tool.');
|
||||
}
|
||||
if (!$players->call('isRestrained', $player)) {
|
||||
menuEntry('Marketplace', 'market', 'Sell stuff to other players and buy other stuff from them.');
|
||||
}
|
||||
menuEntry('Enemies', 'enemylist', 'Manage your enemy list.');
|
||||
menuEntry('Trusted Allies', 'allies', 'Manage your trusted allies list.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Universe', 'universe', 'Overview of the game universe.');
|
||||
if (input::$IE) {
|
||||
menuEntry('Maps', 'map', 'View the maps of the game universe.');
|
||||
menuEntry('Rankings', 'rank', 'View the rankings of players and alliances.');
|
||||
} else {
|
||||
menuSubBegin('Maps', 'map', 'View the maps of the game universe.');
|
||||
menuEntry('Planets', 'map?menu=p', 'View the planets in the current universe.');
|
||||
menuEntry('Alliances', 'map?menu=a', 'View planets belonging to alliances in the current universe.');
|
||||
menuEntry('Listing', 'map?menu=l', 'View a listing of the planets in the game universe.');
|
||||
menuSubEnd();
|
||||
menuSubBegin('Rankings', 'rank', 'View the rankings of players and alliances.');
|
||||
menuEntry('Summary', 'rank?p=s', 'Overview of your current ranking.');
|
||||
menuEntry('General', 'rank?p=g', 'Display general player rankings.');
|
||||
menuEntry('Detailed', 'rank?p=d', 'Display detailed player rankings.');
|
||||
menuEntry('Alliance', 'rank?p=a', 'Display alliance rankings.');
|
||||
menuEntry('Overall', 'rank?p=o', 'Display overall player rankings.');
|
||||
menuEntry('Damage', 'rank?p=i', 'Display inflicted damage rankings.');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Ticks', 'ticks', 'Display details about the ticks.');
|
||||
menuEntry('Manual', 'manual', 'The manual. Newbies, please read it. Seriously.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Communications', 'comms', 'An overview of your communications with other players');
|
||||
menuEntry('Compose', 'message?a=c', 'Compose a new private message.');
|
||||
menuEntry('Inbox', 'message?a=f&f=I', 'View the contents of your inbox.');
|
||||
if (input::$IE) {
|
||||
menuEntry('Transmissions', 'message?a=f&f=T', 'View internal transmissions');
|
||||
menuEntry('Folders', 'message?a=mf', 'Manage your custom folders.');
|
||||
} else {
|
||||
menuSubBegin('Folders', 'message?a=mf', 'Manage your custom folders.', 'jsfmenu');
|
||||
menuEntry('Transmissions', 'message?a=f&f=T', 'View internal transmissions');
|
||||
menuEntry('Outbox', 'message?a=f&f=O', 'View the messages you sent.');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Forums', 'forums?cmd=o', 'Access the forums.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
if ($accounts->call('isLeech', $_SESSION['userid'])) {
|
||||
menuTopLevelEntry('Contribute!', makeLink('contrib', 'main'), 'Contribute to LegacyWorlds!');
|
||||
}
|
||||
if ($accounts->call('isAdmin', $_SESSION['userid'])) {
|
||||
menuTopLevelEntry('Admin', 'admin', 'Administrative tools');
|
||||
}
|
||||
|
||||
?>
|
||||
</tr></table></td>
|
||||
<td id="msgicon"> </td>
|
||||
<td class='icons'><a
|
||||
href='planets'<?=tooltip('Manage your planets')?>><? drawIcon('planets', 'Planet management'); ?></a><a
|
||||
href='fleets'<?=tooltip('Manage your fleets')?>><? drawIcon('fleets', 'Fleet management'); ?></a><a
|
||||
href='map'<?=tooltip("View maps of the universe")?>><? drawIcon('map', 'Galactic maps'); ?></a><a
|
||||
href='alliance'<?=tooltip('Display information about your current alliance or allows you to join an alliance')?>><? drawIcon('alliance', 'Alliance panel'); ?></a><a
|
||||
href='../main/logout'<?=tooltip('Log out from the game')?>><? drawIcon('logout', 'Log out'); ?></a></td>
|
||||
</tr></table></td></tr>
|
||||
</table>
|
||||
<div style="text-align:center">
|
||||
<div style="float: right; padding: 2px 4px"><i>Game: <?=$game->text?></i></div>
|
||||
<table style="width:94%;height:30px;margin:0 2%">
|
||||
<tr>
|
||||
<?php
|
||||
|
||||
$pinf = $players->call('get', $player);
|
||||
if ($accounts->call('getQuitCountdown', $_SESSION['userid'])) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">CLOSING ACCOUNT</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">CLOSING ACCOUNT</td>
|
||||
<?php
|
||||
} else if (!is_null($pinf['qts'])) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">LEAVING GAME</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">LEAVING GAME</td>
|
||||
<?php
|
||||
} else if ($players->call('isOnVacation', $player)) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">ON VACATION</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">ON VACATION</td>
|
||||
<?php
|
||||
} else if ($protected) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">UNDER PROTECTION</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">UNDER PROTECTION</td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<hr/>
|
40
scripts/site/beta5/layout/invert/ajax.inc
Normal file
40
scripts/site/beta5/layout/invert/ajax.inc
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?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" => "thminv_writeHeader(document.getElementById('thm-hdr-init').value);thminv_writePlanets(document.getElementById('thm-plist-init').value);thminv_initFolders();"
|
||||
);
|
||||
|
||||
?>
|
0
scripts/site/beta5/layout/invert/footer.en.inc
Normal file
0
scripts/site/beta5/layout/invert/footer.en.inc
Normal file
239
scripts/site/beta5/layout/invert/header.en.inc
Normal file
239
scripts/site/beta5/layout/invert/header.en.inc
Normal file
|
@ -0,0 +1,239 @@
|
|||
<?php
|
||||
|
||||
|
||||
function menuTopLevelBegin($t, $l, $tt = null) {
|
||||
static $b5menu = 0;
|
||||
if (is_string($tt)) {
|
||||
$te = " onmouseover=\"return escape('" . utf8entities($tt,ENT_QUOTES) . "')\"";
|
||||
} else {
|
||||
$te = "";
|
||||
}
|
||||
echo "<td><ul class='tmenu'><li class='tmenu'";
|
||||
if (input::$IE) {
|
||||
echo " onMouseOver='this.obc=this.style.backgroundColor;this.style.backgroundColor=\"black\";thminv_ieDisplay(\"b5tl$b5menu\")'";
|
||||
echo " onMouseOut='this.style.backgroundColor=this.obc;thminv_ieHide(\"b5tl$b5menu\")'";
|
||||
}
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "><a class='tmenu' href='$l'$te>$t</a><ul class='tmenu' id='b5tl$b5menu'>\n";
|
||||
$b5menu ++;
|
||||
}
|
||||
|
||||
function menuTopLevelEnd() {
|
||||
echo "</ul></li></ul></td>\n";
|
||||
}
|
||||
|
||||
function menuTopLevelEntry($t, $l, $tt = null) {
|
||||
$te = is_string($tt) ? tooltip($tt) : "";
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "<td><ul class='tmenu'><li class='tmenu'><a class='tmenu' href='$l'$te>$t</a></li></ul></td>\n";
|
||||
}
|
||||
|
||||
function menuEntry($t, $l, $tt = null) {
|
||||
$te = is_string($tt) ? tooltip($tt) : "";
|
||||
echo "<li class='tmenu'";
|
||||
if (input::$IE) {
|
||||
echo " onMouseOver='this.obc=this.style.backgroundColor;this.style.backgroundColor=\"black\";' onMouseOut='this.style.backgroundColor=this.obc'";
|
||||
}
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "><a class='tmenu' href='$l'$te>$t</a></li>\n";
|
||||
}
|
||||
|
||||
function menuSubBegin($t, $l, $tt = null, $sid = null) {
|
||||
$te = is_string($tt) ? tooltip($tt) : "";
|
||||
$id = ($sid == "") ? "" : " id='$sid'";
|
||||
$t = preg_replace('/ /', ' ', $t);
|
||||
echo "<li class='tmenu'><a class='tmenu' href='$l'$te>$t</a><ul class='tmenu'$id>\n";
|
||||
}
|
||||
|
||||
function menuSubEnd() {
|
||||
echo "</ul></li>\n";
|
||||
}
|
||||
|
||||
function drawIcon($n, $d) {
|
||||
$src = getStatic("beta5/pics/icons/$n." . (input::$IE ? 'gif' : 'png'));
|
||||
echo "<img class='icon' src='$src' alt=\"". utf8entities($d) .'" />';
|
||||
}
|
||||
|
||||
|
||||
$game = input::$game;
|
||||
$accounts = $game->getLib('main/account');
|
||||
$players = $game->getLib('beta5/player');
|
||||
$alliance = $game->getLib('beta5/alliance');
|
||||
|
||||
$player = $_SESSION[game::sessName()]['player'];
|
||||
$pInfo = $players->call('get', $player);
|
||||
if ($pInfo['aid']) {
|
||||
$privileges = $alliance->call('getPrivileges', $player);
|
||||
$techTrade = ($privileges['tech_trade'] > 0);
|
||||
} else {
|
||||
$techTrade = false;
|
||||
}
|
||||
$protected = $players->call('getProtectionLevel', $player);
|
||||
|
||||
|
||||
?>
|
||||
<div style="visibility:hidden;display:none"><form action="?" onsubmit="return false"><textarea id="thm-hdr-init"><?
|
||||
|
||||
echo thm_getHeaderData();
|
||||
|
||||
?></textarea><textarea id="thm-plist-init"><?
|
||||
|
||||
echo thm_getHeaderPList();
|
||||
|
||||
?></textarea></form></div>
|
||||
<table class='itopframe' cellspacing='0' cellpadding='0'>
|
||||
<tr><td class='topmenu'><table cellspacing='0' cellpadding='0'><tr>
|
||||
<td><table cellspacing='0' cellpadding='0' class='topmenu'><tr>
|
||||
<?php
|
||||
menuTopLevelBegin('Overview', 'overview', 'This page gives an overview of the state of your empire.');
|
||||
menuEntry('Preferences', 'preferences', 'Change the way pages are displayed and modify in-game preferences.');
|
||||
menuEntry('My Account', makeLink('index','main'), 'Go back to your account management page.');
|
||||
menuEntry('Log out', makeLink('logout','main'), 'Log out from the game.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Empire', 'empire', 'Overview of your planets, fleets, and research.');
|
||||
if (input::$IE) {
|
||||
menuEntry('Planets', 'planets', 'Displays an overview of your planets and allows you to manipulate all of their build queues.');
|
||||
} else {
|
||||
menuSubBegin('Planets', 'planets', 'Displays an overview of your planets and allows you to manipulate all of their build queues.', 'jspmenu');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Fleets', 'fleets', 'Fleet management');
|
||||
menuEntry('Beacons', 'probes', 'Allows you to manage hyperspace beacons on your planets');
|
||||
if (input::$IE) {
|
||||
menuEntry('Research', 'research', 'Implement new technologies, enact and revoke laws, balance your research budget and exchange technologies and scientific knowlege with other empires.');
|
||||
} else {
|
||||
menuSubBegin('Research', 'research', 'Implement new technologies, enact and revoke laws, balance your research budget and exchange technologies and scientific knowlege with other empires.');
|
||||
menuEntry('Topics', 'research?p=t', 'Implement new technologies, view foreseen breakthroughs and already implemented technologies.');
|
||||
menuEntry('Laws', 'research?p=l', 'Enact and revoke laws.');
|
||||
menuEntry('Budget', 'research?p=b', 'Balance your research budget between fundamental, military and civilian research.');
|
||||
menuEntry('Diplomacy', 'research?p=d', 'Give or sell technologies and scientific knowledge with other empires, and examine offers made to you');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Money', 'money', 'This page shows the money you earn on the planets you own as well as the money you spend to maintain your fleets and infrastructure.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Diplomacy', 'diplomacy', 'Overview of your current diplomatic relations.');
|
||||
menuEntry('Alliance', 'alliance', 'Create, join, inspect, manage or spy on alliances.');
|
||||
if ($techTrade) {
|
||||
menuEntry('Tech. trading', 'techtrade', 'Alliance technology trading tool.');
|
||||
}
|
||||
if (!$players->call('isRestrained', $player)) {
|
||||
menuEntry('Marketplace', 'market', 'Sell stuff to other players and buy other stuff from them.');
|
||||
}
|
||||
menuEntry('Enemies', 'enemylist', 'Manage your enemy list.');
|
||||
menuEntry('Trusted Allies', 'allies', 'Manage your trusted allies list.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Universe', 'universe', 'Overview of the game universe.');
|
||||
if (input::$IE) {
|
||||
menuEntry('Maps', 'map', 'View the maps of the game universe.');
|
||||
menuEntry('Rankings', 'rank', 'View the rankings of players and alliances.');
|
||||
} else {
|
||||
menuSubBegin('Maps', 'map', 'View the maps of the game universe.');
|
||||
menuEntry('Planets', 'map?menu=p', 'View the planets in the current universe.');
|
||||
menuEntry('Alliances', 'map?menu=a', 'View planets belonging to alliances in the current universe.');
|
||||
menuEntry('Listing', 'map?menu=l', 'View a listing of the planets in the game universe.');
|
||||
menuSubEnd();
|
||||
menuSubBegin('Rankings', 'rank', 'View the rankings of players and alliances.');
|
||||
menuEntry('Summary', 'rank?p=s', 'Overview of your current ranking.');
|
||||
menuEntry('General', 'rank?p=g', 'Display general player rankings.');
|
||||
menuEntry('Detailed', 'rank?p=d', 'Display detailed player rankings.');
|
||||
menuEntry('Alliance', 'rank?p=a', 'Display alliance rankings.');
|
||||
menuEntry('Overall', 'rank?p=o', 'Display overall player rankings.');
|
||||
menuEntry('Damage', 'rank?p=i', 'Display inflicted damage rankings.');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Ticks', 'ticks', 'Display details about the ticks.');
|
||||
menuEntry('Manual', 'manual', 'The manual. Newbies, please read it. Seriously.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
menuTopLevelBegin('Communications', 'comms', 'An overview of your communications with other players');
|
||||
menuEntry('Compose', 'message?a=c', 'Compose a new private message.');
|
||||
menuEntry('Inbox', 'message?a=f&f=I', 'View the contents of your inbox.');
|
||||
if (input::$IE) {
|
||||
menuEntry('Transmissions', 'message?a=f&f=T', 'View internal transmissions');
|
||||
menuEntry('Folders', 'message?a=mf', 'Manage your custom folders.');
|
||||
} else {
|
||||
menuSubBegin('Folders', 'message?a=mf', 'Manage your custom folders.', 'jsfmenu');
|
||||
menuEntry('Transmissions', 'message?a=f&f=T', 'View internal transmissions');
|
||||
menuEntry('Outbox', 'message?a=f&f=O', 'View the messages you sent.');
|
||||
menuSubEnd();
|
||||
}
|
||||
menuEntry('Forums', 'forums?cmd=o', 'Access the forums.');
|
||||
menuTopLevelEnd();
|
||||
|
||||
if ($accounts->call('isLeech', $_SESSION['userid'])) {
|
||||
menuTopLevelEntry('Contribute!', makeLink('contrib', 'main'), 'Contribute to LegacyWorlds!');
|
||||
}
|
||||
if ($accounts->call('isAdmin', $_SESSION['userid'])) {
|
||||
menuTopLevelEntry('Admin', 'admin', 'Administrative tools');
|
||||
}
|
||||
|
||||
?>
|
||||
</tr></table></td>
|
||||
<td id="msgicon"> </td>
|
||||
<td class='icons'><a
|
||||
href='planets'<?=tooltip('Manage your planets')?>><? drawIcon('planets', 'Planet management'); ?></a><a
|
||||
href='fleets'<?=tooltip('Manage your fleets')?>><? drawIcon('fleets', 'Fleet management'); ?></a><a
|
||||
href='map'<?=tooltip("View maps of the universe")?>><? drawIcon('map', 'Galactic maps'); ?></a><a
|
||||
href='alliance'<?=tooltip('Display information about your current alliance or allows you to join an alliance')?>><? drawIcon('alliance', 'Alliance panel'); ?></a><a
|
||||
href='../main/logout'<?=tooltip('Log out from the game')?>><? drawIcon('logout', 'Log out'); ?></a></td>
|
||||
</tr></table></td></tr>
|
||||
<tr><td><table class='player' cellspacing='0' cellpadding='0'><tr>
|
||||
<td class='player'><span<?=tooltip('Your player name as well as the tag of the alliance you are a member of.');?>>Player <b id='jspname'></b><span id='jsalliance'></span></td>
|
||||
<td class='funds'><span<?=tooltip('The money you currently own.')?>>Current funds: <b id='jscash'></b></span></td>
|
||||
<td class='stime'><span<?=tooltip('Date and time on the Legacy Worlds server; this gives you a reference which allows you to synchronize your actions with players from the other side of the Earth.');?>>Server Time: <span id='jsservtm'></span></span></td>
|
||||
</tr></table></td></tr>
|
||||
</table>
|
||||
<div style="text-align:center">
|
||||
<div style="float: right; padding: 2px 4px"><i>Game: <?=$game->text?></i></div>
|
||||
<table style="width:94%;height:30px;margin:0 2%">
|
||||
<tr>
|
||||
<?php
|
||||
|
||||
function drawTitle() {
|
||||
$n = handler::$h->output;
|
||||
$c = prefs::get('main/colour', 'red');
|
||||
$src = getStatic("beta5/pics/ttl/def/en/$c/$n.gif");
|
||||
if (!is_null($src)) {
|
||||
echo "<img class='title' src='$src' alt=\"$n\" />";
|
||||
}
|
||||
}
|
||||
|
||||
$pinf = $players->call('get', $player);
|
||||
if ($accounts->call('getQuitCountdown', $_SESSION['userid'])) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">CLOSING ACCOUNT</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">CLOSING ACCOUNT</td>
|
||||
<?php
|
||||
} else if (!is_null($pinf['qts'])) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">LEAVING GAME</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">LEAVING GAME</td>
|
||||
<?php
|
||||
} else if ($players->call('isOnVacation', $player)) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">ON VACATION</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">ON VACATION</td>
|
||||
<?php
|
||||
} else if ($protected) {
|
||||
?>
|
||||
<td style="width:20%;text-align:right;color:red;font-weight:bold;vertical-align:middle">UNDER PROTECTION</td>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<td style="width:20%;text-align:left;color:red;font-weight:bold;vertical-align:middle">UNDER PROTECTION</td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<td style="text-align:center"><?php drawTitle(); ?></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<hr/>
|
8
scripts/site/beta5/output/admin.en.inc
Normal file
8
scripts/site/beta5/output/admin.en.inc
Normal file
|
@ -0,0 +1,8 @@
|
|||
<h1>Legacy Worlds Administrative Tools</h1>
|
||||
<?php
|
||||
|
||||
$page = $args['subpage'];
|
||||
$data = $args['data'];
|
||||
include("admin/en/$page.inc");
|
||||
|
||||
?>
|
61
scripts/site/beta5/output/admin/en/acmgmt.inc
Normal file
61
scripts/site/beta5/output/admin/en/acmgmt.inc
Normal file
|
@ -0,0 +1,61 @@
|
|||
<form action="?" method="POST">
|
||||
<input type="hidden" name="c" value="a" />
|
||||
<h2>Select an account</h2>
|
||||
<p>
|
||||
Name of the account to manage:
|
||||
<input type="text" name="an" value="<?=utf8entities($data['account'])?>" size="17" maxlength="16" />
|
||||
<input name="sa" value="Select account" type="submit" />
|
||||
<?php
|
||||
|
||||
if ($data['notfound']) {
|
||||
print "<br/><span style='color:red; font-weight: bold'>Account not found.</span>";
|
||||
} elseif ($data['admin']) {
|
||||
?>
|
||||
<br/><span style='color:red; font-weight: bold'>Administrative account, no changes allowed.</span>
|
||||
<?php
|
||||
} elseif ($data['account'] != '') {
|
||||
?>
|
||||
</p>
|
||||
<h2>Manage account</h2>
|
||||
<p>
|
||||
Account status: <b><?=$data['status']?></b>
|
||||
</p>
|
||||
<p>
|
||||
Account email address:
|
||||
<input type="text" name="ma" value="<?=utf8entities($data['email'])?>" size="32" maxlength="128" />
|
||||
<input type="submit" name="mma" value="Change mail address" />
|
||||
<?
|
||||
switch ($data['mailerr']) :
|
||||
case -1: print "<br/><span style='color:green; font-weight: bold'>Address changed</span>"; break;
|
||||
case 1: print "<br/><span style='color:red; font-weight: bold'>Invalid address</span>"; break;
|
||||
case 2: print "<br/><span style='color:red; font-weight: bold'>Address already used by account "
|
||||
. utf8entities($data['oacc']) . "</span>"; break;
|
||||
case 3: print "<br/><span style='color:red; font-weight: bold'>Database error</span>"; break;
|
||||
endswitch;
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
Account password:
|
||||
<input type="text" name="pw" value="<?=utf8entities($data['password'])?>" size="32" maxlength="64" />
|
||||
<input type="submit" name="mpw" value="Change password" />
|
||||
<?
|
||||
switch ($data['passerr']) :
|
||||
case -1: print "<br/><span style='color:green; font-weight: bold'>Password updated</span>"; break;
|
||||
case 1: print "<br/><span style='color:red; font-weight: bold'>Password too short (min 4 characters)</span>"; break;
|
||||
case 2: print "<br/><span style='color:red; font-weight: bold'>Database error</span>"; break;
|
||||
endswitch;
|
||||
}
|
||||
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
|
||||
if (!is_null($data['conf_code'])) {
|
||||
?>
|
||||
<p>
|
||||
Confirmation code: <i><?=$data['conf_code']?></i>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</form>
|
87
scripts/site/beta5/output/admin/en/kicklst.inc
Normal file
87
scripts/site/beta5/output/admin/en/kicklst.inc
Normal file
|
@ -0,0 +1,87 @@
|
|||
<h2>Pending kick requests</h2>
|
||||
<table class="list">
|
||||
<tr>
|
||||
<th style="text-align:left;width:15%">Account name</th>
|
||||
<th style="text-align:left;width:15%">Requested by</th>
|
||||
<th style="text-align:left;width:15%">Date</th>
|
||||
<th style="text-align:left">Reason</th>
|
||||
<th style="text-align:left;width:15%">Actions</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if (empty($data['lists'][0])) {
|
||||
echo "<tr><td colspan='5' style='text-align:center'>No pending kick requests</td></tr>";
|
||||
} else {
|
||||
foreach ($data['lists'][0] as $r) {
|
||||
$pn = handler::$h->accounts->call('getUser', $r['to_kick']);
|
||||
$an = handler::$h->accounts->call('getUser', $r['requested_by']);
|
||||
echo "<tr><td>" . utf8entities($pn['name']) . "</td><td>" . utf8entities($an['name'])
|
||||
. "</td><td>" . gmstrftime("%Y-%m-%d %H:%M:%S", $r['requested_at'])
|
||||
. "</td><td>" . utf8entities($r['reason']) . "</td><td>";
|
||||
if ($r['requested_by'] == $_SESSION['userid']) {
|
||||
echo "<a href='?c=kl&i={$r['id']}&a=0'>Cancel</a>";
|
||||
} else {
|
||||
echo "<a href='?c=kl&i={$r['id']}&a=0'>Reject</a> - <a href='?c=kl&i={$r['id']}&a=1'>Kick player</a>";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
||||
<h2>Accepted kick requests</h2>
|
||||
<table class="list">
|
||||
<tr>
|
||||
<th style="text-align:left;width:15%">Account name</th>
|
||||
<th style="text-align:left;width:15%">Requested by</th>
|
||||
<th style="text-align:left;width:15%">Date</th>
|
||||
<th style="text-align:left">Reason</th>
|
||||
<th style="text-align:left;width:15%">Validated by</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if (empty($data['lists'][1])) {
|
||||
echo "<tr><td colspan='5' style='text-align:center'>No accepted kick requests</td></tr>";
|
||||
} else {
|
||||
foreach ($data['lists'][1] as $r) {
|
||||
$pn = handler::$h->accounts->call('getUser', $r['to_kick']);
|
||||
$an = handler::$h->accounts->call('getUser', $r['requested_by']);
|
||||
$vn = handler::$h->accounts->call('getUser', $r['examined_by']);
|
||||
echo "<tr><td>" . utf8entities($pn['name']) . "</td><td>" . utf8entities($an['name'])
|
||||
. "</td><td>" . gmstrftime("%Y-%m-%d %H:%M:%S", $r['requested_at'])
|
||||
. "</td><td>" . utf8entities($r['reason']) . "</td><td>"
|
||||
. utf8entities($vn['name']) . "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
||||
<h2>Rejected kick requests</h2>
|
||||
<table class="list">
|
||||
<tr>
|
||||
<th style="text-align:left;width:15%">Account name</th>
|
||||
<th style="text-align:left;width:15%">Requested by</th>
|
||||
<th style="text-align:left;width:15%">Date</th>
|
||||
<th style="text-align:left">Reason</th>
|
||||
<th style="text-align:left;width:15%">Rejected by</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if (empty($data['lists'][2])) {
|
||||
echo "<tr><td colspan='5' style='text-align:center'>No rejected requests</td></tr>";
|
||||
} else {
|
||||
foreach ($data['lists'][2] as $r) {
|
||||
$pn = handler::$h->accounts->call('getUser', $r['to_kick']);
|
||||
$an = handler::$h->accounts->call('getUser', $r['requested_by']);
|
||||
$vn = handler::$h->accounts->call('getUser', $r['examined_by']);
|
||||
echo "<tr><td>" . utf8entities($pn['name']) . "</td><td>" . utf8entities($an['name'])
|
||||
. "</td><td>" . gmstrftime("%Y-%m-%d %H:%M:%S", $r['requested_at'])
|
||||
. "</td><td>" . utf8entities($r['reason']) . "</td><td>"
|
||||
. utf8entities($vn['name']) . "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
49
scripts/site/beta5/output/admin/en/kickreq.inc
Normal file
49
scripts/site/beta5/output/admin/en/kickreq.inc
Normal file
|
@ -0,0 +1,49 @@
|
|||
<h2>Request a kick</h2>
|
||||
<p>
|
||||
Please indicate the name of the player to be kicked as well as the reason why the player should be kicked in the form below.<br/>
|
||||
The player will only be kicked after another administrator confirms it.
|
||||
</p>
|
||||
<?php
|
||||
|
||||
if ($data['error'] != 0) {
|
||||
echo "<p style='font-weight:bold;color:red'>";
|
||||
switch($data['error']) :
|
||||
case 1:
|
||||
echo "Account not found.";
|
||||
break;
|
||||
case 2:
|
||||
echo "Please specify a reason (>10 characters).";
|
||||
break;
|
||||
case 3:
|
||||
echo "This player is already on the list of pending kicks.";
|
||||
break;
|
||||
default:
|
||||
echo "Unknown error.";
|
||||
break;
|
||||
endswitch;
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
<form method="POST" action="?">
|
||||
<input type="hidden" name="c" value="k" />
|
||||
<input type="hidden" name="kr" value="1" />
|
||||
<table>
|
||||
<tr>
|
||||
<th style="text-align:left;width:200px;padding:0px 0px 0px 40px">Player to kick:</th>
|
||||
<td><input style="width:50%" maxlength="15" type="text" name="p" value="<?=preg_replace('/"/', '"', $data['name'])?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="text-align:left;padding:0px 0px 0px 40px">Reason:</th>
|
||||
<td><textarea style="width:50%" name="r"><?=utf8entities($data['reason'])?></textarea></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<input style="font-weight:bold;border-color:white;border-style:solid;border-width:1px;color:white;background-color:red" type="submit" value="Request kick" />
|
||||
<input style="border-color:white;border-style:solid;border-width:1px;color:white;background-color:green" type="submit" name="cancel" value="Cancel" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
47
scripts/site/beta5/output/admin/en/lkcat.inc
Normal file
47
scripts/site/beta5/output/admin/en/lkcat.inc
Normal file
|
@ -0,0 +1,47 @@
|
|||
<h2><?=$data['id'] ? "Edit" : "Add"?> category</h2>
|
||||
<form action="?" method="POST">
|
||||
<input type="hidden" name="c" value="lk" />
|
||||
<input type="hidden" name="ac" value="<?=$data['id'] ? 2 : 0?>" />
|
||||
<input type="hidden" name="r" value="1" />
|
||||
<?php
|
||||
if ($data['id']) {
|
||||
?>
|
||||
<input type="hidden" name="cid" value="<?=$data['id']?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<table style="width:80%;padding:0px 0px 0px 30px">
|
||||
<tr>
|
||||
<td style="font-weight:bold;padding:0px 10px 0px 0px">Name:</td>
|
||||
<td><input type="text" name="title" size="40" value="<?=utf8entities($data['title'])?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($data['error'] && $data['error'] < 4) {
|
||||
echo "<tr><td> </td><td><b>";
|
||||
switch ($data['error']) :
|
||||
case 1: echo "This title is too short"; break;
|
||||
case 2: echo "This title is too long"; break;
|
||||
case 3: echo "There is already such a category"; break;
|
||||
endswitch;
|
||||
echo "</b></td></tr>\n";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="vertical-align:top;font-weight:bold;padding:0px 10px 0px 0px">Description:</td>
|
||||
<td><textarea name="desc" rows="5" cols="40"><?=utf8entities($data['desc'])?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($data['error'] == 4) {
|
||||
echo "<tr><td> </td><td><b>This description is too short.</b></td></tr>\n";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="text-align:right;padding:0px 5px 0px 0px">
|
||||
<input type="submit" value="<?=$data['id'] ? "Modify" : "Add"?> category" style="color:white;border-color:white;background-color:green" />
|
||||
</td>
|
||||
<td style="padding:0px 0px 0px 5px">
|
||||
<input type="submit" name="cancel" value="Cancel" style="color:white;border-color:white;background-color:red" />
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
42
scripts/site/beta5/output/admin/en/lklist.inc
Normal file
42
scripts/site/beta5/output/admin/en/lklist.inc
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
echo "<h2>Links and categories</h2>";
|
||||
if (!count($data)) {
|
||||
echo "<p>There are no categories. Click <a href='?c=lk&ac=0'>here</a> to add one.</p>";
|
||||
return;
|
||||
}
|
||||
|
||||
$hasAccount = (is_array($_SESSION) && !is_null($_SESSION['userid']));
|
||||
for ($i=0;$i<count($data);$i++) {
|
||||
echo "<p style='margin:10px 0px 5px 20px;text-align:justify'><b><u>" . utf8entities($data[$i]['title']) . "</u></b>";
|
||||
if (!is_null($data[$i]['description'])) {
|
||||
echo "<br/>" . preg_replace('/\n/', '<br/>', utf8entities($data[$i]['description']));
|
||||
}
|
||||
echo "<br/><a href='?c=lk&ac=1&cid={$data[$i]['id']}'>Add link</a> - <a href='?c=lk&ac=2&cid={$data[$i]['id']}'>Edit</a>";
|
||||
echo " - <a onclick='return confirm(\"Are you sure you want to delete this category?\")' href='?c=lk&ac=3&cid={$data[$i]['id']}'>Delete</a>";
|
||||
if ($i > 0) {
|
||||
echo " - <a href='?c=lk&ac=4&cid={$data[$i]['id']}'>Move up</a>";
|
||||
}
|
||||
if ($i < count($data) - 1) {
|
||||
echo " - <a href='?c=lk&ac=5&cid={$data[$i]['id']}'>Move down</a>";
|
||||
}
|
||||
echo "</p>";
|
||||
|
||||
echo "<ul style='margin:0px 30px 0px 60px'>";
|
||||
if (!count($data[$i]['links'])) {
|
||||
echo "<li><i>No links in this category.</i></li>";
|
||||
} else {
|
||||
foreach ($data[$i]['links'] as $l) {
|
||||
echo "<li><a href='{$l['url']}' target='_blank' title=\"" . utf8entities($l['title']) . "\"><u>" . utf8entities($l['title']) . "</u></a>";
|
||||
if (!is_null($l['description'])) {
|
||||
echo "<br/>" . preg_replace('/\n/', '<br/>', utf8entities($l['description']));
|
||||
}
|
||||
echo "<br/><a href='?c=lk&ac=10&lid={$l['id']}'>Edit</a> - <a onclick='return confirm(\"Are you sure you want to delete this link?\")' href='?c=lk&ac=11&lid={$l['id']}'>Delete</a>";
|
||||
echo "<br/> </li>";
|
||||
}
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
echo "<p style='margin:10px 0px 5px 20px;text-align:justify'><a href='?c=lk&ac=0'>Add category</a></p>";
|
||||
|
||||
?>
|
65
scripts/site/beta5/output/admin/en/lklk.inc
Normal file
65
scripts/site/beta5/output/admin/en/lklk.inc
Normal file
|
@ -0,0 +1,65 @@
|
|||
<h2><?=$data['id'] ? "Edit" : "Add"?> link</h2>
|
||||
<form action="?" method="POST">
|
||||
<input type="hidden" name="c" value="lk" />
|
||||
<input type="hidden" name="ac" value="<?=$data['id'] ? 10 : 1?>" />
|
||||
<input type="hidden" name="r" value="1" />
|
||||
<?php
|
||||
if ($data['id']) {
|
||||
?>
|
||||
<input type="hidden" name="lid" value="<?=$data['id']?>" />
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<input type="hidden" name="cid" value="<?=$data['cid']?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<table style="width:80%;padding:0px 0px 0px 30px">
|
||||
<tr>
|
||||
<td style="font-weight:bold;padding:0px 10px 0px 0px">Name:</td>
|
||||
<td><input type="text" name="title" size="40" value="<?=utf8entities($data['title'])?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($data['error'] && $data['error'] < 3) {
|
||||
echo "<tr><td> </td><td><b>";
|
||||
switch ($data['error']) :
|
||||
case 1: echo "This title is too short"; break;
|
||||
case 2: echo "This title is too long"; break;
|
||||
endswitch;
|
||||
echo "</b></td></tr>\n";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="font-weight:bold;padding:0px 10px 0px 0px">URL:</td>
|
||||
<td><input type="text" name="url" size="40" value="<?=utf8entities($data['url'])?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($data['error'] >= 3 && $data['error'] <= 5) {
|
||||
echo "<tr><td> </td><td><b>";
|
||||
switch ($data['error']) :
|
||||
case 3: echo "This URL is invalid"; break;
|
||||
case 4: echo "The server could not be found"; break;
|
||||
case 5: echo "The URL is already in the DB"; break;
|
||||
endswitch;
|
||||
echo "</b></td></tr>\n";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="vertical-align:top;font-weight:bold;padding:0px 10px 0px 0px">Description:</td>
|
||||
<td><textarea name="desc" rows="5" cols="40"><?=utf8entities($data['desc'])?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($data['error'] == 6) {
|
||||
echo "<tr><td> </td><td><b>This description is too short.</b></td></tr>\n";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="text-align:right;padding:0px 5px 0px 0px">
|
||||
<input type="submit" value="<?=$data['id'] ? "Modify" : "Add"?> link" style="color:white;border-color:white;background-color:green" />
|
||||
</td>
|
||||
<td style="padding:0px 0px 0px 5px">
|
||||
<input type="submit" name="cancel" value="Cancel" style="color:white;border-color:white;background-color:red" />
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
19
scripts/site/beta5/output/admin/en/lkrep.inc
Normal file
19
scripts/site/beta5/output/admin/en/lkrep.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
echo "<h2>Broken links report</h2>";
|
||||
if (!count($data)) {
|
||||
echo "<p>No broken links have been reported.</p>";
|
||||
return;
|
||||
}
|
||||
|
||||
echo "<ul>";
|
||||
foreach ($data as $link) {
|
||||
echo "<li>Link <b>" . utf8entities($link['title']) . "</b> to <a href='{$link['url']}' target='_blank'>"
|
||||
. utf8entities($link['url']) . "</a> in category " . utf8entities($link['category']['title']) . "<br/>"
|
||||
. "Reported by: <b>" . join('</b> - <b>', $link['reporters']) . "</b><br/>"
|
||||
. "<a href='?c=lkr&id={$link['id']}&dr=1'>Remove report</a> - "
|
||||
. "<a onclick='return confirm(\"Please confirm that you want to remove this link\")' href='?c=lkr&id={$link['id']}&dl=1'>Remove link</a><br/> </li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
?>
|
31
scripts/site/beta5/output/admin/en/lksadd.inc
Normal file
31
scripts/site/beta5/output/admin/en/lksadd.inc
Normal file
|
@ -0,0 +1,31 @@
|
|||
<h2>Accept submission</h2>
|
||||
<p>
|
||||
You are about to accept the following submission:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Title: <b><?=utf8entities($data['sub']['title'])?></b></li>
|
||||
<li>URL: <b><?=utf8entities($data['sub']['url'])?></b></li>
|
||||
<?php
|
||||
if ($data['sub']['description'] != '') {
|
||||
echo " <li>Description: <b>" . utf8entities($data['sub']['description']) . "</b></li>\n";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<form action="?" method="GET">
|
||||
<input type="hidden" name="c" value="lks" />
|
||||
<input type="hidden" name="su" value="<?=utf8entities($data['sub']['url'])?>" />
|
||||
<input type="hidden" name="sid" value="<?=$data['sub']['submitted_by']?>" />
|
||||
<p>
|
||||
Select the category into which the link should be added:
|
||||
<select name="cid">
|
||||
<option value="">---------------------------------------</option>
|
||||
<?php
|
||||
foreach ($data['cats'] as $cat) {
|
||||
echo "<option value='{$cat['id']}'>" . utf8entities($cat['title']) . "</option>\n";
|
||||
}
|
||||
?>
|
||||
</select><br/>
|
||||
<input type="submit" value="Add link" style="color:white;border-color:white;background-color:green" />
|
||||
<input type="submit" name="cancel" value="Cancel" style="color:white;border-color:white;background-color:red" />
|
||||
</p>
|
||||
</form>
|
25
scripts/site/beta5/output/admin/en/lksub.inc
Normal file
25
scripts/site/beta5/output/admin/en/lksub.inc
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
echo "<h2>Submitted links</h2>";
|
||||
if (!count($data)) {
|
||||
echo "<p>No links have been submitted.</p>";
|
||||
return;
|
||||
}
|
||||
|
||||
echo "<ul>";
|
||||
foreach ($data as $link => $entries) {
|
||||
echo "<li>Link to <a target='_blank' href='$link'>" . utf8entities($link) . "</a>:<ul>";
|
||||
foreach ($entries as $entry) {
|
||||
echo "<li>Submitted by <b>{$entry['submitter']}</b> as <b>{$entry['title']}</b><br/>";
|
||||
if ($entry['description'] != '') {
|
||||
echo "Description: <b>{$entry['description']}</b>";
|
||||
} else {
|
||||
echo "No description";
|
||||
}
|
||||
echo "<br/><a href='?c=lks&su=" . urlencode($link) . "&sid={$entry['sid']}'>Accept entry</a></li>";
|
||||
}
|
||||
echo "<li><a onclick='return confirm(\"Are you sure?\")' href='?c=lks&su=" . urlencode($link) . "'>Delete entry</a></ul></li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
?>
|
30
scripts/site/beta5/output/admin/en/main.inc
Normal file
30
scripts/site/beta5/output/admin/en/main.inc
Normal file
|
@ -0,0 +1,30 @@
|
|||
<h2>Main administrative tools</h2>
|
||||
<p>
|
||||
<a href="?c=m">Manual update</a><br/>
|
||||
Tool that updates the manual from the XML files on the server.<br/>
|
||||
<b>Warning</b>: this tool is very resource-consuming; please don't run it unless you have a good reason to.
|
||||
</p>
|
||||
<p>
|
||||
<a href="?c=a">Account management</a><br/>
|
||||
This tool allows operations such as changing an account's email address or password.
|
||||
</p>
|
||||
<p>
|
||||
<a href="?c=k">Request player kick</a><br/>
|
||||
Request that a player be banned from the game. Another admin will have to validate your request.<br/>
|
||||
<a href="?c=kl">Manage kicks</a><br/>
|
||||
Display the list of pending, accepted and rejected kick requests, and validate pending requests.
|
||||
</p>
|
||||
<p>
|
||||
<u>Link management:</u> <a href="?c=lk">Links & categories</a> - <a href='?c=lkr'>Reports</a> - <a href='?c=lks'>Submissions</a><br/>
|
||||
Different tools to manage the main page's links.
|
||||
</p>
|
||||
|
||||
<h2>Beta 5 administrative tools</h2>
|
||||
<p>
|
||||
<a href="?c=p">Planet names</a><br/>
|
||||
Planet names moderation tools to spot planets with insulting or "politically incorrect" names.
|
||||
</p>
|
||||
<p>
|
||||
<a href="?c=s">Admin spam</a><br/>
|
||||
Sends a message to all players.
|
||||
</p>
|
98
scripts/site/beta5/output/admin/en/pnlist.inc
Normal file
98
scripts/site/beta5/output/admin/en/pnlist.inc
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
function printOption($value, $text, $cVal) {
|
||||
return "<option value='$value'" . ($cVal === $value ? " selected='selected'" : "") . ">" . utf8entities($text) . "</option>";
|
||||
}
|
||||
|
||||
function printPrompt($id) {
|
||||
$prompts = array(
|
||||
"You are about to send this planet a warning regarding its name.",
|
||||
"You are about to validate this planet name.",
|
||||
"You are about to reset this planet."
|
||||
);
|
||||
return " onclick='return confirm(\"{$prompts[$id]}\\nPlease confirm.\")'";
|
||||
}
|
||||
|
||||
?>
|
||||
<h2>Planet names</h2>
|
||||
<form action="?" method="GET">
|
||||
<input type="hidden" name="c" value="p" />
|
||||
<table style="width:90%;margin: 0 4%">
|
||||
<tr>
|
||||
<td style="text-align:center;width:50%">List: <select name="m" onchange="this.form.submit()">
|
||||
<?=printOption("r", "Unmoderated", $data['mode'])?>
|
||||
<?=printOption("o", "Validated", $data['mode'])?>
|
||||
<?=printOption("p", "Pending", $data['mode'])?>
|
||||
<?=printOption("w", "Renamed after warning", $data['mode'])?>
|
||||
</select></td>
|
||||
<td style="text-align:center"><?php
|
||||
|
||||
if ($data['pages'] == 0) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo "Page <select name='p' onchange='this.form.submit()'>";
|
||||
for ($i=0;$i<$data['pages'];$i++) {
|
||||
echo printOption($i, $i+1, $data['page']);
|
||||
}
|
||||
echo "</select> / {$data['pages']}";
|
||||
}
|
||||
|
||||
?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
|
||||
if (count($data['list'])) {
|
||||
?>
|
||||
<td colspan='2'><table class='list'>
|
||||
<tr>
|
||||
<th style='text-align:left;width:33%'>Planet name</th>
|
||||
<th style='text-align:left;width:33%'>Owner</th>
|
||||
<th style='text-align:left;width:34%'>Actions</th>
|
||||
</tr>
|
||||
<?php
|
||||
for ($i=0;$i<count($data['list']);$i++) {
|
||||
$planet = $data['list'][$i];
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="planet?id=<?=$planet['id']?>"><?=utf8entities($planet['name'])?></a></td>
|
||||
<td><?php
|
||||
if (is_null($planet['owner'])) {
|
||||
echo "(neutral)";
|
||||
} else {
|
||||
echo "<a href='message?a=c&ct=0&id={$planet['owner']}'>" . utf8entities($planet['oname']) . "</a>";
|
||||
}
|
||||
?></td>
|
||||
<td>
|
||||
<a target='_blank' href="map?menu=p&ctr=<?=$planet['id']?>">Centre map</a><?php
|
||||
if ($data['mode'] == 'r' || $data['mode'] == 'o') {
|
||||
if (is_null($planet['owner'])) {
|
||||
echo " - <a href='?c=p&m=r&p={$data['page']}&pc=r&id={$planet['id']}'" . printPrompt(2) . ">Reset</a>\n";
|
||||
} else {
|
||||
echo " - <a href='?c=p&m=r&p={$data['page']}&pc=w&id={$planet['id']}'" . printPrompt(0) . ">Send warning</a>\n";
|
||||
}
|
||||
if ($data['mode'] == 'r') {
|
||||
echo " - <a href='?c=p&m=r&p={$data['page']}&pc=v&id={$planet['id']}'" . printPrompt(1) . ">Validate</a>\n";
|
||||
}
|
||||
} elseif ($data['mode'] != 'p') {
|
||||
echo " - <a href='?c=p&m=r&p={$data['page']}&pc=r&id={$planet['id']}'>Reset</a>\n";
|
||||
if ($data['mode'] == 'w') {
|
||||
echo " - <a href='?c=p&m=r&p={$data['page']}&pc=v&id={$planet['id']}'" . printPrompt(1) . ">Validate</a>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table></td>
|
||||
<?php
|
||||
} else {
|
||||
echo " <td colspan='2' style='text-align:center'>No planets in this list.</td>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
55
scripts/site/beta5/output/admin/en/spam.inc
Normal file
55
scripts/site/beta5/output/admin/en/spam.inc
Normal file
|
@ -0,0 +1,55 @@
|
|||
<h2>Send admin spam</h2>
|
||||
<p>
|
||||
Type the spam in the form below. You can use forum tags inside the spam.<br/>
|
||||
Use the "Preview" button to check on your spam before sending it.<br/>
|
||||
If you need to send the spam to all players within all active games, check the "Send in all games" box.
|
||||
</p>
|
||||
<form action="?" method='post'>
|
||||
<input type='hidden' name='c' value='s' />
|
||||
|
||||
<a name='box'></a>
|
||||
<table cellspacing="0" cellpadding="0" style="width: 75%">
|
||||
<tr><td colspan='3'> </td></tr>
|
||||
<?
|
||||
|
||||
$errs = array('Subject is too short.', 'Subject is too long.', 'Contents are too short.', 'Contents are too long.');
|
||||
if ($data['err']) {
|
||||
echo " <tr><td> </td><th style='text-align:left;color:red'>" . $errs[$data['err']-1]
|
||||
. "</th><td> </td></tr>";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th style="width:10%;text-align:right"><label for="sub" accesskey="s">Subject:</label></th>
|
||||
<td colspan="2"><input type='text' id="sub" name='sub' style="width:90%" value="<?=utf8entities($data['sub'], ENT_QUOTES)?>" maxlength="100" size='60' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="vertical-align:top;width:10%;text-align:right"><label for="txt" accesskey="t">Text:</label></th>
|
||||
<td colspan="2"><textarea name='txt' id="txt" style="width:90%" rows='15'><?=utf8entities($data['txt'])?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:10%;text-align:right">Options:</th>
|
||||
<td colspan="2">
|
||||
<input type='checkbox' name='ag' id="eag" value='1'<?=$data['ag']?" checked='checked'":""?> /> <label for="eag" accesskey="a">Send in all games</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan='3'> </td></tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td colspan='2' class='butt'>
|
||||
<input type='submit' name='e' value='Spam, spam, spam' accesskey="g" />
|
||||
<input type='submit' name='p' value='Preview' accesskey="p" />
|
||||
<input type='submit' name='cc' value='Cancel' accesskey="c" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if ($data['prev'] != "") {
|
||||
echo " <tr><td rowspan='3'> </td><td> </td><td rowspan='3'> </td></tr>\n";
|
||||
echo " <tr><th style='text-align:left'>Preview - " . utf8entities($data['sub']) . "</th></tr>\n";
|
||||
echo " <tr><td style='border: 1px solid #3f3f3f;padding: 4px'>" . $data['prev'] . "</td></tr>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</form>
|
2
scripts/site/beta5/output/alliance.en.inc
Normal file
2
scripts/site/beta5/output/alliance.en.inc
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div id='allinit' style="display: none; visibility: hidden;"><?=$args?></div>
|
||||
<div id="allpage"></div>
|
21
scripts/site/beta5/output/allies.en.inc
Normal file
21
scripts/site/beta5/output/allies.en.inc
Normal file
|
@ -0,0 +1,21 @@
|
|||
<form action="?" onSubmit="return false"><table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="pc5"> </td>
|
||||
<td class="pc45" id="allies"> </td>
|
||||
<td class="pc45">
|
||||
<h1>Players who trust you</h1>
|
||||
<div id="rallies"> </div>
|
||||
</td>
|
||||
<td style="width:5%;vertical-align:top"><a href="manual?p=allies">Help</a></td>
|
||||
</tr>
|
||||
<tr><td colspan='4'> </td></tr>
|
||||
<tr>
|
||||
<td class="pc5"> </td>
|
||||
<td class="pc90" colspan="2">
|
||||
<h1>Trusted Allies blacklist</h1>
|
||||
<div id="bans"> </div>
|
||||
</td>
|
||||
<td class="pc5"> </td>
|
||||
</tr>
|
||||
</table></form>
|
||||
<div id='alinit' style="display: none; visibility: hidden;"><?=$args?></div>
|
25
scripts/site/beta5/output/comms.en.inc
Normal file
25
scripts/site/beta5/output/comms.en.inc
Normal file
|
@ -0,0 +1,25 @@
|
|||
<table><tr>
|
||||
<td class='div2'>
|
||||
<h1>Private Messages</h1>
|
||||
<p><a href='message?a=c' <?=tooltip('Click here to go to the form to compose a new private message')?>>Compose Message</a></p>
|
||||
<h2>Default Folders</h2>
|
||||
<p>
|
||||
<a href='message?a=f&f=I' <?=tooltip('Click here to go to your inbox folder')?>>Inbox</a>: <span id="msg0"> </span><br/>
|
||||
<a href='message?a=f&f=T' <?=tooltip('Click here to go to your internal transmissions folder')?>>Internal Transmissions</a>: <span id="msg1"> </span><br/>
|
||||
<a href='message?a=f&f=O' <?=tooltip('Click here to go to your outbox folder')?>>Outbox</a>: <span id="msg2"> </span>
|
||||
</p>
|
||||
<h2>Custom Folders</h2>
|
||||
<p>
|
||||
<span id='cflist'></span><br/>
|
||||
<a href='message?a=mf' <?=tooltip('Click here to go to the custom folders management page')?>>Manage Custom Folders</a>
|
||||
</p>
|
||||
</td><td style="width:45%">
|
||||
<h1>Forums</h1>
|
||||
<h2>General forums</h2>
|
||||
<p id="gforums"></p>
|
||||
<div id="aforums"></div>
|
||||
</td><td>
|
||||
<a href="manual?p=communications_page">Help</a>
|
||||
</td>
|
||||
</tr></table>
|
||||
<div style="display:none;visibility:hidden"><form action="?" onsubmit="return false"><textarea id="init-data"><?=$args?></textarea></form></div>
|
25
scripts/site/beta5/output/diplomacy.en.inc
Normal file
25
scripts/site/beta5/output/diplomacy.en.inc
Normal file
|
@ -0,0 +1,25 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td class='div2'>
|
||||
<h1>Alliance</h1>
|
||||
<div id="alliance"></div>
|
||||
</td>
|
||||
<td class='pc45'>
|
||||
<h1>Scientific Assistance</h1>
|
||||
<p id="rsass"> </p>
|
||||
<h1>Allies & Enemies</h1>
|
||||
<p>
|
||||
<span id="allies"> </span><br/>
|
||||
<a href="allies"<?=tooltip('Click here to go to the trusted allies management page')?>>Manage allies</a> - <a href="enemylist" <?=tooltip('Click here to go to the enemies management page')?>>Manage enemies</a>
|
||||
</p>
|
||||
<h1>Private Messages</h1>
|
||||
<p>
|
||||
<a href="message?a=f&f=I" <?=tooltip('Click here to go to your inbox in the messaging system')?>>Messages</a>: <b id="pm"> </b> (<b id="pmn"> </b> new)<br/>
|
||||
<a href="message?a=f&f=T" <?=tooltip('Click here to go to the internal transmissions folder of the messaging system')?>>Internal Transmissions</a>: <b id="it"> </b> (<b id="itn"> </b> new)<br/>
|
||||
<a href="message?a=c" <?=tooltip('Click here to go to the new message form and prepare a new message to be sent')?>>Compose</a> a message
|
||||
</p>
|
||||
</td>
|
||||
<td style="vertical-align:top"><a href="manual?p=diplomacy_page">Help</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id='dinit' style="display: none; visibility: hidden;"><?=$args?></div>
|
73
scripts/site/beta5/output/empire.en.inc
Normal file
73
scripts/site/beta5/output/empire.en.inc
Normal file
|
@ -0,0 +1,73 @@
|
|||
<div style="display:none;visibility:hidden"><form action="?" onsubmit="return false"><textarea id="init-data"><?=$args?></textarea></form></div>
|
||||
<table>
|
||||
<tr>
|
||||
<td class='div2'>
|
||||
<h1>Planets</h1>
|
||||
<h2>Overview</h2>
|
||||
<p>
|
||||
Planets owned: <b id='plcnt'></b><br/>
|
||||
Average happiness: <span id='plahap'></span><br/>
|
||||
Average corruption: <span id='placor'></span><br/>
|
||||
Total population: <b id='plpop'></b><br/>
|
||||
Average population: <span id='plapop'></span><br/>
|
||||
Total factories: <b id='plfct'></b><br/>
|
||||
Average factories: <span id='plafct'></span><br/>
|
||||
Total turrets: <b id='pltrt'></b><br/>
|
||||
Average turrets: <span id='platrt'></span><br/>
|
||||
<span id='platt'></span>
|
||||
<a href='planets' <?=tooltip('Click here to go to the main planets page')?>>Planet list</a>
|
||||
</p>
|
||||
<h2>Quick links</h2>
|
||||
<p id='pllst'></p>
|
||||
<h1>Research</h1>
|
||||
<h2>Budget</h2>
|
||||
<p>
|
||||
Fundamental research: <b id='rsbf'></b> (<b id='rspf'></b> points/day)<br/>
|
||||
Military research: <b id='rsbm'></b> (<b id='rspm'></b> points/day)<br/>
|
||||
Civilian research: <b id='rsbc'></b> (<b id='rspc'></b> points/day)<br/>
|
||||
<a href='research' <?=tooltip('Click here to go to the research management page')?>>Manage research</a>
|
||||
</p>
|
||||
<div id="rsst"></div>
|
||||
</td>
|
||||
<td class='pc45'>
|
||||
<h1>Money</h1>
|
||||
<p>
|
||||
Total income: €<b id='minc'> </b><br/>
|
||||
Daily profits: €<b id='mprof'> </b><br/>
|
||||
<a href='money' <?=tooltip('Click here to go to the money page')?>>Details ...</a>
|
||||
<h1>Fleets</h1>
|
||||
<h2>Overview</h2>
|
||||
<p>
|
||||
Total fleet power: <b id='fltot'></b><br/>
|
||||
Fleet upkeep: €<b id='flupk'></b><br/>
|
||||
Number of fleets: <b id='flcnt'></b><br/>
|
||||
Fleets engaged in battle: <b id='flbat'></b><br/>
|
||||
<a href='fleets' <?=tooltip('Click here to go to the fleets management page')?>>View fleets</a>
|
||||
</p>
|
||||
<h2>Fleets at home</h2>
|
||||
<p>
|
||||
Number of fleets: <b id='flhcnt'></b><br/>
|
||||
Fleets engaged in battle: <b id='flhbat'></b>
|
||||
</p>
|
||||
<h2>Other fleets</h2>
|
||||
<p>
|
||||
Fleets on foreign planets: <b id='flocnt'></b><br/>
|
||||
Fleets engaged in battle: <b id='flobat'></b><br/>
|
||||
Moving fleets: <b id='flomv'></b><br/>
|
||||
Fleets waiting in Hyperspace: <b id='flowt'></b>
|
||||
</p>
|
||||
<h2>Statistics</h2>
|
||||
<p>
|
||||
GA ships: <b id='flgas'></b><br/>
|
||||
Fighters: <b id='flfgt'></b><br/>
|
||||
Cruisers: <b id='flcru'></b><br/>
|
||||
Battle cruisers: <b id='flbcr'></b><br/>
|
||||
Total ships: <b id='flsht'></b>
|
||||
</p>
|
||||
</td>
|
||||
<td style="width:5%;text-align:left;vertical-align:top;">
|
||||
<a href="manual?p=empire_overview">Help</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
25
scripts/site/beta5/output/enemylist.en.inc
Normal file
25
scripts/site/beta5/output/enemylist.en.inc
Normal file
|
@ -0,0 +1,25 @@
|
|||
<form action="?" onSubmit="return false"><table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="pc5"> </td>
|
||||
<td class="pc45">
|
||||
<h1>Player Enemy List</h1>
|
||||
<p>
|
||||
New enemy:
|
||||
<input type="text" <?=tooltip('Use this textfield to type in the name of the enemy player to add to your list')?> name="nepl" id="nepl" value="" size="16" maxlength="15" />
|
||||
<input type="button" <?=tooltip('Click here to add this player to your enemy list')?> name="addpl" value="Add" onClick="addPlayer();return false" />
|
||||
</p>
|
||||
<div id="epldiv"></div>
|
||||
</td>
|
||||
<td class="pc45">
|
||||
<h1>Alliance Enemy List</h1>
|
||||
<p>
|
||||
New enemy:
|
||||
<input type="text" <?=tooltip('Use this textfield to type in the tag of the enemy alliance to add to your list')?> name="neal" id="neal" value="" size="6" maxlength="5" />
|
||||
<input type="button" <?=tooltip('Click here to add this alliance to your enemy list')?> name="addal" value="Add" onClick="addAlliance();return false" />
|
||||
</p>
|
||||
<div id="ealdiv"></div>
|
||||
</td>
|
||||
<td class="pc5" style="vertical-align:top"><a href="manual?p=enemies">Help</a></td>
|
||||
</tr>
|
||||
</table></form>
|
||||
<div id='elinit' style="display: none; visibility: hidden;"><?=$args?></div>
|
2
scripts/site/beta5/output/fleets.en.inc
Normal file
2
scripts/site/beta5/output/fleets.en.inc
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div id='finit' style="display: none; visibility: hidden;"><?=$args?></div>
|
||||
<div id='fpage'> </div>
|
72
scripts/site/beta5/output/forums.en.inc
Normal file
72
scripts/site/beta5/output/forums.en.inc
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?
|
||||
|
||||
function drawForumsMenu($mode,$fList)
|
||||
{
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
<tr><th colspan="3">Forums</th></tr>
|
||||
<tr><td colspan="3" style="text-align:right;padding:0px 15px 0px 0px"><a style="color:white;text-decoration:underline" href="manual?p=bugs">Help</a></td></tr>
|
||||
<tr>
|
||||
<td class="mmspc" rowspan="2"> </td>
|
||||
<td colspan="2"><a href='?cmd=o' <?=tooltip('Click here to display the forums overview')?>><?=($mode=='o')?"<i>":""?>Overview<?=($mode=='o')?"</i>":""?></a></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"><a href='?cmd=l' <?=tooltip('Click here to display the latest messages in all forums')?>><?=($mode=='l')?"<i>":""?>Latest messages<?=($mode=='l')?"</i>":""?></a></td></tr>
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
<?
|
||||
|
||||
foreach ($fList as $cid => $cat)
|
||||
{
|
||||
$sel1 = ($mode == "C#$cid");
|
||||
$selL = ($mode == "L#$cid");
|
||||
$sel = $sel1 || $selL;
|
||||
if (!$sel && substr($mode,0,4) == "F#".$cat['type']."#")
|
||||
{
|
||||
for ($i=0;!$sel&&$i<count($cat['forums']);$i++)
|
||||
$sel = (substr($mode,4) == $cat['forums'][$i]['id']);
|
||||
}
|
||||
|
||||
$au = 0;
|
||||
if (!$sel)
|
||||
for ($i=0;$i<count($cat['forums']);$i++)
|
||||
$au += $cat['forums'][$i]['unread'];
|
||||
|
||||
$cb = $au ? '<b>' : ''; $ceb = $au ? " ($au)</b>" : '';
|
||||
|
||||
echo '<tr><td class="mmspc" rowspan="'.(2+($sel?count($cat['forums']):0)).'"> </td>';
|
||||
echo "<td colspan='2'><a href='?cmd=".urlencode("C#$cid")."' ".tooltip('Click here to display this forums category main page').">$cb".($sel1?"<i>":"").utf8entities($cat['title']);
|
||||
echo ($sel1?"</i>":"")."$ceb</a></td></tr>\n";
|
||||
|
||||
if ($sel)
|
||||
foreach ($cat['forums'] as $f)
|
||||
{
|
||||
$au = $f['unread'];
|
||||
$cb = $au ? '<b>' : ''; $ceb = $au ? " ($au)</b>" : '';
|
||||
$fid = "F#".$cat['type']."#".$f['id'];
|
||||
$selF = ($mode == $fid);
|
||||
echo "<tr><td class='mmspc'> </td>";
|
||||
echo " <td><a href='?cmd=".urlencode($fid)."' ".tooltip('Click here to display the contents of this forum').">$cb".($selF?"<i>":"").utf8entities($f['title']).($selF?"</i>":"")."$ceb</a></td>";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo '<tr><td class="mmspc"> </td>';
|
||||
echo "<td><a href='?cmd=".urlencode("L#$cid")."' ".tooltip('Click here to display the latest messages this forums category').">".($selL?"<i>":"").'Latest messages'.($selL?"</i>":"")."</a></td></tr>\n";
|
||||
echo "<tr><td colspan='3'> </td>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="mmspc" rowspan="2"> </td>
|
||||
<td colspan="2"><a href='?cmd=s' <?=tooltip('Click here to go to the forums search page')?>><?=($mode=='s')?"<i>":""?>Search forums<?=($mode=='s')?"</i>":""?></a></td>
|
||||
</tr>
|
||||
<tr><td colspan="3"> </td>
|
||||
<tr><th colspan="3"><a href="message" <?=tooltip('click here to go to the messaging system page')?>>Messages</a></th></tr>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
|
||||
$sp = $args['sp'];
|
||||
$args = $args['d'];
|
||||
include("forums/en/$sp.inc");
|
||||
|
||||
?>
|
67
scripts/site/beta5/output/forums/en/category.inc
Normal file
67
scripts/site/beta5/output/forums/en/category.inc
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?
|
||||
|
||||
$cat = $args['all'][$args['id']];
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('C#'.$args['id'], $args['all']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<table cellspacing='0' cellpadding='0'><tr>
|
||||
<td class="pc50"><h1><?=utf8entities($cat['title'])?></h1></td>
|
||||
<td class='maar'><a href="?cmd=<?=urlencode('MC#'.$cat['type']."#".$cat['id'])?>" <?=tooltip('Click here to mark all topics in the forums belonging to this category as read')?>>Mark forums as read</a></td>
|
||||
</tr></table>
|
||||
<p><?
|
||||
|
||||
if ($cat['desc'] != '')
|
||||
echo preg_replace('/\n/', '<br/>', utf8entities($cat['desc']));
|
||||
else if ($cat['type'] == 'A')
|
||||
echo "<p>These are the forums of the alliance called <b>".utf8entities($cat['title'])."</b></p>";
|
||||
else
|
||||
echo " ";
|
||||
|
||||
echo "</p>\n";
|
||||
|
||||
if (count($cat['forums']))
|
||||
{
|
||||
echo "<table cellspacing='0' cellpadding='0' class='fcf'>\n";
|
||||
echo "<tr><td class='fst' colspan='2'> </td><th class='fnm'>Forum name</th>";
|
||||
echo "<th class='fnt'>Topics</th><th class='fnp'>Posts</th><th class='flpl'>Last post</th></tr>\n";
|
||||
for ($i=0;$i<count($cat['forums']);$i++)
|
||||
{
|
||||
echo "<tr><td class='fst' rowspan='2'> </td>";
|
||||
$pic = config::$main['staticurl'] . "/beta5/pics/" . ($cat['forums'][$i]['unread'] > 0 ? 'un' : '') . 'read.gif';
|
||||
echo "<td class='fst' rowspan='2'><img src='$pic' alt='FIXME' /></td>";
|
||||
echo "<td class='fnm'><a href='?cmd=".urlencode("F#".$cat['type']."#".$cat['forums'][$i]['id'])."' ".tooltip('Click here to go to this forum topics list page')." >";
|
||||
echo utf8entities($cat['forums'][$i]['title']) . "</a></td>";
|
||||
echo "<td class='fnt'>" . $cat['forums'][$i]['topics'] . "</td>";
|
||||
echo "<td class='fnp'>" . $cat['forums'][$i]['posts'] . "</td>";
|
||||
echo "<td class='flpl' rowspan='2'> ";
|
||||
$l = $cat['forums'][$i]['last'];
|
||||
if (is_null($l))
|
||||
echo "No Posts";
|
||||
else
|
||||
{
|
||||
echo "Last post by <b>" . utf8entities($l['author']) . "</b><br/>";
|
||||
echo preg_replace('/ /', ' ', gmstrftime("%H:%M:%S on %d/%m/%Y", $l['moment']));
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr>\n<tr><td colspan='3'><p>";
|
||||
if ($cat['forums'][$i]['description'] != '')
|
||||
echo preg_replace('/\n/', '<br/>', utf8entities($cat['forums'][$i]['description']));
|
||||
else
|
||||
echo " ";
|
||||
echo "</p></td></tr>\n";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
else
|
||||
echo "<p>There are no forums in this category.</p>";
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
11
scripts/site/beta5/output/forums/en/catnotfound.inc
Normal file
11
scripts/site/beta5/output/forums/en/catnotfound.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('', $args); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Category Not Found</h1>
|
||||
<p>The category you wish to view no longer exists.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
146
scripts/site/beta5/output/forums/en/forum.inc
Normal file
146
scripts/site/beta5/output/forums/en/forum.inc
Normal file
|
@ -0,0 +1,146 @@
|
|||
<?
|
||||
$f = $args['forum'];
|
||||
$fid = 'F#'.$f['ctype']."#".$f['id'];
|
||||
list($tPPage,$page,$nPages) = $args['details'];
|
||||
$mod = $f['mod'];
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu($fid, $args['cats']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<table cellspacing='0' cellpadding='0'><tr>
|
||||
<td class="pc50"><h1><?=utf8entities($f['title'])?></h1></td>
|
||||
<td class='maar'><a href="?cmd=<?=urlencode('MF#'.$f['ctype']."#".$f['id'])?>&pg=<?=$page?>" <?=tooltip('Click here to mark all topics in this forum as read')?>>Mark topics as read</a></td>
|
||||
</tr></table>
|
||||
<?
|
||||
if ($f['description'] != '')
|
||||
echo "<p>" . preg_replace('/\n/', '<br/>', utf8entities($f['description'])) . "</p>\n";
|
||||
?>
|
||||
<form action="?" method="post">
|
||||
<input type="hidden" name="cmd" value="<?=$fid?>" />
|
||||
<input type="hidden" name="pg" value="<?=$page?>" />
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd"><tr>
|
||||
<td><?
|
||||
|
||||
if ($f['user_post'] || $f['mod'])
|
||||
echo "<a href='?cmd=n&f=".urlencode($fid)."' ".tooltip('Click here to go to the new topic form and post a new topic').">New topic</a>";
|
||||
else
|
||||
echo "Only moderators can create topics";
|
||||
|
||||
?></td>
|
||||
<td>
|
||||
Display <span <?=tooltip('Use this drop down list to choose the number of topics to display on each page')?>><select name="tpp" onChange="form.submit()"><?
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
{
|
||||
echo "<option value='" . ($i * 10) . "'";
|
||||
if ($i*10 == $tPPage)
|
||||
echo " selected='selected'";
|
||||
echo ">" . ($i*10) . "</option>";
|
||||
}
|
||||
|
||||
?></select></span> topics per page
|
||||
</td>
|
||||
<td <?=tooltip('Use this drop down list to choose the page of topics to display')?>>Page <?
|
||||
|
||||
if ($nPages <= 1)
|
||||
echo "1 / 1";
|
||||
else
|
||||
{
|
||||
echo "<select name='pg' onChange='form.submit()'>";
|
||||
for ($i=0;$i<$nPages;$i++)
|
||||
echo "<option value='$i'" . ($page == $i ? " selected='selected'" : "") . ">" . ($i+1) . "</option>";
|
||||
echo "</select> / $nPages";
|
||||
}
|
||||
|
||||
?></td>
|
||||
</tr></table>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="ftop">
|
||||
<?
|
||||
|
||||
if ($f['topics'] == 0)
|
||||
echo "<tr><td class='fem'>This forum is empty.</tr></td>\n";
|
||||
else
|
||||
{
|
||||
echo "<tr><th class='tpic'> </th>";
|
||||
if ($mod)
|
||||
echo "<th class='tpic'> </th>";
|
||||
echo "<th class='tnm'>Topic</th><th class='trp'>Replies</th>";
|
||||
echo "<th class='tps'>First Post</th><th class='tps'>Last Post</th></tr>\n";
|
||||
|
||||
$topics = $args['topics'];
|
||||
for ($i=0;$i<count($topics);$i++)
|
||||
{
|
||||
echo "<tr>";
|
||||
if ($mod)
|
||||
echo "<td class='tpic'><input " . tooltip('Use this checkbox to select this topic') . " type='checkbox' id='msel$i' name='msel[]' value='" . $topics[$i]['id'] . "' /></td>";
|
||||
$pic = config::$main['staticurl'] . "/beta5/pics/" . ($topics[$i]['read'] ? '' : 'un') . 'read';
|
||||
if ($topics[$i]['sticky'])
|
||||
$pic .= '_sticky';
|
||||
$pic .= '.gif';
|
||||
$text = ($topics[$i]['read'] ? 'Read' : 'Unread') . ($topics[$i]['sticky'] ? " sticky" : "") . " topic";
|
||||
echo "<td class='tpic'><img src='$pic' alt='$text' /></td>";
|
||||
echo "<td class='tnm'><a href='?cmd=".urlencode("T#".$f['ctype']."#".$topics[$i]['id'])."' " . tooltip('Click here to diplay the posts in this topic') . ">";
|
||||
// FIXME: poll icon
|
||||
echo utf8entities($topics[$i]['title']) . "</a></td>";
|
||||
echo "<td class='trp'>" . $topics[$i]['posts'] . "</td>";
|
||||
echo "<td class='tps'>" . gmstrftime('%H:%M:%S on %d/%m/%Y', $topics[$i]['moment']) . " by ";
|
||||
if ($topics[$i]['author_id'] != '')
|
||||
echo "<a href='message?a=c&ct=0&id=".$topics[$i]['author_id']."' ". tooltip('Click here to send a message to the author of this topic') . " >".utf8entities($topics[$i]['author'])."</a>";
|
||||
else
|
||||
echo "<b>".utf8entities($topics[$i]['author'])."</b>";
|
||||
echo "</td><td class='tps'>" . gmstrftime('%H:%M:%S on %d/%m/%Y', $topics[$i]['last_moment']) . " by ";
|
||||
if ($topics[$i]['last_author_id'] != '')
|
||||
echo "<a href='message?a=c&ct=0&id=".$topics[$i]['last_author_id']."' ". tooltip('Click here to send a message to author of the last post in this topic') . " >".utf8entities($topics[$i]['last_author'])."</a>";
|
||||
else
|
||||
echo "<b>".utf8entities($topics[$i]['last_author'])."</b>";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
<?
|
||||
if ($mod && count($topics))
|
||||
{
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd"><tr>
|
||||
<td>
|
||||
<input <?=tooltip('Click here to delete the selected topics')?> type="submit" name="dt" value="Delete" onClick="return confirmDelete()" />
|
||||
<input <?=tooltip('Click here to go to switch sticky status on the selected topics')?> type="submit" name="st" value="Switch sticky" onClick="return confirmSticky()" />
|
||||
</td>
|
||||
<td>
|
||||
<?
|
||||
$mf = array();
|
||||
foreach ($args['cats'] as $cid => $cat) {
|
||||
if ($cat['type'] == 'A' && $f['ctype'] != 'A' || $cat['type'] != 'A' && $f['ctype'] == 'A')
|
||||
continue;
|
||||
foreach ($cat['forums'] as $cf)
|
||||
if ($cf['id'] != $f['id'] && $cf['mod'])
|
||||
array_push($mf, $cf);
|
||||
}
|
||||
|
||||
if (!count($mf))
|
||||
echo " ";
|
||||
else
|
||||
{
|
||||
echo "<input type='submit' " . tooltip('Click here to move the selected topics to the chosen forum') . " name='mt' value='Move' onClick='return confirmMove()' /> to forum ";
|
||||
echo"<span " . tooltip('use this drop down list to choose the forum to which to move the selected topics') . " ><select name='mdest' id='mdest'><option value=''>---------</option>";
|
||||
foreach ($mf as $cf)
|
||||
echo "<option value='" . $cf['id'] . "'>" . utf8entities($cf['title']) . "</option>";
|
||||
echo "</select></span>";
|
||||
}
|
||||
?></td>
|
||||
</tr></table>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
11
scripts/site/beta5/output/forums/en/forumnopost.inc
Normal file
11
scripts/site/beta5/output/forums/en/forumnopost.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('', $args); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Permission Denied</h1>
|
||||
<p>You are not allowed to post in this forum; only its moderators can do so.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
11
scripts/site/beta5/output/forums/en/forumnotfound.inc
Normal file
11
scripts/site/beta5/output/forums/en/forumnotfound.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('', $args); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Forum Not Found</h1>
|
||||
<p>The forum you wish to browse no longer exists.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
98
scripts/site/beta5/output/forums/en/latest.inc
Normal file
98
scripts/site/beta5/output/forums/en/latest.inc
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?
|
||||
if ($args['cat'] == '')
|
||||
{
|
||||
$mode = 'l';
|
||||
$title = 'Latest Messages in All Forums';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mode = 'L#' . $args['cat'];
|
||||
$title = $args['cats'][$args['cat']]['title'] . ": Latest Messages";
|
||||
}
|
||||
list($mPPage,$page) = $args['details'];
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu($mode, $args['cats']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1><?=utf8entities($title)?></h1>
|
||||
<form method='post' action='?'>
|
||||
<input type='hidden' name='cmd' value='<?=$mode?>' />
|
||||
<input type='hidden' name='pg' value='<?=$page?>' />
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td><?=($page > 0) ? ("<a href='?cmd=".urlencode($mode)."&pg=".($page - 1)."' ".tooltip('Click here to go to the previous page of the latest messages in this forums category'). " >") : ""?><- Previous page<?=($page > 0) ? "</a>" : ""?></td>
|
||||
<td>Display <span <?=tooltip('Use this drop down list to choose the number of messages to diplay on each page')?> ><select name='mpp' onChange="submit();"><?php
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$mPPage?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
|
||||
?></select></span> posts per page</td>
|
||||
<td><?=(count($args['posts'])==$mPPage+1)?("<a href='?cmd=".urlencode($mode)."&pg=".($page+1)."' ".tooltip('Click here to go to the next page of the latest messages in this forums category'). " >"):""?>Next page -><?=(count($args['posts'])==$mPPage+1)?"</a>":""?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?
|
||||
|
||||
$p = $args['posts'];
|
||||
$nbp = min($mPPage,count($p));
|
||||
if ($nbp == 0)
|
||||
echo "<center><b>No posts were found.</b></center>";
|
||||
else
|
||||
{
|
||||
for ($i=0;$i<$nbp;$i++)
|
||||
{
|
||||
echo "<table cellspacing='0' cellpadding='0' class='ftp'>";
|
||||
echo "<tr><th class='pfor'>";
|
||||
if ($args['cat'] == '')
|
||||
echo utf8entities($p[$i]['cname'] . " > ");
|
||||
echo utf8entities($p[$i]['fname']) . "</th>";
|
||||
echo "<td class='cmd' rowspan='3'><a href='?cmd=".urlencode("F#".$p[$i]['rctype']."#".$p[$i]['fid'])."'".tooltip('Click here to go to the main page of the forum in which this message was posted'). " >View forum</a><br/>";
|
||||
echo "<a href='?cmd=".urlencode("T#".$p[$i]['rctype']."#".$p[$i]['tid'])."'".tooltip('Click here to go to go to the page of the topic in which this message was posed'). " >View topic</a><br/>";
|
||||
echo "<a href='?cmd=".urlencode("R#".$p[$i]['rctype']."#".$p[$i]['id'])."&q=0'".tooltip('Click here to go to the compose form and reply to this message'). " >Reply</a> - ";
|
||||
echo "<a href='?cmd=".urlencode("R#".$p[$i]['rctype']."#".$p[$i]['id'])."&q=1'".tooltip('Click here to go to the compose form and reply to this message by quoting it'). " >Quote</a>\n";
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><th>" . utf8entities($p[$i]['title']) . "</th></tr>\n";
|
||||
|
||||
echo "<tr><td>Posted <b>" . gmstrftime("%H:%M:%S on %d/%m/%Y", $p[$i]['moment']);
|
||||
echo "</b> by ".(is_null($p[$i]['pid'])?'<b>':('<a href="message?a=c&ct=0&id='.$p[$i]['pid'].'"'.tooltip('Click here to go to the compose form and send a private message to the author of this post'). ' >'));
|
||||
echo $p[$i]['author'].(is_null($p[$i]['pid'])?'</b>':'</a>')."</td>";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr><td colspan='2'>" . $p[$i]["contents"] . "</td></tr>\n";
|
||||
|
||||
if ($p[$i]['edited'] != 0)
|
||||
{
|
||||
echo "<tr><td class='edit' colspan='2'>Edited by ";
|
||||
echo (is_null($p[$i]['edit_id']) ? '<b>' : ('<a href="message?a=c&ct=0&id='.$p[$i]['edit_id'].'"'.tooltip('Click here to go to the compose form and send a private message to the player who last edited this post'). ' >')) . utf8entities($p[$i]['edited_by']);
|
||||
echo (is_null($p[$i]['edit_id']) ? '</b>' : '</a>'). " at " . gmstrftime("%H:%M:%S on %d/%m/%Y", $p[$i]['edited']) . "</td></tr>";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
?>
|
||||
<form method='post' action='?'>
|
||||
<input type='hidden' name='cmd' value='<?=$mode?>' />
|
||||
<input type='hidden' name='pg' value='<?=$page?>' />
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td><?=($page > 0) ? ("<a href='?cmd=".urlencode($mode)."&pg=".($page - 1)."'".tooltip('Click here to go to the previous page of the latest messages in this forums category'). ">") : ""?><- Previous page<?=($page > 0) ? "</a>" : ""?></td>
|
||||
<td>Display <span <?=tooltip('Use this drop down list to choose the number of messages to diplay on each page')?> ><select name='mpp' onChange="submit();"><?php
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$mPPage?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
|
||||
?></select></span> posts per page</td>
|
||||
<td><?=(count($args['posts'])==$mPPage+1)?("<a href='?cmd=".urlencode($mode)."&pg=".($page+1)."'".tooltip('Click here to go to the next page of the latest messages in this forums category'). " >"):""?>Next page -><?=(count($args['posts'])==$mPPage+1)?"</a>":""?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
61
scripts/site/beta5/output/forums/en/overview.inc
Normal file
61
scripts/site/beta5/output/forums/en/overview.inc
Normal file
|
@ -0,0 +1,61 @@
|
|||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('o', $args); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Forums Overview</h1>
|
||||
<?
|
||||
|
||||
foreach ($args as $cid => $cat)
|
||||
{
|
||||
echo "<table cellspacing='0' cellpadding='0' class='fcat'>\n";
|
||||
echo "<tr class='hdr'><th class='hdr'><a href='?cmd=".urlencode("C#$cid")."'" . tooltip('Click here to go to the main page of this forum category') . ">";
|
||||
echo utf8entities($cat['title']) . "</a></th><td class='ctype'>(" . ($cat['type'] == "A" ? "alliance" : "general") . ")</td></tr>\n";
|
||||
echo "<tr><td colspan='2'>";
|
||||
if ($cat['desc'] != "")
|
||||
echo "<p>" . preg_replace('/\n/', '<br/>', utf8entities($cat['desc'])) . "</p>\n";
|
||||
else
|
||||
echo " ";
|
||||
echo "</td></tr>\n";
|
||||
|
||||
if (count($cat['forums']))
|
||||
{
|
||||
echo "<tr><td colspan='2'><table cellspacing='0' cellpadding='0' class='fcf'>\n";
|
||||
echo "<tr><td class='fst'> </td><th class='fnm'>Forum name</th>";
|
||||
echo "<th class='fnt'>Topics</th><th class='fnp'>Posts</th><th class='flp'>Last post</th></tr>\n";
|
||||
for ($i=0;$i<count($cat['forums']);$i++)
|
||||
{
|
||||
$pic = config::$main['staticurl'] . "/beta5/pics/" . ($cat['forums'][$i]['unread'] > 0 ? 'un' : '') . 'read.gif';
|
||||
echo "<tr><td class='fst' rowspan='2'><img src='$pic' alt='FIXME' /></td>";
|
||||
echo "<td class='fnm'><a href='?cmd=".urlencode("F#".$cat['type']."#".$cat['forums'][$i]['id'])."'" . tooltip('Click here to go to the main page of this forum') . ">";
|
||||
echo utf8entities($cat['forums'][$i]['title']) . "</a></td>";
|
||||
echo "<td class='fnt' rowspan='2'>" . $cat['forums'][$i]['topics'] . "</td>";
|
||||
echo "<td class='fnp' rowspan='2'>" . $cat['forums'][$i]['posts'] . "</td>";
|
||||
echo "<td class='flp' rowspan='2'> ";
|
||||
$l = $cat['forums'][$i]['last'];
|
||||
if (is_null($l))
|
||||
echo "No Posts";
|
||||
else
|
||||
{
|
||||
echo "Last post by <b>" . utf8entities($l['author']) . "</b><br/>";
|
||||
echo preg_replace('/ /', ' ', gmstrftime("%H:%M:%S on %d/%m/%Y", $l['moment']));
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr>\n<tr><td><p>";
|
||||
if ($cat['forums'][$i]['description'] != '')
|
||||
echo preg_replace('/\n/', '<br/>', utf8entities($cat['forums'][$i]['description']));
|
||||
else
|
||||
echo " ";
|
||||
echo "</p></td></tr>\n";
|
||||
}
|
||||
echo "</table></td></tr>";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
118
scripts/site/beta5/output/forums/en/post.inc
Normal file
118
scripts/site/beta5/output/forums/en/post.inc
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?
|
||||
$f = $args['forum'];
|
||||
if ($args['cmd'] == 'n')
|
||||
$title = utf8entities($f['title'])." - New Topic";
|
||||
else if (substr($args['cmd'],0,2) == 'R#')
|
||||
$title = "Reply to '" . utf8entities($args['posts'][0]['title']) . "'";
|
||||
else if (substr($args['cmd'],0,2) == 'E#')
|
||||
$title = "Editing '" . utf8entities($args['post']['title']) . "'";
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('F#'.$args['cfid'], $args['cats']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h2><?=$title?></h2>
|
||||
<form action="?#box" method='post'>
|
||||
<input type='hidden' name='cmd' value='<?=$args['cmd']?>' />
|
||||
<input type='hidden' name='f' value='F#<?=$args['cfid']?>' />
|
||||
<input type='hidden' name='ref' value='<?=$args['ref']?>' />
|
||||
<input type='hidden' name='uid' value='<?=$args['uid']?>' />
|
||||
|
||||
<a name='box'></a>
|
||||
<table cellspacing="0" cellpadding="0" class="fpost">
|
||||
<tr><td colspan='3'> </td></tr>
|
||||
<?
|
||||
|
||||
$errs = array('Subject is too short.', 'Subject is too long.', 'Contents are too short.', 'Contents are too long.');
|
||||
if ($args['err'])
|
||||
echo "<tr><td> </td><th class='err'>" . $errs[$args['err']-1] . "</th><td> </td></tr>";
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th><label for="sub" accesskey="s"><?=$args['cmd'] == 'n' ? "Topic title" : "Subject"?>:</label></th>
|
||||
<td colspan="2"><input <?=tooltip('Use this text field to type in or modify the subject of your post')?> type='text' id="sub" name='sub' value="<?=utf8entities($args['sub'], ENT_QUOTES)?>" maxlength="100" size='60' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="txt" accesskey="t">Text:</label></th>
|
||||
<td <?=tooltip('Use this text area to type in or modify your message')?> ><textarea name='txt' id="txt" cols='60' rows='15'><?=utf8entities($args['txt'])?></textarea></td>
|
||||
<td id="jszone"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Options:</th>
|
||||
<td colspan="2">
|
||||
<input <?=tooltip('Use this checkbox to enable / disable graphical smileys')?> type='checkbox' name='sm' id="esm" value='1'<?=$args['sm']?" checked='checked'":""?> /> <label for="esm" accesskey="e">Enable graphical smileys</label>
|
||||
<input <?=tooltip('Use this checkbox to enable / disable forum tags')?> type='checkbox' name='fc' id="efc" value='1'<?=$args['fc']?" checked='checked'":""?> /> <label for="efc" accesskey="f">Enable forum tags</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
|
||||
if ($args['sst'])
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<th>Sticky topic:</th>
|
||||
<td colspan="2">
|
||||
<input <?=tooltip('Use this checkbox to change the sticky status of the post')?> type='checkbox' name='st' id="est" value='1'<?=$args['st']?" checked='checked'":""?> /> <label for="est" accesskey="y">Enable sticky topic</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan='3'> </td></tr>
|
||||
<tr><td> </td><td colspan='2' class='butt'>
|
||||
<input <?=tooltip('Click here to post your message')?> type='submit' name='e' value='Submit' accesskey="g" />
|
||||
<input <?=tooltip('Click here to preview your message as it will be displayed in the forums')?> type='submit' name='p' value='Preview' accesskey="p" />
|
||||
<input <?=tooltip('Click here to cancel your changes and go back to the previous page')?> type='submit' name='c' value='Cancel' accesskey="c" />
|
||||
</td></tr>
|
||||
<?php
|
||||
|
||||
if ($args['prev'] != "")
|
||||
{
|
||||
echo " <tr><td rowspan='3'> </td><td> </td><td rowspan='3'> </td></tr>\n";
|
||||
echo " <tr><th class='hdprev'>Preview - " . utf8entities($args['sub']) . "</th></tr>\n";
|
||||
echo " <tr><td class='prev'>" . $args['prev'] . "</td></tr>\n";
|
||||
}
|
||||
|
||||
if (is_array($args['posts']))
|
||||
{
|
||||
echo " <tr><td rowspan='3'> </td><td> </td><td rowspan='3'> </td></tr>\n";
|
||||
echo " <tr><th class='hdprev'>Replying to ...</th></tr>\n";
|
||||
echo " <tr><td>";
|
||||
$p = $args['posts'];
|
||||
for ($i=0;$i<count($p);$i++)
|
||||
{
|
||||
echo "<table cellspacing='0' cellpadding='0' class='ftp'>";
|
||||
echo "<tr><th>" . utf8entities($p[$i]['title']) . "</td></tr>\n";
|
||||
echo "<tr><td>Posted <b>" . gmstrftime("%H:%M:%S on %d/%m/%Y", $p[$i]['moment']);
|
||||
echo "</b> by <b>".$p[$i]['author']."</b></td>";
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td>" . $p[$i]["html"] . "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
else if (is_array($args['post']))
|
||||
{
|
||||
echo " <tr><td rowspan='3'> </td><td> </td><td rowspan='3'> </td></tr>\n";
|
||||
echo " <tr><th class='hdprev'>Original post</th></tr>\n";
|
||||
echo " <tr><td>";
|
||||
$p = $args['post'];
|
||||
echo "<table cellspacing='0' cellpadding='0' class='ftp'>";
|
||||
echo "<tr><th>" . utf8entities($p['title']) . "</td></tr>\n";
|
||||
echo "<tr><td>Posted <b>" . gmstrftime("%H:%M:%S on %d/%m/%Y", $p['moment']);
|
||||
echo "</b> by <b>".$p['author']."</b></td>";
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td>" . $p["html"] . "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
11
scripts/site/beta5/output/forums/en/postnotfound.inc
Normal file
11
scripts/site/beta5/output/forums/en/postnotfound.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('', $args); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Post Not Found</h1>
|
||||
<p>The post you wish to edit no longer exists.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
76
scripts/site/beta5/output/forums/en/search.inc
Normal file
76
scripts/site/beta5/output/forums/en/search.inc
Normal file
|
@ -0,0 +1,76 @@
|
|||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('s', $args['cats']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Search the Forums</h1>
|
||||
<form action="?" method="post">
|
||||
<input type="hidden" name="cmd" value="s" />
|
||||
<table cellspacing="0" cellpadding="0" class="fsrc">
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr>
|
||||
<th>Text:</th>
|
||||
<td><input <?=tooltip('Use this text field to type in the string you wish to search for in the forums')?> type="text" name="stxt" value="<?=utf8entities($args['sparm']['text'], ENT_QUOTES)?>" size='40' /></td>
|
||||
</tr>
|
||||
<tr><td> </td><td>Note: use the '*' character for partial matches</td></tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr>
|
||||
<th>Search in:</th>
|
||||
<td>
|
||||
<input <?=tooltip('Use this radio button to search in post titles only')?> type="radio" name="sin" value="0"<?=$args['sparm']['whole']?'':' checked="checked"'?> id="sin0" /> <label for="sin0">Post titles</label>
|
||||
<input <?=tooltip('Use this radio button to search in whole posts')?> type="radio" name="sin" value="1"<?=$args['sparm']['whole']?' checked="checked"':''?> id="sin1" /> <label for="sin1">Whole posts</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Forum:</th>
|
||||
<td <?=tooltip('Use this drop down list to select in which forums to search')?> ><select name="sif"><option value="">All Available Forums</option><?
|
||||
|
||||
foreach ($args['cats'] as $cid => $cat)
|
||||
{
|
||||
$ctype = $cat['type'] . "#";
|
||||
foreach ($cat['forums'] as $f)
|
||||
{
|
||||
$id = $ctype . $f['id'];
|
||||
echo "<option value='$id'" . ($args['sparm']['fid']==$id ? " selected='selected'" : "") . ">";
|
||||
echo utf8entities($cat['title'] . " - " . $f['title']) . "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
?></select></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr>
|
||||
<th>Sort by:</th>
|
||||
<td <?=tooltip('Use this drop down list to select a sort criteria for the retrieved posts')?> ><select name="sst">
|
||||
<?php
|
||||
|
||||
$st = array('Post Time', 'Post Title');
|
||||
for ($i=0;$i<count($st);$i++)
|
||||
echo "<option value='$i'" . ($args['sparm']['stype'] == $i ? " selected='selected'" : "") . ">" . $st[$i] . "</option>";
|
||||
|
||||
?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<input <?=tooltip('Use this radio button to use an ascending ordering of the retrieved posts')?> type="radio" name="sor" value="0"<?=$args['sparm']['sord']?'':' checked="checked"'?> id="sor0" /> <label for="sor0">Ascending</label>
|
||||
<input <?=tooltip('Use this radio button to use a descending ordering of the retrieved posts')?> type="radio" name="sor" value="1"<?=$args['sparm']['sord']?' checked="checked"':''?> id="sor1" /> <label for="sor1">Descending</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Display results:</th>
|
||||
<td>
|
||||
<input <?=tooltip('Use this radio button to display whole posts')?> type="radio" name="srp" value="0"<?=$args['sparm']['resd']?'':' checked="checked"'?> id="srp0" /> <label for="srp0">As posts</label>
|
||||
<input <?=tooltip('Use this radio button to display only the topics of the retrieved posts')?> type="radio" name="srp" value="1"<?=$args['sparm']['resd']?' checked="checked"':''?> id="srp1" /> <label for="srp1">As topics</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr><td> </td><td><input <?=tooltip('Click here to launch the search')?> type="submit" name="s" value="Search" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
86
scripts/site/beta5/output/forums/en/sresposts.inc
Normal file
86
scripts/site/beta5/output/forums/en/sresposts.inc
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?
|
||||
$mPPage = $args['sparm']['perpage'];
|
||||
$page = $args['sparm']['page'];
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('s', $args['cats']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Search results</h1>
|
||||
<form method='post' action='?'>
|
||||
<input type='hidden' name='cmd' value='s' />
|
||||
<input type='hidden' name='pg' value='<?=$page?>' />
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td><?=($page > 0) ? ("<a href='?cmd=s&pg=".($page - 1)."' " .tooltip('Click here to go to the previous page of retrieved posts') . " >") : ""?><- Previous page<?=($page > 0) ? "</a>" : ""?></td>
|
||||
<td>Display <span <?=tooltip('Use this drop down list to select the number of posts to display on each page')?>><select name='mpp' onChange="submit();"><?php
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$mPPage?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
|
||||
?></select></span> posts per page</td>
|
||||
<td><?=(count($args['posts'])==$mPPage+1)?("<a href='?cmd=s&pg=".($page+1)."' " .tooltip('Click here to go to the next page of retrieved posts') . " >"):""?>Next page -><?=(count($args['posts'])==$mPPage+1)?"</a>":""?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?
|
||||
|
||||
$p = $args['posts'];
|
||||
$nbp = min($mPPage,count($p));
|
||||
if ($nbp == 0)
|
||||
echo "<center><b>No posts were found.</b></center>";
|
||||
else
|
||||
{
|
||||
for ($i=0;$i<$nbp;$i++)
|
||||
{
|
||||
echo "<table cellspacing='0' cellpadding='0' class='ftp'>";
|
||||
echo "<tr><th class='pfor'>" . utf8entities($p[$i]['cname'] . " > " . $p[$i]['fname']) . "</th>";
|
||||
echo "<td class='cmd' rowspan='3'><a href='?cmd=".urlencode("F#".$p[$i]['rctype']."#".$p[$i]['fid'])."' " .tooltip('Click here to go to the main page of the forum in which that message was posted') . " >View forum</a><br/>";
|
||||
echo "<a href='?cmd=".urlencode("T#".$p[$i]['rctype']."#".$p[$i]['tid'])."' " .tooltip('Click here to go to the page of the topic in which that message was posted') . " >View topic</a><br/>";
|
||||
echo "<a href='?cmd=".urlencode("R#".$p[$i]['rctype']."#".$p[$i]['id'])."&q=0' " .tooltip('Click here to go to the compose form and reply to this post') . " >Reply</a> - ";
|
||||
echo "<a href='?cmd=".urlencode("R#".$p[$i]['rctype']."#".$p[$i]['id'])."&q=1' " .tooltip('Click here to go to the compose form and reply to this post with included quotations') . " >Quote</a>\n";
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><th>" . utf8entities($p[$i]['title']) . "</td></tr>\n";
|
||||
|
||||
echo "<tr><td>Posted <b>" . gmstrftime("%H:%M:%S on %d/%m/%Y", $p[$i]['moment']);
|
||||
echo "</b> by ".(is_null($p[$i]['pid'])?'<b>':('<a href="message?a=c&ct=0&id='.$p[$i]['pid'].'" ' .tooltip('Click here to go to the compose form and send a private message to the author of this post') . ' >'));
|
||||
echo $p[$i]['author'].(is_null($p[$i]['pid'])?'</b>':'</a>')."</td>";
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr><td colspan='2'>" . $p[$i]["contents"] . "</td></tr>\n";
|
||||
|
||||
if ($p[$i]['edited'] != 0)
|
||||
{
|
||||
echo "<tr><td class='edit' colspan='2'>Edited by ";
|
||||
echo (is_null($p[$i]['edit_id']) ? '<b>' : ('<a href="message?a=c&ct=0&id='.$p[$i]['edit_id'].'"' .tooltip('Click here to go to the compose form and send a private message to the author of this post') . ' >')) . utf8entities($p[$i]['edited_by']);
|
||||
echo (is_null($p[$i]['edit_id']) ? '</b>' : '</a>'). " at " . gmstrftime("%H:%M:%S on %d/%m/%Y", $p[$i]['edited']) . "</td></tr>";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
?>
|
||||
<form method='post' action='?'>
|
||||
<input type='hidden' name='cmd' value='s' />
|
||||
<input type='hidden' name='pg' value='<?=$page?>' />
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td><?=($page > 0) ? ("<a href='?cmd=s&pg=".($page - 1)."'" .tooltip('Click here to go to the previous page of retrieved posts') . " >") : ""?><- Previous page<?=($page > 0) ? "</a>" : ""?></td>
|
||||
<td>Display <span <?=tooltip('Use this drop down list to select the number of posts to display on each page')?><select name='mpp' onChange="submit();"><?php
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$mPPage?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
|
||||
?></select></span> posts per page</td>
|
||||
<td><?=(count($args['posts'])==$mPPage+1)?("<a href='?cmd=s&pg=".($page+1)."'" .tooltip('Click here to go to the next page of retrieved posts') . " >"):""?>Next page -><?=(count($args['posts'])==$mPPage+1)?"</a>":""?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
92
scripts/site/beta5/output/forums/en/srestopics.inc
Normal file
92
scripts/site/beta5/output/forums/en/srestopics.inc
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?
|
||||
$mPPage = $args['sparm']['perpage'];
|
||||
$page = $args['sparm']['page'];
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('s', $args['cats']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Search results</h1>
|
||||
<form method='post' action='?'>
|
||||
<input type='hidden' name='cmd' value='s' />
|
||||
<input type='hidden' name='pg' value='<?=$page?>' />
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td><?=($page > 0) ? ("<a href='?cmd=s&pg=".($page - 1)."' " .tooltip('Click here to go to the previous page of retrieved topics') . " >") : ""?><- Previous page<?=($page > 0) ? "</a>" : ""?></td>
|
||||
<td>Display<span <?=tooltip('Use this drop down list to select the number of topics to display on each page')?>> <select name='mpp' onChange="submit();"><?php
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$mPPage?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
|
||||
?></select></span> topics per page</td>
|
||||
<td><?=(count($args['topics'])==$mPPage+1)?("<a href='?cmd=s&pg=".($page+1)."' " .tooltip('Clickhere to go to the next page of retrieved topics') . " >"):""?>Next page -><?=(count($args['topics'])==$mPPage+1)?"</a>":""?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?
|
||||
|
||||
$p = $args['topics'];
|
||||
$nbp = min($mPPage,count($p));
|
||||
if ($nbp == 0)
|
||||
echo "<center><b>No posts were found.</b></center>";
|
||||
else
|
||||
{
|
||||
echo '<table cellspacing="0" cellpadding="0" class="ftop">';
|
||||
echo "<tr><th class='tpic'> </th>";
|
||||
echo "<th class='tnm'>Topic</th><th class='trp'>Replies</th>";
|
||||
echo "<th class='tps'>First Post</th><th class='tps'>Last Post</th></tr>\n";
|
||||
for ($i=0;$i<count($p);$i++)
|
||||
{
|
||||
echo "<tr>";
|
||||
$pic = config::$main['staticurl'] . "/beta5/pics/" . ($p[$i]['read'] ? '' : 'un') . 'read';
|
||||
if ($p[$i]['sticky']) {
|
||||
$pic .= '_sticky';
|
||||
}
|
||||
$pic .= '.gif';
|
||||
$text = ($p[$i]['read'] ? 'Read' : 'Unread') . ($p[$i]['sticky'] ? " sticky" : "") . " topic";
|
||||
$id = $p[$i]['rctype'] . "#" . $p[$i]['id'];
|
||||
echo "<td class='tpic'><img src='$pic' alt='$text' /></td>";
|
||||
echo "<td class='tnm'><a href='?cmd=".urlencode("T#$id")."' " .tooltip('Click here to go to the page of the topic containing the search string') . " >";
|
||||
// FIXME: poll icon
|
||||
echo utf8entities($p[$i]['title']) . "</a><br/>Forum: ";
|
||||
echo "<a href='?cmd=".urlencode("C#".$p[$i]['rctype']."#".$p[$i]['catid']) . "' " .tooltip('Click here to go to main page of the category of forums in which the post containing the search string was posted') . " >" . utf8entities($p[$i]['catname']) . "</a> > ";
|
||||
echo "<a href='?cmd=".urlencode("F#".$p[$i]['rctype']."#".$p[$i]['fid']) . "' " .tooltip('Click here to go to main page of the forum in which the post containing the search string was posted') . " >" . utf8entities($p[$i]['fname']) . "</a></td>";
|
||||
echo "<td class='trp'>" . ($p[$i]['nitems'] - 1) . "</td>";
|
||||
echo "<td class='tps'>" . gmstrftime('%H:%M:%S on %d/%m/%Y', $p[$i]['moment']) . " by ";
|
||||
if ($p[$i]['author_id'] != '')
|
||||
echo "<a href='message?a=c&ct=0&id=".$p[$i]['author_id']."' " .tooltip('Click here to go to compose page and send a private message to the author of the first post ') . " >".utf8entities($p[$i]['author'])."</a>";
|
||||
else
|
||||
echo "<b>".utf8entities($p[$i]['author'])."</b>";
|
||||
echo "</td><td class='tps'>" . gmstrftime('%H:%M:%S on %d/%m/%Y', $p[$i]['last_moment']) . " by ";
|
||||
if ($p[$i]['last_author_id'] != '')
|
||||
echo "<a href='message?a=c&ct=0&id=".$p[$i]['last_author_id']."' " .tooltip('Click here to go to compose page and send a private message to the author of the last post ') . " >".utf8entities($p[$i]['last_author'])."</a>";
|
||||
else
|
||||
echo "<b>".utf8entities($p[$i]['last_author'])."</b>";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
?>
|
||||
<form method='post' action='?'>
|
||||
<input type='hidden' name='cmd' value='s' />
|
||||
<input type='hidden' name='pg' value='<?=$page?>' />
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td><?=($page > 0) ? ("<a href='?cmd=s&pg=".($page - 1) . "' " .tooltip('Click here to go to the previous page of retrieved topics') . "> ") : ""?><- Previous page<?=($page > 0) ? "</a>" : ""?></td>
|
||||
<td>Display <span <?=tooltip('Use this drop down list to select the number of topics to display on each page')?>><select name='mpp' onChange="submit();"><?php
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$mPPage?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
|
||||
?></select></span> topics per page</td>
|
||||
<td><?=(count($args['topics'])==$mPPage+1)?("<a href='?cmd=s&pg=".($page+1)."' " .tooltip('Clickhere to go to the next page of retrieved topics') . " >"):""?>Next page -><?=(count($args['topics'])==$mPPage+1)?"</a>":""?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
102
scripts/site/beta5/output/forums/en/topic.inc
Normal file
102
scripts/site/beta5/output/forums/en/topic.inc
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?
|
||||
$f = $args['forum'];
|
||||
$t = $args['topic'];
|
||||
$fid = 'F#'.$f['ctype']."#".$f['id'];
|
||||
list($mPPage,$page,$nPages,$threaded,$reverse) = $args['details'];
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu($fid, $args['cats']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1><?=utf8entities($t['title'])?></h1>
|
||||
<form method='post' action='?'>
|
||||
<input type='hidden' name='cmd' value='T#<?=$f['ctype'].'#'.$t['id']?>' />
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td>Display <span <?=tooltip('Use this drop down list to select the number of posts to display on each page')?>><select name='mpp' onChange="submit();"><?php
|
||||
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$mPPage?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
|
||||
?></select></span> posts per page</td>
|
||||
<td><?php
|
||||
|
||||
if ($nPages > 1)
|
||||
{
|
||||
echo "Page <span" .tooltip('Use this drop down list to select the page of posts to display') . "><select name='pg' onChange='submit();'>";
|
||||
for ($i=0;$i<$nPages;$i++)
|
||||
echo "<option" . ($i==$page?" selected='selected'":"") . ">".($i+1)."</option>";
|
||||
echo "</select></span> / " . $nPages;
|
||||
}
|
||||
else
|
||||
echo "Page 1 / 1";
|
||||
|
||||
?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?
|
||||
|
||||
$p = $args['posts'];
|
||||
for ($i=0;$i<count($p);$i++)
|
||||
{
|
||||
$d = min($p[$i]['depth'], 20);
|
||||
if ($d)
|
||||
echo "<table cellspacing='0' cellpadding='0'><tr><td class='ftd$d'> </td><td>\n";
|
||||
|
||||
echo "<table cellspacing='0' cellpadding='0' class='ftp'>";
|
||||
echo "<tr><th>" . utf8entities($p[$i]['title']) . "</th>";
|
||||
echo "<td rowspan='2' class='cmd'>";
|
||||
echo "<a href='?cmd=".urlencode("R#".$f['ctype']."#".$p[$i]['id'])."&q=0'".tooltip('Click here to go to the compose form and reply to this message'). " >Reply</a> - ";
|
||||
echo "<a href='?cmd=".urlencode("R#".$f['ctype']."#".$p[$i]['id'])."&q=1'".tooltip('Click here to go to the compose form and reply to this message by quoting it'). " >Quote</a>\n";
|
||||
if ($f['mod'] || $p[$i]['mine'])
|
||||
{
|
||||
echo "<br/>";
|
||||
echo "<a href='?cmd=".urlencode("E#".$f['ctype']."#".$p[$i]['id'])."'".tooltip('Click here to go to the compose form and make changes to this post'). " >Edit</a>";
|
||||
if ($p[$i]['id'] != $t['fpid'] || $f['mod'])
|
||||
{
|
||||
echo " - <a href='?cmd=".urlencode("D#".$f['ctype']."#".$p[$i]['id'])."'".tooltip('Click here to delete this post'). " onClick='return confirm";
|
||||
echo ($p[$i]['id'] != $t['fpid']) ? 'DPost' : 'DTopic';
|
||||
echo "();'>Delete</a>\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td>Posted <b>" . gmstrftime("%H:%M:%S on %d/%m/%Y", $p[$i]['moment']);
|
||||
echo "</b> by ".(is_null($p[$i]['pid'])?'<b>':('<a href="message?a=c&ct=0&id='.$p[$i]['pid'].'"'.tooltip('Click here to go to the compose form and send a private message to the author of this post'). ' >'));
|
||||
echo $p[$i]['author'].(is_null($p[$i]['pid'])?'</b>':'</a>')."</td>";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr><td colspan='2'>" . $p[$i]["contents"] . "</td></tr>\n";
|
||||
|
||||
if ($p[$i]['edited'] != 0)
|
||||
{
|
||||
echo "<tr><td class='edit' colspan='2'>Edited by ";
|
||||
echo (is_null($p[$i]['edit_id']) ? '<b>' : ('<a href="message?a=c&ct=0&id='.$p[$i]['edit_id'].'" '.tooltip('Click here to go to the compose form and send a private message to the last person who edited this post'). ' >')) . utf8entities($p[$i]['edited_by']);
|
||||
echo (is_null($p[$i]['edit_id']) ? '</b>' : '</a>'). " at " . gmstrftime("%H:%M:%S on %d/%m/%Y", $p[$i]['edited']) . "</td></tr>";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
if ($d)
|
||||
echo "</td></tr></table>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0" class="fcmd">
|
||||
<tr>
|
||||
<td>Display mode: <span <?=tooltip('Use this drop down list to choose the display mode (threaded or linear)')?> ><select name='thr' onChange="submit();">
|
||||
<option value='0'>Linear</option>
|
||||
<option value='1'<?=$threaded?" selected='selected'":""?>>Threaded</option>
|
||||
</select></span></td>
|
||||
<td>Messages order:<span <?=tooltip('Use this drop down list to choose the messages order (newest or oldest first)')?> > <select name='ord' onChange="submit();">
|
||||
<option value='0'>Oldest first</option>
|
||||
<option value='1'<?=$reverse?" selected='selected'":""?>>Newest first</option>
|
||||
</select></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
11
scripts/site/beta5/output/forums/en/topicnotfound.inc
Normal file
11
scripts/site/beta5/output/forums/en/topicnotfound.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="mmenu">
|
||||
<? drawForumsMenu('', $args); ?>
|
||||
</td>
|
||||
<td>
|
||||
<h1>Topic Not Found</h1>
|
||||
<p>The topic you wish to view no longer exists.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
14
scripts/site/beta5/output/manual.en.inc
Normal file
14
scripts/site/beta5/output/manual.en.inc
Normal file
|
@ -0,0 +1,14 @@
|
|||
<table cellspacing="0" cellpadding="0" style="width:97%;margin:0% 0% 0% 1%">
|
||||
<tr>
|
||||
<td style="border-style:solid;border-color:white;border-width:0px 1px 0px 0px;width:300px">
|
||||
<?php
|
||||
include('manual/en/header.inc');
|
||||
?>
|
||||
</td>
|
||||
<td style="padding:0px 0px 0px 20px">
|
||||
<?
|
||||
include("manual/en/" . handler::$h->subPage . ".inc");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
68
scripts/site/beta5/output/manual/en/header.inc
Normal file
68
scripts/site/beta5/output/manual/en/header.inc
Normal file
|
@ -0,0 +1,68 @@
|
|||
<div style="margin:1px 1px 30px 1px;padding:0;width:100%">
|
||||
<?php
|
||||
|
||||
$manual = handler::$h->lib->call('getStructure', 'en');
|
||||
$txt = array('Top', 'Up', 'Previous', 'Next');
|
||||
if (!is_null(handler::$h->page)) {
|
||||
$pid = handler::$h->page['id'];
|
||||
$navLinks = handler::$h->lib->call('getNavLinks', $pid);
|
||||
for ($i=0;$i<4;$i++) {
|
||||
$t = is_null($navLinks[$i]) ? "" : "<a href='?p={$navLinks[$i]}'>";
|
||||
$t .= $txt[$i] . (is_null($navLinks[$i]) ? "" : "</a>");
|
||||
$navLinks[$i] = $t;
|
||||
}
|
||||
} else {
|
||||
$pid = null;
|
||||
$navLinks = $txt;
|
||||
}
|
||||
|
||||
$size = 15 + prefs::get('main/font_size', 2) * 3;
|
||||
?>
|
||||
<form action="?" method="POST">
|
||||
<table style="width:98%;margin:0% 0% 0% 1%">
|
||||
<tr>
|
||||
<td style="width:33%"> </td>
|
||||
<td style="width:34%;text-align:center"><?=$navLinks[0]?></td>
|
||||
<td style="width:33%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?=$navLinks[2]?></td>
|
||||
<td style="text-align:center"><?=$navLinks[1]?></td>
|
||||
<td style="text-align:right"><?=$navLinks[3]?></td>
|
||||
</tr>
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
<tr>
|
||||
<th style="text-align:right"><input type="submit" value="Search:" /></th>
|
||||
<td colspan='2'><input type="text" name="ss" value="<?=preg_replace('/"/', '"', handler::$h->searchText)?>" style="width:90%" /></td>
|
||||
</tr>
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
<tr><td colspan="3"><h3 style="margin:0;padding:0">Contents</h3></td></tr>
|
||||
</table>
|
||||
<div id="manual">
|
||||
<?
|
||||
|
||||
function dumpManualStructure(&$sections, $depth) {
|
||||
$br = false;
|
||||
foreach ($sections as $id => $sd) {
|
||||
if ($br) {
|
||||
echo "<br/>";
|
||||
} else {
|
||||
$br = true;
|
||||
}
|
||||
if ($depth > 0) {
|
||||
echo str_repeat(' ', $depth * 2);
|
||||
}
|
||||
echo " <a href='?p={$sd['name']}'>" . utf8entities($sd['title']) . "</a>";
|
||||
if (count($sd['subs'])) {
|
||||
echo "<br/>";
|
||||
dumpManualStructure($sd['subs'], $depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dumpManualStructure($manual, 0);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
5
scripts/site/beta5/output/manual/en/notfound.inc
Normal file
5
scripts/site/beta5/output/manual/en/notfound.inc
Normal file
|
@ -0,0 +1,5 @@
|
|||
<h1>Page not found!</h1>
|
||||
<p>
|
||||
The page you were looking for could not be found in the manual. Maybe the manual
|
||||
has been updated in the meantime.
|
||||
</p>
|
108
scripts/site/beta5/output/manual/en/page.inc
Normal file
108
scripts/site/beta5/output/manual/en/page.inc
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
|
||||
function drawContents (&$list) {
|
||||
$st = input::$IE ? "margin:0px 0px 0px 20px" : "margin:0px 0px 0px -15px";
|
||||
|
||||
$kl = array_keys($list);
|
||||
foreach ($kl as $k) {
|
||||
echo "<li><a href='#{$list[$k]['name']}'>{$list[$k]['title']}</a>";
|
||||
if (count($list[$k]['subsections'])) {
|
||||
echo "<ul style='$st'>";
|
||||
drawContents($list[$k]['subsections']);
|
||||
echo "</ul>";
|
||||
}
|
||||
echo "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function displayLinks($text) {
|
||||
$l = explode('<mlink ', $text);
|
||||
$nText = array_shift($l);
|
||||
while (count($l)) {
|
||||
$t = preg_replace('/^\s*to=[\'"]/', '', array_shift($l));
|
||||
$toName = preg_replace('/^([A-Za-z0-9_\-]+)[\'"]>(.*\n)*.*/', '\1', $t);
|
||||
$toName = preg_replace('/\s/', '', $toName);
|
||||
$t = preg_replace('/^[A-Za-z0-9_\-]+[\'"]>/', '', $t);
|
||||
|
||||
$secId = handler::$h->lib->call('getSectionId', handler::$h->lang, $toName);
|
||||
$link = "";
|
||||
if (!is_null($secId)) {
|
||||
$pageId = handler::$h->lib->call('getPageId', $secId);
|
||||
if (!is_null($pageId)) {
|
||||
$lt = handler::$h->lib->call('readSectionRecord', $secId);
|
||||
if ($pageId == handler::$h->page['id']) {
|
||||
$link = "<a href='#{$lt['name']}'>";
|
||||
} else {
|
||||
$pg = handler::$h->lib->call('readSectionRecord', $pageId);
|
||||
$link = "<a href='?c=0&p={$pg['name']}#{$lt['name']}'>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nText .= $link . preg_replace('/^(.*)<\/mlink>(.*\n)*.*/', '\1', $t) . ($link != '' ? "</a>" : "")
|
||||
. preg_replace('/^.*<\/mlink>/', '', $t);
|
||||
}
|
||||
|
||||
return $nText;
|
||||
}
|
||||
|
||||
|
||||
function drawSecTitle(&$section, $depth) {
|
||||
$pgLink = "";
|
||||
if ($section['linkto'] != "") {
|
||||
$pageId = handler::$h->lib->call('getPageId', $section['linkto']);
|
||||
if (!is_null($pageId)) {
|
||||
$lt = handler::$h->lib->call('readSectionRecord', $section['linkto']);
|
||||
if ($pageId == handler::$h->page['id']) {
|
||||
$pgLink = " (<a href='#{$lt['name']}'>view</a>)";
|
||||
} else {
|
||||
$pg = handler::$h->lib->call('readSectionRecord', $pageId);
|
||||
$pgLink = " (<a href='?c=0&p={$pg['name']}#{$lt['name']}'>view</a>)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mDepth = ($depth - 2) * 10;
|
||||
echo "<table style='width:95%;margin:0;padding:0'><tr><td style='width:85%'><a name='{$section['name']}'></a><h$depth"
|
||||
. " style='padding:0;margin:5px 0px 5px {$mDepth}px'>{$section['title']}$pgLink</h$depth>"
|
||||
. "</td><td style='text-align:right'><a href='#" . handler::$h->page['name'] . "'>Top</a></td></tr></table>";
|
||||
}
|
||||
|
||||
function drawSections (&$list, $depth = 2) {
|
||||
$kl = array_keys($list);
|
||||
foreach ($kl as $k) {
|
||||
if ($depth == 2) {
|
||||
echo "<hr/>";
|
||||
}
|
||||
drawSecTitle($list[$k], $depth);
|
||||
if ($list[$k]['contents'] != '') {
|
||||
echo "<div class='mansection'>" . displayLinks($list[$k]['contents']) . "</div>";
|
||||
}
|
||||
if (count($list[$k]['subsections'])) {
|
||||
drawSections($list[$k]['subsections'], $depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (is_null(handler::$h->page)) {
|
||||
include('manual_notfound.en.inc');
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<a name="<?=handler::$h->page['name']?>"></a>
|
||||
<h1 style="margin:0;padding:0"><?=handler::$h->page['title']?></h1>
|
||||
<?
|
||||
|
||||
if (count(handler::$h->page['subsections'])) {
|
||||
$st = input::$IE ? "margin:0px 0px 0px 30px" : "margin:0px 0px 0px -15px";
|
||||
echo "<div class='mansection'><b>Contents:</b><ul style='$st'>";
|
||||
drawContents(handler::$h->page['subsections']);
|
||||
echo "</ul></div>";
|
||||
drawSections(handler::$h->page['subsections']);
|
||||
}
|
||||
|
||||
?>
|
24
scripts/site/beta5/output/manual/en/search.inc
Normal file
24
scripts/site/beta5/output/manual/en/search.inc
Normal file
|
@ -0,0 +1,24 @@
|
|||
<h1>Search results for '<i><?=utf8entities($args['text'])?></i>'</h1>
|
||||
<?php
|
||||
if (empty($args['results'])) {
|
||||
echo "<p>Sorry, no results were found.</p>\n";
|
||||
} else {
|
||||
$c = count($args['results']);
|
||||
echo "<p><b>$c</b> result" . ($c > 1 ? "s were" : " was") . " found:</p>";
|
||||
echo "<div class='mansection'><ol>";
|
||||
$error = false;
|
||||
foreach ($args['results'] as $p) {
|
||||
$pData = handler::$h->lib->call('readSectionRecord', $p);
|
||||
if (is_null($pData)) {
|
||||
$error = true;
|
||||
continue;
|
||||
}
|
||||
echo "<li><a href='?p={$pData['name']}'>{$pData['title']}</a></li>";
|
||||
}
|
||||
echo "</ol>";
|
||||
if ($error) {
|
||||
echo "<b>Some results could not be displayed because of a database error.</b>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
3
scripts/site/beta5/output/map.en.inc
Normal file
3
scripts/site/beta5/output/map.en.inc
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div id='gametype' style="visibility: hidden; display:none"><?=(int) input::$game->params['victory']?></div>
|
||||
<div id='jsmap'>
|
||||
</div>
|
19
scripts/site/beta5/output/market.en.inc
Normal file
19
scripts/site/beta5/output/market.en.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
if (is_array($args)) {
|
||||
?>
|
||||
<form action="?" method="post" onSubmit="return false;"><table cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td id='mkppsel'> </td>
|
||||
<td style="width:5%;vertical-align:top"><a href="manual?p=marketplace">Help</a></td>
|
||||
</tr>
|
||||
<tr><td id='mkppage' colspan="2">
|
||||
|
||||
</td></tr>
|
||||
</table></form>
|
||||
<div id='mkpfpage' style="display: none; visibility: hidden;"><?=$args['page']?></div>
|
||||
<div id='mkpinit' style="display: none; visibility: hidden;"><?=$args['pdata']?></div>
|
||||
<?php
|
||||
} else {
|
||||
echo "<center><br/>Your account has been created too recently for you to use this feature.<br/>You must wait for $args more day".($args>1?"s":"").".</center>";
|
||||
}
|
||||
?>
|
4
scripts/site/beta5/output/message.en.inc
Normal file
4
scripts/site/beta5/output/message.en.inc
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div id='jsmsgflist' style="display: none; visibility: hidden;"><?=$args['flist']?></div>
|
||||
<div id='jsmsginit' style="display: none; visibility: hidden;"><?=$args['dinit']?></div>
|
||||
<div id='jsmsg'>
|
||||
</div>
|
30
scripts/site/beta5/output/money.en.inc
Normal file
30
scripts/site/beta5/output/money.en.inc
Normal file
|
@ -0,0 +1,30 @@
|
|||
<table cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td class='div2'>
|
||||
<h1>Current Funds</h1>
|
||||
<p>Your empire has <b id='cfunds'></b>.</p>
|
||||
</td>
|
||||
<td rowspan='2' class='pc45'>
|
||||
<h1>Daily Profits</h1>
|
||||
<p>
|
||||
<a href='#pinc' <?=tooltip('Click here to go to the planets profits and loss section of the page')?>>Planet Income:</a> <b id='pinc'></b><br/>
|
||||
<a href='#fukp' <?=tooltip('Click here to go to fleets upkeep section of the pahe')?>>Fleet Upkeep:</a> <b id='fupk'></b><br/>
|
||||
<b>Daily Profits: €<span id='dprof'></span></b>
|
||||
</p>
|
||||
</td>
|
||||
<td rowspan="2" style="width:5%;vertical-align:top"><a href="manual?p=money">Help</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='div2'>
|
||||
<div id='transfer'> </div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan='3'><hr/></td></tr>
|
||||
|
||||
<tr><td colspan='3'><a name='pinc'></a><h1>Planet Profit and Loss</h1></td></tr>
|
||||
<tr><td colspan='3' id='planets'></td></tr>
|
||||
<tr><td colspan='3'><hr/></td></tr>
|
||||
|
||||
<tr><td colspan='3'><a name='fukp'></a><h1>Fleet Upkeep Expenses</h1></td></tr>
|
||||
<tr><td colspan='3' id='fleets'></td></tr>
|
||||
</table>
|
6
scripts/site/beta5/output/norealloc.en.inc
Normal file
6
scripts/site/beta5/output/norealloc.en.inc
Normal file
|
@ -0,0 +1,6 @@
|
|||
<h1>Getting a new planet</h1>
|
||||
<p>
|
||||
In this specific game, it is just impossible to get a new planet this way.<br/>
|
||||
You either need to take a planet using your fleets (provided you have any left),
|
||||
or to get someone to sell you or give you a planet.
|
||||
</p>
|
45
scripts/site/beta5/output/nplanet.en.inc
Normal file
45
scripts/site/beta5/output/nplanet.en.inc
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
if ($args === false)
|
||||
{
|
||||
?>
|
||||
<h1>You Evil, Evil Man</h1>
|
||||
<p>
|
||||
You already have a planet, or many of these. Now begone!
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
elseif ($args['ok'])
|
||||
{
|
||||
?>
|
||||
<h1>New Planet Assigned!</h1>
|
||||
<p>
|
||||
Your new planet, <a href='planet?id=<?=$args['id']?>'><?=utf8entities($args['name'])?></a>, has been assigned to your empire!<br/>
|
||||
<br/>
|
||||
<a href="planets">View the Planet List</a>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<h1>Get a New Planet</h1>";
|
||||
echo "<form method='post' action='?'><p>";
|
||||
echo "Please type the name of your new planet in the field below, then click OK to get the planet.<br/><br/>";
|
||||
if ($args['err'])
|
||||
{
|
||||
echo "<span id='plerror'>";
|
||||
switch ($args['err']) :
|
||||
case 1: echo "This planet name is too long (maximum 15 characters)"; break;
|
||||
case 2: echo "This planet name is incorrect (letters, numbers, spaces and _.@-+'/ only)"; break;
|
||||
case 3: echo "Spaces are not allowed at the beginning or at the end of the planet's name"; break;
|
||||
case 4: echo "Multiple spaces are not allowed"; break;
|
||||
case 5: echo "This planet name is too short (minimum 2 characters)"; break;
|
||||
case 6: echo "A planet by that name already exists"; break;
|
||||
endswitch;
|
||||
echo ".</span><br/>";
|
||||
}
|
||||
echo "Name of your new planet: <input type='text' name='name' value=\"".utf8entities($args['name'],ENT_QUOTES)."\" size='20' maxlength='15' /> ";
|
||||
echo "<input type='submit' value='OK' /><br/><br/>";
|
||||
echo "Please note that getting a new planet will disband all of your fleets and place you under protection from the Peacekeepers.";
|
||||
echo "</p></form>";
|
||||
}
|
2
scripts/site/beta5/output/overview.en.inc
Normal file
2
scripts/site/beta5/output/overview.en.inc
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div id='overview'></div>
|
||||
<div style="display:none;visibility:hidden"><form action="?" onsubmit="return false"><textarea id="init-data"><?=$args?></textarea></form></div>
|
18
scripts/site/beta5/output/planet.en.inc
Normal file
18
scripts/site/beta5/output/planet.en.inc
Normal file
|
@ -0,0 +1,18 @@
|
|||
<table cellspacing='0' cellpadding='0'>
|
||||
|
||||
<tr><td colspan='3'><table cellspacing='0' cellpadding='0' class='phdr'><tr>
|
||||
<td class='pimg' id='pimg'> </td>
|
||||
<td class='pttl'><h1 id='plname'> </h1><p id="plactions"> </p></td>
|
||||
<td class='psel'><form action='?' method='get'>
|
||||
<input type='hidden' name='oid' id='oid' value='<?=$args['id']?>' />
|
||||
Select planet: <span id='psel'></span> -
|
||||
<a href='planets'>Planet list</a> -
|
||||
<a href='manual?p=planet'>Help</a>
|
||||
</form></td>
|
||||
</tr></table></td></tr>
|
||||
<tr><td colspan='3'> </td></tr>
|
||||
|
||||
<tr><td colspan='div20'> </td><td id='pldesc'>
|
||||
</td><td colspan='div20'> </tr>
|
||||
|
||||
</table>
|
5
scripts/site/beta5/output/planetnf.en.inc
Normal file
5
scripts/site/beta5/output/planetnf.en.inc
Normal file
|
@ -0,0 +1,5 @@
|
|||
<h1>Planet not found</h1>
|
||||
<p>
|
||||
The planet you are looking for could not be found.<br/>
|
||||
Insert witty pun here.
|
||||
</p>
|
2
scripts/site/beta5/output/planets.en.inc
Normal file
2
scripts/site/beta5/output/planets.en.inc
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div id='jsplanets'>
|
||||
</div>
|
201
scripts/site/beta5/output/preferences.en.inc
Normal file
201
scripts/site/beta5/output/preferences.en.inc
Normal file
|
@ -0,0 +1,201 @@
|
|||
<?php
|
||||
|
||||
function makeOpt($a,$n,$v)
|
||||
{
|
||||
$t = "<option value='$v'";
|
||||
if ($a[$n] == $v)
|
||||
$t .= " selected='selected'";
|
||||
$t .= ">";
|
||||
return $t;
|
||||
}
|
||||
|
||||
?>
|
||||
<form method='post' action='?'>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="pc5" rowspan="7"> </td>
|
||||
<td class="pc45">
|
||||
<table class="prefs">
|
||||
<tr><td class="psec" colspan="2"><h1>Account</h1></td></tr>
|
||||
<?php
|
||||
if (!is_null($args['err1']))
|
||||
echo "<tr><td class='err' colspan='2'>The address you entered is invalid, please correct it.</td></tr>\n";
|
||||
?>
|
||||
<tr>
|
||||
<th class="div2">E-mail address:</th>
|
||||
<td class="div2"><input type='text' name='mail' <?=tooltip('Use this text field to type in your email address')?> class='txt' value="<?=is_null($args['err1'])?$args['mail']:$args['err1']?>" size="35" maxlength="128" /></td>
|
||||
</tr>
|
||||
<tr><td colspan='2'
|
||||
<?php
|
||||
if (!is_null($args['err2']))
|
||||
{
|
||||
echo " class='err'>";
|
||||
switch ($args['err2']) :
|
||||
case 1: echo "A database access error has occured"; break;
|
||||
case 2: echo "The current password is incorrect"; break;
|
||||
case 3: echo "The new password and its confirmation are different"; break;
|
||||
case 4: echo "The new password is too short (minimum 4 characters)"; break;
|
||||
case 5: echo "The new password is too long (maximum 64 characters)"; break;
|
||||
case 6: echo "The new password must be different from your user name"; break;
|
||||
endswitch;
|
||||
}
|
||||
else
|
||||
echo " class='note'>Please leave these fields empty if you do not intend to change your password.";
|
||||
?></td></tr>
|
||||
<tr>
|
||||
<th>Current password:</th>
|
||||
<td><input type='password' class='txt' name='opass' <?=tooltip('Use this text field to type in your current password')?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>New password:</th>
|
||||
<td><input type='password' class='txt' name='npass' <?=tooltip('Use this text field to type in your new password')?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Confirm new password:</th>
|
||||
<td><input type='password' class='txt' name='cpass' <?=tooltip('Use this text field to confirm your new password')?>/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="pc45">
|
||||
<table class="prefs">
|
||||
<tr><td class="psec" colspan="2">
|
||||
<table style="width:100%;padding:0;margin:0"><tr>
|
||||
<td style="vertical-align:top"><h1>Display</h1></td>
|
||||
<td style="text-align:right;vertical-align:top"><a href="manual?p=preferences">Help</a></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th class="div2">Language:</th>
|
||||
<td class="div2" <?=tooltip('Use this drop down list to choose the language to use')?>><select name='lang' >
|
||||
<?=makeOpt($args,'lang','en')?>English</option>
|
||||
</select></td>
|
||||
</tr><tr>
|
||||
<th>Font size:</th>
|
||||
<td <?=tooltip('Use this drop down list to select the font size')?>><select name='fs'>
|
||||
<?=makeOpt($args,'fs',0)?>tiny</option>
|
||||
<?=makeOpt($args,'fs',1)?>small</option>
|
||||
<?=makeOpt($args,'fs',2)?>normal</option>
|
||||
<?=makeOpt($args,'fs',3)?>big</option>
|
||||
<?=makeOpt($args,'fs',4)?>huge</option>
|
||||
</select></td>
|
||||
</tr><tr>
|
||||
<th>Tooltips:</th>
|
||||
<td <?=tooltip('Use this drop down list to set up tooltips delays')?>><select name='tt'>
|
||||
<?=makeOpt($args,'tt',0)?>Disabled</option>
|
||||
<?=makeOpt($args,'tt',1)?>0.5 second</option>
|
||||
<?=makeOpt($args,'tt',2)?>1 second</option>
|
||||
<?=makeOpt($args,'tt',3)?>1.5 second</option>
|
||||
<?=makeOpt($args,'tt',4)?>2 seconds</option>
|
||||
<?=makeOpt($args,'tt',5)?>2.5 seconds</option>
|
||||
<?=makeOpt($args,'tt',6)?>3 seconds</option>
|
||||
</select></td>
|
||||
</tr><tr>
|
||||
<th>Theme:</th>
|
||||
<td <?=tooltip('Use this drop down list to choose your interface theme')?>><select name='thm'>
|
||||
<?=makeOpt($args,'thm','default')?>LegacyWorlds Beta 5</option>
|
||||
<?=makeOpt($args,'thm','invert')?>Beta 5 Reversed</option>
|
||||
<?=makeOpt($args,'thm','classic')?>LegacyWorlds Classic</option>
|
||||
<?=makeOpt($args,'thm','cripes')?>That Other Theme</option>
|
||||
</select></td>
|
||||
</tr><tr>
|
||||
<th>Colour scheme:</th>
|
||||
<td <?=tooltip('Use this drop down list to choose the colour scheme to use')?>><select name='col'>
|
||||
<?=makeOpt($args,'col','red')?>red</option>
|
||||
<?=makeOpt($args,'col','green')?>green</option>
|
||||
<?=makeOpt($args,'col','blue')?>blue</option>
|
||||
<?=makeOpt($args,'col','grey')?>grey</option>
|
||||
<?=makeOpt($args,'col','purple')?>purple</option>
|
||||
<?=makeOpt($args,'col','yellow')?>yellow</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="pc5" rowspan="7"> </td>
|
||||
</tr>
|
||||
<tr><td colspan="2"><hr/></td></tr>
|
||||
<tr><td colspan="2">
|
||||
<table class="prefs">
|
||||
<tr><td class="psec" colspan='4'><h1>Forums</h1></td></tr>
|
||||
<tr>
|
||||
<th class="div4">Topics/page:</th>
|
||||
<td class="div4" <?=tooltip('Use this drop down list to choose the number oftopics to display on each forum page')?>><select name='tpp'><?php
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$args['tpp']?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
?></select></td>
|
||||
<th class="div4">Messages/page:</th>
|
||||
<td class="div4" <?=tooltip('Use this drop down list to choose the number ofmessages to display on each topic page')?>><select name='mpp'><?php
|
||||
for ($i=1;$i<6;$i++)
|
||||
echo "<option" . ($i*10==$args['mpp']?" selected='selected'":"") . ">" . ($i*10) . "</option>";
|
||||
?></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Graphical smileys:</th>
|
||||
<td <?=tooltip('Use this drop down list to enable / disable graphical smileys in the forums')?>><select name='gsm' >
|
||||
<option value='0'>Disabled</option>
|
||||
<option value='1'<?=$args['gsm']?" selected='selected'":""?>>Enabled</option>
|
||||
</td>
|
||||
<th>Forum tags:</th>
|
||||
<td <?=tooltip('Use this drop down list to enable / disable forum tags - those are necessary to handle text modifiers')?>><select name='gft'>
|
||||
<option value='0'>Disabled</option>
|
||||
<option value='1'<?=$args['gft']?" selected='selected'":""?>>Enabled</option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Display mode:</th>
|
||||
<td <?=tooltip('Use this drop down list to choose between linear and threaded displays')?>><select name='fdm'>
|
||||
<option value='0'>Linear</option>
|
||||
<option value='1'<?=$args['fdm']?" selected='selected'":""?>>Threaded</option>
|
||||
</td>
|
||||
<th>Messages order:</th>
|
||||
<td <?=tooltip('Use this drop down list to choose messager ordering criteria')?>><select name='fmo'>
|
||||
<option value='0'>Oldest first</option>
|
||||
<option value='1'<?=$args['fmo']?" selected='selected'":""?>>Newest first</option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Signature:</th>
|
||||
<td colspan='3' <?=tooltip('Use this text area to type in your signature for your posts in the forums ')?>><textarea name='fsig'><?=utf8entities($args['fsig'])?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td colspan="2"><hr/></td></tr>
|
||||
<tr><td colspan="2" class='buttons'>
|
||||
<input type='submit' value='Update preferences' <?=tooltip('Click here to update your preferences')?>/>
|
||||
<input type='reset' value='Restore previous values' <?=tooltip('Click here to cancel your changes and restore the previous values')?> />
|
||||
</td></tr>
|
||||
<?
|
||||
if ($args['lok']) {
|
||||
?>
|
||||
<tr><td colspan="2"><hr/></td></tr>
|
||||
<tr><td colspan="2">
|
||||
<h1>Leave Game</h1>
|
||||
<p>
|
||||
<?
|
||||
|
||||
if (is_null($args['quit']))
|
||||
{
|
||||
?>
|
||||
Click the button bellow to leave this game. Please note that it will not close your account; it will simply quit the current game. You will have 24 hours after you click the button to cancel your action; after that, your planets will be made neutral, your fleets will be destroyed, your private messages erased, etc...<br/><br/>
|
||||
You will still be able to access the other games you're playing, and you'll be able to start playing any other game from the Account page.<br/><br/><input type='submit'<?=tooltip('Click here to leave this Legacy Worlds Game')?> name='quit' value='Leave <?=$args['name']?>' />
|
||||
<?
|
||||
} else {
|
||||
echo "You have decided to leave {$args['name']}. Your player information will be destroyed in ";
|
||||
$tl = 86400 + $args['quit'] - time();
|
||||
$h = ($tl - $tl % 3600) / 3600;
|
||||
if ($h > 0)
|
||||
echo "<b>$h</b> hour" . ($h>1 ? 's' : '');
|
||||
$tl -= $h * 3600;
|
||||
$m = ($tl - $tl % 60) / 60;
|
||||
if ($m > 0)
|
||||
echo ($h != 0 ? ' and ' : '') . "<b>$m</b> minute" . ($m>1 ? 's' : '');
|
||||
$tl -= $m * 60;
|
||||
?>
|
||||
unless you decide to cancel this action by clicking the button below.<br/><br/><input type='submit' name='quit' <?=tooltip('Click here to cancel your request to leave this game')?> value='Do NOT leave <?=$args['name']?>' />
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
10
scripts/site/beta5/output/probes.en.inc
Normal file
10
scripts/site/beta5/output/probes.en.inc
Normal file
|
@ -0,0 +1,10 @@
|
|||
<div id='pinit' style="display: none; visibility: hidden;"><?=$args?></div>
|
||||
<form action="?" onSubmit="return false"><table cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td id='prmenu' style="width:95%"> </td>
|
||||
<td style="width:5%;vertical-align:top"><a href="manual?p=probes">Help</a></td>
|
||||
</tr>
|
||||
<tr><td id='prpage' colspan="2">
|
||||
|
||||
</td></tr>
|
||||
</table></form>
|
10
scripts/site/beta5/output/rank.en.inc
Normal file
10
scripts/site/beta5/output/rank.en.inc
Normal file
|
@ -0,0 +1,10 @@
|
|||
<table cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td id='rkpsel' style="width:95%"> </td>
|
||||
<td style="width:5%;vertical-align:top"><a href="manual?p=rankings">Help</a></td>
|
||||
</tr>
|
||||
<tr><td id='rkpage' colspan='2'>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
<div id='rkinit' style="display: none; visibility: hidden;"><?=$args?></div>
|
10
scripts/site/beta5/output/rat.en.inc
Normal file
10
scripts/site/beta5/output/rat.en.inc
Normal file
|
@ -0,0 +1,10 @@
|
|||
<h1>Fool!</h1>
|
||||
<p>
|
||||
Begone!
|
||||
</p>
|
||||
<p>
|
||||
Now!
|
||||
</p>
|
||||
<p>
|
||||
You are not wanted here!
|
||||
</p>
|
9
scripts/site/beta5/output/research.en.inc
Normal file
9
scripts/site/beta5/output/research.en.inc
Normal file
|
@ -0,0 +1,9 @@
|
|||
<table cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td id='respsel' style="width:95%"> </td>
|
||||
<td style="width:5%;vertical-align:middle"><a href="manual?p=technology">Help</a></td>
|
||||
</tr>
|
||||
<tr><td id='respage' colspan="2">
|
||||
|
||||
</td></tr>
|
||||
</table>
|
1
scripts/site/beta5/output/techtrade.inc
Normal file
1
scripts/site/beta5/output/techtrade.inc
Normal file
|
@ -0,0 +1 @@
|
|||
<div style="display:none;visibility:hidden"><form action="?" onsubmit="return false"><textarea id="init-data"><?=$args?></textarea></form></div><div id="page-contents"> </div>
|
24
scripts/site/beta5/output/ticks.en.inc
Normal file
24
scripts/site/beta5/output/ticks.en.inc
Normal file
|
@ -0,0 +1,24 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td style="width:95%">
|
||||
<?php
|
||||
|
||||
$now = time();
|
||||
$dt = array($now);
|
||||
foreach ($args as $tid => $td)
|
||||
{
|
||||
if (!$td['game'])
|
||||
continue;
|
||||
echo "<h1>" . utf8entities($td['name']) . "</h1>";
|
||||
echo "<p>" . utf8entities($td['description']) . "</p>";
|
||||
echo "<div id='tick$tid'> </div>";
|
||||
echo "<p> </p>";
|
||||
array_push($dt, "$tid#" . $td['first'] . "#" . $td['interval'] . "#" . $td['last']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td style="width:5%;vertical-align:top"><a href="manual?p=ticks">Help</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id='tickinit' style="display: none; visibility: hidden;"><?=join('#',$dt)?></div>
|
38
scripts/site/beta5/output/universe.en.inc
Normal file
38
scripts/site/beta5/output/universe.en.inc
Normal file
|
@ -0,0 +1,38 @@
|
|||
<div style="display:none;visibility:hidden"><form action="?" onsubmit="return false"><textarea id="init-data"><?=$args?></textarea></form></div>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="div2">
|
||||
<h1>Universe Information</h1>
|
||||
<h2>Galaxy</h2>
|
||||
<p>
|
||||
Planets: <b id="npl"> </b><br/>
|
||||
Neutral planets: <b id="nnpl"> </b><br/>
|
||||
Systems occupied by nebulas: <b id="nnsys"> </b><br/>
|
||||
Average turrets/planet: <b id="avgt"> </b><br/>
|
||||
Average factories/planet: <b id="avgf"> </b>
|
||||
</p>
|
||||
<p><a href="map" <?=tooltip('Click here to go to the map page')?>>View maps</a></p>
|
||||
</td>
|
||||
<td class="pc45">
|
||||
<h1>Ticks</h1>
|
||||
<p>
|
||||
<span id="ticks"> </span>
|
||||
<br/>
|
||||
<a href="ticks" <?=tooltip('Click here to go to the ticks page')?>>More details...</a>
|
||||
</p>
|
||||
<h1>Rankings</h1>
|
||||
<p>
|
||||
You are ranked <b id="genrank"> </b> with <b id="genpts"> </b> points.<br/>
|
||||
Your financial ranking is <b id="finrank"> </b> (<b id="finpts"> </b> points).<br/>
|
||||
Your civilization ranking is <b id="civrank"> </b> (<b id="civpts"> </b> points).<br/>
|
||||
Your military ranking is <b id="milrank"> </b> (<b id="milpts"> </b> points).<br/>
|
||||
Your inflicted damage ranking is <b id="idrank"> </b> (<b id="idpts"> </b> points).<br/>
|
||||
<span id="rndrank"> </span><br/>
|
||||
There are <b id="rknplayers"> </b> players in the rankings.<br/>
|
||||
<br/>
|
||||
<a href="rank" <?=tooltip('Click here to go to the rankings page')?>>More details...</a>
|
||||
</p>
|
||||
</td>
|
||||
<td style="width:5%;vertical-align:top"><a href="manual?p=universe_page">Help</a></td>
|
||||
</tr>
|
||||
</table>
|
172
scripts/site/beta5/page.inc
Normal file
172
scripts/site/beta5/page.inc
Normal file
|
@ -0,0 +1,172 @@
|
|||
<?php
|
||||
|
||||
class page_layout {
|
||||
|
||||
function page_layout() {
|
||||
$this->dir = config::$main['scriptdir'] . "/site/beta5";
|
||||
$this->static = config::$main['staticdir'] . "/beta5";
|
||||
}
|
||||
|
||||
|
||||
function header($pg, $lg) {
|
||||
// Output the HTML header
|
||||
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 4.01 Transitional//EN\">\n"
|
||||
. "<html><head><title>Legacy Worlds " . input::$game->text . "</title>"
|
||||
. "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>";
|
||||
|
||||
// Read the user preferences
|
||||
$tt = prefs::get('main/tooltips', 2);
|
||||
$fs = prefs::get('main/font_size', 2);
|
||||
$col = prefs::get('main/colour', 'purple');
|
||||
$thm = prefs::get('beta5/theme', "default");
|
||||
|
||||
// Generate CSS and JS resources
|
||||
$this->generateStylesheets($pg, $thm, $fs, $col);
|
||||
if (is_null(handler::$h->customJS)) {
|
||||
$this->generateJS($pg, $thm, $col, $lg, $tt, $fs);
|
||||
} else {
|
||||
$this->jsRes = handler::$h->customJS;
|
||||
}
|
||||
|
||||
if (!is_null($this->cssRes)) {
|
||||
echo "<link rel='stylesheet' type='text/css' href='".makeLink('css','main',"css")."?id={$this->cssRes}' />";
|
||||
}
|
||||
if (!is_null($this->jsRes)) {
|
||||
echo "<script language='JavaScript' type='text/javascript' charset='utf-8' src='".makeLink('js','main',"js")."?id={$this->jsRes}'></script>";
|
||||
}
|
||||
|
||||
// Generate HTML body tag
|
||||
echo "</head><body";
|
||||
if (is_null(handler::$h->customJS)) {
|
||||
if (ajax::$init != "" || $tt) {
|
||||
echo " onload='lwAutoInit();'";
|
||||
}
|
||||
if ($tt) {
|
||||
echo " onunload='tt_Disable()'";
|
||||
}
|
||||
echo ">\n";
|
||||
} else {
|
||||
if (!is_null(handler::$h->customJS['load'])) {
|
||||
echo " onload='" . handler::$h->customJS['load'] . "'";
|
||||
}
|
||||
if (!is_null(handler::$h->customJS['unload'])) {
|
||||
echo " onunload='" . handler::$h->customJS['unload'] ."'";
|
||||
}
|
||||
}
|
||||
|
||||
// Load the header
|
||||
if (is_null(handler::$h->customHeader)) {
|
||||
$hdr = "header";
|
||||
} else {
|
||||
$hdr = handler::$h->customHeader;
|
||||
}
|
||||
$this->includeFile("{$this->dir}/layout/$thm/$hdr.$lg.inc");
|
||||
}
|
||||
|
||||
|
||||
function footer($pg, $lg) {
|
||||
$tt = prefs::get('main/tooltips', 2);
|
||||
$col = prefs::get('main/colour', 'purple');
|
||||
$thm = prefs::get('beta5/theme', "default");
|
||||
|
||||
if (is_null(handler::$h->customFooter)) {
|
||||
$ftr = "footer";
|
||||
} else {
|
||||
$ftr = handler::$h->customFooter;
|
||||
}
|
||||
$this->includeFile("{$this->dir}/layout/$thm/$ftr.$lg.inc");
|
||||
|
||||
// Tooltips
|
||||
if ($tt && is_null(handler::$h->customJS)) {
|
||||
echo "<div id='ttPlaceHolderReserved'></div>";
|
||||
$f = getStatic("beta5/js/tt_{$thm}_$col.js");
|
||||
if (!is_null($f)) {
|
||||
echo "<script language='JavaScript' type='text/javascript' src='$f'></script>";
|
||||
}
|
||||
$f = getStatic("beta5/js/tooltips.js");
|
||||
if (!is_null($f)) {
|
||||
echo "<script language='JavaScript' type='text/javascript' src='$f'></script>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</body></html>";
|
||||
}
|
||||
|
||||
|
||||
function generateStylesheets($page, $thm, $fs, $col) {
|
||||
$css = array("main");
|
||||
array_push($css, "thm_$thm");
|
||||
array_push($css, "pg_$page");
|
||||
array_push($css, "fonts$fs");
|
||||
array_push($css, "$col");
|
||||
foreach ($css as $fn) {
|
||||
$rf = "/css/$fn" . (input::$IE ? "-ie" : "");
|
||||
$r = addFileResource("css", "{$this->static}/$rf.css");
|
||||
if (input::$IE && !$r) {
|
||||
$r = addFileResource("css", "{$this->static}/css/$fn.css");
|
||||
}
|
||||
}
|
||||
|
||||
$this->cssRes = storeResource("css", 345600);
|
||||
}
|
||||
|
||||
|
||||
function generateJS($pg, $thm, $col, $lg, $tt, $fs) {
|
||||
// JavaScript variables (static access URL, color, etc...)
|
||||
$jsConf = "var staticurl=\"".config::$main['staticurl']
|
||||
. "\";\nvar color=\"$col\";\nvar ttFontSize = '" . ($fs + 9) . "px';\n"
|
||||
. "var ttDelay = " . ($tt * 500) . ";\n";
|
||||
|
||||
// AJAX-specified initialization code
|
||||
if (ajax::$init != "" || $tt) {
|
||||
$jsConf .= "function lwAutoInit()\n{\n";
|
||||
if (is_array(ajax::$fHandler)) {
|
||||
foreach (ajax::$fHandler as $f) {
|
||||
$jsConf .= "\tnew rpc_Function('$f','" . ajax::$method[$f] . "');\n";
|
||||
}
|
||||
}
|
||||
if (is_array(ajax::$fTheme)) {
|
||||
foreach (ajax::$fTheme as $f) {
|
||||
$jsConf .= "\tnew rpc_Function('$f','" . ajax::$method[$f] . "');\n";
|
||||
}
|
||||
}
|
||||
if (ajax::$init != "") {
|
||||
$jsConf .= "\t" . ajax::$init . "\n";
|
||||
}
|
||||
if ($tt) {
|
||||
$jsConf .= "\ttt_Init();\n";
|
||||
}
|
||||
$jsConf .= "}\n";
|
||||
}
|
||||
addRawResource("js", $jsConf);
|
||||
|
||||
// Common JavaScript functions
|
||||
addFileResource("js", "{$this->static}/js/main.js");
|
||||
addFileResource("js", "{$this->static}/js/main-$lg.js");
|
||||
|
||||
// AJAX script and initialisation
|
||||
if (count(ajax::$fHandler) || count(ajax::$fTheme)) {
|
||||
addRawResource("js", "var rpc_pageURI='" . makeLink($pg, input::$game->name, 'rpc') . "';\n");
|
||||
addFileResource("js", "{$this->static}/js/rpc.js");
|
||||
addFileResource("js", "{$this->static}/js/rpc-$lg.js");
|
||||
}
|
||||
|
||||
// Theme-specific JavaScript
|
||||
addFileResource("js", "{$this->static}/js/thm_$thm.js");
|
||||
addFileResource("js", "{$this->static}/js/thm_$thm-$lg.js");
|
||||
|
||||
// Page-specific JavaScript
|
||||
addFileResource("js", "{$this->static}/js/pg_$pg.js");
|
||||
addFileResource("js", "{$this->static}/js/pg_$pg-$lg.js");
|
||||
|
||||
// Add JS resource
|
||||
$this->jsRes = storeResource("js", 345600);
|
||||
}
|
||||
|
||||
|
||||
function includeFile($file, $args = null) {
|
||||
include($file);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue