Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fde7653cf | ||
|
|
7dcc790e65 | ||
|
|
5797328adc | ||
|
|
6f1e5e4467 | ||
|
|
8ebc4cd91f | ||
|
|
4b92511bae | ||
|
|
74c4f31f7f | ||
|
|
50538bd332 | ||
|
|
9e3c1e68bf | ||
|
|
4b2167c133 | ||
|
|
fa9fa5d3a5 | ||
|
|
b09c4e6c62 | ||
|
|
422f2c1295 | ||
|
|
a531d61639 | ||
|
|
347952319a | ||
|
|
70145967d0 | ||
|
|
3dde300c80 | ||
|
|
802be5f8c3 | ||
|
|
7e7924e97e | ||
|
|
03efb85c0b | ||
|
|
690a7f60f3 | ||
|
|
d40313279a | ||
|
|
66805034a6 | ||
|
|
dfa3dfb086 | ||
|
|
5393be4daf | ||
|
|
fcd1f5b740 | ||
|
|
4bb4693d2e | ||
|
|
5acde87794 | ||
|
|
9636b4bb00 | ||
|
|
c38e53706e | ||
|
|
6d61e93c47 | ||
|
|
fc311855b4 | ||
|
|
ec7e40e1aa | ||
|
|
cfeb6aca6d | ||
|
|
be8c6a6629 | ||
|
|
8f0f7a4d46 | ||
|
|
ddfb36efa5 |
1730 changed files with 46050 additions and 23268 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -1 +1,8 @@
|
||||||
/config.php
|
config.php
|
||||||
|
.buildpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
.idea/
|
||||||
|
coverage/
|
||||||
|
src/application/cache/*
|
||||||
|
src/application/configs/local.php
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
SetEnv DEBUG On
|
|
||||||
SetEnv DEPRECATION Off
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
|
|
||||||
|
|
||||||
includeLang('admin');
|
|
||||||
|
|
||||||
$mode = $_POST['mode'];
|
|
||||||
|
|
||||||
$PageTpl = gettemplate("add_declare");
|
|
||||||
$parse = $lang;
|
|
||||||
|
|
||||||
if ($mode == 'addit') {
|
|
||||||
$declarator = $user['id'];
|
|
||||||
$declarator_name = addslashes(htmlspecialchars($user['username']));
|
|
||||||
$decl1 = addslashes(htmlspecialchars($_POST['dec1']));
|
|
||||||
$decl2 = addslashes(htmlspecialchars($_POST['dec2']));
|
|
||||||
$decl3 = addslashes(htmlspecialchars($_POST['dec3']));
|
|
||||||
$reason1 = addslashes(htmlspecialchars($_POST['reason']));
|
|
||||||
|
|
||||||
$QryDeclare = "INSERT INTO {{table}} SET ";
|
|
||||||
$QryDeclare .= "`declarator` = '". $declarator ."', ";
|
|
||||||
$QryDeclare .= "`declarator_name` = '". $declarator_name ."', "; $QryDeclare .= "`declared_1` = '". $decl1 ."', ";
|
|
||||||
$QryDeclare .= "`declared_2` = '". $decl2 ."', ";
|
|
||||||
$QryDeclare .= "`declared_3` = '". $decl3 ."', ";
|
|
||||||
$QryDeclare .= "`reason` = '". $reason1 ."' ";
|
|
||||||
|
|
||||||
doquery( $QryDeclare, "declared");
|
|
||||||
doquery("UPDATE {{table}} SET multi_validated ='1' WHERE username='{$user['username']}'","users");
|
|
||||||
|
|
||||||
AdminMessage ( "Merci, votre demande a ete prise en compte. Les autres joueurs que vous avez implique doivent egalement et imperativement suivre cette procedure aussi.", "Ajout" );
|
|
||||||
}
|
|
||||||
$Page = parsetemplate($PageTpl, $parse);
|
|
||||||
|
|
||||||
display ($Page, "Declaration d\'IP partagee", false, '', true);
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
|
||||||
|
|
||||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
|
||||||
includeLang('admin');
|
|
||||||
|
|
||||||
$parse = $lang;
|
|
||||||
$parse['dpath'] = $dpath;
|
|
||||||
$parse['mf'] = $mf;
|
|
||||||
|
|
||||||
$PageTPL = gettemplate('admin/activeplanet_body');
|
|
||||||
$AllActivPlanet = doquery("SELECT * FROM {{table}} WHERE `last_update` >= '". (time()-15 * 60) ."' ORDER BY `id` ASC", 'planets');
|
|
||||||
$Count = 0;
|
|
||||||
|
|
||||||
while ($ActivPlanet = $AllActivPlanet->fetch(PDO::FETCH_BOTH)) {
|
|
||||||
$parse['online_list'] .= "<tr>";
|
|
||||||
$parse['online_list'] .= "<td class=b><center><b>". $ActivPlanet['name'] ."</b></center></td>";
|
|
||||||
$parse['online_list'] .= "<td class=b><center><b>[". $ActivPlanet['galaxy'] .":". $ActivPlanet['system'] .":". $ActivPlanet['planet'] ."]</b></center></td>";
|
|
||||||
$parse['online_list'] .= "<td class=m><center><b>". pretty_number($ActivPlanet['points'] / 1000) ."</b></center></td>";
|
|
||||||
$parse['online_list'] .= "<td class=b><center><b>". pretty_time(time() - $ActivPlanet['last_update']) . "</b></center></td>";
|
|
||||||
$parse['online_list'] .= "</tr>";
|
|
||||||
$Count++;
|
|
||||||
}
|
|
||||||
$parse['online_list'] .= "<tr>";
|
|
||||||
$parse['online_list'] .= "<th class=\"b\" colspan=\"4\">". $lang['adm_pl_they'] ." ". $Count ." ". $lang['adm_pl_apla'] ."</th>";
|
|
||||||
$parse['online_list'] .= "</tr>";
|
|
||||||
|
|
||||||
$page = parsetemplate( $PageTPL , $parse );
|
|
||||||
display( $page, $lang['adm_pl_title'], false, '', true );
|
|
||||||
} else {
|
|
||||||
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
|
||||||
|
|
||||||
if ($user['authlevel'] >= 1) {
|
|
||||||
includeLang('admin/add_fleet');
|
|
||||||
$mode = $_GET['mode'];
|
|
||||||
|
|
||||||
if($mode != 'add') {
|
|
||||||
$parse['ID'] = $lang['Id'];
|
|
||||||
$parse['Cle'] = $lang['cle'];
|
|
||||||
$parse['Clourd'] = $lang['clourd'];
|
|
||||||
$parse['Pt'] = $lang['pt'];
|
|
||||||
$parse['Gt'] = $lang['gt'];
|
|
||||||
$parse['Cruise'] = $lang['cruise'];
|
|
||||||
$parse['Vb'] = $lang['vb'];
|
|
||||||
$parse['Colo'] = $lang['colo'];
|
|
||||||
$parse['Rc'] = $lang['rc'];
|
|
||||||
$parse['Spy'] = $lang['spy'];
|
|
||||||
$parse['Bomb'] = $lang['bomb'];
|
|
||||||
$parse['Solar'] = $lang['solar'];
|
|
||||||
$parse['Des'] = $lang['des'];
|
|
||||||
$parse['Rip'] = $lang['rip'];
|
|
||||||
$parse['Traq'] = $lang['traq'];
|
|
||||||
|
|
||||||
} elseif($mode == 'add') {
|
|
||||||
$id = $_POST['id'];
|
|
||||||
$cle = $_POST['cle'];
|
|
||||||
$clourd = $_POST['clourd'];
|
|
||||||
$pt = $_POST['pt'];
|
|
||||||
$gt = $_POST['gt'];
|
|
||||||
$cruise = $_POST['cruise'];
|
|
||||||
$vb = $_POST['vb'];
|
|
||||||
$colo = $_POST['colo'];
|
|
||||||
$rc = $_POST['rc'];
|
|
||||||
$spy = $_POST['spy'];
|
|
||||||
$bomb = $_POST['bomb'];
|
|
||||||
$solar = $_POST['solar'];
|
|
||||||
$des = $_POST['des'];
|
|
||||||
$rip = $_POST['rip'];
|
|
||||||
$traq = $_POST['traq'];
|
|
||||||
|
|
||||||
$SqlAdd = "UPDATE {{table}} SET";
|
|
||||||
$SqlAdd .= "`light_hunter` = '".$cle."+light_hunter', ";
|
|
||||||
$SqlAdd .= "`heavy_hunter` = '".$clourd."+heavy_hunter', ";
|
|
||||||
$SqlAdd .= "`small_ship_cargo` = '".$pt."+small_ship_cargo', ";
|
|
||||||
$SqlAdd .= "`big_ship_cargo` = '".$gt."+big_ship_cargo', ";
|
|
||||||
$SqlAdd .= "`crusher` = '".$cruise."+crusher', ";
|
|
||||||
$SqlAdd .= "`battle_ship` = '".$vb."+battle_ship', ";
|
|
||||||
$SqlAdd .= "`colonizer` = '".$colo."+colonizer', ";
|
|
||||||
$SqlAdd .= "`recycler` = '".$rc."+recycler', ";
|
|
||||||
$SqlAdd .= "`spy_sonde`= '".$spy."+spy_sonde', ";
|
|
||||||
$SqlAdd .= "`bomber_ship` = '".$bomb."+bomber_ship', ";
|
|
||||||
$SqlAdd .= "`solar_satelit` = '".$solar."+solar_satelit', ";
|
|
||||||
$SqlAdd .= "`destructor` = '".$des."+destructor', ";
|
|
||||||
$SqlAdd .= "`dearth_star` = '".$rip."+dearth_star', ";
|
|
||||||
$SqlAdd .= "`battleship` = '".$traq."+battleship', ";
|
|
||||||
$SqlAdd .= " WHERE `id` = '".$id."' LIMIT 1";
|
|
||||||
doquery($SqlAdd, "planets");
|
|
||||||
message('Ajout OK');
|
|
||||||
}
|
|
||||||
|
|
||||||
$page = parsetemplate(gettemplate('admin/add_fleet'), $parse);
|
|
||||||
display( $page);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
|
||||||
|
|
||||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
|
||||||
includeLang('admin');
|
|
||||||
|
|
||||||
$mode = $_POST['mode'];
|
|
||||||
|
|
||||||
$PageTpl = gettemplate("admin/add_money");
|
|
||||||
$parse = $lang;
|
|
||||||
|
|
||||||
if ($mode == 'addit') {
|
|
||||||
$id = $_POST['id'];
|
|
||||||
$metal = $_POST['metal'];
|
|
||||||
$cristal = $_POST['cristal'];
|
|
||||||
$deut = $_POST['deut'];
|
|
||||||
|
|
||||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
|
||||||
$QryUpdatePlanet .= "`metal` = `metal` + '". $metal ."', ";
|
|
||||||
$QryUpdatePlanet .= "`crystal` = `crystal` + '". $cristal ."', ";
|
|
||||||
$QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $deut ."' ";
|
|
||||||
$QryUpdatePlanet .= "WHERE ";
|
|
||||||
$QryUpdatePlanet .= "`id` = '". $id ."' ";
|
|
||||||
doquery( $QryUpdatePlanet, "planets");
|
|
||||||
|
|
||||||
AdminMessage ( $lang['adm_am_done'], $lang['adm_am_ttle'] );
|
|
||||||
}
|
|
||||||
$Page = parsetemplate($PageTpl, $parse);
|
|
||||||
|
|
||||||
display ($Page, $lang['adm_am_ttle'], false, '', true);
|
|
||||||
} else {
|
|
||||||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
|
|
||||||
function mass_message_run($parent){
|
|
||||||
if($_POST["mode"] == "change"){
|
|
||||||
if(isset($_POST["tresc"])&& $_POST["tresc"] != ''){
|
|
||||||
$gameConfig['tresc'] = $parent->safe_get_post_var("tresc");
|
|
||||||
}
|
|
||||||
if(isset($_POST["temat"])&& $_POST["temat"] != ''){
|
|
||||||
$gameConfig['temat'] = $parent->safe_get_post_var("temat");
|
|
||||||
}
|
|
||||||
$kolor = 'red';
|
|
||||||
if($gameConfig['tresc'] !='' and $gameConfig['temat']){
|
|
||||||
$sq = $parent->db->query("SELECT `id` FROM {{table}}","users");
|
|
||||||
while($u = $parent->db->fetch_assoc($sq)){
|
|
||||||
doquery("INSERT INTO {{table}} SET
|
|
||||||
`message_owner`='{$u['id']}',
|
|
||||||
`message_sender`='1' ,
|
|
||||||
`message_time`='".time()."',
|
|
||||||
`message_type`='0',
|
|
||||||
`message_from`='<font color=\"$kolor\">Administracja</font>',
|
|
||||||
`message_subject`='<font color=\"$kolor\">{$gameConfig['temat']}</font>',
|
|
||||||
`message_text`='<font color=\"$kolor\"><b>{$gameConfig['tresc']}</b></font>'
|
|
||||||
","messages");
|
|
||||||
$parent->db->query("UPDATE {{table}} SET new_message=new_message+1 WHERE id='{$u['id']}'",'users');
|
|
||||||
}
|
|
||||||
$parent->smarty->assign("message","<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$parent->smarty->display("mass_message.tpl");
|
|
||||||
}
|
|
||||||
|
|
||||||
function mass_message_info(){
|
|
||||||
return array("name" => "Send MassMessages","description"=>"Sends messagess to all players","default_weight"=>"0");
|
|
||||||
}
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
|
||||||
|
|
||||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
|
||||||
if ($_POST && $mode == "change") {
|
|
||||||
if (isset($_POST["tresc"]) && $_POST["tresc"] != '') {
|
|
||||||
$gameConfig['tresc'] = $_POST['tresc'];
|
|
||||||
}
|
|
||||||
if (isset($_POST["temat"]) && $_POST["temat"] != '') {
|
|
||||||
$gameConfig['temat'] = $_POST['temat'];
|
|
||||||
}
|
|
||||||
if ($user['authlevel'] == LEVEL_ADMIN) {
|
|
||||||
$kolor = 'red';
|
|
||||||
$ranga = 'Administrator';
|
|
||||||
} elseif ($user['authlevel'] == LEVEL_OPERATOR) {
|
|
||||||
$kolor = 'skyblue';
|
|
||||||
$ranga = 'Operator';
|
|
||||||
} elseif ($user['authlevel'] == LEVEL_MODERATOR) {
|
|
||||||
$kolor = 'yellow';
|
|
||||||
$ranga = 'Moderator';
|
|
||||||
}
|
|
||||||
if ($gameConfig['tresc'] != '' and $gameConfig['temat']) {
|
|
||||||
$sq = doquery("SELECT `id` FROM {{table}}", "users");
|
|
||||||
$Time = time();
|
|
||||||
$From = "<font color=\"". $kolor ."\">". $ranga ." ".$user['username']."</font>";
|
|
||||||
$Subject = "<font color=\"". $kolor ."\">". $gameConfig['temat'] ."</font>";
|
|
||||||
$Message = "<font color=\"". $kolor ."\"><b>". $gameConfig['tresc'] ."</b></font>";
|
|
||||||
while ($u = $sq->fetch(PDO::FETCH_BOTH)) {
|
|
||||||
SendSimpleMessage ( $u['id'], $user['id'], $Time, 97, $From, $Subject, $Message);
|
|
||||||
}
|
|
||||||
message("<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>", "Complete", "../overview." . PHPEXT, 3);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$parse = $gameConfig;
|
|
||||||
$parse['dpath'] = $dpath;
|
|
||||||
$parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":'';
|
|
||||||
$page .= parsetemplate(gettemplate('admin/messall_body'), $parse);
|
|
||||||
display($page, '', false,'', true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
@ -1,116 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
|
||||||
|
|
||||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
|
||||||
includeLang('admin');
|
|
||||||
|
|
||||||
if ($_GET['cmd'] == 'sort') {
|
|
||||||
$TypeSort = $_GET['type'];
|
|
||||||
} else {
|
|
||||||
$TypeSort = "id";
|
|
||||||
}
|
|
||||||
|
|
||||||
$PageTPL = gettemplate('admin/overview_body');
|
|
||||||
$RowsTPL = gettemplate('admin/overview_rows');
|
|
||||||
|
|
||||||
$parse = $lang;
|
|
||||||
$parse['dpath'] = $dpath;
|
|
||||||
$parse['mf'] = $mf;
|
|
||||||
$parse['adm_ov_data_yourv'] = colorRed(VERSION);
|
|
||||||
|
|
||||||
$Last15Mins = doquery("SELECT * FROM {{table}} WHERE `onlinetime` >= '". (time() - 15 * 60) ."' ORDER BY `". $TypeSort ."` ASC;", 'users');
|
|
||||||
$Count = 0;
|
|
||||||
$Color = "lime";
|
|
||||||
while ( $TheUser = mysql_fetch_array($Last15Mins) ) {
|
|
||||||
if ($PrevIP != "") {
|
|
||||||
if ($PrevIP == $TheUser['user_lastip']) {
|
|
||||||
$Color = "red";
|
|
||||||
} else {
|
|
||||||
$Color = "lime";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $TheUser['id'] . "';", 'statpoints', true);
|
|
||||||
$Bloc['dpath'] = $dpath;
|
|
||||||
$Bloc['adm_ov_altpm'] = $lang['adm_ov_altpm'];
|
|
||||||
$Bloc['adm_ov_wrtpm'] = $lang['adm_ov_wrtpm'];
|
|
||||||
$Bloc['adm_ov_data_id'] = $TheUser['id'];
|
|
||||||
$Bloc['adm_ov_data_name'] = $TheUser['username'];
|
|
||||||
$Bloc['adm_ov_data_agen'] = $TheUser['user_agent'];
|
|
||||||
$Bloc['current_page'] = $TheUser['current_page'];
|
|
||||||
$Bloc['usr_s_id'] = $TheUser['id'];
|
|
||||||
|
|
||||||
$Bloc['adm_ov_data_clip'] = $Color;
|
|
||||||
$Bloc['adm_ov_data_adip'] = $TheUser['user_lastip'];
|
|
||||||
$Bloc['adm_ov_data_ally'] = $TheUser['ally_name'];
|
|
||||||
$Bloc['adm_ov_data_point'] = pretty_number ( $UserPoints['total_points'] );
|
|
||||||
$Bloc['adm_ov_data_activ'] = pretty_time ( time() - $TheUser['onlinetime'] );
|
|
||||||
$Bloc['adm_ov_data_pict'] = "m.gif";
|
|
||||||
$PrevIP = $TheUser['user_lastip'];
|
|
||||||
|
|
||||||
//Tweaks vue g<>n<EFBFBD>rale
|
|
||||||
$Bloc['usr_email'] = $TheUser['email'];
|
|
||||||
$Bloc['usr_xp_raid'] = $TheUser['xpraid'];
|
|
||||||
$Bloc['usr_xp_min'] = $TheUser['xpminier'];
|
|
||||||
|
|
||||||
if ($TheUser['urlaubs_modus'] == 1) {
|
|
||||||
$Bloc['state_vacancy'] = "<img src=\"../images/true.png\" >";
|
|
||||||
} else {
|
|
||||||
$Bloc['state_vacancy'] = "<img src=\"../images/false.png\">";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($TheUser['bana'] == 1) {
|
|
||||||
$Bloc['is_banned'] = "<img src=\"../images/banned.png\" >";
|
|
||||||
} else {
|
|
||||||
$Bloc['is_banned'] = $lang['is_banned_lang'];
|
|
||||||
}
|
|
||||||
$Bloc['usr_planet_gal'] = $TheUser['galaxy'];
|
|
||||||
$Bloc['usr_planet_sys'] = $TheUser['system'];
|
|
||||||
$Bloc['usr_planet_pos'] = $TheUser['planet'];
|
|
||||||
|
|
||||||
|
|
||||||
$parse['adm_ov_data_table'] .= parsetemplate( $RowsTPL, $Bloc );
|
|
||||||
$Count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parse['adm_ov_data_count'] = $Count;
|
|
||||||
$Page = parsetemplate($PageTPL, $parse);
|
|
||||||
|
|
||||||
display ( $Page, $lang['sys_overview'], false, '', true);
|
|
||||||
} else {
|
|
||||||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,310 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
|
||||||
|
|
||||||
|
|
||||||
function DisplayGameSettingsPage ( $CurrentUser ) {
|
|
||||||
global $lang, $gameConfig;
|
|
||||||
|
|
||||||
includeLang('admin/settings');
|
|
||||||
|
|
||||||
if (in_array((int) $CurrentUser['authlevel'], array(LEVEL_ADMIN))) {
|
|
||||||
if ($_POST['opt_save'] == "1") {
|
|
||||||
// Jeu Ouvert ou Ferm<72> !
|
|
||||||
if (isset($_POST['closed']) && $_POST['closed'] == 'on') {
|
|
||||||
$gameConfig['game_disable'] = "1";
|
|
||||||
$gameConfig['close_reason'] = addslashes( $_POST['close_reason'] );
|
|
||||||
} else {
|
|
||||||
$gameConfig['game_disable'] = "0";
|
|
||||||
$gameConfig['close_reason'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Y a un News Frame ? !
|
|
||||||
if (isset($_POST['newsframe']) && $_POST['newsframe'] == 'on') {
|
|
||||||
$gameConfig['OverviewNewsFrame'] = "1";
|
|
||||||
$gameConfig['OverviewNewsText'] = addslashes( $_POST['NewsText'] );
|
|
||||||
} else {
|
|
||||||
$gameConfig['OverviewNewsFrame'] = "0";
|
|
||||||
$gameConfig['OverviewNewsText'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Y a un TCHAT externe ??
|
|
||||||
if (isset($_POST['chatframe']) && $_POST['chatframe'] == 'on') {
|
|
||||||
$gameConfig['OverviewExternChat'] = "1";
|
|
||||||
$gameConfig['OverviewExternChatCmd'] = addslashes( $_POST['ExternChat'] );
|
|
||||||
} else {
|
|
||||||
$gameConfig['OverviewExternChat'] = "0";
|
|
||||||
$gameConfig['OverviewExternChatCmd'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST['googlead']) && $_POST['googlead'] == 'on') {
|
|
||||||
$gameConfig['OverviewBanner'] = "1";
|
|
||||||
$gameConfig['OverviewClickBanner'] = addslashes( $_POST['GoogleAds'] );
|
|
||||||
} else {
|
|
||||||
$gameConfig['OverviewBanner'] = "0";
|
|
||||||
$gameConfig['OverviewClickBanner'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Y a un BANNER Frame ?
|
|
||||||
if (isset($_POST['bannerframe']) && $_POST['bannerframe'] == 'on') {
|
|
||||||
$gameConfig['ForumBannerFrame'] = "1";
|
|
||||||
} else {
|
|
||||||
$gameConfig['ForumBannerFrame'] = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mode Debug ou pas !
|
|
||||||
if (isset($_POST['debug']) && $_POST['debug'] == 'on') {
|
|
||||||
$gameConfig['debug'] = "1";
|
|
||||||
} else {
|
|
||||||
$gameConfig['debug'] = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nom du Jeu
|
|
||||||
if (isset($_POST['game_name']) && $_POST['game_name'] != '') {
|
|
||||||
$gameConfig['game_name'] = $_POST['game_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adresse du Forum
|
|
||||||
if (isset($_POST['forum_url']) && $_POST['forum_url'] != '') {
|
|
||||||
$gameConfig['forum_url'] = $_POST['forum_url'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vitesse du Jeu
|
|
||||||
if (isset($_POST['game_speed']) && is_numeric($_POST['game_speed'])) {
|
|
||||||
$gameConfig['game_speed'] = $_POST['game_speed'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vitesse des Flottes
|
|
||||||
if (isset($_POST['fleet_speed']) && is_numeric($_POST['fleet_speed'])) {
|
|
||||||
$gameConfig['fleet_speed'] = $_POST['fleet_speed'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Multiplicateur de Production
|
|
||||||
if (isset($_POST['resource_multiplier']) && is_numeric($_POST['resource_multiplier'])) {
|
|
||||||
$gameConfig['resource_multiplier'] = $_POST['resource_multiplier'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Taille de la planete mère
|
|
||||||
if (isset($_POST['initial_fields']) && is_numeric($_POST['initial_fields'])) {
|
|
||||||
$gameConfig['initial_fields'] = $_POST['initial_fields'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Revenu de base Metal
|
|
||||||
if (isset($_POST['metal_basic_income']) && is_numeric($_POST['metal_basic_income'])) {
|
|
||||||
$gameConfig['metal_basic_income'] = $_POST['metal_basic_income'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Revenu de base Cristal
|
|
||||||
if (isset($_POST['crystal_basic_income']) && is_numeric($_POST['crystal_basic_income'])) {
|
|
||||||
$gameConfig['crystal_basic_income'] = $_POST['crystal_basic_income'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Revenu de base Deuterium
|
|
||||||
if (isset($_POST['deuterium_basic_income']) && is_numeric($_POST['deuterium_basic_income'])) {
|
|
||||||
$gameConfig['deuterium_basic_income'] = $_POST['deuterium_basic_income'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Revenu de base Energie
|
|
||||||
if (isset($_POST['energy_basic_income']) && is_numeric($_POST['energy_basic_income'])) {
|
|
||||||
$gameConfig['energy_basic_income'] = $_POST['energy_basic_income'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lien supplémentaire dans le menu
|
|
||||||
if (isset($_POST['enable_link_']) && is_numeric($_POST['enable_link_'])) {
|
|
||||||
$gameConfig['link_enable'] = $_POST['enable_link_'];
|
|
||||||
}
|
|
||||||
// Texte de ce lien...
|
|
||||||
$gameConfig['link_name'] = addslashes( $_POST['name_link_']);
|
|
||||||
|
|
||||||
// URL de ce lien...
|
|
||||||
$gameConfig['link_url'] = $_POST['url_link_'];
|
|
||||||
// Image de la bannière
|
|
||||||
$gameConfig['banner_source_post'] = $_POST['banner_source_post'];
|
|
||||||
// 1 point = ??? Ressources ?
|
|
||||||
if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings'])) {
|
|
||||||
$gameConfig['stat_settings'] = $_POST['stat_settings'];
|
|
||||||
}
|
|
||||||
// Activation -ou non- des annonces
|
|
||||||
if (isset($_POST['enable_announces_']) && is_numeric($_POST['enable_announces_'])) {
|
|
||||||
$gameConfig['enable_announces'] = $_POST['enable_announces_'];
|
|
||||||
}
|
|
||||||
// Activation -ou non- du marchand
|
|
||||||
if (isset($_POST['enable_marchand_']) && is_numeric($_POST['enable_marchand_'])) {
|
|
||||||
$gameConfig['enable_marchand'] = $_POST['enable_marchand_'];
|
|
||||||
}
|
|
||||||
// Activation -ou non- des notes
|
|
||||||
if (isset($_POST['enable_notes_']) && is_numeric($_POST['enable_notes_'])) {
|
|
||||||
$gameConfig['enable_notes'] = $_POST['enable_notes_'];
|
|
||||||
}
|
|
||||||
// Nom du bot antimulti
|
|
||||||
$gameConfig['bot_name'] = addslashes( $_POST['name_bot']);
|
|
||||||
|
|
||||||
// email du bot antimulti
|
|
||||||
$gameConfig['bot_adress'] = addslashes( $_POST['adress_bot']);
|
|
||||||
|
|
||||||
// Activation -ou non- des notes
|
|
||||||
if (isset($_POST['duration_ban']) && is_numeric($_POST['duration_ban'])) {
|
|
||||||
$gameConfig['ban_duration'] = $_POST['duration_ban'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activation -ou non- du bot
|
|
||||||
if (isset($_POST['bot_enable']) && is_numeric($_POST['bot_enable'])) {
|
|
||||||
$gameConfig['enable_bot'] = $_POST['bot_enable'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// BBCode ou pas ?
|
|
||||||
|
|
||||||
if (isset($_POST['bbcode_field']) && is_numeric($_POST['bbcode_field'])) {
|
|
||||||
$gameConfig['enable_bbcode'] = $_POST['bbcode_field'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activation du jeu
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_disable'] ."' WHERE `config_name` = 'game_disable';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['close_reason'] ."' WHERE `config_name` = 'close_reason';", 'config');
|
|
||||||
|
|
||||||
//Stats
|
|
||||||
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['stat_settings'] ."' WHERE `config_name` = 'stat_settings';", 'config');
|
|
||||||
|
|
||||||
|
|
||||||
// Configuration du Jeu
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['forum_url'] ."' WHERE `config_name` = 'forum_url';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_name'] ."' WHERE `config_name` = 'game_name';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_speed'] ."' WHERE `config_name` = 'game_speed';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['fleet_speed'] ."' WHERE `config_name` = 'fleet_speed';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['resource_multiplier'] ."' WHERE `config_name` = 'resource_multiplier';", 'config');
|
|
||||||
|
|
||||||
// Page Generale
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewNewsFrame'] ."' WHERE `config_name` = 'OverviewNewsFrame';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewNewsText'] ."' WHERE `config_name` = 'OverviewNewsText';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewExternChat'] ."' WHERE `config_name` = 'OverviewExternChat';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewExternChatCmd'] ."' WHERE `config_name` = 'OverviewExternChatCmd';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewBanner'] ."' WHERE `config_name` = 'OverviewBanner';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewClickBanner'] ."' WHERE `config_name` = 'OverviewClickBanner';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ForumBannerFrame'] ."' WHERE `config_name` = 'ForumBannerFrame';", 'config');
|
|
||||||
|
|
||||||
//Bannière
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['banner_source_post'] ."' WHERE `config_name` = 'banner_source_post';", 'config');
|
|
||||||
|
|
||||||
// Lien supplémentaire dans le menu
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_enable'] ."' WHERE `config_name` = 'link_enable';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_name'] ."' WHERE `config_name` = 'link_name';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_url'] ."' WHERE `config_name` = 'link_url';", 'config');
|
|
||||||
|
|
||||||
// Options Planete
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['initial_fields'] ."' WHERE `config_name` = 'initial_fields';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['metal_basic_income'] ."' WHERE `config_name` = 'metal_basic_income';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['crystal_basic_income'] ."' WHERE `config_name` = 'crystal_basic_income';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['deuterium_basic_income'] ."' WHERE `config_name` = 'deuterium_basic_income';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['energy_basic_income'] ."' WHERE `config_name` = 'energy_basic_income';", 'config');
|
|
||||||
|
|
||||||
//Bot antimulti
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['bot_name'] ."' WHERE `config_name` = 'bot_name';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['bot_adress'] ."' WHERE `config_name` = 'bot_adress';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ban_duration'] ."' WHERE `config_name` = 'ban_duration';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_bot'] ."' WHERE `config_name` = 'enable_bot';", 'config');
|
|
||||||
|
|
||||||
|
|
||||||
//Réglage du BBCode
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_bbcode'] ."' WHERE `config_name` = 'enable_bbcode';", 'config');
|
|
||||||
|
|
||||||
|
|
||||||
//Controle des pages
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_announces'] ."' WHERE `config_name` = 'enable_announces';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_marchand'] ."' WHERE `config_name` = 'enable_marchand';", 'config');
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_notes'] ."' WHERE `config_name` = 'enable_notes';", 'config');
|
|
||||||
|
|
||||||
// Mode Debug
|
|
||||||
doquery("UPDATE {{table}} SET `config_value` = '" .$gameConfig['debug'] ."' WHERE `config_name` ='debug'", 'config');
|
|
||||||
AdminMessage ('Options changees avec succes !', 'Succes', '?');
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$parse = $lang;
|
|
||||||
$parse['game_name'] = $gameConfig['game_name'];
|
|
||||||
$parse['game_speed'] = $gameConfig['game_speed'];
|
|
||||||
$parse['fleet_speed'] = $gameConfig['fleet_speed'];
|
|
||||||
$parse['resource_multiplier'] = $gameConfig['resource_multiplier'];
|
|
||||||
$parse['forum_url'] = $gameConfig['forum_url'];
|
|
||||||
$parse['initial_fields'] = $gameConfig['initial_fields'];
|
|
||||||
$parse['metal_basic_income'] = $gameConfig['metal_basic_income'];
|
|
||||||
$parse['crystal_basic_income'] = $gameConfig['crystal_basic_income'];
|
|
||||||
$parse['deuterium_basic_income'] = $gameConfig['deuterium_basic_income'];
|
|
||||||
$parse['energy_basic_income'] = $gameConfig['energy_basic_income'];
|
|
||||||
$parse['enable_link'] = $gameConfig['link_enable'];
|
|
||||||
$parse['name_link'] = $gameConfig['link_name'];
|
|
||||||
$parse['url_link'] = $gameConfig['link_url'];
|
|
||||||
$parse['enable_announces'] = $gameConfig['enable_announces'];
|
|
||||||
$parse['enable_marchand'] = $gameConfig['enable_marchand'];
|
|
||||||
$parse['enable_notes'] = $gameConfig['enable_notes'];
|
|
||||||
$parse['bot_name'] = stripslashes($gameConfig['bot_name']);
|
|
||||||
$parse['bot_adress'] = stripslashes($gameConfig['bot_adress']);
|
|
||||||
$parse['ban_duration'] = stripslashes($gameConfig['ban_duration']);
|
|
||||||
$parse['enable_bot'] = stripslashes($gameConfig['enable_bot']);
|
|
||||||
$parse['enable_bbcode'] = stripslashes($gameConfig['enable_bbcode']);
|
|
||||||
|
|
||||||
$parse['banner_source_post'] = $gameConfig['banner_source_post'];
|
|
||||||
$parse['stat_settings'] = stripslashes($gameConfig['stat_settings']);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$parse['closed'] = ($gameConfig['game_disable'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
$parse['close_reason'] = stripslashes( $gameConfig['close_reason'] );
|
|
||||||
|
|
||||||
$parse['newsframe'] = ($gameConfig['OverviewNewsFrame'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
$parse['NewsTextVal'] = stripslashes( $gameConfig['OverviewNewsText'] );
|
|
||||||
|
|
||||||
$parse['chatframe'] = ($gameConfig['OverviewExternChat'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
$parse['ExtTchatVal'] = stripslashes( $gameConfig['OverviewExternChatCmd'] );
|
|
||||||
|
|
||||||
$parse['googlead'] = ($gameConfig['OverviewBanner'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
$parse['GoogleAdVal'] = stripslashes( $gameConfig['OverviewClickBanner'] );
|
|
||||||
|
|
||||||
$parse['debug'] = ($gameConfig['debug'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
|
|
||||||
$parse['bannerframe'] = ($gameConfig['ForumBannerFrame'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
|
|
||||||
$PageTPL = gettemplate('admin/options_body');
|
|
||||||
$Page .= parsetemplate( $PageTPL, $parse );
|
|
||||||
|
|
||||||
display ( $Page, $lang['adm_opt_title'], false, '', true );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
|
||||||
}
|
|
||||||
return $Page;
|
|
||||||
}
|
|
||||||
|
|
||||||
$Page = DisplayGameSettingsPage ( $user );
|
|
||||||
|
|
||||||
?>
|
|
||||||
71
ainfo.php
71
ainfo.php
|
|
@ -1,71 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
|
|
||||||
$dpath = (!$userrow["dpath"]) ? DEFAULT_SKINPATH : $userrow["dpath"];
|
|
||||||
|
|
||||||
|
|
||||||
if(!is_numeric($_GET["a"]) || !$_GET["a"] ){ message("Ungültige Allianz-ID","Fehler");}
|
|
||||||
|
|
||||||
$allyrow = doquery("SELECT ally_name,ally_tag,ally_description,ally_web,ally_image FROM {{table}} WHERE id=".$_GET["a"],"alliance",true);
|
|
||||||
|
|
||||||
if(!$allyrow){ message("Alliance non trouvée","Erreur");}
|
|
||||||
|
|
||||||
$count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=".$_GET["a"].";","users",true);
|
|
||||||
$ally_member_scount = $count[0];
|
|
||||||
|
|
||||||
$page .="<table width=519><tr><td class=c colspan=2>Informations sur l'alliance</td></tr>";
|
|
||||||
|
|
||||||
if($allyrow["ally_image"] != ""){
|
|
||||||
$page .= "<tr><th colspan=2><img src=\"".$allyrow["ally_image"]."\"></td></tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$page .= "<tr><th>Tag</th><th>".$allyrow["ally_tag"]."</th></tr><tr><th>Nom</th><th>".$allyrow["ally_name"]."</th></tr><tr><th>Membres</th><th>$ally_member_scount</th></tr>";
|
|
||||||
|
|
||||||
if($allyrow["ally_description"] != ""){
|
|
||||||
$page .= "<tr><th colspan=2 height=100>".$allyrow["ally_description"]."</th></tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($allyrow["ally_web"] != ""){
|
|
||||||
$page .="<tr>
|
|
||||||
<th>Site internet</th>
|
|
||||||
<th><a href=\"".$allyrow["ally_web"]."\">".$allyrow["ally_web"]."</a></th>
|
|
||||||
</tr>";
|
|
||||||
}
|
|
||||||
$page .= "</table>";
|
|
||||||
|
|
||||||
display($page,"Information sur l'alliance [".$allyrow["ally_name"]."]",false);
|
|
||||||
|
|
||||||
// Created by Perberos. All rights reversed (C) 2006
|
|
||||||
?>
|
|
||||||
1199
alliance.php
1199
alliance.php
File diff suppressed because it is too large
Load diff
146
build.xml
Normal file
146
build.xml
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<project name="name-of-project" default="build">
|
||||||
|
<target name="build"
|
||||||
|
depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpdoc,phpunit,phpcb"/>
|
||||||
|
|
||||||
|
<target name="build-parallel"
|
||||||
|
depends="prepare,lint,tools-parallel,phpunit,phpcb"/>
|
||||||
|
|
||||||
|
<target name="tools-parallel"
|
||||||
|
description="Run tools in parallel">
|
||||||
|
<parallel threadCount="2">
|
||||||
|
<sequential>
|
||||||
|
<antcall target="pdepend"/>
|
||||||
|
<antcall target="phpmd-ci"/>
|
||||||
|
</sequential>
|
||||||
|
<antcall target="phpcpd"/>
|
||||||
|
<antcall target="phpcs-ci"/>
|
||||||
|
<antcall target="phploc"/>
|
||||||
|
<antcall target="phpdoc"/>
|
||||||
|
</parallel>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean" description="Cleanup build artifacts">
|
||||||
|
<delete dir="${basedir}/build/api"/>
|
||||||
|
<delete dir="${basedir}/build/code-browser"/>
|
||||||
|
<delete dir="${basedir}/build/coverage"/>
|
||||||
|
<delete dir="${basedir}/build/logs"/>
|
||||||
|
<delete dir="${basedir}/build/pdepend"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="prepare" depends="clean"
|
||||||
|
description="Prepare for build">
|
||||||
|
<mkdir dir="${basedir}/build/api"/>
|
||||||
|
<mkdir dir="${basedir}/build/code-browser"/>
|
||||||
|
<mkdir dir="${basedir}/build/coverage"/>
|
||||||
|
<mkdir dir="${basedir}/build/logs"/>
|
||||||
|
<mkdir dir="${basedir}/build/pdepend"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="lint">
|
||||||
|
<apply executable="php" failonerror="true">
|
||||||
|
<arg value="-l" />
|
||||||
|
|
||||||
|
<fileset dir="${basedir}/src">
|
||||||
|
<include name="**/*.php" />
|
||||||
|
<modified />
|
||||||
|
</fileset>
|
||||||
|
|
||||||
|
<fileset dir="${basedir}/tests">
|
||||||
|
<include name="**/*.php" />
|
||||||
|
<modified />
|
||||||
|
</fileset>
|
||||||
|
</apply>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phploc" description="Measure project size using PHPLOC">
|
||||||
|
<exec executable="phploc">
|
||||||
|
<arg value="--log-csv" />
|
||||||
|
<arg value="${basedir}/build/logs/phploc.csv" />
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="pdepend"
|
||||||
|
description="Calculate software metrics using PHP_Depend">
|
||||||
|
<exec executable="pdepend">
|
||||||
|
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
|
||||||
|
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
|
||||||
|
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpmd"
|
||||||
|
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
|
||||||
|
<exec executable="phpmd">
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
<arg value="text" />
|
||||||
|
<arg value="${basedir}/build/phpmd.xml" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpmd-ci"
|
||||||
|
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
|
||||||
|
<exec executable="phpmd">
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
<arg value="xml" />
|
||||||
|
<arg value="${basedir}/build/phpmd.xml" />
|
||||||
|
<arg value="--reportfile" />
|
||||||
|
<arg value="${basedir}/build/logs/pmd.xml" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpcs"
|
||||||
|
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
|
||||||
|
<exec executable="phpcs">
|
||||||
|
<arg value="--standard=${basedir}/build/phpcs.xml" />
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpcs-ci"
|
||||||
|
description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
|
||||||
|
<exec executable="phpcs" output="/dev/null">
|
||||||
|
<arg value="--report=checkstyle" />
|
||||||
|
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
|
||||||
|
<arg value="--standard=${basedir}/build/phpcs.xml" />
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpcpd" description="Find duplicate code using PHPCPD">
|
||||||
|
<exec executable="phpcpd">
|
||||||
|
<arg value="--log-pmd" />
|
||||||
|
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpdoc"
|
||||||
|
description="Generate API documentation using PHPDocumentor">
|
||||||
|
<exec executable="phpdoc">
|
||||||
|
<arg value="--directory" />
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
<arg value="--target" />
|
||||||
|
<arg path="${basedir}/build/api" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpunit" description="Run unit tests with PHPUnit">
|
||||||
|
<exec executable="phpunit" failonerror="true"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="phpcb"
|
||||||
|
description="Aggregate tool output with PHP_CodeBrowser">
|
||||||
|
<exec executable="phpcb">
|
||||||
|
<arg value="--log" />
|
||||||
|
<arg path="${basedir}/build/logs" />
|
||||||
|
<arg value="--source" />
|
||||||
|
<arg path="${basedir}/src" />
|
||||||
|
<arg value="--output" />
|
||||||
|
<arg path="${basedir}/build/code-browser" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
</project>
|
||||||
36
build/phpcs.xml
Normal file
36
build/phpcs.xml
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="PPW-DEFAULT">
|
||||||
|
<description>Default coding standard</description>
|
||||||
|
|
||||||
|
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.Commenting.Todo"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.Files.LineEndings"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
||||||
|
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
|
||||||
|
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
|
||||||
|
<rule ref="PEAR.Functions.ValidDefaultValue"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.NamingConventions.ConstructorName"/>
|
||||||
|
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
||||||
|
<rule ref="PEAR.NamingConventions.ValidClassName"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
||||||
|
<rule ref="Generic.PHP.NoSilencedErrors"/>
|
||||||
|
<rule ref="Generic.PHP.UpperCaseConstant"/>
|
||||||
|
|
||||||
|
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||||
|
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
||||||
|
</ruleset>
|
||||||
26
build/phpmd.xml
Normal file
26
build/phpmd.xml
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<ruleset name="PPW-DEFAULT"
|
||||||
|
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||||
|
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||||
|
<description>Default coding standard</description>
|
||||||
|
|
||||||
|
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
|
||||||
|
<rule ref="rulesets/codesize.xml/NPathComplexity" />
|
||||||
|
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
|
||||||
|
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
|
||||||
|
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
|
||||||
|
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
|
||||||
|
|
||||||
|
<rule ref="rulesets/design.xml/EvalExpression" />
|
||||||
|
<rule ref="rulesets/design.xml/ExitExpression" />
|
||||||
|
|
||||||
|
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
|
||||||
|
|
||||||
|
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
|
||||||
|
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
|
||||||
|
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
|
||||||
|
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
|
||||||
|
</ruleset>
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
|
|
||||||
includeLang('buildings');
|
|
||||||
|
|
||||||
$user = Legacies_Empire_Model_User::getSingleton();
|
|
||||||
$planet = $user->getCurrentPlanet();
|
|
||||||
|
|
||||||
switch ($_GET['mode']) {
|
|
||||||
case 'fleet':
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
FleetBuildingPage($planet, $user);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'research':
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
ResearchBuildingPage($planet, $user, $IsWorking['OnWork'], $IsWorking['WorkOn'] );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'defense':
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
DefensesBuildingPage($planet, $user);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
BatimentBuildingPage($planet, $user);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------
|
|
||||||
// History version
|
|
||||||
// 1.0 - Nettoyage modularisation
|
|
||||||
// 1.1 - Mise au point, mise en fonction pour lin<69>arisation du fonctionnement
|
|
||||||
// 1.2 - Liste de construction batiments
|
|
||||||
?>
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<?php return array(
|
|
||||||
'global' => array(
|
|
||||||
'date' => array(
|
|
||||||
'timezone' => 'Europe/Paris'
|
|
||||||
),
|
|
||||||
'database' => array(
|
|
||||||
'engine' => 'mysql',
|
|
||||||
'options' => array(
|
|
||||||
'hostname' => 'localhost',
|
|
||||||
'username' => 'root',
|
|
||||||
'password' => '',
|
|
||||||
'database' => 'db_xnova'
|
|
||||||
),
|
|
||||||
'table_prefix' => 'game_',
|
|
||||||
),
|
|
||||||
'layout' => array(
|
|
||||||
'page' => 'page.php',
|
|
||||||
'empire' => 'empire.php'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
64
db/mysql.php
64
db/mysql.php
|
|
@ -1,64 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
* @deprecated
|
|
||||||
* @param string $query
|
|
||||||
* @param string $table
|
|
||||||
* @param bool $fetch
|
|
||||||
*/
|
|
||||||
function doquery($query, $table, $fetch = false)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var Legacies_Database $database
|
|
||||||
*/
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
|
|
||||||
$sql = str_replace("{{table}}", $database->getTable($table), $query);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var PDOStatement $statement
|
|
||||||
*/
|
|
||||||
try {
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
|
|
||||||
$statement->execute(array());
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
trigger_error($e->getMessage() . PHP_EOL . "<br /><pre></code>$sql<code></pre><br />" . PHP_EOL, E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($fetch) {
|
|
||||||
return $statement->fetch(PDO::FETCH_BOTH);
|
|
||||||
} else {
|
|
||||||
return $statement;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<?php return 'php';
|
|
||||||
287
fleet.php
287
fleet.php
|
|
@ -1,287 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
|
|
||||||
$maxfleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets', true);
|
|
||||||
|
|
||||||
$MaxFlyingFleets = $maxfleet['actcnt'];
|
|
||||||
|
|
||||||
//Compteur de flotte en expéditions et nombre d'expédition maximum
|
|
||||||
$MaxExpedition = $user[$resource[124]];
|
|
||||||
if ($MaxExpedition >= 1) {
|
|
||||||
$maxexpde = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets', true);
|
|
||||||
$ExpeditionEnCours = $maxexpde['expedi'];
|
|
||||||
$EnvoiMaxExpedition = 1 + floor( $MaxExpedition / 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
$MaxFlottes = 1 + $user[$resource[108]];
|
|
||||||
|
|
||||||
CheckPlanetUsedFields($planetrow);
|
|
||||||
|
|
||||||
includeLang('fleet');
|
|
||||||
|
|
||||||
$missiontype = array(
|
|
||||||
1 => $lang['type_mission'][1],
|
|
||||||
2 => $lang['type_mission'][2],
|
|
||||||
3 => $lang['type_mission'][3],
|
|
||||||
4 => $lang['type_mission'][4],
|
|
||||||
5 => $lang['type_mission'][5],
|
|
||||||
6 => $lang['type_mission'][6],
|
|
||||||
7 => $lang['type_mission'][7],
|
|
||||||
8 => $lang['type_mission'][8],
|
|
||||||
9 => $lang['type_mission'][9],
|
|
||||||
15 => $lang['type_mission'][15]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Histoire de recuperer les infos passées par galaxy
|
|
||||||
$galaxy = $_GET['galaxy'];
|
|
||||||
$system = $_GET['system'];
|
|
||||||
$planet = $_GET['planet'];
|
|
||||||
$planettype = $_GET['planettype'];
|
|
||||||
$target_mission = $_GET['target_mission'];
|
|
||||||
|
|
||||||
if (!$galaxy) {
|
|
||||||
$galaxy = $planetrow['galaxy'];
|
|
||||||
}
|
|
||||||
if (!$system) {
|
|
||||||
$system = $planetrow['system'];
|
|
||||||
}
|
|
||||||
if (!$planet) {
|
|
||||||
$planet = $planetrow['planet'];
|
|
||||||
}
|
|
||||||
if (!$planettype) {
|
|
||||||
$planettype = $planetrow['planet_type'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$page = "<script language=\"JavaScript\" src=\"scripts/flotten.js\"></script>\n";
|
|
||||||
$page .= "<script language=\"JavaScript\" src=\"scripts/ocnt.js\"></script>\n";
|
|
||||||
$page .= "<br><center>";
|
|
||||||
$page .= "<table width='519' border='0' cellpadding='0' cellspacing='1'>";
|
|
||||||
$page .= "<tr height='20'>";
|
|
||||||
$page .= "<td colspan='9' class='c'>";
|
|
||||||
$page .= "<table border=\"0\" width=\"100%\">";
|
|
||||||
$page .= "<tbody><tr>";
|
|
||||||
$page .= "<td style=\"background-color: transparent;\">";
|
|
||||||
$page .= $lang['fl_title']." ".$MaxFlyingFleets." ".$lang['fl_sur']." ".$MaxFlottes;
|
|
||||||
$page .= "</td><td style=\"background-color: transparent;\" align=\"right\">";
|
|
||||||
$page .= $ExpeditionEnCours."/".$EnvoiMaxExpedition." ".$lang['fl_expttl'];
|
|
||||||
$page .= "</td>";
|
|
||||||
$page .= "</tr></tbody></table>";
|
|
||||||
$page .= "</td>";
|
|
||||||
$page .= "</tr><tr height='20'>";
|
|
||||||
$page .= "<th>".$lang['fl_id']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_mission']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_count']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_from']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_start_t']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_dest']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_dest_t']."</th>";
|
|
||||||
// $page .= "<th>".$lang['fl_back_t']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_back_in']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_order']."</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
|
|
||||||
// Gestion des flottes du joueur actif
|
|
||||||
$fq = doquery("SELECT * FROM {{table}} WHERE fleet_owner={$user[id]}", "fleets");
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
|
||||||
while ($f = $fq->fetch(PDO::FETCH_BOTH)) {
|
|
||||||
$i++;
|
|
||||||
$page .= "<tr height=20>";
|
|
||||||
// (01) Fleet ID
|
|
||||||
$page .= "<th>".$i."</th>";
|
|
||||||
// (02) Fleet Mission
|
|
||||||
$page .= "<th>";
|
|
||||||
$page .= "<a>". $missiontype[$f[fleet_mission]] ."</a>";
|
|
||||||
if (($f['fleet_start_time'] + 1) == $f['fleet_end_time']) {
|
|
||||||
$page .= "<br><a title=\"".$lang['fl_back_to_ttl']."\">".$lang['fl_back_to']."</a>";
|
|
||||||
} else {
|
|
||||||
$page .= "<br><a title=\"".$lang['fl_get_to_ttl']."\">".$lang['fl_get_to']."</a>";
|
|
||||||
}
|
|
||||||
$page .= "</th>";
|
|
||||||
// (03) Fleet Mission
|
|
||||||
$page .= "<th><a title=\"";
|
|
||||||
// Fleet details (commentaire)
|
|
||||||
$fleet = explode(";", $f['fleet_array']);
|
|
||||||
$e = 0;
|
|
||||||
foreach ($fleet as $a => $b) {
|
|
||||||
if ($b != '') {
|
|
||||||
$e++;
|
|
||||||
$a = explode(",", $b);
|
|
||||||
$page .= $lang['tech'][$a[0]]. ":". $a[1] ."\n";
|
|
||||||
if ($e > 1) {
|
|
||||||
$page .= "\t";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$page .= "\">". pretty_number($f[fleet_amount]) ."</a></th>";
|
|
||||||
// (04) Fleet From (Planete d'origine)
|
|
||||||
$page .= "<th>[".$f[fleet_start_galaxy].":".$f[fleet_start_system].":".$f[fleet_start_planet]."]</th>";
|
|
||||||
// (05) Fleet Start Time
|
|
||||||
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_start_time']) ."</th>";
|
|
||||||
// (06) Fleet Target (Planete de destination)
|
|
||||||
$page .= "<th>[".$f[fleet_end_galaxy].":".$f[fleet_end_system].":".$f[fleet_end_planet]."]</th>";
|
|
||||||
// (07) Fleet Target Time
|
|
||||||
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_end_time']) ."</th>";
|
|
||||||
// (08) Fleet Back Time
|
|
||||||
// $page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
|
|
||||||
// (09) Fleet Back In
|
|
||||||
$page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
|
|
||||||
// (10) Orders
|
|
||||||
$page .= "<th>";
|
|
||||||
if ($f['fleet_mess'] == 0) {
|
|
||||||
$page .= "<form action=\"fleetback.php\" method=\"post\">";
|
|
||||||
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
|
|
||||||
$page .= "<input value=\" ".$lang['fl_back_to_ttl']." \" type=\"submit\" name=\"send\">";
|
|
||||||
$page .= "</form>";
|
|
||||||
if ($f[fleet_mission] == 1) {
|
|
||||||
$page .= "<form action=\"verband.php\" method=\"post\">";
|
|
||||||
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
|
|
||||||
$page .= "<input value=\" ".$lang['fl_associate']." \" type=\"submit\">";
|
|
||||||
$page .= "</form>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$page .= " - ";
|
|
||||||
}
|
|
||||||
$page .= "</th>";
|
|
||||||
// Fin de ligne
|
|
||||||
$page .= "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Y a pas de flottes en vol ... on met des '-'
|
|
||||||
if ($i == 0) {
|
|
||||||
$page .= "<tr>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
// $page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($MaxFlottes == $MaxFlyingFleets) {
|
|
||||||
$page .= "<tr height=\"20\"><th colspan=\"9\"><font color=\"red\">".$lang['fl_noslotfree']."</font></th></tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$page .= "</table></center>";
|
|
||||||
|
|
||||||
$page .= "<center>";
|
|
||||||
|
|
||||||
// Selection d'une nouvelle mission
|
|
||||||
$page .= "<form action=\"floten1.php\" method=\"post\">";
|
|
||||||
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td colspan=\"4\" class=\"c\">".$lang['fl_new_miss']."</td>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th>".$lang['fl_fleet_typ']."</th>";
|
|
||||||
$page .= "<th>".$lang['fl_fleet_disp']."</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "<th>-</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
|
|
||||||
if (!$planetrow) {
|
|
||||||
message($lang['fl_noplanetrow'], $lang['fl_error']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prise des coordonnées sur la ligne de commande
|
|
||||||
$galaxy = intval($_GET['galaxy']);
|
|
||||||
$system = intval($_GET['system']);
|
|
||||||
$planet = intval($_GET['planet']);
|
|
||||||
$planettype = intval($_GET['planettype']);
|
|
||||||
$target_mission = intval($_GET['target_mission']);
|
|
||||||
$ShipData = "";
|
|
||||||
|
|
||||||
foreach ($reslist['fleet'] as $n => $i) {
|
|
||||||
if ($planetrow[$resource[$i]] > 0) {
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th><a title=\"". $lang['fl_fleetspeed'] . $CurrentShipSpeed ."\">" . $lang['tech'][$i] . "</a></th>";
|
|
||||||
$page .= "<th>". pretty_number ($planetrow[$resource[$i]]);
|
|
||||||
$ShipData .= "<input type=\"hidden\" name=\"maxship". $i ."\" value=\"". $planetrow[$resource[$i]] ."\" />";
|
|
||||||
$ShipData .= "<input type=\"hidden\" name=\"consumption". $i ."\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
|
|
||||||
$ShipData .= "<input type=\"hidden\" name=\"speed" .$i ."\" value=\"" . GetFleetMaxSpeed ("", $i, $user) . "\" />";
|
|
||||||
$ShipData .= "<input type=\"hidden\" name=\"capacity". $i ."\" value=\"". $pricelist[$i]['capacity'] ."\" />";
|
|
||||||
$page .= "</th>";
|
|
||||||
// Satelitte Solaire (eux ne peuvent pas bouger !)
|
|
||||||
if ($i == 212) {
|
|
||||||
$page .= "<th></th><th></th>";
|
|
||||||
} else {
|
|
||||||
$page .= "<th><a href=\"javascript:maxShip('ship". $i ."'); shortInfo();\">".$lang['fl_selmax']."</a> </th>";
|
|
||||||
$page .= "<th><input name=\"ship". $i ."\" size=\"10\" value=\"0\" onfocus=\"javascript:if(this.value == '0') this.value='';\" onblur=\"javascript:if(this.value == '') this.value='0';\" alt=\"". $lang['tech'][$i] . $planetrow[$resource[$i]] ."\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" /></th>";
|
|
||||||
}
|
|
||||||
$page .= "</tr>";
|
|
||||||
}
|
|
||||||
$have_ships = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$btncontinue = "<tr height=\"20\"><th colspan=\"4\"><input type=\"submit\" value=\" ".$lang['fl_continue']." \" /></th>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
if (!$have_ships) {
|
|
||||||
// Il n'y a pas de vaisseaux sur cette planete
|
|
||||||
$page .= "<th colspan=\"4\">". $lang['fl_noships'] ."</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= $btncontinue;
|
|
||||||
} else {
|
|
||||||
$page .= "<th colspan=\"2\"><a href=\"javascript:noShips();shortInfo();noResources();\" >". $lang['fl_unselectall'] ."</a></th>";
|
|
||||||
$page .= "<th colspan=\"2\"><a href=\"javascript:maxShips();shortInfo();\" >". $lang['fl_selectall'] ."</a></th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
|
|
||||||
if ($MaxFlottes > $MaxFlyingFleets) {
|
|
||||||
$page .= $btncontinue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "</table>";
|
|
||||||
$page .= $ShipData;
|
|
||||||
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $planet ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"planet_type\" value=\"". $planettype ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"mission\" value=\"". $target_mission ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $EnvoiMaxExpedition ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
|
|
||||||
$page .= "</form>";
|
|
||||||
$page .= "</center>";
|
|
||||||
|
|
||||||
display($page, $lang['fl_title']);
|
|
||||||
|
|
||||||
// Updated by Chlorel. 16 Jan 2008 (String extraction, bug corrections, code uniformisation
|
|
||||||
// Created by Perberos. All rights reversed (C) 2006
|
|
||||||
?>
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
includeLang('fleet');
|
|
||||||
|
|
||||||
$BoxTitle = $lang['fl_error'];
|
|
||||||
$TxtColor = "red";
|
|
||||||
$BoxMessage = $lang['fl_notback'];
|
|
||||||
if ( is_numeric($_POST['fleetid']) ) {
|
|
||||||
$fleetid = intval($_POST['fleetid']);
|
|
||||||
|
|
||||||
$FleetRow = doquery("SELECT * FROM {{table}} WHERE `fleet_id` = '". $fleetid ."';", 'fleets', true);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
if ($FleetRow['fleet_owner'] == $user['id']) {
|
|
||||||
if ($FleetRow['fleet_mess'] == 0) {
|
|
||||||
if ($FleetRow['fleet_end_stay'] != 0) {
|
|
||||||
// Faut calculer le temps reel de retour
|
|
||||||
if ($FleetRow['fleet_start_time'] < time()) {
|
|
||||||
// On a pas encore entamé le stationnement
|
|
||||||
// Il faut calculer la parcelle de temps ecoulée depuis le lancement de la flotte
|
|
||||||
$CurrentFlyingTime = time() - $FleetRow['start_time'];
|
|
||||||
} else {
|
|
||||||
// On est deja en stationnement
|
|
||||||
// Il faut donc directement calculer la durée d'un vol aller ou retour
|
|
||||||
$CurrentFlyingTime = $FleetRow['fleet_start_time'] - $FleetRow['start_time'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// C'est quoi le stationnement ??
|
|
||||||
// On calcule sagement la parcelle de temps ecoulée depuis le depart
|
|
||||||
$CurrentFlyingTime = time() - $FleetRow['start_time'];
|
|
||||||
}
|
|
||||||
// Allez houste au bout du compte y a la maison !! (E.T. phone home.............)
|
|
||||||
$ReturnFlyingTime = $CurrentFlyingTime + time();
|
|
||||||
|
|
||||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
|
||||||
$QryUpdateFleet .= "`fleet_start_time` = '". (time() - 1) ."', ";
|
|
||||||
$QryUpdateFleet .= "`fleet_end_stay` = '0', ";
|
|
||||||
$QryUpdateFleet .= "`fleet_end_time` = '". ($ReturnFlyingTime + 1) ."', ";
|
|
||||||
$QryUpdateFleet .= "`fleet_target_owner` = '". $user['id'] ."', ";
|
|
||||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
|
||||||
$QryUpdateFleet .= "WHERE ";
|
|
||||||
$QryUpdateFleet .= "`fleet_id` = '" . $fleetid . "';";
|
|
||||||
doquery( $QryUpdateFleet, 'fleets');
|
|
||||||
|
|
||||||
$BoxTitle = $lang['fl_sback'];
|
|
||||||
$TxtColor = "lime";
|
|
||||||
$BoxMessage = $lang['fl_isback'];
|
|
||||||
} elseif ($FleetRow['fleet_mess'] == 1) {
|
|
||||||
$BoxMessage = $lang['fl_notback'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$BoxMessage = $lang['fl_onlyyours'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message ("<font color=\"".$TxtColor."\">". $BoxMessage ."</font>", $BoxTitle, "fleet.". PHPEXT, 2);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------
|
|
||||||
// History version
|
|
||||||
// Updated by Chlorel. 22 Jan 2008 (String extraction, bug corrections, code uniformisation
|
|
||||||
// Created by DxPpLmOs. All rights reversed (C) 2007
|
|
||||||
// Updated by -= MoF =- for Deutsches Ugamela Forum
|
|
||||||
// 06.12.2007 - 08:41
|
|
||||||
// Open Source
|
|
||||||
// (c) by MoF
|
|
||||||
?>
|
|
||||||
|
|
@ -1,165 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
|
|
||||||
|
|
||||||
$mode = $_GET['mode'];
|
|
||||||
$a = $_GET['a'];
|
|
||||||
/*
|
|
||||||
Este script es original xD
|
|
||||||
La funcion de este script es administrar una variable del $user
|
|
||||||
Permite agregar y quitar arrays...
|
|
||||||
*/
|
|
||||||
//Lets start!
|
|
||||||
if(isset($_GET['mode'])){
|
|
||||||
if($_POST){
|
|
||||||
//Pegamos el texto :P
|
|
||||||
if($_POST["n"] == ""){$_POST["n"] = "Unbenannt";}
|
|
||||||
|
|
||||||
$r = strip_tags($_POST[n]).",".intval($_POST[g]).",".intval($_POST[s]).",".intval($_POST[p]).",".intval($_POST[t])."\r\n";
|
|
||||||
$user['fleet_shortcut'] .= $r;
|
|
||||||
doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users");
|
|
||||||
message("Le raccourcis a été enregistré !","Enregistrment","fleetshortcut.php");
|
|
||||||
}
|
|
||||||
$page = "<form method=POST><table border=0 cellpadding=0 cellspacing=1 width=519>
|
|
||||||
<tr height=20>
|
|
||||||
<td colspan=2 class=c>Nom [Galaxie/Système solaire/Planète]</td>
|
|
||||||
</tr><tr height=\"20\"><th>
|
|
||||||
<input type=text name=n value=\"$g\" size=32 maxlength=32 title=\"Name\">
|
|
||||||
<input type=text name=g value=\"$s\" size=3 maxlength=1 title=\"Galaxie\">
|
|
||||||
<input type=text name=s value=\"$p\" size=3 maxlength=3 title=\"Sonnensystem\">
|
|
||||||
<input type=text name=p value=\"$t\" size=3 maxlength=3 title=\"Planet\">
|
|
||||||
<select name=t>";
|
|
||||||
$page .= '<option value="1"'.(($c[4]==1)?" SELECTED":"").">Planète</option>";
|
|
||||||
$page .= '<option value="2"'.(($c[4]==2)?" SELECTED":"").">Débris</option>";
|
|
||||||
$page .= '<option value="3"'.(($c[4]==3)?" SELECTED":"").">Lune</option>";
|
|
||||||
$page .= "</select>
|
|
||||||
</th></tr><tr>
|
|
||||||
<th><input type=\"reset\" value=\"Zurücksetzen\"> <input type=\"submit\" value=\"Enregistrer\">";
|
|
||||||
//Muestra un (L) si el destino pertenece a luna, lo mismo para escombros
|
|
||||||
$page .= "</th></tr>";
|
|
||||||
$page .= '<tr><td colspan=2 class=c><a href=fleetshortcut.php>Effacer</a></td></tr></tr></table></form>';
|
|
||||||
}
|
|
||||||
elseif(isset($_GET['a'])){
|
|
||||||
if($_POST){
|
|
||||||
//Armamos el array...
|
|
||||||
$scarray = explode("\r\n",$user['fleet_shortcut']);
|
|
||||||
if($_POST["delete"]){
|
|
||||||
unset($scarray[$a]);
|
|
||||||
$user['fleet_shortcut'] = implode("\r\n",$scarray);
|
|
||||||
doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users");
|
|
||||||
message("Shortcut wurde gelöscht","Gelöscht","fleetshortcut.php");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$r = explode(",",$scarray[$a]);
|
|
||||||
$r[0] = strip_tags($_POST['n']);
|
|
||||||
$r[1] = intval($_POST['g']);
|
|
||||||
$r[2] = intval($_POST['s']);
|
|
||||||
$r[3] = intval($_POST['p']);
|
|
||||||
$r[4] = intval($_POST['t']);
|
|
||||||
$scarray[$a] = implode(",",$r);
|
|
||||||
$user['fleet_shortcut'] = implode("\r\n",$scarray);
|
|
||||||
doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users");
|
|
||||||
message("Le raccourcis a été édité !.","Editer","fleetshortcut.php");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($user['fleet_shortcut']){
|
|
||||||
|
|
||||||
$scarray = explode("\r\n",$user['fleet_shortcut']);
|
|
||||||
$c = explode(',',$scarray[$a]);
|
|
||||||
|
|
||||||
$page = "<form method=POST><table border=0 cellpadding=0 cellspacing=1 width=519>
|
|
||||||
<tr height=20>
|
|
||||||
<td colspan=2 class=c>Editer: {$c[0]} [{$c[1]}:{$c[2]}:{$c[3]}]</td>
|
|
||||||
</tr>";
|
|
||||||
//if($i==0){$page .= "";}
|
|
||||||
$page .= "<tr height=\"20\"><th>
|
|
||||||
<input type=hidden name=a value=$a>
|
|
||||||
<input type=text name=n value=\"{$c[0]}\" size=32 maxlength=32>
|
|
||||||
<input type=text name=g value=\"{$c[1]}\" size=3 maxlength=1>
|
|
||||||
<input type=text name=s value=\"{$c[2]}\" size=3 maxlength=3>
|
|
||||||
<input type=text name=p value=\"{$c[3]}\" size=3 maxlength=3>
|
|
||||||
<select name=t>";
|
|
||||||
$page .= '<option value="1"'.(($c[4]==1)?" SELECTED":"").">Planète</option>";
|
|
||||||
$page .= '<option value="2"'.(($c[4]==2)?" SELECTED":"").">Débris</option>";
|
|
||||||
$page .= '<option value="3"'.(($c[4]==3)?" SELECTED":"").">Lune</option>";
|
|
||||||
$page .= "</select>
|
|
||||||
</th></tr><tr>
|
|
||||||
<th><input type=reset value=\"Reset\"> <input type=submit value=\"Enregistrer\"> <input type=submit name=delete value=\"Supprimer\">";
|
|
||||||
$page .= "</th></tr>";
|
|
||||||
|
|
||||||
}else{$page .= message("Le raccourcis a été enregistré !","Enregistrer","fleetshortcut.php");}
|
|
||||||
|
|
||||||
$page .= '<tr><td colspan=2 class=c><a href=fleetshortcut.php>Retour</a></td></tr></tr></table></form>';
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
$page = '<table border="0" cellpadding="0" cellspacing="1" width="519">
|
|
||||||
<tr height="20">
|
|
||||||
<td colspan="2" class="c">Raccourcis(<a href="?mode=add">Ajout</a>)</td>
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
if($user['fleet_shortcut']){
|
|
||||||
/*
|
|
||||||
Dentro de fleet_shortcut, se pueden almacenar las diferentes direcciones
|
|
||||||
de acceso directo, el formato es el siguiente.
|
|
||||||
Nombre, Galaxia,Sistema,Planeta,Tipo
|
|
||||||
*/
|
|
||||||
$scarray = explode("\r\n",$user['fleet_shortcut']);
|
|
||||||
$i=$e=0;
|
|
||||||
foreach($scarray as $a => $b){
|
|
||||||
if($b!=""){
|
|
||||||
$c = explode(',',$b);
|
|
||||||
if($i==0){$page .= "<tr height=\"20\">";}
|
|
||||||
$page .= "<th><a href=\"?a=".$e++."\">";
|
|
||||||
$page .= "{$c[0]} {$c[1]}:{$c[2]}:{$c[3]}";
|
|
||||||
//Muestra un (L) si el destino pertenece a luna, lo mismo para escombros
|
|
||||||
if($c[4]==2){$page .= " (E)";}elseif($c[4]==3){$page .= " (L)";}
|
|
||||||
$page .= "</a></th>";
|
|
||||||
if($i==1){$page .= "</tr>";}
|
|
||||||
if($i==1){$i=0;}else{$i=1;}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if($i==1){$page .= "<th></th></tr>";}
|
|
||||||
|
|
||||||
}else{$page .= "<th colspan=\"2\">Pas de Raccourcis</th>";}
|
|
||||||
|
|
||||||
$page .= '<tr><td colspan=2 class=c><a href=fleet.php>Retour</a></td></tr></tr></table>';
|
|
||||||
}
|
|
||||||
display($page,"Shortcutmanager");
|
|
||||||
|
|
||||||
// Created by Perberos. All rights reversed (C) 2006
|
|
||||||
?>
|
|
||||||
286
floten1.php
286
floten1.php
|
|
@ -1,286 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Tis file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
includeLang('fleet');
|
|
||||||
|
|
||||||
$speed = array(10 => 100,
|
|
||||||
9 => 90,
|
|
||||||
8 => 80,
|
|
||||||
7 => 70,
|
|
||||||
6 => 60,
|
|
||||||
5 => 50,
|
|
||||||
4 => 40,
|
|
||||||
3 => 30,
|
|
||||||
2 => 20,
|
|
||||||
1 => 10,
|
|
||||||
);
|
|
||||||
|
|
||||||
$g = $_POST['galaxy'];
|
|
||||||
$s = $_POST['system'];
|
|
||||||
$p = $_POST['planet'];
|
|
||||||
$t = $_POST['planet_type'];
|
|
||||||
|
|
||||||
if (!$g) {
|
|
||||||
$g = $planetrow['galaxy'];
|
|
||||||
}
|
|
||||||
if (!$s) {
|
|
||||||
$s = $planetrow['system'];
|
|
||||||
}
|
|
||||||
if (!$p) {
|
|
||||||
$p = $planetrow['planet'];
|
|
||||||
}
|
|
||||||
if (!$t) {
|
|
||||||
$t = $planetrow['planet_type'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verifions si nous avons bien tout ce que nous voullons envoyer
|
|
||||||
$FleetHiddenBlock = "";
|
|
||||||
foreach ($reslist['fleet'] as $n => $i) {
|
|
||||||
if ($i > 200 && $i < 300 && $_POST["ship$i"] > "0") {
|
|
||||||
if ($_POST["ship$i"] > $planetrow[$resource[$i]]) {
|
|
||||||
$page .= $lang['fl_noenought'];
|
|
||||||
$speedalls[$i] = GetFleetMaxSpeed ( "", $i, $user );
|
|
||||||
} else {
|
|
||||||
$fleet['fleetarray'][$i] = $_POST["ship$i"];
|
|
||||||
// Tableau des vaisseaux avec leur nombre
|
|
||||||
$fleet['fleetlist'] .= $i . "," . $_POST["ship$i"] . ";";
|
|
||||||
// Nombre total de vaisseaux
|
|
||||||
$fleet['amount'] += $_POST["ship$i"];
|
|
||||||
// Tableau des vitesses
|
|
||||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"consumption". $i ."\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
|
|
||||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"speed". $i ."\" value=\"". GetFleetMaxSpeed ( "", $i, $user ) ."\" />";
|
|
||||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"capacity". $i ."\" value=\"". $pricelist[$i]['capacity'] ."\" />";
|
|
||||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"ship". $i ."\" value=\"". $_POST["ship$i"] ."\" />";
|
|
||||||
$speedalls[$i] = GetFleetMaxSpeed ( "", $i, $user );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$fleet['fleetlist']) {
|
|
||||||
message($lang['fl_unselectall'], $lang['fl_error'], "fleet." . PHPEXT, 1);
|
|
||||||
} else {
|
|
||||||
$speedallsmin = min($speedalls);
|
|
||||||
}
|
|
||||||
$page .= "<script type=\"text/javascript\" src=\"scripts/flotten.js\"></script>";
|
|
||||||
$page .= "<script type=\"text/javascript\">\n";
|
|
||||||
$page .= "function getStorageFaktor() {\n";
|
|
||||||
$page .= " return 1\n";
|
|
||||||
$page .= "}\n";
|
|
||||||
$page .= "</script>\n";
|
|
||||||
$page .= "<form action=\"floten2.php\" method=\"post\">";
|
|
||||||
$page .= $FleetHiddenBlock;
|
|
||||||
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $speedallsmin ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". str_rot13(base64_encode(serialize($fleet['fleetarray']))) ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $planetrow['galaxy'] ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow['system'] ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow['planet'] ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"galaxyend\" value=\"". intval($_POST['galaxy']) ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"systemend\" value=\"". intval($_POST['system']) ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"planetend\" value=\"". intval($_POST['planet']) ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". GetGameSpeedFactor () ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $planetrow['planet_type'] ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow['metal']) ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisresource2\" value=\"". floor($planetrow['crystal']) ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow['deuterium']) ."\" />";
|
|
||||||
|
|
||||||
$page .= "<br><div><center>";
|
|
||||||
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_floten1_ttl'] ."</td>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th width=\"50%\">". $lang['fl_dest'] ."</th>";
|
|
||||||
$page .= "<th>";
|
|
||||||
$page .= "<input name=\"galaxy\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $g ."\" />";
|
|
||||||
$page .= "<input name=\"system\" size=\"3\" maxlength=\"3\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $s ."\" />";
|
|
||||||
$page .= "<input name=\"planet\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $p ."\" />";
|
|
||||||
$page .= "<select name=\"planettype\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
|
|
||||||
$page .= "<option value=\"1\"". (($t == 1) ? " SELECTED" : "" ) .">". $lang['fl_planet'] ." </option>";
|
|
||||||
$page .= "<option value=\"2\"". (($t == 2) ? " SELECTED" : "" ) .">". $lang['fl_ruins'] ." </option>";
|
|
||||||
$page .= "<option value=\"3\"". (($t == 3) ? " SELECTED" : "" ) .">". $lang['fl_moon'] ." </option>";
|
|
||||||
$page .= "</select>";
|
|
||||||
$page .= "</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_speed'] ."</th>";
|
|
||||||
$page .= "<th>";
|
|
||||||
$page .= "<select name=\"speed\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
|
|
||||||
foreach ($speed as $a => $b) {
|
|
||||||
$page .= "<option value=\"".$a."\">".$b."</option>";
|
|
||||||
}
|
|
||||||
$page .= "</select> %";
|
|
||||||
$page .= "</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_dist'] ."</th>";
|
|
||||||
$page .= "<th><div id=\"distance\">-</div></th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_fltime'] ."</th>";
|
|
||||||
$page .= "<th><div id=\"duration\">-</div></th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
/* A faire assez rapidement (faut juste savoir comment)
|
|
||||||
$page .= "<th>". $lang['fl_time_go'] ."</th>";
|
|
||||||
$page .= "<th><font color=\"lime\"><div id=\"llegada1\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_time_back'] ."</th>";
|
|
||||||
$page .= "<th><font color=\"lime\"><div id=\"llegada2\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
*/
|
|
||||||
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
|
|
||||||
$page .= "<th><div id=\"consumption\">-</div></th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_speed_max'] ."</th>";
|
|
||||||
$page .= "<th><div id=\"maxspeed\">-</div></th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_max_load'] ."</th>";
|
|
||||||
$page .= "<th><div id=\"storage\">-</div></th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
|
|
||||||
// Gestion des raccourcis sur la galaxie
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_shortcut'] ." <a href=\"fleetshortcut.php\">". $lang['fl_shortlnk'] ."</a></td>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
if ($user['fleet_shortcut']) {
|
|
||||||
$scarray = explode("\r\n", $user['fleet_shortcut']);
|
|
||||||
$i = 0;
|
|
||||||
foreach ($scarray as $a => $b) {
|
|
||||||
if ($b != "") {
|
|
||||||
$c = explode(',', $b);
|
|
||||||
if ($i == 0) {
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
}
|
|
||||||
$page .= "<th><a href=\"javascript:setTarget(". $c[1] .",". $c[2] .",". $c[3] .",". $c[4] ."); shortInfo();\"";
|
|
||||||
$page .= ">". $c[0] ." ". $c[1] .":". $c[2] .":". $c[3] ." ";
|
|
||||||
// Signalisation du type de raccourci ...
|
|
||||||
// (P)lanete
|
|
||||||
// (D)ebris
|
|
||||||
// (L)une
|
|
||||||
if ($c[4] == 1) {
|
|
||||||
$page .= $lang['fl_shrtcup1'];
|
|
||||||
} elseif ($c[4] == 2) {
|
|
||||||
$page .= $lang['fl_shrtcup2'];
|
|
||||||
} elseif ($c[4] == 3) {
|
|
||||||
$page .= $lang['fl_shrtcup3'];
|
|
||||||
}
|
|
||||||
$page .= "</a></th>";
|
|
||||||
if ($i == 1) {
|
|
||||||
$page .= "</tr>";
|
|
||||||
}
|
|
||||||
if ($i == 1) {
|
|
||||||
$i = 0;
|
|
||||||
} else {
|
|
||||||
$i = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($i == 1) {
|
|
||||||
$page .= "<th></th></tr>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th colspan=\"2\">". $lang['fl_noshortc'] ."</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_myplanets'] ."</td>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
|
|
||||||
// Gestion des raccourcis vers ses propres colonies ou planetes
|
|
||||||
$kolonien = SortUserPlanets ( $user );
|
|
||||||
$currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true);
|
|
||||||
|
|
||||||
if (mysql_num_rows($kolonien) > 1) {
|
|
||||||
$i = 0;
|
|
||||||
$w = 0;
|
|
||||||
$tr = true;
|
|
||||||
while ($row = $kolonien->fetch(PDO::FETCH_BOTH)) {
|
|
||||||
if ($w == 0 && $tr) {
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$tr = false;
|
|
||||||
}
|
|
||||||
if ($w == 2) {
|
|
||||||
$page .= "</tr>";
|
|
||||||
$w = 0;
|
|
||||||
$tr = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($row['planet_type'] == 3) {
|
|
||||||
$row['name'] .= " ". $lang['fl_shrtcup3'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($currentplanet['galaxy'] == $row['galaxy'] &&
|
|
||||||
$currentplanet['system'] == $row['system'] &&
|
|
||||||
$currentplanet['planet'] == $row['planet'] &&
|
|
||||||
$currentplanet['planet_type'] == $row['planet_type'] ) {
|
|
||||||
// $page .= '<th><a href="javascript:setTarget('.$row['galaxy'].','.$row['system'].','.$row['planet'].','.$row['planet_type'].'); shortInfo();">'.$row['name'].' '.$row['galaxy'].':'.$row['system'].':'.$row['planet'].'</a></th>';
|
|
||||||
} else {
|
|
||||||
$page .= "<th><a href=\"javascript:setTarget(". $row['galaxy'] .",". $row['system'] .",". $row['planet'] .",". $row['planet_type'] ."); shortInfo();\">". $row['name'] ." ". $row['galaxy'] .":". $row['system'] .":". $row['planet'] ."</a></th>";
|
|
||||||
$w++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($i % 2 != 0) {
|
|
||||||
$page .= "<th> </th></tr>";
|
|
||||||
} elseif ($w == 2) {
|
|
||||||
$page .= "</tr>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$page .= "<th colspan=\"2\">". $lang['fl_nocolonies'] ."</th>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_grattack'] ."</td>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th colspan=\"2\">-</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th colspan=\"2\"><input type=\"submit\" value=\"". $lang['fl_continue'] ."\" /></th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "</table>";
|
|
||||||
$page .= "</div></center>";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
|
|
||||||
$page .= "</form>";
|
|
||||||
$page .= "<script>javascript:shortInfo(); </script>";
|
|
||||||
|
|
||||||
display($page, $lang['fl_title']);
|
|
||||||
|
|
||||||
// Updated by Chlorel. 16 Jan 2008 (String extraction, bug corrections, code uniformisation
|
|
||||||
// Created by Perberos. All rights reversed (C) 2006
|
|
||||||
?>
|
|
||||||
283
floten2.php
283
floten2.php
|
|
@ -1,283 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
includeLang('fleet');
|
|
||||||
|
|
||||||
$galaxy = intval($_POST['galaxy']);
|
|
||||||
$system = intval($_POST['system']);
|
|
||||||
$planet = intval($_POST['planet']);
|
|
||||||
$planettype = intval($_POST['planettype']);
|
|
||||||
|
|
||||||
// Test d'existance et de proprieté de la planete
|
|
||||||
$YourPlanet = false;
|
|
||||||
$UsedPlanet = false;
|
|
||||||
$select = doquery("SELECT * FROM {{table}}", "planets");
|
|
||||||
|
|
||||||
while ($row = $select->fetch(PDO::FETCH_BOTH)) {
|
|
||||||
if ($galaxy == $row['galaxy'] &&
|
|
||||||
$system == $row['system'] &&
|
|
||||||
$planet == $row['planet'] &&
|
|
||||||
$planettype == $row['planet_type']) {
|
|
||||||
if ($row['id_owner'] == $user['id']) {
|
|
||||||
$YourPlanet = true;
|
|
||||||
$UsedPlanet = true;
|
|
||||||
} else {
|
|
||||||
$UsedPlanet = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determinons les type de missions possibles par rapport a la planete cible
|
|
||||||
if ($_POST['planettype'] == "2") {
|
|
||||||
if ($_POST['ship209'] >= 1) {
|
|
||||||
$missiontype = array(8 => $lang['type_mission'][8]);
|
|
||||||
} else {
|
|
||||||
$missiontype = array();
|
|
||||||
}
|
|
||||||
} elseif ($_POST['planettype'] == "1" || $_POST['planettype'] == "3") {
|
|
||||||
if ($_POST['ship208'] >= 1 && !$UsedPlanet) {
|
|
||||||
$missiontype = array(7 => $lang['type_mission'][7]);
|
|
||||||
} elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
|
|
||||||
$missiontype = array(6 => $lang['type_mission'][6]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['ship202'] >= 1 ||
|
|
||||||
$_POST['ship203'] >= 1 ||
|
|
||||||
$_POST['ship204'] >= 1 ||
|
|
||||||
$_POST['ship205'] >= 1 ||
|
|
||||||
$_POST['ship206'] >= 1 ||
|
|
||||||
$_POST['ship207'] >= 1 ||
|
|
||||||
$_POST['ship210'] >= 1 ||
|
|
||||||
$_POST['ship211'] >= 1 ||
|
|
||||||
$_POST['ship213'] >= 1 ||
|
|
||||||
$_POST['ship214'] >= 1 ||
|
|
||||||
$_POST['ship215'] >= 1 ||
|
|
||||||
$_POST['ship216'] >= 1) {
|
|
||||||
if (!$YourPlanet) {
|
|
||||||
$missiontype[1] = $lang['type_mission'][1];
|
|
||||||
$missiontype[5] = $lang['type_mission'][5];
|
|
||||||
}
|
|
||||||
$missiontype[3] = $lang['type_mission'][3];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208'] >= 1) {
|
|
||||||
$missiontype[3] = $lang['type_mission'][3];
|
|
||||||
}
|
|
||||||
if ($YourPlanet)
|
|
||||||
$missiontype[4] = $lang['type_mission'][4];
|
|
||||||
|
|
||||||
if ( $_POST['planettype'] == 3 &&
|
|
||||||
($_POST['ship214'] ||
|
|
||||||
$_POST['ship213']) &&
|
|
||||||
!$YourPlanet &&
|
|
||||||
$UsedPlanet) {
|
|
||||||
$missiontype[2] = $lang['type_mission'][2];
|
|
||||||
}
|
|
||||||
if ( $_POST['planettype'] == 3 &&
|
|
||||||
($_POST['ship214'] >= 1 || $_POST['ship216'] >= 1) &&
|
|
||||||
!$YourPlanet &&
|
|
||||||
$UsedPlanet) {
|
|
||||||
$missiontype[9] = $lang['type_mission'][9];
|
|
||||||
}
|
|
||||||
|
|
||||||
$fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"])));
|
|
||||||
$mission = $_POST['target_mission'];
|
|
||||||
$SpeedFactor = $_POST['speedfactor'];
|
|
||||||
$AllFleetSpeed = GetFleetMaxSpeed ($fleetarray, 0, $user);
|
|
||||||
$GenFleetSpeed = $_POST['speed'];
|
|
||||||
$MaxFleetSpeed = min($AllFleetSpeed);
|
|
||||||
|
|
||||||
$distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] );
|
|
||||||
$duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor );
|
|
||||||
$consumption = GetFleetConsumption ( $fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user );
|
|
||||||
|
|
||||||
$MissionSelector = "";
|
|
||||||
if (count($missiontype) > 0) {
|
|
||||||
if ($planet == 16) {
|
|
||||||
$MissionSelector .= "<tr height=\"20\">";
|
|
||||||
$MissionSelector .= "<th>";
|
|
||||||
$MissionSelector .= "<input type=\"radio\" name=\"mission\" value=\"15\" checked=\"checked\">". $lang['type_mission'][15] ."<br /><br />";
|
|
||||||
$MissionSelector .= "<font color=\"red\">". $lang['fl_expe_warning'] ."</font>";
|
|
||||||
$MissionSelector .= "</th>";
|
|
||||||
$MissionSelector .= "</tr>";
|
|
||||||
} else {
|
|
||||||
$i = 0;
|
|
||||||
foreach ($missiontype as $a => $b) {
|
|
||||||
$MissionSelector .= "<tr height=\"20\">";
|
|
||||||
$MissionSelector .= "<th>";
|
|
||||||
$MissionSelector .= "<input id=\"inpuT_".$i."\" type=\"radio\" name=\"mission\" value=\"".$a."\"". ($mission == $a ? " checked=\"checked\"":"") .">";
|
|
||||||
$MissionSelector .= "<label for=\"inpuT_".$i."\">".$b."</label><br>";
|
|
||||||
$MissionSelector .= "</th>";
|
|
||||||
$MissionSelector .= "</tr>";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$MissionSelector .= "<tr height=\"20\">";
|
|
||||||
$MissionSelector .= "<th>";
|
|
||||||
$MissionSelector .= "<font color=\"red\">". $lang['fl_bad_mission'] ."</font>";
|
|
||||||
$MissionSelector .= "</th>";
|
|
||||||
$MissionSelector .= "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['thisplanettype'] == 1) {
|
|
||||||
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_planet'] ."";
|
|
||||||
} elseif ($_POST['thisplanettype'] == 3) {
|
|
||||||
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_moon'] ."";
|
|
||||||
}
|
|
||||||
|
|
||||||
$page = "<script type=\"text/javascript\" src=\"scripts/flotten.js\">\n</script>";
|
|
||||||
$page .= "<script type=\"text/javascript\">\n";
|
|
||||||
$page .= "function getStorageFaktor() {\n";
|
|
||||||
$page .= " return 1;\n";
|
|
||||||
$page .= "}\n";
|
|
||||||
$page .= "</script>\n";
|
|
||||||
$page .= "<br><center>";
|
|
||||||
$page .= "<form action=\"floten3.php\" method=\"post\">\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow["metal"]) ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisresource2\" value=\"". floor($planetrow["crystal"]) ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow["deuterium"]) ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"consumption\" value=\"". $consumption ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"dist\" value=\"". $distance ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $_POST['speedfactor'] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $_POST["thisgalaxy"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $_POST["thissystem"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $_POST["thisplanet"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $_POST["galaxy"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $_POST["system"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $_POST["planet"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $_POST["thisplanettype"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"planettype\" value=\"". $_POST["planettype"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $_POST["speedallsmin"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"speed\" value=\"". $_POST['speed'] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $_POST["speedfactor"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". $_POST["usedfleet"] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />\n";
|
|
||||||
foreach ($fleetarray as $Ship => $Count) {
|
|
||||||
$page .= "<input type=\"hidden\" name=\"ship". $Ship ."\" value=\"". $Count ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"capacity". $Ship ."\" value=\"". $pricelist[$Ship]['capacity'] ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"consumption". $Ship ."\" value=\"". GetShipConsumption ( $Ship, $user ) ."\" />\n";
|
|
||||||
$page .= "<input type=\"hidden\" name=\"speed". $Ship ."\" value=\"". GetFleetMaxSpeed ( "", $Ship, $user ) ."\" />\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">\n";
|
|
||||||
$page .= "<tbody>\n";
|
|
||||||
$page .= "<tr align=\"left\" height=\"20\">\n";
|
|
||||||
$page .= "<td class=\"c\" colspan=\"2\">". $TableTitle ."</td>\n";
|
|
||||||
$page .= "</tr>\n";
|
|
||||||
$page .= "<tr align=\"left\" valign=\"top\">\n";
|
|
||||||
$page .= "<th width=\"50%\">\n";
|
|
||||||
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
|
|
||||||
$page .= "<tbody>\n";
|
|
||||||
$page .= "<tr height=\"20\">\n";
|
|
||||||
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_mission'] ."</td>\n";
|
|
||||||
$page .= "</tr>\n";
|
|
||||||
$page .= $MissionSelector;
|
|
||||||
$page .= "</tbody>\n";
|
|
||||||
$page .= "</table>\n";
|
|
||||||
$page .= "</th>\n";
|
|
||||||
$page .= "<th>\n";
|
|
||||||
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
|
|
||||||
$page .= "<tbody>\n";
|
|
||||||
$page .= "<tr height=\"20\">\n";
|
|
||||||
$page .= "<td colspan=\"3\" class=\"c\">". $lang['fl_ressources'] ."</td>\n";
|
|
||||||
$page .= "</tr><tr height=\"20\">\n";
|
|
||||||
$page .= "<th>". $lang['Metal'] ."</th>\n";
|
|
||||||
$page .= "<th><a href=\"javascript:maxResource('1');\">". $lang['fl_selmax'] ."</a></th>\n";
|
|
||||||
$page .= "<th><input name=\"resource1\" alt=\"". $lang['Metal'] ." ". floor($planetrow["metal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
|
|
||||||
$page .= "</tr><tr height=\"20\">\n";
|
|
||||||
$page .= "<th>". $lang['Crystal'] ."</th>\n";
|
|
||||||
$page .= "<th><a href=\"javascript:maxResource('2');\">". $lang['fl_selmax'] ."</a></th>\n";
|
|
||||||
$page .= "<th><input name=\"resource2\" alt=\"". $lang['Crystal'] ." ". floor($planetrow["crystal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
|
|
||||||
$page .= "</tr><tr height=\"20\">\n";
|
|
||||||
$page .= "<th>". $lang['Deuterium'] ."</th>\n";
|
|
||||||
$page .= "<th><a href=\"javascript:maxResource('3');\">". $lang['fl_selmax'] ."</a></th>\n";
|
|
||||||
$page .= "<th><input name=\"resource3\" alt=\"". $lang['Deuterium'] ." ". floor($planetrow["deuterium"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
|
|
||||||
$page .= "</tr><tr height=\"20\">\n";
|
|
||||||
$page .= "<th>". $lang['fl_space_left'] ."</th>\n";
|
|
||||||
$page .= "<th colspan=\"2\"><div id=\"remainingresources\">-</div></th>\n";
|
|
||||||
$page .= "</tr><tr height=\"20\">\n";
|
|
||||||
$page .= "<th colspan=\"3\"><a href=\"javascript:maxResources()\">". $lang['fl_allressources'] ."</a></th>\n";
|
|
||||||
$page .= "</tr><tr height=\"20\">\n";
|
|
||||||
$page .= "<th colspan=\"3\"> </th>\n";
|
|
||||||
$page .= "</tr>\n";
|
|
||||||
if ($planet == 16) {
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th colspan=\"3\">";
|
|
||||||
$page .= "<select name=\"expeditiontime\" >";
|
|
||||||
$page .= "<option value=\"1\">1</option>";
|
|
||||||
$page .= "<option value=\"2\">2</option>";
|
|
||||||
$page .= "</select>";
|
|
||||||
$page .= $lang['fl_expe_hours'];
|
|
||||||
$page .= "</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
} elseif ( $missiontype[5] != '' ) {
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<th colspan=\"3\">";
|
|
||||||
$page .= "<select name=\"holdingtime\" >";
|
|
||||||
$page .= "<option value=\"0\">0</option>";
|
|
||||||
$page .= "<option value=\"1\">1</option>";
|
|
||||||
$page .= "<option value=\"2\">2</option>";
|
|
||||||
$page .= "<option value=\"4\">4</option>";
|
|
||||||
$page .= "<option value=\"8\">8</option>";
|
|
||||||
$page .= "<option value=\"16\">16</option>";
|
|
||||||
$page .= "<option value=\"32\">32</option>";
|
|
||||||
$page .= "</select>";
|
|
||||||
$page .= $lang['fl_expe_hours'];
|
|
||||||
$page .= "</th>";
|
|
||||||
$page .= "</tr>";
|
|
||||||
}
|
|
||||||
$page .= "</tbody>\n";
|
|
||||||
$page .= "</table>\n";
|
|
||||||
$page .= "</th>\n";
|
|
||||||
$page .= "</tr><tr height=\"20\">\n";
|
|
||||||
$page .= "<th colspan=\"2\"><input accesskey=\"z\" value=\"". $lang['fl_continue'] ."\" type=\"submit\"></th>\n";
|
|
||||||
$page .= "</tr>\n";
|
|
||||||
$page .= "</tbody>\n";
|
|
||||||
$page .= "</table>\n";
|
|
||||||
$page .= "</form></center>\n";
|
|
||||||
|
|
||||||
display($page, $lang['fl_title']);
|
|
||||||
|
|
||||||
// Updated by Chlorel. 16 Jan 2008 (String extraction, bug corrections, code uniformisation)
|
|
||||||
// Created by Perberos. All rights reversed (C) 2006
|
|
||||||
?>
|
|
||||||
539
floten3.php
539
floten3.php
|
|
@ -1,539 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
|
|
||||||
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
|
|
||||||
|
|
||||||
includeLang('fleet');
|
|
||||||
|
|
||||||
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_planet'] ."'", 'planets', true);
|
|
||||||
$TargetPlanet = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '". $_POST['galaxy'] ."' AND `system` = '". $_POST['system'] ."' AND `planet` = '". $_POST['planet'] ."' AND `planet_type` = '". $_POST['planettype'] ."';", 'planets', true);
|
|
||||||
$MyDBRec = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['id']."';", 'users', true);
|
|
||||||
|
|
||||||
$protection = $gameConfig['noobprotection'];
|
|
||||||
$protectiontime = $gameConfig['noobprotectiontime'];
|
|
||||||
$protectionmulti = $gameConfig['noobprotectionmulti'];
|
|
||||||
if ($protectiontime < 1) {
|
|
||||||
$protectiontime = 9999999999999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
$fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"])));
|
|
||||||
|
|
||||||
if (!is_array($fleetarray)) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// On verifie s'il y a assez de vaisseaux sur la planete !
|
|
||||||
foreach ($fleetarray as $Ship => $Count) {
|
|
||||||
if ($Count > $CurrentPlanet[$resource[$Ship]]) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$error = 0;
|
|
||||||
$galaxy = intval($_POST['galaxy']);
|
|
||||||
$system = intval($_POST['system']);
|
|
||||||
$planet = intval($_POST['planet']);
|
|
||||||
$planettype = intval($_POST['planettype']);
|
|
||||||
$fleetmission = $_POST['mission'];
|
|
||||||
|
|
||||||
if ($planettype != 1 && $planettype != 2 && $planettype != 3) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_fleet_err_pl'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($fleetmission == 8) {
|
|
||||||
$YourPlanet = false;
|
|
||||||
$UsedPlanet = false;
|
|
||||||
$select = doquery("SELECT * FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."'", "planets");
|
|
||||||
} else {
|
|
||||||
$YourPlanet = false;
|
|
||||||
$UsedPlanet = false;
|
|
||||||
$select = doquery("SELECT * FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."' AND planet_type = '". $planettype ."'", "planets");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($CurrentPlanet['galaxy'] == $galaxy &&
|
|
||||||
$CurrentPlanet['system'] == $system &&
|
|
||||||
$CurrentPlanet['planet'] == $planet &&
|
|
||||||
$CurrentPlanet['planet_type'] == $planettype) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_ownpl_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test d'existance de l'enregistrement dans la gaalxie !
|
|
||||||
if ($_POST['mission'] != 15) {
|
|
||||||
if (mysql_num_rows($select) < 1 && $fleetmission != 7) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_unknow_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
} elseif ($fleetmission == 9 && mysql_num_rows($select) < 1) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_used_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$EnvoiMaxExpedition = $_POST['maxepedition'];
|
|
||||||
$Expedition = $_POST['curepedition'];
|
|
||||||
|
|
||||||
if ($EnvoiMaxExpedition == 0 ) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_expe_notech'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
} elseif ($Expedition >= $EnvoiMaxExpedition ) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_expe_max'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$select = mysql_fetch_array($select);
|
|
||||||
|
|
||||||
if ($select['id_owner'] == $user['id']) {
|
|
||||||
$YourPlanet = true;
|
|
||||||
$UsedPlanet = true;
|
|
||||||
} elseif (!empty($select['id_owner'])) {
|
|
||||||
$YourPlanet = false;
|
|
||||||
$UsedPlanet = true;
|
|
||||||
} else {
|
|
||||||
$YourPlanet = false;
|
|
||||||
$UsedPlanet = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determinons les type de missions possibles par rapport a la planete cible
|
|
||||||
if ($fleetmission == 15) {
|
|
||||||
// Gestion des Exp<78>ditions
|
|
||||||
$missiontype = array(15 => $lang['type_mission'][15]);
|
|
||||||
} else {
|
|
||||||
if ($_POST['planettype'] == "2") {
|
|
||||||
if ($_POST['ship209'] >= 1) {
|
|
||||||
$missiontype = array(8 => $lang['type_mission'][8]);
|
|
||||||
} else {
|
|
||||||
$missiontype = array();
|
|
||||||
}
|
|
||||||
} elseif ($_POST['planettype'] == "1" || $_POST['planettype'] == "3") {
|
|
||||||
if ($_POST['ship208'] >= 1 && !$UsedPlanet) {
|
|
||||||
$missiontype = array(7 => $lang['type_mission'][7]);
|
|
||||||
} elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
|
|
||||||
$missiontype = array(6 => $lang['type_mission'][6]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['ship202'] >= 1 ||
|
|
||||||
$_POST['ship203'] >= 1 ||
|
|
||||||
$_POST['ship204'] >= 1 ||
|
|
||||||
$_POST['ship205'] >= 1 ||
|
|
||||||
$_POST['ship206'] >= 1 ||
|
|
||||||
$_POST['ship207'] >= 1 ||
|
|
||||||
$_POST['ship210'] >= 1 ||
|
|
||||||
$_POST['ship211'] >= 1 ||
|
|
||||||
$_POST['ship213'] >= 1 ||
|
|
||||||
$_POST['ship214'] >= 1 ||
|
|
||||||
$_POST['ship215'] >= 1 ||
|
|
||||||
$_POST['ship216'] >= 1) {
|
|
||||||
if (!$YourPlanet) {
|
|
||||||
$missiontype[1] = $lang['type_mission'][1];
|
|
||||||
$missiontype[5] = $lang['type_mission'][5];
|
|
||||||
}
|
|
||||||
$missiontype[3] = $lang['type_mission'][3];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208'] >= 1) {
|
|
||||||
$missiontype[3] = $lang['type_mission'][3];
|
|
||||||
}
|
|
||||||
if ($YourPlanet)
|
|
||||||
$missiontype[4] = $lang['type_mission'][4];
|
|
||||||
|
|
||||||
if ( $_POST['planettype'] == 3 &&
|
|
||||||
($_POST['ship214'] ||
|
|
||||||
$_POST['ship213']) &&
|
|
||||||
!$YourPlanet &&
|
|
||||||
$UsedPlanet) {
|
|
||||||
$missiontype[2] = $lang['type_mission'][2];
|
|
||||||
}
|
|
||||||
if ($_POST['planettype'] == 3 &&
|
|
||||||
($_POST['ship214'] >= 1 || $_POST['ship216'] >= 1) &&
|
|
||||||
!$YourPlanet && $UsedPlanet) {
|
|
||||||
$missiontype[9] = $lang['type_mission'][9];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($missiontype[$fleetmission])) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_bad_mission'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckPlanetUsedFields($CurrentPlanet);
|
|
||||||
|
|
||||||
if ($TargetPlanet['id_owner'] == '') {
|
|
||||||
$HeDBRec = $MyDBRec;
|
|
||||||
} elseif ($TargetPlanet['id_owner'] != '') {
|
|
||||||
$HeDBRec = doquery("SELECT * FROM {{table}} WHERE `id` = '". $TargetPlanet['id_owner'] ."';", 'users', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $MyDBRec['id'] ."';", 'statpoints', true);
|
|
||||||
$User2Points = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $HeDBRec['id'] ."';", 'statpoints', true);
|
|
||||||
|
|
||||||
$MyGameLevel = $UserPoints['total_points'];
|
|
||||||
$HeGameLevel = $User2Points['total_points'];
|
|
||||||
$VacationMode = $HeDBRec['urlaubs_modus'];
|
|
||||||
|
|
||||||
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND
|
|
||||||
$TargetPlanet['id_owner'] != '' AND
|
|
||||||
$_POST['mission'] == 1 AND
|
|
||||||
$protection == 1 AND
|
|
||||||
$HeGameLevel < ($protectiontime * 1000)) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND
|
|
||||||
$TargetPlanet['id_owner'] != '' AND
|
|
||||||
$_POST['mission'] == 5 AND
|
|
||||||
$protection == 1 AND
|
|
||||||
$HeGameLevel < ($protectiontime * 1000)) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND
|
|
||||||
$TargetPlanet['id_owner'] != '' AND
|
|
||||||
$_POST['mission'] == 6 AND
|
|
||||||
$protection == 1 AND
|
|
||||||
$HeGameLevel < ($protectiontime * 1000)) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND
|
|
||||||
$TargetPlanet['id_owner'] != '' AND
|
|
||||||
$_POST['mission'] == 1 AND
|
|
||||||
$protection == 1 AND
|
|
||||||
$MyGameLevel < ($protectiontime * 1000)) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND
|
|
||||||
$TargetPlanet['id_owner'] != '' AND
|
|
||||||
$_POST['mission'] == 5 AND
|
|
||||||
$protection == 1 AND
|
|
||||||
$MyGameLevel < ($protectiontime * 1000)) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND
|
|
||||||
$TargetPlanet['id_owner'] != '' AND
|
|
||||||
$_POST['mission'] == 6 AND
|
|
||||||
$protection == 1 AND
|
|
||||||
$MyGameLevel < ($protectiontime * 1000)) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($VacationMode AND $_POST['mission'] != 8) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_vacation_pla']."</b></font>", $lang['fl_vacation_ttl'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$FlyingFleets = mysql_fetch_assoc(doquery("SELECT COUNT(fleet_id) as Number FROM {{table}} WHERE `fleet_owner`='{$user['id']}'", 'fleets'));
|
|
||||||
$ActualFleets = $FlyingFleets["Number"];
|
|
||||||
if (($user[$resource[108]] + 1) <= $ActualFleets) {
|
|
||||||
message("Pas de slot disponible", "Erreur", "fleet." . PHPEXT, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 AND $_POST['mission'] == 3) {
|
|
||||||
message("<font color=\"lime\"><b>".$lang['fl_noenoughtgoods']."</b></font>", $lang['type_mission'][3], "fleet." . PHPEXT, 1);
|
|
||||||
}
|
|
||||||
if ($_POST['mission'] != 15) {
|
|
||||||
if ($TargetPlanet['id_owner'] == '' AND $_POST['mission'] < 7) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_bad_planet01'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
if ($TargetPlanet['id_owner'] != '' AND $_POST['mission'] == 7) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_bad_planet02'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
if ($HeDBRec['ally_id'] != $MyDBRec['ally_id'] AND $_POST['mission'] == 4) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_dont_stay_here'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
if ($TargetPlanet['ally_deposit'] < 1 AND $HeDBRec != $MyDBRec AND $_POST['mission'] == 5) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_no_allydeposit'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
if (($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"]) AND ($_POST["mission"] == 1)) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_no_self_attack'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
if (($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"]) AND ($_POST["mission"] == 6)) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_no_self_spy'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
if (($TargetPlanet["id_owner"] != $CurrentPlanet["id_owner"]) AND ($_POST["mission"] == 4)) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_only_stay_at_home'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$missiontype = array(
|
|
||||||
1 => $lang['type_mission'][1],
|
|
||||||
2 => $lang['type_mission'][2],
|
|
||||||
3 => $lang['type_mission'][3],
|
|
||||||
4 => $lang['type_mission'][4],
|
|
||||||
5 => $lang['type_mission'][5],
|
|
||||||
6 => $lang['type_mission'][6],
|
|
||||||
7 => $lang['type_mission'][7],
|
|
||||||
8 => $lang['type_mission'][8],
|
|
||||||
9 => $lang['type_mission'][9],
|
|
||||||
15 => $lang['type_mission'][15],
|
|
||||||
);
|
|
||||||
|
|
||||||
$speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
|
|
||||||
|
|
||||||
$AllFleetSpeed = GetFleetMaxSpeed ($fleetarray, 0, $user);
|
|
||||||
$GenFleetSpeed = $_POST['speed'];
|
|
||||||
$SpeedFactor = $_POST['speedfactor'];
|
|
||||||
$MaxFleetSpeed = min($AllFleetSpeed);
|
|
||||||
|
|
||||||
if (!in_array($GenFleetSpeed, $speed_possible)) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '".$user['current_planet']."';", 'planets', true);
|
|
||||||
|
|
||||||
if ($MaxFleetSpeed != $_POST['speedallsmin']) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$_POST['planettype']) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test de coherance de la destination (voir si elle se trouve dans les limites de l'univers connu
|
|
||||||
$error = 0;
|
|
||||||
$errorlist = "";
|
|
||||||
if (!$_POST['galaxy'] || !is_numeric($_POST['galaxy']) || $_POST['galaxy'] > MAX_GALAXY_IN_WORLD || $_POST['galaxy'] < 1) {
|
|
||||||
$error++;
|
|
||||||
$errorlist .= $lang['fl_limit_galaxy'];
|
|
||||||
}
|
|
||||||
if (!$_POST['system'] || !is_numeric($_POST['system']) || $_POST['system'] > MAX_SYSTEM_IN_GALAXY || $_POST['system'] < 1) {
|
|
||||||
$error++;
|
|
||||||
$errorlist .= $lang['fl_limit_system'];
|
|
||||||
}
|
|
||||||
if (!$_POST['planet'] || !is_numeric($_POST['planet']) || $_POST['planet'] > MAX_PLANET_IN_SYSTEM+1 || $_POST['planet'] < 1) {
|
|
||||||
$error++;
|
|
||||||
$errorlist .= $lang['fl_limit_planet'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($error > 0) {
|
|
||||||
message ("<font color=\"red\"><ul>" . $errorlist . "</ul></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// La flotte part bien de la planete courrante ??
|
|
||||||
if ($_POST['thisgalaxy'] != $CurrentPlanet['galaxy'] |
|
|
||||||
$_POST['thissystem'] != $CurrentPlanet['system'] |
|
|
||||||
$_POST['thisplanet'] != $CurrentPlanet['planet'] |
|
|
||||||
$_POST['thisplanettype'] != $CurrentPlanet['planet_type']) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_cheat_origine'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($fleetarray)) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_no_fleetarray'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] );
|
|
||||||
$duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor );
|
|
||||||
$consumption = GetFleetConsumption ( $fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user );
|
|
||||||
|
|
||||||
$fleet['start_time'] = $duration + time();
|
|
||||||
if ($_POST['mission'] == 15) {
|
|
||||||
$StayDuration = $_POST['expeditiontime'] * 3600;
|
|
||||||
$StayTime = $fleet['start_time'] + $_POST['expeditiontime'] * 3600;
|
|
||||||
} elseif ($_POST['mission'] == 5) {
|
|
||||||
$StayDuration = $_POST['holdingtime'] * 3600;
|
|
||||||
$StayTime = $fleet['start_time'] + $_POST['holdingtime'] * 3600;
|
|
||||||
} else {
|
|
||||||
$StayDuration = 0;
|
|
||||||
$StayTime = 0;
|
|
||||||
}
|
|
||||||
$fleet['end_time'] = $StayDuration + (2 * $duration) + time();
|
|
||||||
$FleetStorage = 0;
|
|
||||||
$FleetShipCount = 0;
|
|
||||||
$fleet_array = "";
|
|
||||||
$FleetSubQRY = "";
|
|
||||||
|
|
||||||
foreach ($fleetarray as $Ship => $Count) {
|
|
||||||
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
|
|
||||||
$FleetShipCount += $Count;
|
|
||||||
$fleet_array .= $Ship .",". $Count .";";
|
|
||||||
$FleetSubQRY .= "`".$resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , ";
|
|
||||||
}
|
|
||||||
|
|
||||||
$FleetStorage -= $consumption;
|
|
||||||
$StorageNeeded = 0;
|
|
||||||
if ($_POST['resource1'] < 1) {
|
|
||||||
$TransMetal = 0;
|
|
||||||
} else {
|
|
||||||
$TransMetal = $_POST['resource1'];
|
|
||||||
$StorageNeeded += $TransMetal;
|
|
||||||
}
|
|
||||||
if ($_POST['resource2'] < 1) {
|
|
||||||
$TransCrystal = 0;
|
|
||||||
} else {
|
|
||||||
$TransCrystal = $_POST['resource2'];
|
|
||||||
$StorageNeeded += $TransCrystal;
|
|
||||||
}
|
|
||||||
if ($_POST['resource3'] < 1) {
|
|
||||||
$TransDeuterium = 0;
|
|
||||||
} else {
|
|
||||||
$TransDeuterium = $_POST['resource3'];
|
|
||||||
$StorageNeeded += $TransDeuterium;
|
|
||||||
}
|
|
||||||
|
|
||||||
$StockMetal = $CurrentPlanet['metal'];
|
|
||||||
$StockCrystal = $CurrentPlanet['crystal'];
|
|
||||||
$StockDeuterium = $CurrentPlanet['deuterium'];
|
|
||||||
$StockDeuterium -= $consumption;
|
|
||||||
|
|
||||||
$StockOk = false;
|
|
||||||
if ($StockMetal >= $TransMetal) {
|
|
||||||
if ($StockCrystal >= $TransCrystal) {
|
|
||||||
if ($StockDeuterium >= $TransDeuterium) {
|
|
||||||
$StockOk = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !$StockOk ) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_noressources'] . pretty_number($consumption) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $StorageNeeded > $FleetStorage) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($TargetPlanet['id_level'] > $user['authlevel']) {
|
|
||||||
$Allowed = true;
|
|
||||||
switch ($_POST['mission']){
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 6:
|
|
||||||
case 9:
|
|
||||||
$Allowed = false;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
case 5:
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
case 15:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
if ($Allowed == false) {
|
|
||||||
message ("<font color=\"red\"><b>". $lang['fl_adm_attak'] ."</b></font>", $lang['fl_warning'], "fleet." . PHPEXT, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ecriture de l'enregistrement de flotte (a partir de l<>, y a quelque chose qui vole et c'est toujours sur la planete d'origine)
|
|
||||||
$QryInsertFleet = "INSERT INTO {{table}} SET ";
|
|
||||||
$QryInsertFleet .= "`fleet_owner` = '". $user['id'] ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_mission` = '". $_POST['mission'] ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_amount` = '". $FleetShipCount ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_array` = '". $fleet_array ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_start_time` = '". $fleet['start_time'] ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_start_galaxy` = '". intval($_POST['thisgalaxy']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_start_system` = '". intval($_POST['thissystem']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_start_planet` = '". intval($_POST['thisplanet']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_start_type` = '". intval($_POST['thisplanettype']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_end_time` = '". $fleet['end_time'] ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_end_stay` = '". $StayTime ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_end_galaxy` = '". intval($_POST['galaxy']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_end_system` = '". intval($_POST['system']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_end_planet` = '". intval($_POST['planet']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_end_type` = '". intval($_POST['planettype']) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_resource_metal` = '". intval($TransMetal) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_resource_crystal` = '". intval($TransCrystal) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_resource_deuterium` = '". intval($TransDeuterium) ."', ";
|
|
||||||
$QryInsertFleet .= "`fleet_target_owner` = '". $TargetPlanet['id_owner'] ."', ";
|
|
||||||
$QryInsertFleet .= "`start_time` = '". time() ."';";
|
|
||||||
doquery( $QryInsertFleet, 'fleets');
|
|
||||||
|
|
||||||
|
|
||||||
$CurrentPlanet["metal"] = $CurrentPlanet["metal"] - $TransMetal;
|
|
||||||
$CurrentPlanet["crystal"] = $CurrentPlanet["crystal"] - $TransCrystal;
|
|
||||||
$CurrentPlanet["deuterium"] = $CurrentPlanet["deuterium"] - $TransDeuterium;
|
|
||||||
$CurrentPlanet["deuterium"] = $CurrentPlanet["deuterium"] - $consumption;
|
|
||||||
|
|
||||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
|
||||||
$QryUpdatePlanet .= $FleetSubQRY;
|
|
||||||
$QryUpdatePlanet .= "`metal` = '". $CurrentPlanet["metal"] ."', ";
|
|
||||||
$QryUpdatePlanet .= "`crystal` = '". $CurrentPlanet["crystal"] ."', ";
|
|
||||||
$QryUpdatePlanet .= "`deuterium` = '". $CurrentPlanet["deuterium"] ."' ";
|
|
||||||
$QryUpdatePlanet .= "WHERE ";
|
|
||||||
$QryUpdatePlanet .= "`id` = '". $CurrentPlanet['id'] ."'";
|
|
||||||
|
|
||||||
// Mise a jours de l'enregistrement de la planete de depart (a partir de là, y a quelque chose qui vole et ce n'est plus sur la planete de depart)
|
|
||||||
doquery("LOCK TABLE {{table}} WRITE", 'planets');
|
|
||||||
doquery ($QryUpdatePlanet, "planets");
|
|
||||||
doquery("UNLOCK TABLES", '');
|
|
||||||
// doquery("FLUSH TABLES", '');
|
|
||||||
|
|
||||||
// Un peu de blabla pour l'utilisateur, affichage d'un joli tableau de la flotte expedi<64>e
|
|
||||||
$page = "<br><div><center>";
|
|
||||||
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">";
|
|
||||||
$page .= "<tr height=\"20\">";
|
|
||||||
$page .= "<td class=\"c\" colspan=\"2\"><span class=\"success\">". $lang['fl_fleet_send'] ."</span></td>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_mission'] ."</th>";
|
|
||||||
$page .= "<th>". $missiontype[$_POST['mission']] ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_dist'] ."</th>";
|
|
||||||
$page .= "<th>". pretty_number($distance) ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_speed'] ."</th>";
|
|
||||||
$page .= "<th>". pretty_number($_POST['speedallsmin']) ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
|
|
||||||
$page .= "<th>". pretty_number($consumption) ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_from'] ."</th>";
|
|
||||||
$page .= "<th>". $_POST['thisgalaxy'] .":". $_POST['thissystem']. ":". $_POST['thisplanet'] ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_dest'] ."</th>";
|
|
||||||
$page .= "<th>". $_POST['galaxy'] .":". $_POST['system'] .":". $_POST['planet'] ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_time_go'] ."</th>";
|
|
||||||
$page .= "<th>". date("M D d H:i:s", $fleet['start_time']) ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['fl_time_back'] ."</th>";
|
|
||||||
$page .= "<th>". date("M D d H:i:s", $fleet['end_time']) ."</th>";
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_title'] ."</td>";
|
|
||||||
|
|
||||||
foreach ($fleetarray as $Ship => $Count) {
|
|
||||||
$page .= "</tr><tr height=\"20\">";
|
|
||||||
$page .= "<th>". $lang['tech'][$Ship] ."</th>";
|
|
||||||
$page .= "<th>". pretty_number($Count) ."</th>";
|
|
||||||
}
|
|
||||||
$page .= "</tr></table></div></center>";
|
|
||||||
|
|
||||||
// Provisoire
|
|
||||||
sleep (1);
|
|
||||||
|
|
||||||
$planetrow = doquery ("SELECT * FROM {{table}} WHERE `id` = '". $CurrentPlanet['id'] ."';", 'planets', true);
|
|
||||||
|
|
||||||
display($page, $lang['fl_title']);
|
|
||||||
|
|
||||||
// Updated by Chlorel. 16 Jan 2008 (String extraction, bug corrections, code uniformisation
|
|
||||||
// Updated by -= MoF =- for Deutsches Ugamela Forum
|
|
||||||
// 06.12.2007 - 08:39
|
|
||||||
// Open Source
|
|
||||||
// (c) by MoF
|
|
||||||
|
|
||||||
?>
|
|
||||||
16
frames.php
16
frames.php
|
|
@ -1,16 +0,0 @@
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
|
||||||
<title>XNova:Legacies</title>
|
|
||||||
</head>
|
|
||||||
<frameset framespacing="0" border="0" cols="190,*" frameborder="0">
|
|
||||||
<frame name="LeftMenu" target="Mainframe" src="leftmenu.php" noresize scrolling="no" marginwidth="0" marginheight="0">
|
|
||||||
<frame name="Hauptframe" src="overview.php">
|
|
||||||
<noframes>
|
|
||||||
<body>
|
|
||||||
<p>Votre navigateur ne gère pas les frames.</p>
|
|
||||||
</body>
|
|
||||||
</noframes>
|
|
||||||
</frameset>
|
|
||||||
</html>
|
|
||||||
163
galaxy.php
163
galaxy.php
|
|
@ -1,163 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/common.php';
|
|
||||||
|
|
||||||
includeLang('galaxy');
|
|
||||||
|
|
||||||
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_planet'] ."';", 'planets', true);
|
|
||||||
$lunarow = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_luna'] ."';", 'lunas', true);
|
|
||||||
$galaxyrow = doquery("SELECT * FROM {{table}} WHERE `id_planet` = '". $CurrentPlanet['id'] ."';", 'galaxy', true);
|
|
||||||
|
|
||||||
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
|
|
||||||
$fleetmax = $user['computer_tech'] + 1;
|
|
||||||
$CurrentPlID = $CurrentPlanet['id'];
|
|
||||||
$CurrentMIP = $CurrentPlanet['interplanetary_misil'];
|
|
||||||
$CurrentRC = $CurrentPlanet['recycler'];
|
|
||||||
$CurrentSP = $CurrentPlanet['spy_sonde'];
|
|
||||||
$HavePhalanx = $CurrentPlanet['phalanx'];
|
|
||||||
$CurrentSystem = $CurrentPlanet['system'];
|
|
||||||
$CurrentGalaxy = $CurrentPlanet['galaxy'];
|
|
||||||
$CanDestroy = $CurrentPlanet[$resource[213]] + $CurrentPlanet[$resource[214]];
|
|
||||||
|
|
||||||
$maxfleet = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '". $user['id'] ."';", 'fleets');
|
|
||||||
$maxfleet_count = mysql_num_rows($maxfleet);
|
|
||||||
|
|
||||||
CheckPlanetUsedFields($CurrentPlanet);
|
|
||||||
CheckPlanetUsedFields($lunarow);
|
|
||||||
|
|
||||||
if (!isset($mode)) {
|
|
||||||
if (isset($_GET['mode'])) {
|
|
||||||
$mode = intval($_GET['mode']);
|
|
||||||
} else {
|
|
||||||
$mode = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$galaxy = 1;
|
|
||||||
$system = 1;
|
|
||||||
$planet = null;
|
|
||||||
|
|
||||||
if ($mode == 0) {
|
|
||||||
$galaxy = $CurrentGalaxy;
|
|
||||||
$system = $CurrentSystem;
|
|
||||||
} elseif ($mode == 1 || $mode == 3) {
|
|
||||||
if (isset($_POST["galaxyLeft"])) {
|
|
||||||
if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 1 || $_POST["galaxy"] > MAX_GALAXY_IN_WORLD) {
|
|
||||||
$galaxy = 1;
|
|
||||||
} else {
|
|
||||||
$galaxy = intval($_POST["galaxy"]) - 1;
|
|
||||||
}
|
|
||||||
} elseif (isset($_POST["galaxyRight"])) {
|
|
||||||
if (!isset($_POST["galaxy"]) || $_POST["galaxy"] >= MAX_GALAXY_IN_WORLD) {
|
|
||||||
$galaxy = MAX_GALAXY_IN_WORLD;
|
|
||||||
} else {
|
|
||||||
$galaxy = intval($_POST["galaxy"]) + 1;
|
|
||||||
}
|
|
||||||
} else if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 1 || $_POST["galaxy"] > MAX_GALAXY_IN_WORLD) {
|
|
||||||
$galaxy = 1;
|
|
||||||
} else {
|
|
||||||
$galaxy = intval($_POST["galaxy"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["systemLeft"])) {
|
|
||||||
if (!isset($_POST["system"]) || $_POST["system"] <= 1 || $_POST["system"] > MAX_SYSTEM_IN_GALAXY) {
|
|
||||||
$system = 1;
|
|
||||||
} else {
|
|
||||||
$system = intval($_POST["system"]) - 1;
|
|
||||||
}
|
|
||||||
} elseif (isset($_POST["systemRight"])) {
|
|
||||||
if (!isset($_POST["system"]) || $_POST["system"] >= MAX_SYSTEM_IN_GALAXY) {
|
|
||||||
$system = MAX_SYSTEM_IN_GALAXY;
|
|
||||||
} else {
|
|
||||||
$system = intval($_POST["system"]) + 1;
|
|
||||||
}
|
|
||||||
} else if (!isset($_POST["system"]) || $_POST["system"] <= 1 || $_POST["system"] > MAX_SYSTEM_IN_GALAXY) {
|
|
||||||
$system = 1;
|
|
||||||
} else {
|
|
||||||
$system = intval($_POST["system"]);
|
|
||||||
}
|
|
||||||
} elseif ($mode == 2) {
|
|
||||||
if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 0) {
|
|
||||||
$galaxy = 1;
|
|
||||||
} else if ($_POST["galaxy"] >= MAX_GALAXY_IN_WORLD) {
|
|
||||||
$galaxy = MAX_GALAXY_IN_WORLD;
|
|
||||||
} else {
|
|
||||||
$galaxy = intval($_POST["galaxy"]) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($_POST["system"]) || $_POST["system"] <= 0) {
|
|
||||||
$system = 1;
|
|
||||||
} else if ($_POST["system"] >= MAX_SYSTEM_IN_GALAXY) {
|
|
||||||
$system = MAX_SYSTEM_IN_GALAXY;
|
|
||||||
} else {
|
|
||||||
$system = intval($_POST["system"]) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($_POST["planet"]) || $_POST["planet"] <= 0) {
|
|
||||||
$planet = 1;
|
|
||||||
} else if ($_POST["planet"] >= MAX_PLANET_IN_SYSTEM) {
|
|
||||||
$planet = MAX_PLANET_IN_SYSTEM;
|
|
||||||
} else {
|
|
||||||
$planet = intval($_POST["planet"]) + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$planetcount = 0;
|
|
||||||
$lunacount = 0;
|
|
||||||
|
|
||||||
$page = InsertGalaxyScripts($CurrentPlanet);
|
|
||||||
|
|
||||||
$page .= "<body style=\"overflow: hidden;\" onUnload=\"\"><br><br>";
|
|
||||||
$page .= ShowGalaxySelector ( $galaxy, $system );
|
|
||||||
|
|
||||||
if ($mode == 2) {
|
|
||||||
$page .= ShowGalaxyMISelector($galaxy, $system, $planet, $CurrentPlanet['id'], $CurrentMIP);
|
|
||||||
}
|
|
||||||
|
|
||||||
$page .= "<table width=569><tbody>";
|
|
||||||
|
|
||||||
$page .= ShowGalaxyTitles($galaxy, $system);
|
|
||||||
$page .= ShowGalaxyRows($galaxy, $system);
|
|
||||||
$page .= ShowGalaxyFooter($galaxy, $system, $CurrentMIP, $CurrentRC, $CurrentSP);
|
|
||||||
|
|
||||||
$page .= "</tbody></table></div>";
|
|
||||||
|
|
||||||
display ($page, $lang[''], false, '', false);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------
|
|
||||||
// History version
|
|
||||||
// 1.0 - Created by Perberos
|
|
||||||
// 1.1 - Modified by -MoF- (UGamela germany)
|
|
||||||
// 1.2 - 1er Nettoyage Chlorel ...
|
|
||||||
// 1.3 - 2eme Nettoyage Chlorel ... Mise en fonction et debuging complet
|
|
||||||
?>
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies
|
|
||||||
{
|
|
||||||
private static $_listeners = array();
|
|
||||||
|
|
||||||
private static $_translators = array();
|
|
||||||
|
|
||||||
public static $request = null;
|
|
||||||
public static $response = null;
|
|
||||||
|
|
||||||
protected static $_now = null;
|
|
||||||
|
|
||||||
public static function registerListener($event, $listener)
|
|
||||||
{
|
|
||||||
if (!isset(self::$_listeners[$event])) {
|
|
||||||
self::$_listeners[$event] = array();
|
|
||||||
}
|
|
||||||
self::$_listeners[$event][] = $listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function clearAllListeners()
|
|
||||||
{
|
|
||||||
self::$_listeners = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function clearEventListeners($event)
|
|
||||||
{
|
|
||||||
if (isset(self::$_listeners[$event])) {
|
|
||||||
self::$_listeners[$event] = array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function dispatchEvent($event, $params)
|
|
||||||
{
|
|
||||||
if (!isset(self::$_listeners[$event])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$eventObject = new Legacies_Core_Event($params);
|
|
||||||
foreach (self::$_listeners[$event] as $listener) {
|
|
||||||
call_user_func($listener, $eventObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getSession($namespace)
|
|
||||||
{
|
|
||||||
return Legacies_Core_Model_Session::factory($namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getTranslator($locale = 'fr_FR')
|
|
||||||
{
|
|
||||||
if (!isset($translator[$locale])) {
|
|
||||||
$path = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'locale';
|
|
||||||
$translator[$locale] = new Legacies_Core_Model_Translator($path, $locale);
|
|
||||||
}
|
|
||||||
return $translator[$locale];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function translate($locale, $message, Array $args)
|
|
||||||
{
|
|
||||||
return self::getTranslator($locale)->translateArgs($message, $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function __($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return self::getTranslator(self::getLocale())->translate($message, $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getLocale()
|
|
||||||
{
|
|
||||||
return 'fr_FR';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function now()
|
|
||||||
{
|
|
||||||
if (self::$_now === null) {
|
|
||||||
self::$_now = time();
|
|
||||||
}
|
|
||||||
return self::$_now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Block_Html_Form
|
|
||||||
extends Legacies_Core_Block_Template
|
|
||||||
{
|
|
||||||
public function getFormKey()
|
|
||||||
{
|
|
||||||
$session = Legacies::getSession('security');
|
|
||||||
return $session->getFormKey(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,145 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Block_Html_Head
|
|
||||||
extends Legacies_Core_Block_Template
|
|
||||||
{
|
|
||||||
const TYPE_GLOBAL_JS = 'global_js';
|
|
||||||
|
|
||||||
const TYPE_SKIN_CSS = 'skin_css';
|
|
||||||
const TYPE_SKIN_JS = 'skin_js';
|
|
||||||
|
|
||||||
const TYPE_INLINE_CSS = 'inline_css';
|
|
||||||
const TYPE_INLINE_JS = 'inline_js';
|
|
||||||
|
|
||||||
protected $_items = array();
|
|
||||||
|
|
||||||
public function addItem($type, Array $options = array())
|
|
||||||
{
|
|
||||||
if (!isset($this->_items[$type])) {
|
|
||||||
$this->_items[$type] = array();
|
|
||||||
}
|
|
||||||
$this->_items[$type][] = $options;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addJs($script, $type = 'text/javascript', Array $options = array())
|
|
||||||
{
|
|
||||||
$options['type'] = $type;
|
|
||||||
$options['path'] = $script;
|
|
||||||
|
|
||||||
$this->addItem(self::TYPE_GLOBAL_JS, $options);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addCss($stylesheet, $type = 'text/css', $condition = null, Array $options = array())
|
|
||||||
{
|
|
||||||
$options['type'] = $type;
|
|
||||||
$options['path'] = $stylesheet;
|
|
||||||
$options['condition'] = $condition;
|
|
||||||
|
|
||||||
$this->addItem(self::TYPE_SKIN_CSS, $options);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addSkinJs($script, $type = 'text/javascript', Array $options = array())
|
|
||||||
{
|
|
||||||
$options['type'] = $type;
|
|
||||||
$options['path'] = $script;
|
|
||||||
|
|
||||||
$this->addItem(self::TYPE_SKIN_JS, $options);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addInlineJs($content, $type = 'text/javascript', Array $options = array())
|
|
||||||
{
|
|
||||||
$options['type'] = $type;
|
|
||||||
$options['content'] = $content;
|
|
||||||
|
|
||||||
$this->addItem(self::TYPE_INLINE_JS, $options);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addInlineCss($content, $type = 'text/css', Array $options = array())
|
|
||||||
{
|
|
||||||
$options['type'] = $type;
|
|
||||||
$options['path'] = $path;
|
|
||||||
$options['content'] = $content;
|
|
||||||
|
|
||||||
$this->addItem(self::TYPE_INLINE_CSS, $options);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCss()
|
|
||||||
{
|
|
||||||
if (isset($this->_items[self::TYPE_SKIN_CSS])) {
|
|
||||||
return $this->_items[self::TYPE_SKIN_CSS];
|
|
||||||
}
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getInlineCss()
|
|
||||||
{
|
|
||||||
if (isset($this->_items[self::TYPE_INLINE_CSS])) {
|
|
||||||
return $this->_items[self::TYPE_INLINE_CSS];
|
|
||||||
}
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getJs()
|
|
||||||
{
|
|
||||||
if (isset($this->_items[self::TYPE_GLOBAL_JS])) {
|
|
||||||
return $this->_items[self::TYPE_GLOBAL_JS];
|
|
||||||
}
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSkinJs()
|
|
||||||
{
|
|
||||||
if (isset($this->_items[self::TYPE_SKIN_JS])) {
|
|
||||||
return $this->_items[self::TYPE_SKIN_JS];
|
|
||||||
}
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getInlineJs()
|
|
||||||
{
|
|
||||||
if (isset($this->_items[self::TYPE_INLINE_JS])) {
|
|
||||||
return $this->_items[self::TYPE_INLINE_JS];
|
|
||||||
}
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderCss()
|
|
||||||
{
|
|
||||||
$render = '';
|
|
||||||
foreach ($this->getCss() as $css) {
|
|
||||||
if (!isset($css['media'])) {
|
|
||||||
$css['media'] = 'all';
|
|
||||||
}
|
|
||||||
$render .=<<<HTML_EOF
|
|
||||||
<link rel="stylesheet" type="{$css['type']}" src="{$css['path']}" media="{$css['media']}" />
|
|
||||||
HTML_EOF;
|
|
||||||
}
|
|
||||||
return $render;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderJs()
|
|
||||||
{
|
|
||||||
$render = '';
|
|
||||||
foreach ($this->getJs() as $js) {
|
|
||||||
if (!isset($css['media'])) {
|
|
||||||
$css['media'] = 'all';
|
|
||||||
}
|
|
||||||
$render .=<<<HTML_EOF
|
|
||||||
<script type="{$js['type']}" src="{$js['path']}"></script>
|
|
||||||
HTML_EOF;
|
|
||||||
}
|
|
||||||
return $render;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Block_Html_Navigation
|
|
||||||
extends Legacies_Core_Block_Template
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Block_Template
|
|
||||||
extends Legacies_Core_View
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,345 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Collection
|
|
||||||
extends Legacies_Core_Model
|
|
||||||
implements Iterator, Countable
|
|
||||||
{
|
|
||||||
protected $_tableName = null;
|
|
||||||
protected $_tableAlias = null;
|
|
||||||
protected $_entityClassName = 'Legacies_Object';
|
|
||||||
|
|
||||||
protected $_columns = array();
|
|
||||||
protected $_where = array();
|
|
||||||
protected $_join = array();
|
|
||||||
protected $_order = array();
|
|
||||||
protected $_union = array();
|
|
||||||
protected $_limit = null;
|
|
||||||
protected $_offset = null;
|
|
||||||
protected $_group = array();
|
|
||||||
|
|
||||||
protected $_items = array();
|
|
||||||
|
|
||||||
public function __construct($tableName = null, $entityClassName = null)
|
|
||||||
{
|
|
||||||
if ($tableName !== null) {
|
|
||||||
$this->setTableName($tableName);
|
|
||||||
}
|
|
||||||
if ($entityClassName != null) {
|
|
||||||
$this->setEntityClassName($entityClassName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _init()
|
|
||||||
{
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTableName($tableName)
|
|
||||||
{
|
|
||||||
if (!is_array($tableName)) {
|
|
||||||
$this->_tableName = $tableName;
|
|
||||||
} else {
|
|
||||||
$this->_tableName = current($tableName);
|
|
||||||
$this->_tableAlias = key($tableName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTableName()
|
|
||||||
{
|
|
||||||
return $this->_tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setEntityClassName($entityClassName)
|
|
||||||
{
|
|
||||||
$this->_entityClassName = $entityClassName;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEntityClassName()
|
|
||||||
{
|
|
||||||
return $this->_entityClassName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function quote($data)
|
|
||||||
{
|
|
||||||
static $database = null;
|
|
||||||
|
|
||||||
if ($database === null) {
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $database->quote($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function column($column = '*', $alias = null)
|
|
||||||
{
|
|
||||||
if (is_array($column)) {
|
|
||||||
foreach ($column as $alias => $field) {
|
|
||||||
if (is_int($alias)) {
|
|
||||||
$this->_columns[] = array($field);
|
|
||||||
} else {
|
|
||||||
$this->_columns[] = array($alias => $field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ($alias === null || is_int($alias)) {
|
|
||||||
$this->_columns[] = array($column);
|
|
||||||
} else {
|
|
||||||
$this->_columns[] = array($alias => $column);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function where($condition)
|
|
||||||
{
|
|
||||||
$this->_where[] = $condition;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function join($table, $condition, $fields = array('*'), $mode = 'INNER')
|
|
||||||
{
|
|
||||||
static $database = null;
|
|
||||||
|
|
||||||
if ($database === null) {
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($table)) {
|
|
||||||
$alias = key($table);
|
|
||||||
$table = current($table);
|
|
||||||
|
|
||||||
foreach ($fields as $fieldAlias => $fieldName) {
|
|
||||||
$this->column("{$alias}.{$field}", $fieldAlias);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_join[] = "{$mode} JOIN {$database->getTable($table)} AS {$alias} ON {$condition}";
|
|
||||||
} else {
|
|
||||||
foreach ($fields as $field) {
|
|
||||||
$this->column("{$field}");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_join[] = "{$mode} JOIN {$database->getTable($table)} ON {$condition}";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function order($field, $direction = 'ASC')
|
|
||||||
{
|
|
||||||
$this->_order[] = "{$field} {$direction}";
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function union($collection)
|
|
||||||
{
|
|
||||||
$this->_union[] = $collection;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function limit($limit, $offset = null)
|
|
||||||
{
|
|
||||||
$this->_limit = intval($limit);
|
|
||||||
$this->_offset = $offset;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function group($groupField)
|
|
||||||
{
|
|
||||||
$this->_group[] = $groupField;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _prepareSql()
|
|
||||||
{
|
|
||||||
if (empty($this->_union)) {
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
|
|
||||||
$fields = array();
|
|
||||||
foreach ($this->_columns as $field) {
|
|
||||||
$fieldName = current($field);
|
|
||||||
$fieldAlias = key($field);
|
|
||||||
if (is_string($fieldAlias)) {
|
|
||||||
$fields[] = "{$fieldName} AS {$fieldAlias}";
|
|
||||||
} else {
|
|
||||||
$fields[] = $fieldName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($fields)) {
|
|
||||||
$fields = implode(", ", $fields);
|
|
||||||
} else {
|
|
||||||
$fields = '*';
|
|
||||||
}
|
|
||||||
if (!empty($this->_where)) {
|
|
||||||
$where = 'WHERE (' . implode(") AND (", $this->_where) . ')';
|
|
||||||
} else {
|
|
||||||
$where = '';
|
|
||||||
}
|
|
||||||
$joinedTables = implode("\n ", $this->_join);
|
|
||||||
|
|
||||||
$order = '';
|
|
||||||
if (!empty($this->_order)) {
|
|
||||||
$order = 'ORDER BY ' . implode(", ", $this->_order);
|
|
||||||
}
|
|
||||||
$alias = '';
|
|
||||||
if ($this->_tableAlias !== null) {
|
|
||||||
$alias = " AS {$this->_tableAlias}";
|
|
||||||
}
|
|
||||||
$limit = '';
|
|
||||||
if ($this->_limit) {
|
|
||||||
if ($this->_offset) {
|
|
||||||
$limit = "LIMIT {$this->_limit}, {$this->_offset}";
|
|
||||||
} else {
|
|
||||||
$limit = "LIMIT {$this->_limit}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$group = '';
|
|
||||||
if (!empty($this->_group)) {
|
|
||||||
$group = 'GROUP BY ' . implode(', ', $this->_group);
|
|
||||||
}
|
|
||||||
|
|
||||||
return <<<SQL_EOF
|
|
||||||
SELECT {$fields}
|
|
||||||
FROM {$database->getTable($this->getTableName())}{$alias}
|
|
||||||
{$joinedTables}
|
|
||||||
{$where}
|
|
||||||
{$group}
|
|
||||||
{$order}
|
|
||||||
{$limit}
|
|
||||||
SQL_EOF;
|
|
||||||
} else {
|
|
||||||
$statements = array();
|
|
||||||
foreach ($this->_union as $statement) {
|
|
||||||
$statements[] = $statement->_prepareSql();
|
|
||||||
}
|
|
||||||
|
|
||||||
$statements = '(' . implode(') UNION (', $statements) . ')';
|
|
||||||
if (!empty($where)) {
|
|
||||||
$where = 'WHERE ' . implode(" AND ", $this->_where);
|
|
||||||
} else {
|
|
||||||
$where = '';
|
|
||||||
}
|
|
||||||
$where = implode(" AND ", $this->_where);
|
|
||||||
|
|
||||||
$limit = '';
|
|
||||||
if ($this->_limit) {
|
|
||||||
if ($this->_offset) {
|
|
||||||
$limit = "LIMIT {$this->_limit}, {$this->_offset}";
|
|
||||||
} else {
|
|
||||||
$limit = "LIMIT {$this->_limit}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return <<<SQL_EOF
|
|
||||||
$statements
|
|
||||||
{$where}
|
|
||||||
{$limit}
|
|
||||||
SQL_EOF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __toString()
|
|
||||||
{
|
|
||||||
return $this->_prepareSql();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _load()
|
|
||||||
{
|
|
||||||
$sql = $this->_prepareSql();
|
|
||||||
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
|
||||||
$statement->execute(array_shift($args));
|
|
||||||
|
|
||||||
$this->_items = array();
|
|
||||||
if (func_num_args() > 1) {
|
|
||||||
$reflection = new ReflectionClass(array_shift($args));
|
|
||||||
} else {
|
|
||||||
$reflection = new ReflectionClass($this->getEntityClassName());
|
|
||||||
}
|
|
||||||
|
|
||||||
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
|
|
||||||
$params = array_merge(array($row), $args);
|
|
||||||
$this->_items[] = $reflection->newInstanceArgs($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _save()
|
|
||||||
{
|
|
||||||
foreach ($this->_items as $child) {
|
|
||||||
$child->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _delete()
|
|
||||||
{
|
|
||||||
foreach ($this->_items as $child) {
|
|
||||||
$child->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSize()
|
|
||||||
{
|
|
||||||
$clone = clone $this;
|
|
||||||
$clone->_fields = array();
|
|
||||||
$clone->column('COUNT(*)');
|
|
||||||
|
|
||||||
$sql = $clone->_prepareSql();
|
|
||||||
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
|
||||||
$statement->execute(array_shift($args));
|
|
||||||
return $statement->fetch(PDO::FETCH_COLUMN, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function count()
|
|
||||||
{
|
|
||||||
return count($this->_items);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function current()
|
|
||||||
{
|
|
||||||
return current($this->_items);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function next()
|
|
||||||
{
|
|
||||||
next($this->_items);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function rewind()
|
|
||||||
{
|
|
||||||
reset($this->_items);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function key()
|
|
||||||
{
|
|
||||||
return key($this->_items);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function valid()
|
|
||||||
{
|
|
||||||
return current($this->_items) !== false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Controller_Action
|
|
||||||
{
|
|
||||||
private $_request = null;
|
|
||||||
private $_response = null;
|
|
||||||
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function preDispatch()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function postDispatch()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRequest()
|
|
||||||
{
|
|
||||||
return $this->_request;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getResponse()
|
|
||||||
{
|
|
||||||
return $this->_response;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _forward($action, $controller = null, $module = null)
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$request->setAction($action);
|
|
||||||
if ($controller !== null) {
|
|
||||||
$request->setController($controller);
|
|
||||||
if ($module != null) {
|
|
||||||
$request->setModule($module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$request->setIsDispatched(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _redirect($url)
|
|
||||||
{
|
|
||||||
$this->getResponse()
|
|
||||||
->setRawHeader('HTTP/1.1 302 Found')
|
|
||||||
->setHeader('Location', $url)
|
|
||||||
->setIsRedirect(true)
|
|
||||||
;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Controller_Request_Http
|
|
||||||
extends Legacies_Object
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct(array());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setParam($key, $value)
|
|
||||||
{
|
|
||||||
return $this->setData($key, $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getParam($key, $default = null)
|
|
||||||
{
|
|
||||||
if ($this->hasData($key)) {
|
|
||||||
return $this->getData($key);
|
|
||||||
}
|
|
||||||
if (isset($_POST[$key])) {
|
|
||||||
return $_POST[$key];
|
|
||||||
}
|
|
||||||
if (!isset($_GET[$key])) {
|
|
||||||
return $_GET[$key];
|
|
||||||
}
|
|
||||||
if (!isset($_FILES[$key])) {
|
|
||||||
return $_FILES[$key];
|
|
||||||
}
|
|
||||||
if (!isset($_COOKIE[$key])) {
|
|
||||||
return $_COOKIE[$key];
|
|
||||||
}
|
|
||||||
if (!isset($_SERVER[$key])) {
|
|
||||||
return $_SERVER[$key];
|
|
||||||
}
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQuery($key, $default = null)
|
|
||||||
{
|
|
||||||
if (!isset($_GET[$key])) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
return $_GET[$key];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFile($key, $default = null)
|
|
||||||
{
|
|
||||||
if (!isset($_FILES[$key])) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
return $_FILES[$key];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCookie($key, $default = null)
|
|
||||||
{
|
|
||||||
if (!isset($_COOKIE[$key])) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
return unserialize(stripslashes($_COOKIE[$key]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRawCookie($key, $default = null)
|
|
||||||
{
|
|
||||||
if (!isset($_COOKIE[$key])) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
return $_COOKIE[$key];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPost($key, $default = null)
|
|
||||||
{
|
|
||||||
if (!isset($_POST[$key])) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
return $_POST[$key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,155 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
abstract class Legacies_Core_Entity
|
|
||||||
extends Legacies_Core_Model
|
|
||||||
implements Legacies_Core_EntityInterface
|
|
||||||
{
|
|
||||||
protected $_idFieldName = null;
|
|
||||||
protected $_tableName = null;
|
|
||||||
|
|
||||||
protected $_eventPrefix = 'entity';
|
|
||||||
|
|
||||||
public function setIdFieldName($fieldName)
|
|
||||||
{
|
|
||||||
$this->_idFieldName = $fieldName;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getIdFieldName()
|
|
||||||
{
|
|
||||||
return $this->_idFieldName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTableName($tableName)
|
|
||||||
{
|
|
||||||
$this->_tableName = $tableName;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTableName()
|
|
||||||
{
|
|
||||||
return $this->_tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setId($id)
|
|
||||||
{
|
|
||||||
$this->setData($this->getIdFieldName(), $id);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->getData($this->getIdFieldName());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _load()
|
|
||||||
{
|
|
||||||
$id = func_get_arg(0);
|
|
||||||
|
|
||||||
$idFieldName = self::getIdFieldName();
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
SELECT * FROM {$database->getTable(self::getTableName())}
|
|
||||||
WHERE {$idFieldName}=:id
|
|
||||||
LIMIT 1
|
|
||||||
SQL_EOF;
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
$statement->execute(array(
|
|
||||||
'id' => $id
|
|
||||||
));
|
|
||||||
|
|
||||||
$datas = $statement->fetch(PDO::FETCH_ASSOC);
|
|
||||||
if (!is_array($datas) || empty($datas)) {
|
|
||||||
throw new Legacies_Core_Model_Exception('Could not load data: this id could not be found.');
|
|
||||||
}
|
|
||||||
unset($datas[self::getIdFieldName()]);
|
|
||||||
|
|
||||||
$this->_data = $datas;
|
|
||||||
$this->setId($id);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _save()
|
|
||||||
{
|
|
||||||
if ($this->getId() !== null) {
|
|
||||||
$fields = array();
|
|
||||||
$values = array();
|
|
||||||
foreach ($this->getAllDatas() as $field => $value) {
|
|
||||||
if ($field == self::getIdFieldName()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$fields[] = "{$field}=:{$field}";
|
|
||||||
$values[$field] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$fieldsImploded = implode(', ', $fields);
|
|
||||||
$idFieldName = self::getIdFieldName();
|
|
||||||
$values[$idFieldName] = $this->getId();
|
|
||||||
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
UPDATE {$database->getTable(self::getTableName())}
|
|
||||||
SET {$fieldsImploded}
|
|
||||||
WHERE {$idFieldName}=:{$idFieldName}
|
|
||||||
SQL_EOF;
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
|
|
||||||
$statement->execute($values);
|
|
||||||
} else {
|
|
||||||
$datas = $this->getAllDatas();
|
|
||||||
$fieldsImploded = implode(', ', array_keys($datas));
|
|
||||||
|
|
||||||
$tokens = array();
|
|
||||||
$values = array();
|
|
||||||
foreach ($datas as $field => $value) {
|
|
||||||
if ($field == self::getIdFieldName()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$tokens[] = ":{$field}";
|
|
||||||
$values[$field] = $value;
|
|
||||||
}
|
|
||||||
$tokensImploded = implode(', ', $tokens);
|
|
||||||
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
INSERT INTO {$database->getTable(self::getTableName())} ($fieldsImploded)
|
|
||||||
VALUES ({$tokensImploded})
|
|
||||||
SQL_EOF;
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
|
|
||||||
$statement->execute($values);
|
|
||||||
|
|
||||||
$this->setId($database->lastInsertId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _delete()
|
|
||||||
{
|
|
||||||
$fields = array();
|
|
||||||
foreach ($this->getAllDatas() as $field => $value) {
|
|
||||||
if ($field == self::getIdFieldName()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$fields[] = "{$field}=:{$field}";
|
|
||||||
}
|
|
||||||
|
|
||||||
$fieldsImploded = implod(', ', $fields);
|
|
||||||
$idFieldName = self::getIdFieldName();
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
DELETE {$database->getTable(self::getTableName())}
|
|
||||||
WHERE {$idFieldName}=:{$idFieldName}
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$statement->execute($this->getAllDatas());
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Core_EntityInterface
|
|
||||||
{
|
|
||||||
public function getId();
|
|
||||||
public function setId($id);
|
|
||||||
|
|
||||||
public function getIdFieldName();
|
|
||||||
public function setIdFieldName($fieldName);
|
|
||||||
|
|
||||||
public function getTableName();
|
|
||||||
public function setTableName($tableName);
|
|
||||||
}
|
|
||||||
|
|
@ -1,179 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_ErrorProfiler
|
|
||||||
{
|
|
||||||
private static $_singleton = null;
|
|
||||||
|
|
||||||
protected $_errors = array();
|
|
||||||
protected $_warnings = array();
|
|
||||||
protected $_notices = array();
|
|
||||||
protected $_otherErrors = array();
|
|
||||||
protected $_exceptions = array();
|
|
||||||
|
|
||||||
private static $_isTraceRegistered = false;
|
|
||||||
|
|
||||||
public static function getSingleton()
|
|
||||||
{
|
|
||||||
if (self::$_singleton === null) {
|
|
||||||
self::$_singleton = new self;
|
|
||||||
}
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function errorManager($errno, $errstr, $errfile = null, $errline = null, Array $errcontext = array())
|
|
||||||
{
|
|
||||||
switch ($errno) {
|
|
||||||
case E_USER_ERROR:
|
|
||||||
case E_ERROR:
|
|
||||||
$this->_errors[] = array(
|
|
||||||
'time' => explode(' ', microtime()),
|
|
||||||
'code' => $errno,
|
|
||||||
'message' => $errstr,
|
|
||||||
'file' => $errfile,
|
|
||||||
'line' => $errline,
|
|
||||||
'context' => $errcontext
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case E_USER_WARNING:
|
|
||||||
case E_WARNING:
|
|
||||||
$this->_warnings[] = array(
|
|
||||||
'time' => explode(' ', microtime()),
|
|
||||||
'code' => $errno,
|
|
||||||
'message' => $errstr,
|
|
||||||
'file' => $errfile,
|
|
||||||
'line' => $errline,
|
|
||||||
'context' => $errcontext
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case E_USER_NOTICE:
|
|
||||||
case E_NOTICE:
|
|
||||||
$this->_notices[] = array(
|
|
||||||
'time' => explode(' ', microtime()),
|
|
||||||
'code' => $errno,
|
|
||||||
'message' => $errstr,
|
|
||||||
'file' => $errfile,
|
|
||||||
'line' => $errline,
|
|
||||||
'context' => $errcontext
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (!isset($this->_otherErrors[$errno])) {
|
|
||||||
$this->_otherErrors[$errno] = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_otherErrors[$errno][] = array(
|
|
||||||
'time' => explode(' ', microtime()),
|
|
||||||
'code' => $errno,
|
|
||||||
'message' => $errstr,
|
|
||||||
'file' => $errfile,
|
|
||||||
'line' => $errline,
|
|
||||||
'context' => $errcontext
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function exceptionManager($exception)
|
|
||||||
{
|
|
||||||
$this->_exceptions[] = $exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _renderError($error)
|
|
||||||
{
|
|
||||||
$types = array(
|
|
||||||
0x0001 => 'E_ERROR',
|
|
||||||
0x0002 => 'E_WARNING',
|
|
||||||
0x0004 => 'E_PARSE',
|
|
||||||
0x0008 => 'E_NOTICE',
|
|
||||||
0x0010 => 'E_CORE_ERROR',
|
|
||||||
0x0020 => 'E_CORE_WARNING',
|
|
||||||
0x0040 => 'E_COMPILE_ERROR',
|
|
||||||
0x0080 => 'E_COMPILE_WARNING',
|
|
||||||
0x0100 => 'E_USER_ERROR',
|
|
||||||
0x0200 => 'E_USER_WARNING',
|
|
||||||
0x0400 => 'E_USER_NOTICE',
|
|
||||||
0x0800 => 'E_STRICT',
|
|
||||||
0x1000 => 'E_RECOVERABLE_ERROR',
|
|
||||||
0x2000 => 'E_DEPRECATED',
|
|
||||||
0x4000 => 'E_USER_DEPRECATED',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset($error['code']) && isset($types[$error['code']])) {
|
|
||||||
$code = $types[$error['code']];
|
|
||||||
} else {
|
|
||||||
$code = "Unknown ({$error['code']})";
|
|
||||||
}
|
|
||||||
|
|
||||||
$date = date('Y-m-d H:i:s', (int) $error['time'][1]);
|
|
||||||
$microsec = (int) ($error['time'][0] * 1000000);
|
|
||||||
|
|
||||||
return <<<ERROR_EOF
|
|
||||||
On: {$date} +{$microsec}µs
|
|
||||||
Type: {$code}
|
|
||||||
Message: {$error['message']}
|
|
||||||
File: {$error['file']}
|
|
||||||
Line: {$error['line']}
|
|
||||||
\n
|
|
||||||
ERROR_EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function shutdownManager()
|
|
||||||
{
|
|
||||||
echo '<div style="background:#FFF;border:1px solid #F00;color:#000;padding:10px;margin:20px;text-align:left;">';
|
|
||||||
echo '<h1>Debug profiler</h1>';
|
|
||||||
if (count($this->_errors) <= 0 && count($this->_warnings) <= 0 &&
|
|
||||||
count($this->_notices) <= 0 && count($this->_otherErrors) <= 0 &&
|
|
||||||
count($this->_exceptions) <= 0) {
|
|
||||||
echo '<p>Profiler was empty.</p>';
|
|
||||||
} else {
|
|
||||||
echo '<pre>';
|
|
||||||
foreach ($this->_errors as $error) {
|
|
||||||
echo $this->_renderError($error);
|
|
||||||
}
|
|
||||||
foreach ($this->_warnings as $error) {
|
|
||||||
echo $this->_renderError($error);
|
|
||||||
}
|
|
||||||
foreach ($this->_notices as $error) {
|
|
||||||
echo $this->_renderError($error);
|
|
||||||
}
|
|
||||||
foreach ($this->_otherErrors as $errorList) {
|
|
||||||
foreach ($errorList as $error) {
|
|
||||||
echo $this->_renderError($error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach ($this->_exceptions as $exception) {
|
|
||||||
echo $exception->getMessage() . PHP_EOL;
|
|
||||||
echo $exception->getTraceAsString();
|
|
||||||
}
|
|
||||||
echo '</pre>';
|
|
||||||
}
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function register()
|
|
||||||
{
|
|
||||||
set_error_handler(array(self::getSingleton(), 'errorManager'));
|
|
||||||
set_exception_handler(array(self::getSingleton(), 'exceptionManager'));
|
|
||||||
|
|
||||||
if (self::$_isTraceRegistered === false && defined('DEBUG')) {
|
|
||||||
self::$_isTraceRegistered = true;
|
|
||||||
register_shutdown_function(array(self::getSingleton(), 'shutdownManager'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function unregister($force = false)
|
|
||||||
{
|
|
||||||
restore_error_handler();
|
|
||||||
restore_exception_handler();
|
|
||||||
|
|
||||||
if ((self::$_isTraceRegistered && defined('DEBUG')) || $force) {
|
|
||||||
self::$_isTraceRegistered = false;
|
|
||||||
register_shutdown_function(array(self::getSingleton(), 'shutdownManager'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Event
|
|
||||||
extends Legacies_Object
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Event_Break
|
|
||||||
extends Exception
|
|
||||||
implements Legacies_Core_Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Core_Exception extends Legacies_Exception {}
|
|
||||||
|
|
@ -1,220 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Layout
|
|
||||||
extends Legacies_Core_Model
|
|
||||||
{
|
|
||||||
protected $_blocks = array();
|
|
||||||
|
|
||||||
protected $_view = null;
|
|
||||||
protected $_eventPrefix = 'layout';
|
|
||||||
protected $_eventObject = 'layout';
|
|
||||||
|
|
||||||
public function _init()
|
|
||||||
{
|
|
||||||
$path = APPLICATION_PATH . 'design/layouts/';
|
|
||||||
$config = include ROOT_PATH . 'config.php';
|
|
||||||
$fileList = $config['global']['layout'];
|
|
||||||
|
|
||||||
foreach ($fileList as $layoutFile) {
|
|
||||||
foreach (include $path . $layoutFile as $layoutId => $layoutConfig) {
|
|
||||||
if ($this->hasData($layoutId)) {
|
|
||||||
$declared = $this->getData($layoutId);
|
|
||||||
$layoutConfig = array_merge($declared, $layoutConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setData($layoutId, $layoutConfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function _load()
|
|
||||||
{
|
|
||||||
$layoutId = func_get_arg(0);
|
|
||||||
|
|
||||||
if (!$this->hasData($layoutId)) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$layoutConfigs = array($this->getData($layoutId));
|
|
||||||
$layoutUpdates = array();
|
|
||||||
if (isset($layoutConfigs[0]['update'])) {
|
|
||||||
$parent = $layoutConfigs[0]['update'];
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
while (true) {
|
|
||||||
$layoutConfigs[++$i] = $this->getData($parent);
|
|
||||||
|
|
||||||
if (!isset($layoutConfigs[$i]['update'])) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$parent = $layoutConfigs[$i]['update'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$layoutConfig = array();
|
|
||||||
foreach (array_reverse($layoutConfigs) as $config) {
|
|
||||||
$layoutConfig = array_merge($layoutConfig, $config);
|
|
||||||
|
|
||||||
if (isset($layoutConfig['reference'])) {
|
|
||||||
foreach ($layoutConfig['reference'] as $name => $update) {
|
|
||||||
if (!isset($layoutUpdates[$name])) {
|
|
||||||
$layoutUpdates[$name] = array();
|
|
||||||
}
|
|
||||||
$layoutUpdates[$name][] = $update;
|
|
||||||
}
|
|
||||||
unset($layoutConfig['reference']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($layoutConfigs, $layoutConfig['update']);
|
|
||||||
|
|
||||||
$type = $layoutConfig['type'];
|
|
||||||
$name = isset($layoutConfig['name']) ? $layoutConfig['name'] : 'root';
|
|
||||||
|
|
||||||
$this->_view = $this->createBlock($type, $name, $layoutConfig);
|
|
||||||
|
|
||||||
foreach ($layoutUpdates as $block => $updates) {
|
|
||||||
if (!isset($this->_blocks[$block])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$parent = $this->_blocks[$block];
|
|
||||||
foreach ($updates as $update) {
|
|
||||||
if (isset($update['children'])) {
|
|
||||||
foreach ($update['children'] as $childName => $childConfig) {
|
|
||||||
$type = $childConfig['type'];
|
|
||||||
$alias = isset($childConfig['alias']) ? $childConfig['alias'] : $childName;
|
|
||||||
|
|
||||||
$parent->$alias = $this->createBlock($type, $childName, $childConfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function _save()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function _delete()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _resolveBlockClassType($type)
|
|
||||||
{
|
|
||||||
$offset = strpos($type, '/');
|
|
||||||
if ($offset === false) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$module = substr($type, 0, $offset);
|
|
||||||
$block = substr($type, $offset + 1);
|
|
||||||
|
|
||||||
$module = str_replace(' ', '', ucwords(str_replace('-', ' ', $module)));
|
|
||||||
$module = str_replace(' ', '_', ucwords(str_replace('.', ' ', $module)));
|
|
||||||
$block = str_replace(' ', '', ucwords(str_replace('-', ' ', $block)));
|
|
||||||
$block = str_replace(' ', '_', ucwords(str_replace('.', ' ', $block)));
|
|
||||||
|
|
||||||
return 'Legacies_' . $module . '_Block_' . $block;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function createBlock($type, $name, $config = array())
|
|
||||||
{
|
|
||||||
$className = $this->_resolveBlockClassType($type);
|
|
||||||
|
|
||||||
$children = array();
|
|
||||||
if (isset($config['children'])) {
|
|
||||||
$children = $config['children'];
|
|
||||||
unset($config['children']);
|
|
||||||
}
|
|
||||||
$actions = array();
|
|
||||||
if (isset($config['actions'])) {
|
|
||||||
$actions = $config['actions'];
|
|
||||||
unset($config['actions']);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$reflectionClass = new ReflectionClass($className);
|
|
||||||
|
|
||||||
$instance = $reflectionClass->newInstance($config);
|
|
||||||
$this->_blocks[$name] = $instance;
|
|
||||||
|
|
||||||
foreach ($children as $name => $config) {
|
|
||||||
if (isset($config['alias'])) {
|
|
||||||
$alias = $config['alias'];
|
|
||||||
} else {
|
|
||||||
$alias = $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['type'])) {
|
|
||||||
$instance->$alias = new Legacies_Core_View($config);
|
|
||||||
} else {
|
|
||||||
$instance->$alias = $this->createBlock($config['type'], $name, $config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (ReflectionException $e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$instance->setLayout($this);
|
|
||||||
|
|
||||||
foreach ($actions as $action) {
|
|
||||||
if (!isset($action['method'])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$method = $action['method'];
|
|
||||||
|
|
||||||
$params = array();
|
|
||||||
if (isset($action['params'])) {
|
|
||||||
$params = $action['params'];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$reflectionMethod = $reflectionClass->getMethod($method);
|
|
||||||
$callParamaters = array();
|
|
||||||
foreach ($reflectionMethod->getParameters() as $parameter) {
|
|
||||||
$paramterName = $parameter->getName();
|
|
||||||
$paramterPosition = $parameter->getPosition();
|
|
||||||
|
|
||||||
if (isset($params[$paramterName])) {
|
|
||||||
$callParamaters[$paramterPosition] = $params[$paramterName];
|
|
||||||
} else if ($parameter->isDefaultValueAvailable()) {
|
|
||||||
$callParamaters[$paramterPosition] = $parameter->getDefaultValue();
|
|
||||||
} else if ($parameter->isOptionnal()) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
throw RuntimeException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$reflectionMethod->invokeArgs($instance, $callParamaters);
|
|
||||||
} catch (ReflectionException $e) {
|
|
||||||
continue;
|
|
||||||
} catch (RuntimeException $e) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$instance->prepareLayout();
|
|
||||||
|
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBlock($code)
|
|
||||||
{
|
|
||||||
if (isset($this->_blocks[$code])) {
|
|
||||||
return $this->_blocks[$code];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
foreach ($this->_blocks as $block) {
|
|
||||||
$block->beforeToHtml();
|
|
||||||
}
|
|
||||||
unset($block);
|
|
||||||
|
|
||||||
return $this->_view->render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,140 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
abstract class Legacies_Core_Model
|
|
||||||
extends Legacies_Object
|
|
||||||
{
|
|
||||||
protected $_originalData = array();
|
|
||||||
|
|
||||||
protected $_eventPrefix = 'model';
|
|
||||||
protected $_eventObject = 'model';
|
|
||||||
|
|
||||||
public function __construct(Array $data = array())
|
|
||||||
{
|
|
||||||
$this->_data = $data;
|
|
||||||
|
|
||||||
$this->_init();
|
|
||||||
$this->_setOriginalData($this->_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract protected function _init();
|
|
||||||
|
|
||||||
protected function _setOriginalData(Array $data)
|
|
||||||
{
|
|
||||||
$this->_originalData = $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
final public function save()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$params = func_get_args();
|
|
||||||
call_user_func_array(array($this, '_beforeSave'), $params);
|
|
||||||
call_user_func_array(array($this, '_save'), $params);
|
|
||||||
call_user_func_array(array($this, '_afterSave'), $params);
|
|
||||||
$this->_setOriginalData($this->_data);
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
throw new Legacies_Core_Model_Exception('Could not save data: ' . $e->getMessage(), 0);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract protected function _save();
|
|
||||||
|
|
||||||
protected function _beforeSave()
|
|
||||||
{
|
|
||||||
Legacies::dispatchEvent('model.before-save', array($this->_eventObject => $this));
|
|
||||||
Legacies::dispatchEvent($this->_eventPrefix . '.before-save', array($this->_eventObject => $this));
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _afterSave()
|
|
||||||
{
|
|
||||||
Legacies::dispatchEvent('model.after-save', array($this->_eventObject => $this));
|
|
||||||
Legacies::dispatchEvent($this->_eventPrefix . '.after-save', array($this->_eventObject => $this));
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
final public function load()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$params = func_get_args();
|
|
||||||
call_user_func_array(array($this, '_beforeLoad'), $params);
|
|
||||||
call_user_func_array(array($this, '_load'), $params);
|
|
||||||
call_user_func_array(array($this, '_afterLoad'), $params);
|
|
||||||
$this->_setOriginalData($this->_data);
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
throw new Legacies_Core_Model_Exception('Could not load data: ' . $e->getMessage(), 0);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract protected function _load();
|
|
||||||
|
|
||||||
protected function _beforeLoad()
|
|
||||||
{
|
|
||||||
Legacies::dispatchEvent('model.before-load', array($this->_eventObject => $this));
|
|
||||||
Legacies::dispatchEvent($this->_eventPrefix . '.before-load', array($this->_eventObject => $this));
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _afterLoad()
|
|
||||||
{
|
|
||||||
Legacies::dispatchEvent('model.after-load', array($this->_eventObject => $this));
|
|
||||||
Legacies::dispatchEvent($this->_eventPrefix . '.after-load', array($this->_eventObject => $this));
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
final public function delete()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$params = func_get_args();
|
|
||||||
call_user_func_array(array($this, '_beforeDelete'), $params);
|
|
||||||
call_user_func_array(array($this, '_delete'), $params);
|
|
||||||
call_user_func_array(array($this, '_afterDelete'), $params);
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
throw new Legacies_Core_Model_Exception('Could not delete entity: ' . $e->getMessage(), 0);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract protected function _delete();
|
|
||||||
|
|
||||||
protected function _beforeDelete()
|
|
||||||
{
|
|
||||||
Legacies::dispatchEvent('model.before-delete', array($this->_eventObject => $this));
|
|
||||||
Legacies::dispatchEvent($this->_eventPrefix . '.before-delete', array($this->_eventObject => $this));
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _afterDelete()
|
|
||||||
{
|
|
||||||
Legacies::dispatchEvent('model.after-delete', array($this->_eventObject => $this));
|
|
||||||
Legacies::dispatchEvent($this->_eventPrefix . '.after-delete', array($this->_eventObject => $this));
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __set($key, $value)
|
|
||||||
{
|
|
||||||
return $this->setData($key, $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __get($key)
|
|
||||||
{
|
|
||||||
return $this->getData($key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __unset($key)
|
|
||||||
{
|
|
||||||
return $this->unsetData($key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __isset($key)
|
|
||||||
{
|
|
||||||
return $this->hasData($key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
*
|
|
||||||
* @uses Legacies_Object
|
|
||||||
* @uses Legacies_Empire
|
|
||||||
*/
|
|
||||||
class Legacies_Core_Model_Config
|
|
||||||
extends Legacies_Core_Model
|
|
||||||
implements Legacies_Core_Singleton
|
|
||||||
{
|
|
||||||
private static $_singleton = null;
|
|
||||||
|
|
||||||
protected $_eventPrefix = 'core.config';
|
|
||||||
protected $_eventObject = 'config';
|
|
||||||
|
|
||||||
public static function getSingleton()
|
|
||||||
{
|
|
||||||
if (self::$_singleton === null) {
|
|
||||||
self::$_singleton = new self();
|
|
||||||
}
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _init()
|
|
||||||
{
|
|
||||||
$this->load();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _load()
|
|
||||||
{
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
SELECT config_name AS attribute, config_value AS value
|
|
||||||
FROM {$database->getTable('config')} AS config
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$attributeName = null;
|
|
||||||
$attributeValue = null;
|
|
||||||
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
$statement->execute();
|
|
||||||
|
|
||||||
$statement->bindColumn('attribute', $attributeName, PDO::PARAM_STR);
|
|
||||||
$statement->bindColumn('value', $attributeValue, PDO::PARAM_STR);
|
|
||||||
|
|
||||||
while ($statement->fetch(PDO::FETCH_BOUND)) {
|
|
||||||
$this->setData($attributeName, $attributeValue);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _save()
|
|
||||||
{
|
|
||||||
$database = Legacies_Database::getSingleton();
|
|
||||||
$fields = array();
|
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
UPDATE {{table}}
|
|
||||||
SET config_value=:value
|
|
||||||
WHERE config_name=:name
|
|
||||||
SQL_EOF;
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
|
|
||||||
foreach ($this->getAllDatas() as $attributeName => $attributeValue) {
|
|
||||||
$statement->execute(array(
|
|
||||||
'name' => $attributeName,
|
|
||||||
'value' => $attributeValue
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _delete()
|
|
||||||
{
|
|
||||||
// NOP
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
return (bool) $this->getData('game_disable');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_Model_Exception
|
|
||||||
extends RuntimeException
|
|
||||||
implements Legacies_Core_Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,140 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
*
|
|
||||||
* @uses Legacies_Object
|
|
||||||
* @uses Legacies_Empire
|
|
||||||
*/
|
|
||||||
class Legacies_Core_Model_Session
|
|
||||||
extends Legacies_Object
|
|
||||||
{
|
|
||||||
const CRIT = 0x80;
|
|
||||||
const ERROR = 0x40;
|
|
||||||
const WARN = 0x20;
|
|
||||||
const INFO = 0x10;
|
|
||||||
const DEBUG = 0x01;
|
|
||||||
const SUCCESS = 0;
|
|
||||||
|
|
||||||
protected static $_instances = null;
|
|
||||||
|
|
||||||
protected static $_levels = null;
|
|
||||||
|
|
||||||
public static function factory($namespace)
|
|
||||||
{
|
|
||||||
$namespace = (string) $namespace;
|
|
||||||
if (!isset(self::$_instances[$namespace])) {
|
|
||||||
if (self::$_levels === null) {
|
|
||||||
$reflection = new ReflectionClass(__CLASS__);
|
|
||||||
self::$_levels = array_flip($reflection->getConstants());
|
|
||||||
}
|
|
||||||
if (session_id() == '') {
|
|
||||||
session_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$_instances[$namespace] = new self($namespace);
|
|
||||||
}
|
|
||||||
return self::$_instances[$namespace];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function destroy()
|
|
||||||
{
|
|
||||||
session_destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __construct($namespace)
|
|
||||||
{
|
|
||||||
$this->_data = &$_SESSION[$namespace];
|
|
||||||
$this->_data['messages'] = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMessages($clear = true)
|
|
||||||
{
|
|
||||||
$messages = $this->_data['messages'];
|
|
||||||
if ($clear == true) {
|
|
||||||
$this->_data['messages'] = array();
|
|
||||||
}
|
|
||||||
return $messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addMessage($message, $type = self::DEBUG)
|
|
||||||
{
|
|
||||||
if (!isset(self::$_levels[$type])) {
|
|
||||||
$type = self::DEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($this->_data['messages'])) {
|
|
||||||
$this->_data['messages'] = array();
|
|
||||||
}
|
|
||||||
if (!isset($this->_data['messages'][self::$_levels[$type]])) {
|
|
||||||
$this->_data['messages'][self::$_levels[$type]] = array();
|
|
||||||
}
|
|
||||||
$this->_data['messages'][self::$_levels[$type]][] = $message;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addCritical($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return $this->addMessage(vsprintf($message, $args), self::CRIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addError($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return $this->addMessage(vsprintf($message, $args), self::ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addWarning($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return $this->addMessage(vsprintf($message, $args), self::WARN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addSuccess($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return $this->addMessage(vsprintf($message, $args), self::SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addInfo($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return $this->addMessage(vsprintf($message, $args), self::INFO);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addDebug($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return $this->addMessage(vsprintf($message, $args), self::DEBUG);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormKey($reset = false)
|
|
||||||
{
|
|
||||||
if (!$this->getData('form_key')) {
|
|
||||||
$this->setData('form_key', uniqid());
|
|
||||||
return $this->getData('form_key');
|
|
||||||
}
|
|
||||||
|
|
||||||
$key = $this->getData('form_key');
|
|
||||||
if ($reset == true) {
|
|
||||||
$this->setData('form_key', uniqid());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Core_Singleton
|
|
||||||
{
|
|
||||||
public static function getSingleton();
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
class Legacies_Core_Time
|
|
||||||
{
|
|
||||||
public static function init()
|
|
||||||
{
|
|
||||||
$config = include ROOT_PATH . 'config.php';
|
|
||||||
$timezone = $config['global']['date']['timezone'];
|
|
||||||
|
|
||||||
date_default_timezone_set($timezone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,186 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Core_View
|
|
||||||
extends Legacies_Object
|
|
||||||
{
|
|
||||||
protected $_template = null;
|
|
||||||
protected $_partials = array();
|
|
||||||
protected $_layout = null;
|
|
||||||
|
|
||||||
public function __construct(Array $data = array())
|
|
||||||
{
|
|
||||||
if (isset($data['template'])) {
|
|
||||||
$this->_template = $data['template'];
|
|
||||||
unset($data['template']);
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _prepareRender()
|
|
||||||
{
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderNumber($number)
|
|
||||||
{
|
|
||||||
return Math::render($number);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function escape($unescaped)
|
|
||||||
{
|
|
||||||
return htmlspecialchars($unescaped, ENT_QUOTES, 'UTF-8');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return Legacies::translate(Legacies::getLocale(), $message, $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function translate($message, $_ = null)
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
return Legacies::translate(Legacies::getLocale(), $message, $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderScript($file)
|
|
||||||
{
|
|
||||||
$this->_prepareRender();
|
|
||||||
|
|
||||||
$path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR . 'scripts';
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
include $path . DIRECTORY_SEPARATOR . $file;
|
|
||||||
$contents = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
$template = $this->getTemplate();
|
|
||||||
if (empty($template)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $this->renderScript($template);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTemplate($template)
|
|
||||||
{
|
|
||||||
$this->_template = $template;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTemplate()
|
|
||||||
{
|
|
||||||
return $this->_template;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUrl($uri, Array $params = array())
|
|
||||||
{
|
|
||||||
// TODO: base path integration
|
|
||||||
$serializedParams = array();
|
|
||||||
foreach ($params as $paramKey => $paramValue) {
|
|
||||||
if ($paramValue) {
|
|
||||||
$serializedParams[] = "{$paramKey}={$paramValue}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($serializedParams) > 0) {
|
|
||||||
return $uri . '?' . implode('&', $serializedParams);
|
|
||||||
}
|
|
||||||
return $uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSkinUrl($uri)
|
|
||||||
{
|
|
||||||
static $baseUrl = null;
|
|
||||||
if ($baseUrl === null) {
|
|
||||||
$user = Legacies_Empire_Model_User::getSingleton();
|
|
||||||
if ($user !== null && $user->getId() && ($baseUrl = $user->getSkinPath()) == '') {
|
|
||||||
$baseUrl = DEFAULT_SKINPATH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $baseUrl . $uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setPartial($name, $content)
|
|
||||||
{
|
|
||||||
if (!is_string($content) && !$content instanceof self) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_partials[$name] = $content;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPartial($name)
|
|
||||||
{
|
|
||||||
return $this->_partials[$name];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function unsetPartial($name)
|
|
||||||
{
|
|
||||||
if (isset($this->_partials[$name])) {
|
|
||||||
unset($this->_partials[$name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasPartial($name)
|
|
||||||
{
|
|
||||||
return isset($this->_partials[$name]) && (is_string($this->_partials[$name]) || $this->_partials[$name] instanceof self);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __set($name, $content)
|
|
||||||
{
|
|
||||||
return $this->setPartial($name, $content);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __get($name)
|
|
||||||
{
|
|
||||||
$name = str_replace(' ', '', ucwords(str_replace('-', ' ', $name)));
|
|
||||||
$name[0] = strtolower($name[0]);
|
|
||||||
return $this->getPartial($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __unset($name)
|
|
||||||
{
|
|
||||||
return $this->unsetPartial($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __isset($name)
|
|
||||||
{
|
|
||||||
return $this->hasPartial($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setLayout($layout)
|
|
||||||
{
|
|
||||||
$this->_layout = $layout;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLayout()
|
|
||||||
{
|
|
||||||
return $this->_layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function prepareLayout()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function beforeToHtml()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Database
|
|
||||||
extends PDO
|
|
||||||
{
|
|
||||||
protected static $_singleton = null;
|
|
||||||
|
|
||||||
protected static $_prefix = null;
|
|
||||||
|
|
||||||
public static function getSingleton()
|
|
||||||
{
|
|
||||||
if (self::$_singleton === null) {
|
|
||||||
$config = include ROOT_PATH . 'config.php';
|
|
||||||
$hostname = $config['global']['database']['options']['hostname'];
|
|
||||||
$username = $config['global']['database']['options']['username'];
|
|
||||||
$password = $config['global']['database']['options']['password'];
|
|
||||||
$database = $config['global']['database']['options']['database'];
|
|
||||||
|
|
||||||
self::$_singleton = new self("mysql:dbname={$database};host={$hostname}", $username, $password, array(
|
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
|
||||||
));
|
|
||||||
}
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTable($name)
|
|
||||||
{
|
|
||||||
if (self::$_prefix === null) {
|
|
||||||
$config = include ROOT_PATH . 'config.php';
|
|
||||||
self::$_prefix = $config['global']['database']['table_prefix'];
|
|
||||||
}
|
|
||||||
return self::$_prefix . $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Block_Overview
|
|
||||||
extends Legacies_Core_Block_Template
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Block_Overview_DestroyPlanet
|
|
||||||
extends Legacies_Core_Block_Html_Form
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Block_Overview_RenamePlanet
|
|
||||||
extends Legacies_Core_Block_Html_Form
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Block_PlanetList
|
|
||||||
extends Legacies_Core_Block_Template
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Block_Topnav
|
|
||||||
extends Legacies_Core_Block_Template
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Legacies_Empire_Model_User
|
|
||||||
*/
|
|
||||||
public function getCurrentUser()
|
|
||||||
{
|
|
||||||
return Legacies_Empire_Model_User::getSingleton();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Legacies_Empire_Model_Planet
|
|
||||||
*/
|
|
||||||
public function getCurrentPlanet()
|
|
||||||
{
|
|
||||||
return $this->getCurrentUser()->getCurrentPlanet();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Legacies_Core_Collection
|
|
||||||
*/
|
|
||||||
public function getPlanetCollection()
|
|
||||||
{
|
|
||||||
return $this->getCurrentUser()->getPlanetCollection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Empire_Exception extends Legacies_Exception {}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Builder_Break
|
|
||||||
extends Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
*
|
|
||||||
* @uses Legacies_Object
|
|
||||||
* @uses Legacies_Empire
|
|
||||||
*/
|
|
||||||
class Legacies_Empire_Model_Fleet
|
|
||||||
extends Legacies_Core_Entity
|
|
||||||
{
|
|
||||||
protected static $_instances = array();
|
|
||||||
|
|
||||||
protected $_eventPrefix = 'fleet';
|
|
||||||
protected $_eventObject = 'fleet';
|
|
||||||
|
|
||||||
public static function factory($id)
|
|
||||||
{
|
|
||||||
if ($id === null) {
|
|
||||||
return new self();
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = intval($id);
|
|
||||||
if (!isset(self::$_instances[$id])) {
|
|
||||||
$instance = new self();
|
|
||||||
$params = func_get_args();
|
|
||||||
call_user_func_array(array($instance, 'load'), $params);
|
|
||||||
self::$_instances[$id] = $instance;
|
|
||||||
}
|
|
||||||
return self::$_instances[$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _init()
|
|
||||||
{
|
|
||||||
$this->setIdFieldName('fleet_id');
|
|
||||||
$this->setTableName('fleets');
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function planetListener($eventData)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isOwnedBy(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
if ($this->getData('fleet_owner') == $user->getId()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isMission($missionType)
|
|
||||||
{
|
|
||||||
if ($this->getData('fleet_mission') == $missionType) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRowClass()
|
|
||||||
{
|
|
||||||
if ($this->isMission(Legacies_Empire::ID_MISSION_ATTACK) || $this->isMission(Legacies_Empire::ID_MISSION_GROUP_ATTACK)) {
|
|
||||||
return 'attack';
|
|
||||||
} else if ($this->isMission(Legacies_Empire::ID_MISSION_TRANSPORT)) {
|
|
||||||
return 'transport';
|
|
||||||
} else if ($this->isMission(Legacies_Empire::ID_MISSION_STATION) || $this->isMission(Legacies_Empire::ID_MISSION_STATION_ALLY)) {
|
|
||||||
return 'station';
|
|
||||||
} else if ($this->isMission(Legacies_Empire::ID_MISSION_SETTLE_COLONY)) {
|
|
||||||
return 'settle';
|
|
||||||
} else if ($this->isMission(Legacies_Empire::ID_MISSION_RECYCLE)) {
|
|
||||||
return 'recycle';
|
|
||||||
} else if ($this->isMission(Legacies_Empire::ID_MISSION_DESTROY)) {
|
|
||||||
return 'destroy';
|
|
||||||
} else if ($this->isMission(Legacies_Empire::ID_MISSION_MISSILES)) {
|
|
||||||
return 'missiles';
|
|
||||||
} else if ($this->isMission(Legacies_Empire::ID_MISSION_EXPEDITION)) {
|
|
||||||
return 'expedition';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
abstract class Legacies_Empire_Model_Game_Abstract
|
|
||||||
extends Legacies_Core_Model
|
|
||||||
implements Iterator, Countable
|
|
||||||
{
|
|
||||||
public function count()
|
|
||||||
{
|
|
||||||
return count($this->_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function current()
|
|
||||||
{
|
|
||||||
return current($this->_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function next()
|
|
||||||
{
|
|
||||||
return next($this->_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function key()
|
|
||||||
{
|
|
||||||
return key($this->_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function valid()
|
|
||||||
{
|
|
||||||
return $this->current() !== false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function rewind()
|
|
||||||
{
|
|
||||||
reset($this->_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
*
|
|
||||||
* @uses Legacies_Object
|
|
||||||
* @uses Legacies_Empire
|
|
||||||
*/
|
|
||||||
class Legacies_Empire_Model_Game_Requirements
|
|
||||||
extends Legacies_Empire_Model_Game_Abstract
|
|
||||||
implements Legacies_Core_Singleton
|
|
||||||
{
|
|
||||||
private static $_singleton = null;
|
|
||||||
|
|
||||||
public static function getSingleton()
|
|
||||||
{
|
|
||||||
if (self::$_singleton === null) {
|
|
||||||
self::$_singleton = new self();
|
|
||||||
}
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _init()
|
|
||||||
{
|
|
||||||
foreach (include ROOT_PATH . 'includes/data/requirements.php' as $elementId => $fieldName) {
|
|
||||||
$this->setData($elementId, $fieldName);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _load()
|
|
||||||
{
|
|
||||||
// NOP
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _save()
|
|
||||||
{
|
|
||||||
// NOP
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _delete()
|
|
||||||
{
|
|
||||||
// NOP
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,192 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Builder
|
|
||||||
extends Legacies_Empire_Model_BuilderAbstract
|
|
||||||
{
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
$this->_unserializeQueue($this->_currentPlanet->getData('b_building_id'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $buildingId
|
|
||||||
* @param int $level
|
|
||||||
* @param int $time
|
|
||||||
*/
|
|
||||||
public function _initItem()
|
|
||||||
{
|
|
||||||
$buildingId = func_get_arg(0);
|
|
||||||
$level = func_get_arg(1);
|
|
||||||
$time = func_get_arg(2);
|
|
||||||
|
|
||||||
return new Legacies_Empire_Model_Planet_Builder_Item(array(
|
|
||||||
'building_id' => $buildingId,
|
|
||||||
'level' => $level,
|
|
||||||
'created_at' => $time,
|
|
||||||
'updated_at' => $time
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a building is actually buildable on the current planet,
|
|
||||||
* depending on the technology and buildings requirements.
|
|
||||||
*
|
|
||||||
* @param int $buildingId
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function checkAvailability($buildingId)
|
|
||||||
{
|
|
||||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
|
||||||
|
|
||||||
if ($types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->checkAvailability($buildingId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getResourcesNeeded($buildingId, $level)
|
|
||||||
{
|
|
||||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
|
||||||
$resources = Legacies_Empire_Model_Game_Resources::getSingleton();
|
|
||||||
|
|
||||||
if (!isset($prices[$buildingId])) {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
$resourcesNeeded = array();
|
|
||||||
foreach ($resources as $resourceId => $resourceConfig) {
|
|
||||||
if (!isset($prices[$buildingId][$resourceId])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (Math::isPositive($prices[$buildingId][$resourceId])) {
|
|
||||||
$firstLevelCost = $prices[$buildingId][$resourceId];
|
|
||||||
$partialLevelCost = Math::mul($firstLevelCost, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
|
|
||||||
$resourcesNeeded[$resourceId] = Math::sub($partialLevelCost, $firstLevelCost);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $resourcesNeeded;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBuildingTime($buildingId, $level)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the contruction queue.
|
|
||||||
*
|
|
||||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
|
||||||
*/
|
|
||||||
public function updateQueue($time)
|
|
||||||
{
|
|
||||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
|
||||||
|
|
||||||
$elapsedTime = $time - $this->_currentPlanet->getData('b_building');
|
|
||||||
|
|
||||||
foreach ($this->getQueue() as $element) {
|
|
||||||
$buildingId = $element->getData('building_id');
|
|
||||||
$level = $element->getData('level');
|
|
||||||
$buildTime = $this->getBuildingTime($buildingId, $level); // FIXME: consider total time, not only the construction time
|
|
||||||
|
|
||||||
if ($elapsedTime >= $buildTime) {
|
|
||||||
$this->_currentPlanet->updateResources($time - $elapsedTime);
|
|
||||||
$this->_currentPlanet->setElement($buildingId, $level);
|
|
||||||
$this->_currentPlanet->updateResourceProduction($time - $elapsedTime);
|
|
||||||
$this->_currentPlanet->updateStorages($time - $elapsedTime);
|
|
||||||
$this->_currentPlanet->updateBuildingFields();
|
|
||||||
$this->dequeue($element);
|
|
||||||
|
|
||||||
Legacies::dispatchEvent('planet.building.level-update', array(
|
|
||||||
'time' => $time - $elapsedTime,
|
|
||||||
'planet' => $this->_currentPlanet,
|
|
||||||
'user' => $this->_currentUser,
|
|
||||||
'building_id' => $buildingId,
|
|
||||||
'level' => $level
|
|
||||||
));
|
|
||||||
|
|
||||||
$elapsedTime -= $buildTime;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$element->setData('updated_at', $time);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_currentPlanet->setData('b_building_id', $this->serialize());
|
|
||||||
$this->_currentPlanet->setData('b_building', $time);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Append items to build to the construction list
|
|
||||||
*
|
|
||||||
* @param int $buildingId
|
|
||||||
* @param int|string $level
|
|
||||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
|
||||||
*/
|
|
||||||
public function appendQueue($buildingId, $level, $time)
|
|
||||||
{
|
|
||||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
|
||||||
$resources = Legacies_Empire_Model_Game_Resources::getSingleton();
|
|
||||||
|
|
||||||
if (!Math::isPositive($level)) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->checkAvailability($buildingId)) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$resourcesNeeded = $this->getResourcesNeeded($buildingId, $level);
|
|
||||||
|
|
||||||
$amounts = array();
|
|
||||||
foreach ($resourcesNeeded as $resourceId => $resourceCost) {
|
|
||||||
$amount[$resourceId] = Math::sub($this->_currentPlanet[$resourceId], $resourceCost);
|
|
||||||
|
|
||||||
if (Math::isNegative($amount[$resourceId])) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->enqueue($buildingId, $level, $time);
|
|
||||||
|
|
||||||
foreach ($resourcesNeeded as $resourceId => $resourceCost) {
|
|
||||||
if (!isset($resources[$resourceId]) || !Math::isPositive($resourceCost)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$this->_currentPlanet->setData($resourceId, $resourceId[$resourceId]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_currentPlanet->setData('b_building_id', $this->serialize());
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Append items to build to the construction list
|
|
||||||
*
|
|
||||||
* @param int $buildingId
|
|
||||||
* @param int|string $level
|
|
||||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
|
||||||
*/
|
|
||||||
public function dequeueFirstItem($time)
|
|
||||||
{
|
|
||||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
|
||||||
$resources = Legacies_Empire_Model_Game_Resources::getSingleton();
|
|
||||||
|
|
||||||
if (!Math::isPositive($level)) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
|
|
||||||
$this->_currentPlanet->setData('b_building_id', $this->serialize());
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Builder_Item
|
|
||||||
extends Legacies_Empire_Model_Builder_Item
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Building_CristalMine
|
|
||||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
|
||||||
{
|
|
||||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 10 + 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser
|
|
||||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
|
||||||
{
|
|
||||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => -30 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Building_FusionReactor
|
|
||||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
|
||||||
{
|
|
||||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 50 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Building_MetalMine
|
|
||||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
|
||||||
{
|
|
||||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 20 + 30 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Building_Shipyard_Item
|
|
||||||
extends Legacies_Empire_Model_Builder_Item
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Building_SolarPlant
|
|
||||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
|
||||||
{
|
|
||||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Empire_Model_Planet_BuildingInterface
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Exception implements Legacies_Core_Exception {}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Empire_Model_Planet_ResourceProductionInterface
|
|
||||||
{
|
|
||||||
public function getProductionRatios($level, $produtionRatio, $planet, $user);
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Ship_LargeTransport
|
|
||||||
extends Legacies_Empire_Model_Planet_ShipAbstract
|
|
||||||
{
|
|
||||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4;
|
|
||||||
|
|
||||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
|
||||||
|
|
||||||
return $prices[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
return pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Ship_LightTransport
|
|
||||||
extends Legacies_Empire_Model_Planet_ShipAbstract
|
|
||||||
{
|
|
||||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4;
|
|
||||||
|
|
||||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
|
||||||
|
|
||||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
|
|
||||||
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
|
||||||
} else {
|
|
||||||
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
|
|
||||||
return pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE));
|
|
||||||
} else {
|
|
||||||
return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Ship_SolarSatellite
|
|
||||||
extends Legacies_Empire_Model_Planet_ShipAbstract
|
|
||||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface
|
|
||||||
{
|
|
||||||
public function getProductionRatios($quantity, $produtionRatio, $planet, $user)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getActualSpeed(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBaseConsumption(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_Planet_Ship_Supernova
|
|
||||||
extends Legacies_Empire_Model_Planet_ShipAbstract
|
|
||||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface
|
|
||||||
{
|
|
||||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE = 20;
|
|
||||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY = 15;
|
|
||||||
|
|
||||||
public function getProductionRatios($quantity, $produtionRatio, $planet, $user)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity) * -1250
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
|
||||||
|
|
||||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
|
|
||||||
$user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
|
|
||||||
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
|
||||||
} else {
|
|
||||||
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
|
|
||||||
$user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
|
|
||||||
return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
|
|
||||||
} else {
|
|
||||||
return pow(1.3, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE)) *
|
|
||||||
pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
abstract class Legacies_Empire_Model_Planet_ShipAbstract
|
|
||||||
implements Legacies_Empire_Model_Planet_ShipInterface
|
|
||||||
{
|
|
||||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
|
||||||
|
|
||||||
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
return pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getActualSpeed(Legacies_Empire_Model_User $user)
|
|
||||||
{
|
|
||||||
return $this->getBaseSpeed($user) * $this->getSpeedMultiplier($user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getActualConsumption(Legacies_Empire_Model_User $user, $speed)
|
|
||||||
{
|
|
||||||
return $this->getBaseConsumption($user) * ($speed / 100) * $this->getSpeedMultiplier($user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Empire_Model_Planet_ShipInterface
|
|
||||||
{
|
|
||||||
public function getBaseSpeed(Legacies_Empire_Model_User $user);
|
|
||||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user);
|
|
||||||
public function getActualSpeed(Legacies_Empire_Model_User $user);
|
|
||||||
|
|
||||||
public function getBaseConsumption(Legacies_Empire_Model_User $user);
|
|
||||||
public function getActualConsumption(Legacies_Empire_Model_User $user, $speed);
|
|
||||||
}
|
|
||||||
|
|
@ -1,487 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
*
|
|
||||||
* @uses Legacies_Object
|
|
||||||
* @uses Legacies_Empire
|
|
||||||
*/
|
|
||||||
class Legacies_Empire_Model_User
|
|
||||||
extends Legacies_Core_Entity
|
|
||||||
{
|
|
||||||
protected static $_instances = array();
|
|
||||||
|
|
||||||
protected static $_singleton = null;
|
|
||||||
|
|
||||||
protected $_eventPrefix = 'user';
|
|
||||||
protected $_eventObject = 'user';
|
|
||||||
|
|
||||||
public static $hashCallback = 'md5';
|
|
||||||
|
|
||||||
const SESSION_KEY = 'user';
|
|
||||||
const COOKIE_NAME = 'legacies';
|
|
||||||
const COOKIE_LIFETIME = 2592000;
|
|
||||||
|
|
||||||
const PLANET_SORT_DATE = 0;
|
|
||||||
const PLANET_SORT_POSITION = 1;
|
|
||||||
const PLANET_SORT_NAME = 2;
|
|
||||||
|
|
||||||
protected static $_cookieName = self::COOKIE_NAME;
|
|
||||||
|
|
||||||
public static function setCookieName($name)
|
|
||||||
{
|
|
||||||
self::$_cookieName = $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function factory($id)
|
|
||||||
{
|
|
||||||
if ($id === null) {
|
|
||||||
return new self();
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = intval($id);
|
|
||||||
if (!isset(self::$_instances[$id])) {
|
|
||||||
$instance = new self();
|
|
||||||
$params = func_get_args();
|
|
||||||
call_user_func_array(array($instance, 'load'), $params);
|
|
||||||
self::$_instances[$id] = $instance;
|
|
||||||
}
|
|
||||||
return self::$_instances[$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getSingleton()
|
|
||||||
{
|
|
||||||
if (self::$_singleton === null) {
|
|
||||||
$session = Legacies::getSession(self::SESSION_KEY);
|
|
||||||
if ($session->hasData('user_id')) {
|
|
||||||
$id = intval($session->getData('user_id'));
|
|
||||||
} else if (Legacies::$request !== null && ($cookie = Legacies::$request->getCookie(self::$_cookieName)) !== null) {
|
|
||||||
$cookieData = unserialize(stripslashes($cookie));
|
|
||||||
if (is_array($cookieData)) {
|
|
||||||
$collection = new Legacies_Core_Collection(array('user' => 'users'));
|
|
||||||
$cookieData = array(
|
|
||||||
'id' => (isset($cookieData['id']) ? intval($cookieData['id']) : 0),
|
|
||||||
'key' => (isset($cookieData['key']) ? $collection->quote($cookieData['key']) : null)
|
|
||||||
);
|
|
||||||
|
|
||||||
$collection
|
|
||||||
->column('id')
|
|
||||||
->where('user.id=:id')
|
|
||||||
->where(':key=CONCAT((@salt:=MID(:key, 0, 4)), SHA1(CONCAT(user.username, user.password, @salt)))')
|
|
||||||
->load($cookieData)
|
|
||||||
;
|
|
||||||
|
|
||||||
if ($collection->count() > 0) {
|
|
||||||
$session->setData(self::SESSION_KEY, $cookieData['id']);
|
|
||||||
} else {
|
|
||||||
$session->addError('Your session has expired, please login.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$session->addError('Your session has expired, please login.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
self::$_singleton = self::factory($id);
|
|
||||||
} catch (Legacies_Core_Model_Exception $e) {
|
|
||||||
$session->addError('Session error.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
self::$_singleton->_updateActivity();
|
|
||||||
}
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function hash($password, $salt = null)
|
|
||||||
{
|
|
||||||
if ($salt === null) {
|
|
||||||
return call_user_func(self::$hashCallback, ($password));
|
|
||||||
}
|
|
||||||
|
|
||||||
return call_user_func(self::$hashCallback, ($password . $salt));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _init()
|
|
||||||
{
|
|
||||||
$this->setIdFieldName('id');
|
|
||||||
$this->setTableName('users');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _updateActivity()
|
|
||||||
{
|
|
||||||
$this
|
|
||||||
->setData('current_page', $_SERVER['REQUEST_URI'])
|
|
||||||
->setData('user_lastip', $_SERVER['REMOTE_ADDR'])
|
|
||||||
->setData('user_agent', $_SERVER['HTTP_USER_AGENT'])
|
|
||||||
->setData('onlinetime', time())
|
|
||||||
->save()
|
|
||||||
;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function logout()
|
|
||||||
{
|
|
||||||
if (Legacies::$response !== null) {
|
|
||||||
Legacies::$response->unsetCookie(self::$_cookieName);
|
|
||||||
}
|
|
||||||
Legacies_Core_Model_Session::destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function login($username, $password, $remember = false)
|
|
||||||
{
|
|
||||||
$session = Legacies::getSession(self::SESSION_KEY);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$collection = new Legacies_Core_Collection(array('user' => 'users'));
|
|
||||||
|
|
||||||
$passwordHash = md5($password);
|
|
||||||
$collection
|
|
||||||
->column('user.id')
|
|
||||||
->column('user.username')
|
|
||||||
->column('user.password')
|
|
||||||
->column('user.banaday')
|
|
||||||
->column('CONCAT((@salt:=MID(MD5(RAND()), 0, 4)), SHA1(CONCAT(user.username, user.password, @salt))) AS login_rememberme')
|
|
||||||
->column('(CASE WHEN user.password="' . $passwordHash . '" THEN 1 ELSE 0 END) AS login_success')
|
|
||||||
->where('user.username=:username')
|
|
||||||
->load(array(
|
|
||||||
'username' => $username
|
|
||||||
))
|
|
||||||
;
|
|
||||||
} catch (Legacies_Core_Model_Exception $e) {
|
|
||||||
Legacies_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
|
||||||
$session->addError('No such user.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($collection->count() <= 0) {
|
|
||||||
$session->addError('No such user.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$login = $collection->current();
|
|
||||||
|
|
||||||
if (intval($login['login_success']) == 1) {
|
|
||||||
if ($login['banaday'] != 0) {
|
|
||||||
if($login['banaday'] <= time() && $login['banaday'] != '0') {
|
|
||||||
$user->setData('banaday', 0)
|
|
||||||
->setData('bana', 0)
|
|
||||||
->setData('urlaubs_modus', 0)
|
|
||||||
->save()
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
$session->addError('You were banned, please contact admin for more information.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["rememberme"]) && Legacies::$request !== null) {
|
|
||||||
Legacies::$response->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$_singleton = self::factory($login['id']);
|
|
||||||
self::$_singleton->_updateActivity();
|
|
||||||
|
|
||||||
$session->setData('user_id', intval($login['id']));
|
|
||||||
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
$session->addError('Your username or credential is invalid, please check your input.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function register($username, $email, $password)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$user = new self(array(
|
|
||||||
'username' => $username,
|
|
||||||
'password' => md5($password),
|
|
||||||
'email' => $email,
|
|
||||||
'email_2' => $email
|
|
||||||
));
|
|
||||||
|
|
||||||
$user->save();
|
|
||||||
|
|
||||||
Legacies::dispatchEvent('user.init', array(
|
|
||||||
'user' => $user
|
|
||||||
));
|
|
||||||
|
|
||||||
$user->save();
|
|
||||||
} catch (Legacies_Core_Model_Exception $e) {
|
|
||||||
$session->addError($e->getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
* @param int|Legacies_Empire_Model_Planet $planet
|
|
||||||
*/
|
|
||||||
public function updateCurrentPlanet($planet)
|
|
||||||
{
|
|
||||||
if (!$planetId instanceof Legacies_Empire_Model_Planet) {
|
|
||||||
$planetColelction = $this->_preparePlanetCollection()->where('id=:id');
|
|
||||||
|
|
||||||
$planetCollection->load(array(
|
|
||||||
'id' => $planet,
|
|
||||||
'user' => $this->getId()
|
|
||||||
));
|
|
||||||
|
|
||||||
if ($planetCollection->count() !== 1) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$planet = $planetCollection->current();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setData('current_planet', $planet->getId())->save();
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
* @param Legacies_Empire_Model_Planet $planet
|
|
||||||
*/
|
|
||||||
public function setCurrentPlanet(Legacies_Empire_Model_Planet $planet)
|
|
||||||
{
|
|
||||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setData('current_planet', $planet->getId());
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
* @return Legacies_Empire_Model_Planet
|
|
||||||
*/
|
|
||||||
public function getHomePlanet()
|
|
||||||
{
|
|
||||||
$planetId = $this->getData('id_planet');
|
|
||||||
if (!$planetId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$planet = Legacies_Empire_Model_Planet::factory($planetId);
|
|
||||||
|
|
||||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $planet;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enter description here ...
|
|
||||||
* @return Legacies_Empire_Model_Planet
|
|
||||||
*/
|
|
||||||
public function getCurrentPlanet()
|
|
||||||
{
|
|
||||||
$planetId = $this->getData('current_planet');
|
|
||||||
|
|
||||||
if (!$planetId) {
|
|
||||||
$planet = $this->getHomePlanet();
|
|
||||||
$this->setData('current_planet', $planet->getId())->save();
|
|
||||||
|
|
||||||
return $planet;
|
|
||||||
}
|
|
||||||
|
|
||||||
$planet = Legacies_Empire_Model_Planet::factory($planetId);
|
|
||||||
|
|
||||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $planet;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _preparePlanetCollection()
|
|
||||||
{
|
|
||||||
$planetCollection = new Legacies_Core_Collection(array('planet' => 'planets'), 'Legacies_Empire_Model_Planet');
|
|
||||||
$planetCollection->where('id_owner=:user');
|
|
||||||
|
|
||||||
$order = ($this->getData('planet_sort_order') == 1) ? 'DESC' : 'ASC';
|
|
||||||
|
|
||||||
switch ($this->getData('planet_sort')) {
|
|
||||||
case self::PLANET_SORT_POSITION:
|
|
||||||
$planetCollection
|
|
||||||
->order('planet.galaxy', $order)
|
|
||||||
->order('planet.system', $order)
|
|
||||||
->order('planet.planet', $order)
|
|
||||||
->order('planet.planet_type', $order)
|
|
||||||
;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case self::PLANET_SORT_NAME:
|
|
||||||
$planetCollection->order('planet.name', $order);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case self::PLANET_SORT_DATE:
|
|
||||||
default:
|
|
||||||
$planetCollection->order('planet.id', $order);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $planetCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPlanetCollection()
|
|
||||||
{
|
|
||||||
$planetCollection = $this->_preparePlanetCollection();
|
|
||||||
|
|
||||||
$planetCollection->load(array(
|
|
||||||
'user' => $this->getId()
|
|
||||||
));
|
|
||||||
|
|
||||||
return $planetCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFleets()
|
|
||||||
{
|
|
||||||
$collection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
|
||||||
$collection
|
|
||||||
->setEntityClassName('Legacies_Empire_Model_Fleet')
|
|
||||||
->where('fleet_owner <= :user_id')
|
|
||||||
->load(array('user_id' => $this->getId()))
|
|
||||||
;
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getVisibleFleets()
|
|
||||||
{
|
|
||||||
|
|
||||||
$user = Legacies_Empire_Model_User::getSingleton();
|
|
||||||
$firstCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
|
||||||
$firstCollection
|
|
||||||
// ->column('*')
|
|
||||||
->column('fleet.fleet_start_galaxy', 'galaxy')
|
|
||||||
->column('fleet.fleet_start_system', 'system')
|
|
||||||
->column('fleet.fleet_start_planet', 'planet')
|
|
||||||
->column('fleet.fleet_start_type', 'planet_type')
|
|
||||||
->where('fleet_end_time <= :now')
|
|
||||||
;
|
|
||||||
$backCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
|
||||||
$backCollection
|
|
||||||
// ->column('*')
|
|
||||||
->column('fleet.fleet_end_galaxy', 'galaxy')
|
|
||||||
->column('fleet.fleet_end_system', 'system')
|
|
||||||
->column('fleet.fleet_end_planet', 'planet')
|
|
||||||
->column('fleet.fleet_end_type', 'planet_type')
|
|
||||||
->where('fleet_end_time <= :now')
|
|
||||||
;
|
|
||||||
$collection = new Legacies_Core_Collection();
|
|
||||||
$collection
|
|
||||||
->setEntityClassName('Legacies_Empire_Model_Fleet')
|
|
||||||
->union($firstCollection)
|
|
||||||
->union($backCollection)
|
|
||||||
->load(array('now' => time()));
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getElement($elementId)
|
|
||||||
{
|
|
||||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
|
||||||
|
|
||||||
return $this->getData($fields[$elementId]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setElement($elementId, $level)
|
|
||||||
{
|
|
||||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
|
||||||
|
|
||||||
return $this->setData($fields[$elementId], $level);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasElement($elementId, $levelRequired = 0)
|
|
||||||
{
|
|
||||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
|
||||||
|
|
||||||
return $this->hasData($fields[$elementId]) && Math::comp($this->getElement($elementId), $levelRequired) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSkinPath($default = null)
|
|
||||||
{
|
|
||||||
if ($path = $this->getData('dpath')) {
|
|
||||||
return $path;
|
|
||||||
}
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSkinPath($path)
|
|
||||||
{
|
|
||||||
$this->setData('dpath', $path);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkPassword($password)
|
|
||||||
{
|
|
||||||
if (self::hash($password) == $this->getData('password')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFleetCollection($time = null)
|
|
||||||
{
|
|
||||||
$firstCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
|
||||||
$firstCollection
|
|
||||||
->column('*')
|
|
||||||
->where('fleet.fleet_owner = :user')
|
|
||||||
;
|
|
||||||
$backCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
|
||||||
$backCollection
|
|
||||||
->column('*')
|
|
||||||
->where('fleet.fleet_target_owner = :user')
|
|
||||||
;
|
|
||||||
|
|
||||||
$options = array(
|
|
||||||
'user' => $this->getId()
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($time !== null) {
|
|
||||||
$options['now'] = $time;
|
|
||||||
$firstCollection->where('fleet_start_time <= :now');
|
|
||||||
$backCollection->where('fleet_end_time <= :now');
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = new Legacies_Core_Collection();
|
|
||||||
$collection
|
|
||||||
->setEntityClassName('Legacies_Empire_Model_Fleet')
|
|
||||||
->union($firstCollection)
|
|
||||||
->union($backCollection)
|
|
||||||
->load($options)
|
|
||||||
;
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNewMessagesCount()
|
|
||||||
{
|
|
||||||
$messageCollection = new Legacies_Core_Collection('messages');
|
|
||||||
$messageCollection->where('message_owner=:user');
|
|
||||||
$messageCollection->where('message_read_at<=0');
|
|
||||||
|
|
||||||
$newMessages = null;
|
|
||||||
if (($count = $messageCollection->getSize(array('user' => $this->getId()))) > 0) {
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Empire_Model_User_Message
|
|
||||||
extends Legacies_Core_Entity_SubTable
|
|
||||||
{
|
|
||||||
protected function _init()
|
|
||||||
{
|
|
||||||
$this->_tableName = 'messages';
|
|
||||||
$this->_idFieldNames = array('message_id', 'message_owner');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
interface Legacies_Exception {}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Legacies_Officers_Model_Observer
|
|
||||||
{
|
|
||||||
public static function planetUpdateListener($eventData)
|
|
||||||
{
|
|
||||||
if (isset($eventData['planet'])) {
|
|
||||||
$planet = $eventData['planet'];
|
|
||||||
|
|
||||||
$user = $planet->getUser();
|
|
||||||
|
|
||||||
$level = floor(sqrt($user->getData('xpminier') / 500));
|
|
||||||
if ($user->getData('lvl_minier') < $level) {
|
|
||||||
$difference = $level - $user->getData('lvl_minier');
|
|
||||||
if ($difference == 1) {
|
|
||||||
Legacies::getSession(Legacies_Empire_Model_User::SESSION_KEY)
|
|
||||||
->addInfo('You gained 1 miner level.');
|
|
||||||
} else {
|
|
||||||
Legacies::getSession(Legacies_Empire_Model_User::SESSION_KEY)
|
|
||||||
->addInfo('You gained %1$d miner level.', (int) $difference);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$level = floor(sqrt($user->getData('xpraid')));
|
|
||||||
if ($user->getData('lvl_raid') < $level) {
|
|
||||||
$difference = $level - $user->getData('lvl_raid');
|
|
||||||
if ($difference == 1) {
|
|
||||||
Legacies::getSession(Legacies_Empire_Model_User::SESSION_KEY)
|
|
||||||
->addInfo('You gained 1 raider level.');
|
|
||||||
} else {
|
|
||||||
Legacies::getSession(Legacies_Empire_Model_User::SESSION_KEY)
|
|
||||||
->addInfo('You gained %1$d raider level.', (int) $difference);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Math_Bcmath
|
|
||||||
{
|
|
||||||
public function setPrecision($precision)
|
|
||||||
{
|
|
||||||
bcscale($precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function add($a, $b)
|
|
||||||
{
|
|
||||||
return bcadd($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mul($a, $b)
|
|
||||||
{
|
|
||||||
return bcmul($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sub($a, $b)
|
|
||||||
{
|
|
||||||
return bcsub($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function div($a, $b)
|
|
||||||
{
|
|
||||||
return bcdiv($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mod($a, $b)
|
|
||||||
{
|
|
||||||
return bcmod($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function pow($a, $b)
|
|
||||||
{
|
|
||||||
return bcpow($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function comp($a, $b)
|
|
||||||
{
|
|
||||||
return bccomp($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function ceil($x)
|
|
||||||
{
|
|
||||||
$integer = bcmul($x, 1, 0);
|
|
||||||
$decimals = bcsub($x, $integer);
|
|
||||||
|
|
||||||
if (bccomp($decimals, 0) > 0) {
|
|
||||||
return bcadd($integer, 1);
|
|
||||||
} else {
|
|
||||||
return $integer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function floor($x)
|
|
||||||
{
|
|
||||||
$integer = bcmul($x, 1, 0);
|
|
||||||
$decimals = bcsub($x, $integer);
|
|
||||||
|
|
||||||
if (bccomp($decimals, 0) < 0) {
|
|
||||||
return bcsub($integer, 1);
|
|
||||||
} else {
|
|
||||||
return $integer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function round($x, $range = 0)
|
|
||||||
{
|
|
||||||
$integer = bcmul($x, 1, 0);
|
|
||||||
$decimals = bcsub($x, $integer, $range);
|
|
||||||
|
|
||||||
if (bccomp($decimals, 0) > 0) {
|
|
||||||
return bcadd($integer, '0.' . str_pad('5', $range, STR_PAD_LEFT), $range);
|
|
||||||
} else {
|
|
||||||
return bcsub($integer, '0.' . str_pad('5', $range, STR_PAD_LEFT), $range);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render($a)
|
|
||||||
{
|
|
||||||
if (!$a) {
|
|
||||||
return '0';
|
|
||||||
}
|
|
||||||
$a = strval($a);
|
|
||||||
|
|
||||||
$pos = strrpos($a, '.');
|
|
||||||
if ($pos !== false) {
|
|
||||||
$a = substr($a, 0, $pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
$length = $pos + ((3 - ($pos % 3)) % 3);
|
|
||||||
$a = str_pad($a, $length, ' ', STR_PAD_LEFT);
|
|
||||||
$parts = str_split($a, 3);
|
|
||||||
switch ((int) (count($parts) / 3)) {
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
return implode('.', $parts);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
return implode('.', array_slice($parts, 0, 2)) . 'M';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
return implode('.', array_slice($parts, 0, 2)) . 'G';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
return implode('.', array_slice($parts, 0, 2)) . 'T';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
return implode('.', array_slice($parts, 0, 2)) . 'P';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
return implode('.', array_slice($parts, 0, 2)) . 'Y';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return implode('.', array_slice($parts, 0, sizeof($parts) - 18)) . 'Z';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Math_Native
|
|
||||||
{
|
|
||||||
public function setPrecision($precision)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function add($a, $b)
|
|
||||||
{
|
|
||||||
return $a + $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mul($a, $b)
|
|
||||||
{
|
|
||||||
return $a * $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sub($a, $b)
|
|
||||||
{
|
|
||||||
return $a - $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function div($a, $b)
|
|
||||||
{
|
|
||||||
return $a / $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mod($a, $b)
|
|
||||||
{
|
|
||||||
return $a % $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function pow($a, $b)
|
|
||||||
{
|
|
||||||
return pow($a, $b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function comp($a, $b)
|
|
||||||
{
|
|
||||||
return ($a > $b) ? 1 : (($a < $b) ? -1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function ceil($x)
|
|
||||||
{
|
|
||||||
return ceil($x);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function floor($x)
|
|
||||||
{
|
|
||||||
return floor($x);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function round($range = 0)
|
|
||||||
{
|
|
||||||
return round($x, $range);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render($a)
|
|
||||||
{
|
|
||||||
return number_format($a, 0, ',', '.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
<?php return array(
|
|
||||||
'overview' => array(
|
|
||||||
'update' => '1column',
|
|
||||||
'reference' => array(
|
|
||||||
'content' => array(
|
|
||||||
'children' => array(
|
|
||||||
'overview.forms' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
),
|
|
||||||
'overview' => array(
|
|
||||||
'type' => 'empire/overview',
|
|
||||||
'template' => 'empire/overview.phtml'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'overview.rename-planet' => array(
|
|
||||||
'update' => 'overview',
|
|
||||||
'reference' => array(
|
|
||||||
'overview.forms' => array(
|
|
||||||
'children' => array(
|
|
||||||
'rename-planet' => array(
|
|
||||||
'type' => 'empire/overview.rename-planet',
|
|
||||||
'template' => 'empire/overview/form/rename-planet.phtml'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'overview.destroy-planet' => array(
|
|
||||||
'update' => 'overview',
|
|
||||||
'reference' => array(
|
|
||||||
'overview.forms' => array(
|
|
||||||
'children' => array(
|
|
||||||
'destroy-planet' => array(
|
|
||||||
'type' => 'empire/overview.destroy-planet',
|
|
||||||
'template' => 'empire/overview/form/destroy-planet.phtml'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
||||||
<?php return array(
|
|
||||||
'1column' => array(
|
|
||||||
'update' => 'default'
|
|
||||||
),
|
|
||||||
|
|
||||||
'2columns-left' => array(
|
|
||||||
'update' => 'default',
|
|
||||||
'template' => 'page/2columns-left.phtml',
|
|
||||||
'reference' => array(
|
|
||||||
'root' => array(
|
|
||||||
'children' => array(
|
|
||||||
'left' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'2columns-right' => array(
|
|
||||||
'update' => 'default',
|
|
||||||
'template' => 'page/2columns-right.phtml',
|
|
||||||
'reference' => array(
|
|
||||||
'root' => array(
|
|
||||||
'children' => array(
|
|
||||||
'right' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'3columns' => array(
|
|
||||||
'update' => 'default',
|
|
||||||
'template' => 'page/3columns.phtml',
|
|
||||||
'reference' => array(
|
|
||||||
'root' => array(
|
|
||||||
'children' => array(
|
|
||||||
'left' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
),
|
|
||||||
'right' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'default' => array(
|
|
||||||
'type' => 'core/html.page',
|
|
||||||
'template' => 'page/1column.phtml',
|
|
||||||
'children' => array(
|
|
||||||
'head' => array(
|
|
||||||
'type' => 'core/html.head',
|
|
||||||
'template' => 'page/html/head.phtml',
|
|
||||||
'actions' => array(
|
|
||||||
array(
|
|
||||||
'method' => 'addCss',
|
|
||||||
'params' => array(
|
|
||||||
'stylesheet' => 'css/default.css'
|
|
||||||
)
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'method' => 'addCss',
|
|
||||||
'params' => array(
|
|
||||||
'stylesheet' => 'css/formate.css'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'header' => array(
|
|
||||||
'type' => 'core/template',
|
|
||||||
'template' => 'page/html/header.phtml',
|
|
||||||
'children' => array(
|
|
||||||
'menu' => array(
|
|
||||||
'type' => 'core/html.navigation',
|
|
||||||
'template' => 'page/html/navigation.phtml',
|
|
||||||
),
|
|
||||||
'planet-list' => array(
|
|
||||||
'type' => 'empire/planet-list',
|
|
||||||
'template' => 'empire/planet-list.phtml',
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'footer' => array(
|
|
||||||
'type' => 'core/template',
|
|
||||||
'template' => 'page/html/footer.phtml'
|
|
||||||
),
|
|
||||||
'content' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'ajax' => array(
|
|
||||||
'type' => 'core/html.page',
|
|
||||||
'template' => 'page/empty.phtml',
|
|
||||||
'children' => array(
|
|
||||||
'content' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'empty' => array(
|
|
||||||
'type' => 'core/html.page',
|
|
||||||
'template' => 'page/empty.phtml',
|
|
||||||
'children' => array(
|
|
||||||
'head' => array(
|
|
||||||
'type' => 'core/html.head',
|
|
||||||
'template' => 'page/html/head.phtml'
|
|
||||||
),
|
|
||||||
'content' => array(
|
|
||||||
'type' => 'core/concat'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<form name="rename-planet" id="overview:rename-planet" method="post" action="">
|
|
||||||
<fieldset>
|
|
||||||
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey()?>" />
|
|
||||||
<label for="overview:rename-planet:password"><?php echo $this->__('Password:')?></label>
|
|
||||||
<input id="overview:rename-planet:password" type="password" name="password" />
|
|
||||||
<label for="overview:rename-planet:name"><?php echo $this->__('New name:')?></label>
|
|
||||||
<input id="overview:rename-planet:name" type="text" name="name" />
|
|
||||||
<input type="submit" />
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<span>Hello world!!</span>
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<th>
|
|
||||||
<h1><?php echo $this->escape($this['planet']->getData('name'))?></h1>
|
|
||||||
<p><a href="<?php echo $this->getUrl('overview.php', array('cp' => $this['planet']->getId()))?>" title="<?php echo $this->escape($this['planet']->getData('name'))?>">
|
|
||||||
<img src="<?php echo $this->getUrl('planeten/small/s_' . $this['planet']->getData('image') . '.jpg')?>" height="50" width="50" />
|
|
||||||
</a></p>
|
|
||||||
<?php if ($this['queue']->count() > 0):?>
|
|
||||||
<p><?php echo $this->escape($this['queue_item']->getData('building_id'))?></p>
|
|
||||||
<?php else:?>
|
|
||||||
<p><?php echo $this->__('Idle.')?></p>
|
|
||||||
<?php endif?>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<?php echo $this->planetList->render() ?>
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?php foreach ($this->getResourceIds() as $resourceId):?>
|
|
||||||
<div class="resource-<?php echo $this->escape($resourceId) ?>">
|
|
||||||
<?php echo $this->getResourceBlock($resourceId)->render()?>
|
|
||||||
</div>
|
|
||||||
<?php endforeach?>
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
<div id="header_top">
|
|
||||||
<table class="header">
|
|
||||||
<tbody>
|
|
||||||
<tr class="header">
|
|
||||||
<td class="header">
|
|
||||||
<center>
|
|
||||||
<table class="header">
|
|
||||||
<tbody>
|
|
||||||
<tr class="header">
|
|
||||||
<td class="header"><img src="<?php echo $this->getSkinUrl($this->getCurrentPlanet()->getSmallImage())?>" height="50" width="50"></td>
|
|
||||||
<td class="header" valign="middle">
|
|
||||||
<select size="1" onchange="document.location.href=this.options[this.selectedIndex].value;">
|
|
||||||
<?php foreach ($this->getPlanetCollection() as $planet):?>
|
|
||||||
<option value="<?php echo $this->getUrl('', array('cp' => $planet->getId()))?>"<?php if ($planet->getId() == $this->getCurrentPlanet()->getId()):?> selected="selected"<?php endif?>><?php echo $this->escape($planet->getName())?> [<?php echo $this->escape($planet->getCoords())?>]</option>
|
|
||||||
<?php endforeach?>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</center>
|
|
||||||
</td>
|
|
||||||
<td class="header">
|
|
||||||
<table style="width: 508px;" class="header" id="resources" padding-right="30" border="0" cellpadding="0" cellspacing="0">
|
|
||||||
<tbody>
|
|
||||||
<tr class="header">
|
|
||||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/metall.gif')?>" border="0" height="22" width="42"></td>
|
|
||||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/kristall.gif')?>" border="0" height="22" width="42"></td>
|
|
||||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/deuterium.gif')?>" border="0" height="22" width="42"></td>
|
|
||||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/energie.gif')?>" border="0" height="22" width="42"></td>
|
|
||||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/message.gif')?>" border="0" height="22" width="42"></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="header">
|
|
||||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Metal')?></font></b></i></td>
|
|
||||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Cristal')?></font></b></i></td>
|
|
||||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Deuterium')?></font></b></i></td>
|
|
||||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Energy')?></font></b></i></td>
|
|
||||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Messages')?></font></b></i></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="header">
|
|
||||||
<td class="header" align="center" width="140">
|
|
||||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_METAL)):?>
|
|
||||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?></span>
|
|
||||||
<?php else:?>
|
|
||||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?>
|
|
||||||
<?php endif?>
|
|
||||||
</td>
|
|
||||||
<td class="header" align="center" width="140">
|
|
||||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_CRISTAL)):?>
|
|
||||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?></span>
|
|
||||||
<?php else:?>
|
|
||||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?>
|
|
||||||
<?php endif?>
|
|
||||||
</td>
|
|
||||||
<td class="header" align="center" width="140">
|
|
||||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_DEUTERIUM)):?>
|
|
||||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?></span>
|
|
||||||
<?php else:?>
|
|
||||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?>
|
|
||||||
<?php endif?>
|
|
||||||
</td>
|
|
||||||
<td class="header" align="center" width="140">
|
|
||||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_ENERGY)):?>
|
|
||||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / <?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?></span>
|
|
||||||
<?php else:?>
|
|
||||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / <?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?>
|
|
||||||
<?php endif?>
|
|
||||||
</td>
|
|
||||||
<td class="header" align="center" width="140"><a href="<?php echo $this->getUrl('messages.php')?>"><?php echo $this->getCurrentUser()->getNewMessagesCount()?></a></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,265 +0,0 @@
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Main application script execution class
|
|
||||||
*
|
|
||||||
* @param string responder
|
|
||||||
* @param int messageOffset
|
|
||||||
*/
|
|
||||||
|
|
||||||
function Legacies_Client(responder, messageOffset) {
|
|
||||||
if (!document.querySelectorAll) {
|
|
||||||
alert("Your browser is not compatible with CSS selectors API.\n\nCould not continue.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.responder = responder;
|
|
||||||
this.messages = [];
|
|
||||||
this.messageId = messageOffset || 1;
|
|
||||||
this.callbacks = {};
|
|
||||||
this.recurrentMessages = [];
|
|
||||||
|
|
||||||
this.send = (function() {
|
|
||||||
if (this.messages.length == 0) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
var request = new XMLHttpRequest();
|
|
||||||
request.open('POST', this.responder, false);
|
|
||||||
request.send(JSON.stringify(this.messages));
|
|
||||||
this.messages = [];
|
|
||||||
for (var i in this.recurrentMessages) {
|
|
||||||
this.enqueue(this.recurrentMessages[i].action, this.recurrentMessages[i].params, this.recurrentMessages[i].callback);
|
|
||||||
}
|
|
||||||
if(request.status == 404) {
|
|
||||||
alert('Request failed, responder not found.');
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
var response = JSON.parse(request.responseText);
|
|
||||||
} catch (e) {
|
|
||||||
alert('Invalid response.');
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
if(request.status == 200) {
|
|
||||||
for (var i in response) {
|
|
||||||
this._callback(response[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this.main = (function(interval) {
|
|
||||||
setInterval(this.send, interval || 30000);
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this.enqueue = (function(action, params){
|
|
||||||
this.messages.push({'uid':this.messageId++,'action':action,'params':params});
|
|
||||||
return this;
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this.enqueueRecurrent = (function(action, params, callback) {
|
|
||||||
this.recurrentMessages.push({'callback':callback,'action':action,'params':params});
|
|
||||||
this.enqueue(action, params, callback);
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this._callback = (function(message){
|
|
||||||
if (message.error === undefined || message.payload === undefined) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
if (message.error === true) {
|
|
||||||
if (typeof(message.payload.messages) == 'string') {
|
|
||||||
alert(message.payload.messages);
|
|
||||||
} else {
|
|
||||||
var info = '';
|
|
||||||
for (var i in message.payload.messages) {
|
|
||||||
info = info + "\n[" + i + "]:\n" + message.payload.messages[i].join("\n") + "\n";
|
|
||||||
}
|
|
||||||
alert("Errors were returned:\n" + info);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
if (message.callback && this.CallbackType[message.callback]) {
|
|
||||||
(this.CallbackType[message.callback]).bind(this)(message.payload);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this.login = (function(username, password, rememberme) {
|
|
||||||
var params = {
|
|
||||||
'username': username,
|
|
||||||
'password': password,
|
|
||||||
'rememberme': rememberme || false
|
|
||||||
};
|
|
||||||
this.enqueue('user.account.login', params).send();
|
|
||||||
return this;
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this.logout = (function() {
|
|
||||||
this.enqueue('user.account.logout', {}).send();
|
|
||||||
return this;
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this.form = (function(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
var form = event.target;
|
|
||||||
var params = {};
|
|
||||||
for (var i = 0; i < form.length; i++) {
|
|
||||||
if (!form[i].name || !form[i].type) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (form[i].type == 'checkbox') {
|
|
||||||
if (form[i].checked) {
|
|
||||||
params[form[i].name] = true;
|
|
||||||
} else {
|
|
||||||
params[form[i].name] = false;
|
|
||||||
}
|
|
||||||
} else if (form[i].type == 'radio') {
|
|
||||||
params[form[i].name] = form[i].value;
|
|
||||||
} else if (form[i].value !== undefined) {
|
|
||||||
params[form[i].name] = form[i].value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var action = form.action.slice(form.action.indexOf('#') + 1);
|
|
||||||
this.enqueue(action, params, this.CallbackType.updater).send();
|
|
||||||
}).bind(this);
|
|
||||||
|
|
||||||
this.CallbackType = {
|
|
||||||
redirector: function(payload) {
|
|
||||||
if (payload.redirect) {
|
|
||||||
document.location.href = payload.redirect;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
updater: function(payload) {
|
|
||||||
if (payload.html && payload.selector) {
|
|
||||||
var parent = $$(payload.selector);
|
|
||||||
var handler = document.createElement("div");
|
|
||||||
handler.innerHTML = payload.html;
|
|
||||||
|
|
||||||
var fragment = document.createDocumentFragment();
|
|
||||||
for (var i = 0; i < handler.childNodes.length; i++) {
|
|
||||||
fragment.appendChild(handler.childNodes[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < parent.length; i++) {
|
|
||||||
parent[i].appendChild(fragment.cloneNode(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
script: function(payload) {
|
|
||||||
if (payload.script) {
|
|
||||||
eval(payload.script);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(payload) {
|
|
||||||
if (payload.messages) {
|
|
||||||
alert(payload.messages.join(', '));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
show: function(payload) {
|
|
||||||
if (payload.selector) {
|
|
||||||
var elementList = $$(payload.selector);
|
|
||||||
for (var i = 0; i < elementList.length; i++) {
|
|
||||||
elementList[i].style.display = 'block';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hide: function(payload) {
|
|
||||||
if (payload.selector) {
|
|
||||||
var elementList = $$(payload.selector);
|
|
||||||
for (var i = 0; i < elementList.length; i++) {
|
|
||||||
elementList[i].style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(payload) {
|
|
||||||
if (payload.callback) {
|
|
||||||
payload.callback.apply(this, payload.params);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enqueueRecurrent: function(payload) {
|
|
||||||
if (payload.action && payload.params && payload.callback) {
|
|
||||||
this.enqueueRecurrent(payload.action, payload.params, payload.callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function Legacies_Element(object) {
|
|
||||||
object.listen = (function(event, callback) {
|
|
||||||
this.addEventListener(event, callback, false);
|
|
||||||
return this;
|
|
||||||
}).bind(object);
|
|
||||||
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Legacies_List(object) {
|
|
||||||
object.listen = (function(event, callback) {
|
|
||||||
for (var i in this) {
|
|
||||||
Legacies_Element(Legacies_Element[i]);
|
|
||||||
this[i].listen(event, callback);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}).bind(object);
|
|
||||||
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
function $A(object) {
|
|
||||||
return Array.prototype.slice.call(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
function $(element) {
|
|
||||||
if (typeof(element) == 'string') {
|
|
||||||
element = document.getElementById(element);
|
|
||||||
}
|
|
||||||
Legacies_Element(element);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
function $$(selector, context) {
|
|
||||||
context = context || document;
|
|
||||||
var nodeList = context.querySelectorAll(selector);
|
|
||||||
Legacies_List(nodeList);
|
|
||||||
return nodeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
function $E(element, methods) {
|
|
||||||
for (var i in methods) {
|
|
||||||
if (methods[i] === undefined) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
element[i] = function(){
|
|
||||||
var args = $A(arguments);
|
|
||||||
args.unshift(element);
|
|
||||||
methods[i].apply(element, args);
|
|
||||||
}
|
|
||||||
element[i].bind(element);
|
|
||||||
}
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,155 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
include './bootstrap.php';
|
|
||||||
|
|
||||||
if (!extension_loaded('xdebug')) {
|
|
||||||
header('Content-Type: text/plain');
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = new Legacies_Empire_Model_User(array(
|
|
||||||
'rpg_stockeur' => 0,
|
|
||||||
|
|
||||||
"spy_tech" => 12,
|
|
||||||
"computer_tech" => 8,
|
|
||||||
"military_tech" => 10,
|
|
||||||
"defence_tech" => 10,
|
|
||||||
"shield_tech" => 10,
|
|
||||||
"energy_tech" => 8,
|
|
||||||
"hyperspace_tech" => 8,
|
|
||||||
"combustion_tech" => 6,
|
|
||||||
"impulse_motor_tech" => 6,
|
|
||||||
"hyperspace_motor_tech" => 6,
|
|
||||||
"laser_tech" => 6,
|
|
||||||
"ionic_tech" => 6,
|
|
||||||
"buster_tech" => 6,
|
|
||||||
"intergalactic_tech" => 0,
|
|
||||||
"expedition_tech" => 0,
|
|
||||||
"graviton_tech" => 0,
|
|
||||||
));
|
|
||||||
|
|
||||||
$data = array(
|
|
||||||
'last_update' => 0,
|
|
||||||
'planet_type' => 1,
|
|
||||||
|
|
||||||
'b_building_id' => '',
|
|
||||||
'b_hangar_id' => serialize(array(/*array(
|
|
||||||
'ship_id' => Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT,
|
|
||||||
'qty' => 10,
|
|
||||||
'created_at' => 0,
|
|
||||||
'updated_at' => 0
|
|
||||||
), array(
|
|
||||||
'ship_id' => Legacies_Empire::ID_SHIP_LARGE_TRANSPORT,
|
|
||||||
'qty' => 20,
|
|
||||||
'created_at' => 600,
|
|
||||||
'updated_at' => 600
|
|
||||||
), array(
|
|
||||||
'ship_id' => Legacies_Empire::ID_SHIP_LARGE_TRANSPORT,
|
|
||||||
'qty' => 30,
|
|
||||||
'created_at' => 650,
|
|
||||||
'updated_at' => 650
|
|
||||||
), array(
|
|
||||||
'ship_id' => Legacies_Empire::ID_SHIP_LARGE_TRANSPORT,
|
|
||||||
'qty' => 40,
|
|
||||||
'created_at' => 700,
|
|
||||||
'updated_at' => 700
|
|
||||||
)*/)),
|
|
||||||
|
|
||||||
'metal' => 100000,
|
|
||||||
'metal_perhour' => 20,
|
|
||||||
'cristal' => 100000,
|
|
||||||
'cristal_perhour' => 10,
|
|
||||||
'deuterium' => 0,
|
|
||||||
'deuterium_perhour' => 0,
|
|
||||||
'energy_max' => 0,
|
|
||||||
'energy_used' => 0,
|
|
||||||
|
|
||||||
'metal_mine_porcent' => 10,
|
|
||||||
'cristal_mine_porcent' => 10,
|
|
||||||
'solar_plant_porcent' => 10,
|
|
||||||
'fusion_plant_porcent' => 10,
|
|
||||||
'solar_satelit_porcent' => 10,
|
|
||||||
'deuterium_sintetizer_porcent' => 10,
|
|
||||||
|
|
||||||
'metal_mine' => 20,
|
|
||||||
'cristal_mine' => 19,
|
|
||||||
'deuterium_sintetizer' => 0,
|
|
||||||
'solar_plant' => 20,
|
|
||||||
'fusion_plant' => 0,
|
|
||||||
'robot_factory' => 0,
|
|
||||||
'nano_factory' => 0,
|
|
||||||
'hangar' => 12,
|
|
||||||
'metal_store' => 10,
|
|
||||||
'cristal_store' => 10,
|
|
||||||
'deuterium_store' => 10,
|
|
||||||
|
|
||||||
'rpg_stockeur' => 0
|
|
||||||
);
|
|
||||||
$planet = new Legacies_Empire_Model_Planet($data);
|
|
||||||
|
|
||||||
$planet->setUser($user);
|
|
||||||
var_dump(array('$planet->setUser($user)', array_diff($planet->getAllDatas(), $data)));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
$planet->updateStorages(0);
|
|
||||||
var_dump(array('$planet->updateStorages(0)', array_diff($planet->getAllDatas(), $data)));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
$planet->updateResourceProduction(0);
|
|
||||||
var_dump(array('$planet->updateResourceProduction(0)', array_diff($planet->getAllDatas(), $data)));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
$planet->getShipyard()->appendQueue(Legacies_Empire::ID_SHIP_LIGHT_FIGHTER, 10, 0);
|
|
||||||
var_dump(array('$planet->getShipyard()->appendQueue(Legacies_Empire::ID_SHIP_LIGHT_FIGHTER, 10, 0)', array_diff($planet->getAllDatas(), $data)));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 0);
|
|
||||||
var_dump(array('$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 0)', array_diff($planet->getAllDatas(), $data)));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
var_dump(array_diff($planet->getAllDatas(), $data));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
Legacies::dispatchEvent('planet.update', array(
|
|
||||||
'planet' => $planet,
|
|
||||||
'time' => 5400
|
|
||||||
));
|
|
||||||
|
|
||||||
var_dump(array_diff($planet->getAllDatas(), $data));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
Legacies::dispatchEvent('planet.update', array(
|
|
||||||
'planet' => $planet,
|
|
||||||
'time' => (3600 * 20)
|
|
||||||
));
|
|
||||||
|
|
||||||
$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 3600);
|
|
||||||
|
|
||||||
var_dump(array_diff($planet->getAllDatas(), $data));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
Legacies::dispatchEvent('planet.update', array(
|
|
||||||
'planet' => $planet,
|
|
||||||
'time' => (3600 * 30)
|
|
||||||
));
|
|
||||||
|
|
||||||
var_dump(array_diff($planet->getAllDatas(), $data));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
Legacies::dispatchEvent('planet.update', array(
|
|
||||||
'planet' => $planet,
|
|
||||||
'time' => (3600 * 5000)
|
|
||||||
));
|
|
||||||
|
|
||||||
var_dump(array_diff($planet->getAllDatas(), $data));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
||||||
$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 0);
|
|
||||||
$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_SOLAR_PLANT, false, 0);
|
|
||||||
|
|
||||||
Legacies::dispatchEvent('planet.update', array(
|
|
||||||
'planet' => $planet,
|
|
||||||
'time' => (3600 * 10000)
|
|
||||||
));
|
|
||||||
|
|
||||||
var_dump(array_diff($planet->getAllDatas(), $data));
|
|
||||||
$data = $planet->getAllDatas();
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
//define('BCNUMBERS', true);
|
|
||||||
|
|
||||||
if (!defined('DEBUG') && in_array(strtolower(getenv('DEBUG')), array('1', 'on', 'true'))) {
|
|
||||||
define('DEBUG', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!defined('DEBUG')) {
|
|
||||||
@ini_set('display_errors', false);
|
|
||||||
} else {
|
|
||||||
@ini_set('display_errors', true);
|
|
||||||
@error_reporting(E_ALL | E_STRICT);
|
|
||||||
}
|
|
||||||
|
|
||||||
defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR);
|
|
||||||
defined('APPLICATION_PATH') || define('APPLICATION_PATH', ROOT_PATH . 'includes' . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR);
|
|
||||||
|
|
||||||
defined('PHPEXT') || define('PHPEXT', require ROOT_PATH . 'extension.inc');
|
|
||||||
|
|
||||||
defined('VERSION') || define('VERSION', '2009.5');
|
|
||||||
|
|
||||||
set_include_path(implode(PATH_SEPARATOR, array(
|
|
||||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'core',
|
|
||||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'community',
|
|
||||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'local',
|
|
||||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'libraries',
|
|
||||||
get_include_path()
|
|
||||||
)));
|
|
||||||
|
|
||||||
function __autoload($class) {
|
|
||||||
include_once str_replace('_', '/', $class) . '.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 === filesize(ROOT_PATH . 'config.php')) {
|
|
||||||
header('Location: install/');
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (include ROOT_PATH . 'includes/data/events.php' as $event => $listenerList) {
|
|
||||||
foreach ($listenerList as $listener) {
|
|
||||||
Legacies::registerListener($event, $listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include ROOT_PATH . 'includes/constants.php';
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<?php return array(
|
|
||||||
'login.failure' => array(),
|
|
||||||
'login.success' => array(),
|
|
||||||
'logout.success' => array(),
|
|
||||||
'register.before' => array(),
|
|
||||||
'register.failure' => array(),
|
|
||||||
'register.success' => array(
|
|
||||||
array('Legacies_Empire_Model_Planet', 'registrationListener')
|
|
||||||
),
|
|
||||||
'planet.update' => array(
|
|
||||||
array('Legacies_Empire_Model_Planet', 'planetUpdateListener'),
|
|
||||||
array('Legacies_Empire_Model_Planet_Building_Shipyard', 'planetUpdateListener')
|
|
||||||
),
|
|
||||||
'user.init' => array(),
|
|
||||||
'planet.init' => array(),
|
|
||||||
'planet.shipyard.check-availability' => array(),
|
|
||||||
'planet.shipyard.update-queue.before' => array(),
|
|
||||||
'planet.shipyard.update-queue.after' => array(),
|
|
||||||
'planet.shipyard.append-queue.before' => array(),
|
|
||||||
'planet.shipyard.append-queue.after' => array()
|
|
||||||
);
|
|
||||||
|
|
@ -1,113 +0,0 @@
|
||||||
<?php return array(
|
|
||||||
//
|
|
||||||
// Buildings production
|
|
||||||
// {{{
|
|
||||||
Legacies_Empire::ID_BUILDING_METAL_MINE => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 40,
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 10,
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
|
||||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
|
||||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 'return (30 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);',
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(10 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
|
||||||
),
|
|
||||||
Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_MetalMine'
|
|
||||||
),
|
|
||||||
|
|
||||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 30,
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 15,
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
|
||||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.6,
|
|
||||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 'return (20 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);',
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(10 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
|
||||||
),
|
|
||||||
Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_CristalMine'
|
|
||||||
),
|
|
||||||
|
|
||||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 150,
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 50,
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
|
||||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
|
||||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return ((10 * $BuildLevel * pow((1.1), $BuildLevel)) * (-0.002 * $BuildTemp + 1.28)) * (0.1 * $BuildLevelFactor);',
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(30 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
|
||||||
),
|
|
||||||
Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser'
|
|
||||||
),
|
|
||||||
|
|
||||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 50,
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 20,
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
|
||||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
|
||||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 'return (20 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
|
||||||
),
|
|
||||||
Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_SolarPlant'
|
|
||||||
),
|
|
||||||
|
|
||||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 500,
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 200,
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100,
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
|
||||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.8,
|
|
||||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return -(10 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);',
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 'return (50 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
|
||||||
),
|
|
||||||
Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_FusionReactor'
|
|
||||||
),
|
|
||||||
// }}}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Ships production
|
|
||||||
// {{{
|
|
||||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 0,
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 500,
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
|
||||||
Legacies_Empire::RESOURCE_MULTIPLIER => 0.5,
|
|
||||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 'return (($BuildTemp / 4) + 20) * $BuildLevel * (0.1 * $BuildLevelFactor);'
|
|
||||||
),
|
|
||||||
Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Ship_SolarSatellite'
|
|
||||||
),
|
|
||||||
Legacies_Empire::ID_SHIP_SUPERNOVA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 0,
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 500,
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
|
||||||
Legacies_Empire::RESOURCE_MULTIPLIER => 0.5,
|
|
||||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
|
||||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
|
||||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(12500 * ($BuildTemp / 4) + 20) * $BuildLevel * (0.1 * $BuildLevelFactor);'
|
|
||||||
),
|
|
||||||
Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Ship_Supernova'
|
|
||||||
)
|
|
||||||
// }}}
|
|
||||||
);
|
|
||||||
|
|
@ -1,551 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$QryTableAks = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableAks .= "`id` bigint(20) unsigned NOT NULL auto_increment, ";
|
|
||||||
$QryTableAks .= "`name` varchar(50) collate latin1_general_ci default NULL, ";
|
|
||||||
$QryTableAks .= "`teilnehmer` text collate latin1_general_ci, ";
|
|
||||||
$QryTableAks .= "`flotten` text collate latin1_general_ci, ";
|
|
||||||
$QryTableAks .= "`ankunft` int(32) default NULL, ";
|
|
||||||
$QryTableAks .= "`galaxy` int(2) default NULL, ";
|
|
||||||
$QryTableAks .= "`system` int(4) default NULL, ";
|
|
||||||
$QryTableAks .= "`planet` int(2) default NULL, ";
|
|
||||||
$QryTableAks .= "`eingeladen` int(11) default NULL, ";
|
|
||||||
$QryTableAks .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableAks .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table annonce
|
|
||||||
$QryTableAnnonce = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableAnnonce .= "`id` int(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableAnnonce .= "`user` text collate latin1_general_ci NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`galaxie` int(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`systeme` int(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`metala` bigint(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`cristala` bigint(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`deuta` bigint(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`metals` bigint(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`cristals` bigint(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "`deuts` bigint(11) NOT NULL, ";
|
|
||||||
$QryTableAnnonce .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableAnnonce .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table alliance
|
|
||||||
$QryTableAlliance = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableAlliance .= "`id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableAlliance .= "`ally_name` varchar(32) character set latin1 default '', ";
|
|
||||||
$QryTableAlliance .= "`ally_tag` varchar(8) character set latin1 default '', ";
|
|
||||||
$QryTableAlliance .= "`ally_owner` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableAlliance .= "`ally_register_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableAlliance .= "`ally_description` text character set latin1, ";
|
|
||||||
$QryTableAlliance .= "`ally_web` varchar(255) character set latin1 default '', ";
|
|
||||||
$QryTableAlliance .= "`ally_text` text character set latin1, ";
|
|
||||||
$QryTableAlliance .= "`ally_image` varchar(255) character set latin1 default '', ";
|
|
||||||
$QryTableAlliance .= "`ally_request` text character set latin1, ";
|
|
||||||
$QryTableAlliance .= "`ally_request_waiting` text character set latin1, ";
|
|
||||||
$QryTableAlliance .= "`ally_request_notallow` tinyint(4) NOT NULL default '0', ";
|
|
||||||
$QryTableAlliance .= "`ally_owner_range` varchar(32) character set latin1 default '', ";
|
|
||||||
$QryTableAlliance .= "`ally_ranks` text character set latin1, ";
|
|
||||||
$QryTableAlliance .= "`ally_members` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableAlliance .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableAlliance .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table banned
|
|
||||||
$QryTableBanned = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableBanned .= "`id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableBanned .= "`who` varchar(11) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableBanned .= "`theme` text character set latin1 NOT NULL, ";
|
|
||||||
$QryTableBanned .= "`who2` varchar(11) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableBanned .= "`time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableBanned .= "`longer` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableBanned .= "`author` varchar(11) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableBanned .= "`email` varchar(20) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableBanned .= "KEY `ID` (`id`) ";
|
|
||||||
$QryTableBanned .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table buddy
|
|
||||||
$QryTableBuddy = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableBuddy .= "`id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableBuddy .= "`sender` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableBuddy .= "`owner` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableBuddy .= "`active` tinyint(3) NOT NULL default '0', ";
|
|
||||||
$QryTableBuddy .= "`text` text character set latin1, ";
|
|
||||||
$QryTableBuddy .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableBuddy .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table chat
|
|
||||||
$QryTableChat = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableChat .= "`messageid` int(5) unsigned NOT NULL auto_increment, ";
|
|
||||||
$QryTableChat .= "`user` varchar(255) NOT NULL default '', ";
|
|
||||||
$QryTableChat .= "`message` text NOT NULL, ";
|
|
||||||
$QryTableChat .= "`timestamp` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableChat .= "PRIMARY KEY (`messageid`) ";
|
|
||||||
$QryTableChat .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table config
|
|
||||||
$QryTableConfig = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableConfig .= "`config_name` varchar(64) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableConfig .= "`config_value` text character set latin1 NOT NULL ";
|
|
||||||
$QryTableConfig .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Valeurs de base de la config
|
|
||||||
$QryInsertConfig = "INSERT INTO `{{table}}` ";
|
|
||||||
$QryInsertConfig .= "(`config_name` , `config_value`) VALUES ";
|
|
||||||
$QryInsertConfig .= "('users_amount' , '0'), ";
|
|
||||||
$QryInsertConfig .= "('game_speed' , '2500'), ";
|
|
||||||
$QryInsertConfig .= "('fleet_speed' , '2500'), ";
|
|
||||||
$QryInsertConfig .= "('resource_multiplier' , '1'), ";
|
|
||||||
$QryInsertConfig .= "('Fleet_Cdr' , '30'), ";
|
|
||||||
$QryInsertConfig .= "('Defs_Cdr' , '30'), ";
|
|
||||||
$QryInsertConfig .= "('initial_fields' , '163'), ";
|
|
||||||
$QryInsertConfig .= "('COOKIE_NAME' , 'XNova Legacies'), ";
|
|
||||||
$QryInsertConfig .= "('game_name' , 'XNova Legacies'), ";
|
|
||||||
$QryInsertConfig .= "('game_disable' , '1'), ";
|
|
||||||
$QryInsertConfig .= "('close_reason' , 'Le jeu est clos pour le moment!'), ";
|
|
||||||
$QryInsertConfig .= "('metal_basic_income' , '20'), ";
|
|
||||||
$QryInsertConfig .= "('crystal_basic_income' , '10'), ";
|
|
||||||
$QryInsertConfig .= "('deuterium_basic_income', '0'), ";
|
|
||||||
$QryInsertConfig .= "('energy_basic_income' , '0'), ";
|
|
||||||
$QryInsertConfig .= "('BuildLabWhileRun' , '0'), ";
|
|
||||||
$QryInsertConfig .= "('LastSettedGalaxyPos' , '1'), ";
|
|
||||||
$QryInsertConfig .= "('LastSettedSystemPos' , '8'), ";
|
|
||||||
$QryInsertConfig .= "('LastSettedPlanetPos' , '3'), ";
|
|
||||||
$QryInsertConfig .= "('urlaubs_modus_erz' , '1'), ";
|
|
||||||
$QryInsertConfig .= "('noobprotection' , '1'), ";
|
|
||||||
$QryInsertConfig .= "('noobprotectiontime' , '5000'), ";
|
|
||||||
$QryInsertConfig .= "('noobprotectionmulti' , '5'), ";
|
|
||||||
$QryInsertConfig .= "('forum_url' , 'http://board.xnova-ng.org/' ), ";
|
|
||||||
$QryInsertConfig .= "('OverviewNewsFrame' , '1' ), ";
|
|
||||||
$QryInsertConfig .= "('OverviewNewsText' , 'Bienvenue sur le nouveau serveur XNova Legacies' ), ";
|
|
||||||
$QryInsertConfig .= "('OverviewExternChat' , '0' ), ";
|
|
||||||
$QryInsertConfig .= "('OverviewExternChatCmd' , '' ), ";
|
|
||||||
$QryInsertConfig .= "('OverviewBanner' , '0' ), ";
|
|
||||||
$QryInsertConfig .= "('OverviewClickBanner' , '' ), ";
|
|
||||||
$QryInsertConfig .= "('ExtCopyFrame' , '0' ), ";
|
|
||||||
$QryInsertConfig .= "('ExtCopyOwner' , '' ), ";
|
|
||||||
$QryInsertConfig .= "('ExtCopyFunct' , '' ), ";
|
|
||||||
$QryInsertConfig .= "('ForumBannerFrame' , '0' ), ";
|
|
||||||
$QryInsertConfig .= "('stat_settings' , '1000' ), ";
|
|
||||||
$QryInsertConfig .= "('link_enable' , '0' ), ";
|
|
||||||
$QryInsertConfig .= "('link_name' , '' ), ";
|
|
||||||
$QryInsertConfig .= "('link_url' , '' ), ";
|
|
||||||
$QryInsertConfig .= "('enable_announces' , '1' ), ";
|
|
||||||
$QryInsertConfig .= "('enable_marchand' , '1'), ";
|
|
||||||
$QryInsertConfig .= "('enable_notes' , '1'), ";
|
|
||||||
$QryInsertConfig .= "('bot_name' , 'XNoviana Reali'), ";
|
|
||||||
$QryInsertConfig .= "('bot_adress' , 'xnova@xnova-ng.org' ), ";
|
|
||||||
$QryInsertConfig .= "('banner_source_post' , '../images/bann.png' ), ";
|
|
||||||
$QryInsertConfig .= "('ban_duration' , '30' ), ";
|
|
||||||
$QryInsertConfig .= "('enable_bot' , '0' ), ";
|
|
||||||
$QryInsertConfig .= "('enable_bbcode' , '1' ), ";
|
|
||||||
$QryInsertConfig .= "('debug' , '0') ";
|
|
||||||
$QryInsertConfig .= ";";
|
|
||||||
|
|
||||||
|
|
||||||
// Table declared (multicomptes)
|
|
||||||
$QryTabledeclared = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTabledeclared .= "`declarator`TEXT NOT NULL, ";
|
|
||||||
$QryTabledeclared .= "`declared_1`TEXT NOT NULL, ";
|
|
||||||
$QryTabledeclared .= "`declared_2`TEXT NOT NULL, ";
|
|
||||||
$QryTabledeclared .= "`declared_3`TEXT NOT NULL, ";
|
|
||||||
$QryTabledeclared .= "`reason`TEXT NOT NULL, ";
|
|
||||||
$QryTabledeclared .= "`declarator_name`TEXT NOT NULL ";
|
|
||||||
|
|
||||||
$QryTabledeclared .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table errors
|
|
||||||
$QryTableErrors = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableErrors .= "`error_id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableErrors .= "`error_sender` varchar(32) character set latin1 NOT NULL default '0', ";
|
|
||||||
$QryTableErrors .= "`error_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableErrors .= "`error_type` varchar(32) character set latin1 NOT NULL default 'unknown', ";
|
|
||||||
$QryTableErrors .= "`error_text` text character set latin1, ";
|
|
||||||
$QryTableErrors .= "PRIMARY KEY (`error_id`) ";
|
|
||||||
$QryTableErrors .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table fleets
|
|
||||||
$QryTableFleets = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableFleets .= "`fleet_id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableFleets .= "`fleet_owner` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_mission` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_amount` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_array` text character set latin1, ";
|
|
||||||
$QryTableFleets .= "`fleet_start_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_start_galaxy` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_start_system` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_start_planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_start_type` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_end_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_end_stay` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_end_galaxy` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_end_system` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_end_planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_end_type` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_taget_owner` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_resource_metal` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_resource_crystal` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_resource_deuterium` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_target_owner` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_group` int (11) NOT NULL DEFAULT '0', ";
|
|
||||||
$QryTableFleets .= "`fleet_mess` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableFleets .= "`start_time` int(11) default NULL, ";
|
|
||||||
$QryTableFleets .= "PRIMARY KEY (`fleet_id`) ";
|
|
||||||
$QryTableFleets .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table galaxy
|
|
||||||
$QryTableGalaxy = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableGalaxy .= "`galaxy` int(2) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "`system` int(3) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "`planet` int(2) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "`id_planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "`metal` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "`crystal` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "`id_luna` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "`luna` int(2) NOT NULL default '0', ";
|
|
||||||
$QryTableGalaxy .= "KEY `galaxy` (`galaxy`), ";
|
|
||||||
$QryTableGalaxy .= "KEY `system` (`system`), ";
|
|
||||||
$QryTableGalaxy .= "KEY `planet` (`planet`) ";
|
|
||||||
$QryTableGalaxy .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table iraks
|
|
||||||
$QryTableIraks = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableIraks .= "`id` bigint(20) unsigned NOT NULL auto_increment, ";
|
|
||||||
$QryTableIraks .= "`zeit` int(32) default NULL, ";
|
|
||||||
$QryTableIraks .= "`galaxy` int(2) default NULL, ";
|
|
||||||
$QryTableIraks .= "`system` int(4) default NULL, ";
|
|
||||||
$QryTableIraks .= "`planet` int(2) default NULL, ";
|
|
||||||
$QryTableIraks .= "`galaxy_angreifer` int(2) default NULL, ";
|
|
||||||
$QryTableIraks .= "`system_angreifer` int(4) default NULL, ";
|
|
||||||
$QryTableIraks .= "`planet_angreifer` int(2) default NULL, ";
|
|
||||||
$QryTableIraks .= "`owner` int(32) default NULL, ";
|
|
||||||
$QryTableIraks .= "`zielid` int(32) default NULL, ";
|
|
||||||
$QryTableIraks .= "`anzahl` int(32) default NULL, ";
|
|
||||||
$QryTableIraks .= "`primaer` int(32) default NULL, ";
|
|
||||||
$QryTableIraks .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableIraks .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table lunas
|
|
||||||
$QryTableLunas = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableLunas .= "`id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableLunas .= "`id_luna` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableLunas .= "`name` varchar(11) character set latin1 NOT NULL default 'Lune', ";
|
|
||||||
$QryTableLunas .= "`image` varchar(11) character set latin1 NOT NULL default 'mond', ";
|
|
||||||
$QryTableLunas .= "`destruyed` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableLunas .= "`id_owner` int(11) default NULL, ";
|
|
||||||
$QryTableLunas .= "`galaxy` int(11) default NULL, ";
|
|
||||||
$QryTableLunas .= "`system` int(11) default NULL, ";
|
|
||||||
$QryTableLunas .= "`lunapos` int(11) default NULL, ";
|
|
||||||
$QryTableLunas .= "`temp_min` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableLunas .= "`temp_max` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableLunas .= "`diameter` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableLunas .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableLunas .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table messages
|
|
||||||
$QryTableMessages = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableMessages .= "`message_id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableMessages .= "`message_owner` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableMessages .= "`message_sender` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableMessages .= "`message_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableMessages .= "`message_type` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableMessages .= "`message_from` varchar(48) character set latin1 default NULL, ";
|
|
||||||
$QryTableMessages .= "`message_subject` varchar(48) character set latin1 default NULL, ";
|
|
||||||
$QryTableMessages .= "`message_text` text character set latin1, ";
|
|
||||||
$QryTableMessages .= "PRIMARY KEY (`message_id`) ";
|
|
||||||
$QryTableMessages .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table notes
|
|
||||||
$QryTableNotes = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableNotes .= "`id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableNotes .= "`owner` int(11) default NULL, ";
|
|
||||||
$QryTableNotes .= "`time` int(11) default NULL, ";
|
|
||||||
$QryTableNotes .= "`priority` tinyint(1) default NULL, ";
|
|
||||||
$QryTableNotes .= "`title` varchar(32) character set latin1 default NULL, ";
|
|
||||||
$QryTableNotes .= "`text` text character set latin1, ";
|
|
||||||
$QryTableNotes .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableNotes .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table planets
|
|
||||||
$QryTablePlanets = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTablePlanets .= "`id` bigint(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTablePlanets .= "`name` varchar(255) character set latin1 default NULL, ";
|
|
||||||
$QryTablePlanets .= "`id_owner` int(11) default NULL, ";
|
|
||||||
$QryTablePlanets .= "`id_level` int(11) default NULL, ";
|
|
||||||
$QryTablePlanets .= "`galaxy` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`system` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`last_update` int(11) default NULL, ";
|
|
||||||
$QryTablePlanets .= "`planet_type` int(11) NOT NULL default '1', ";
|
|
||||||
$QryTablePlanets .= "`destruyed` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`b_building` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`b_building_id` text character set latin1 NOT NULL, ";
|
|
||||||
$QryTablePlanets .= "`b_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`b_tech_id` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`b_hangar` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`b_hangar_id` text character set latin1 NOT NULL, ";
|
|
||||||
$QryTablePlanets .= "`b_hangar_plus` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`image` varchar(32) character set latin1 NOT NULL default 'normaltempplanet01', ";
|
|
||||||
$QryTablePlanets .= "`diameter` int(11) NOT NULL default '12800', ";
|
|
||||||
$QryTablePlanets .= "`points` bigint(20) default '0', ";
|
|
||||||
$QryTablePlanets .= "`ranks` bigint(20) default '0', ";
|
|
||||||
$QryTablePlanets .= "`field_current` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`field_max` int(11) NOT NULL default '163', ";
|
|
||||||
$QryTablePlanets .= "`temp_min` int(3) NOT NULL default '-17', ";
|
|
||||||
$QryTablePlanets .= "`temp_max` int(3) NOT NULL default '23', ";
|
|
||||||
$QryTablePlanets .= "`metal` double(132,8) NOT NULL default '0.00000000', ";
|
|
||||||
$QryTablePlanets .= "`metal_perhour` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`metal_max` bigint(20) default '100000', ";
|
|
||||||
$QryTablePlanets .= "`crystal` double(132,8) NOT NULL default '0.00000000', ";
|
|
||||||
$QryTablePlanets .= "`crystal_perhour` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`crystal_max` bigint(20) default '100000', ";
|
|
||||||
$QryTablePlanets .= "`deuterium` double(132,8) NOT NULL default '0.00000000', ";
|
|
||||||
$QryTablePlanets .= "`deuterium_perhour` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`deuterium_max` bigint(20) default '100000', ";
|
|
||||||
$QryTablePlanets .= "`energy_used` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`energy_max` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`metal_mine` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`crystal_mine` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`deuterium_sintetizer` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`solar_plant` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`fusion_plant` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`robot_factory` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`nano_factory` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`hangar` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`metal_store` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`crystal_store` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`deuterium_store` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`laboratory` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`terraformer` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`ally_deposit` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`silo` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`small_ship_cargo` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`big_ship_cargo` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`light_hunter` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`heavy_hunter` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`crusher` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`battle_ship` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`colonizer` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`recycler` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`spy_sonde` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`bomber_ship` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`solar_satelit` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`destructor` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`dearth_star` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`battleship` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`supernova` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`misil_launcher` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`small_laser` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`big_laser` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`gauss_canyon` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`ionic_canyon` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`buster_canyon` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`small_protection_shield` enum('0', '1') NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`big_protection_shield` enum('0', '1') NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`interceptor_misil` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`interplanetary_misil` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`metal_mine_porcent` int(11) NOT NULL default '10', ";
|
|
||||||
$QryTablePlanets .= "`crystal_mine_porcent` int(11) NOT NULL default '10', ";
|
|
||||||
$QryTablePlanets .= "`deuterium_sintetizer_porcent` int(11) NOT NULL default '10', ";
|
|
||||||
$QryTablePlanets .= "`solar_plant_porcent` int(11) NOT NULL default '10', ";
|
|
||||||
$QryTablePlanets .= "`fusion_plant_porcent` int(11) NOT NULL default '10', ";
|
|
||||||
$QryTablePlanets .= "`solar_satelit_porcent` int(11) NOT NULL default '10', ";
|
|
||||||
$QryTablePlanets .= "`mondbasis` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`phalanx` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`sprungtor` bigint(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "`last_jump_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTablePlanets .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTablePlanets .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table rw
|
|
||||||
$QryTableRw = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableRw .= "`id_owner1` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableRw .= "`id_owner2` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableRw .= "`rid` varchar(72) character set latin1 NOT NULL, ";
|
|
||||||
$QryTableRw .= "`raport` text character set latin1 NOT NULL, ";
|
|
||||||
$QryTableRw .= "`a_zestrzelona` tinyint(3) unsigned NOT NULL default '0', ";
|
|
||||||
$QryTableRw .= "`time` int(10) unsigned NOT NULL default '0', ";
|
|
||||||
$QryTableRw .= "UNIQUE KEY `rid` (`rid`), ";
|
|
||||||
$QryTableRw .= "KEY `id_owner1` (`id_owner1`,`rid`), ";
|
|
||||||
$QryTableRw .= "KEY `id_owner2` (`id_owner2`,`rid`), ";
|
|
||||||
$QryTableRw .= "KEY `time` (`time`), ";
|
|
||||||
$QryTableRw .= "FULLTEXT KEY `raport` (`raport`) ";
|
|
||||||
$QryTableRw .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table statpoints
|
|
||||||
$QryTableStatPoints = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableStatPoints .= "`id_owner` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`id_ally` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`stat_type` int(2) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`stat_code` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`tech_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`tech_old_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`tech_points` bigint(20) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`tech_count` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`build_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`build_old_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`build_points` bigint(20) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`build_count` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`defs_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`defs_old_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`defs_points` bigint(20) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`defs_count` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`fleet_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`fleet_old_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`fleet_points` bigint(20) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`fleet_count` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`total_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`total_old_rank` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`total_points` bigint(20) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`total_count` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "`stat_date` int(11) NOT NULL, ";
|
|
||||||
$QryTableStatPoints .= "KEY `TECH` (`tech_points`), ";
|
|
||||||
$QryTableStatPoints .= "KEY `BUILDS` (`build_points`), ";
|
|
||||||
$QryTableStatPoints .= "KEY `DEFS` (`defs_points`), ";
|
|
||||||
$QryTableStatPoints .= "KEY `FLEET` (`fleet_points`), ";
|
|
||||||
$QryTableStatPoints .= "KEY `TOTAL` (`total_points`) ";
|
|
||||||
$QryTableStatPoints .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Table users
|
|
||||||
$QryTableUsers = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableUsers .= "`id` bigint(11) unsigned NOT NULL auto_increment PRIMARY KEY, ";
|
|
||||||
$QryTableUsers .= "`username` varchar(64) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`password` varchar(64) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`email` varchar(64) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`email_2` varchar(64) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`lang` varchar(8) character set latin1 NOT NULL default 'fr', ";
|
|
||||||
$QryTableUsers .= "`authlevel` tinyint(4) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`sex` char(1) character set latin1 default NULL, ";
|
|
||||||
$QryTableUsers .= "`avatar` varchar(255) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`sign` text character set latin1, ";
|
|
||||||
$QryTableUsers .= "`id_planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`galaxy` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`system` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`current_planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`user_lastip` varchar(16) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`ip_at_reg` varchar(16) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`user_agent` text character set latin1 NOT NULL, ";
|
|
||||||
$QryTableUsers .= "`current_page` text character set latin1 NOT NULL, ";
|
|
||||||
$QryTableUsers .= "`register_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`onlinetime` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`dpath` varchar(255) character set latin1 NOT NULL default '', ";
|
|
||||||
$QryTableUsers .= "`design` tinyint(4) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`noipcheck` tinyint(4) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`planet_sort` tinyint(1) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`planet_sort_order` tinyint(1) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`spio_anz` tinyint(4) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`settings_tooltiptime` tinyint(4) NOT NULL default '5', ";
|
|
||||||
$QryTableUsers .= "`settings_fleetactions` tinyint(4) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`settings_allylogo` tinyint(4) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`settings_esp` tinyint(4) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`settings_wri` tinyint(4) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`settings_bud` tinyint(4) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`settings_mis` tinyint(4) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`settings_rep` tinyint(4) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`urlaubs_modus` tinyint(4) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`urlaubs_until` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`db_deaktjava` tinyint(4) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`new_message` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`fleet_shortcut` text character set latin1, ";
|
|
||||||
$QryTableUsers .= "`b_tech_planet` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`spy_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`computer_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`military_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`defence_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`shield_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`energy_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`hyperspace_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`combustion_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`impulse_motor_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`hyperspace_motor_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`laser_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`ionic_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`buster_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`intergalactic_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`expedition_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`graviton_tech` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`ally_id` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`ally_name` varchar(32) character set latin1 default '', ";
|
|
||||||
$QryTableUsers .= "`ally_request` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`ally_request_text` text character set latin1, ";
|
|
||||||
$QryTableUsers .= "`ally_register_time` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`ally_rank_id` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`current_luna` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`kolorminus` varchar(11) character set latin1 NOT NULL default 'red', ";
|
|
||||||
$QryTableUsers .= "`kolorplus` varchar(11) character set latin1 NOT NULL default '#00FF00', ";
|
|
||||||
$QryTableUsers .= "`kolorpoziom` varchar(11) character set latin1 NOT NULL default 'yellow', ";
|
|
||||||
$QryTableUsers .= "`rpg_geologue` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_amiral` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_ingenieur` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_technocrate` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_espion` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_constructeur` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_scientifique` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_commandant` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_points` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_stockeur` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_defenseur` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_destructeur` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_general` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_bunker` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_raideur` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`rpg_empereur` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`lvl_minier` int(11) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`lvl_raid` int(11) NOT NULL default '1', ";
|
|
||||||
$QryTableUsers .= "`xpraid` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`xpminier` int(11) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`raids` bigint(20) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`p_infligees` bigint(20) NOT NULL default '0', ";
|
|
||||||
$QryTableUsers .= "`mnl_alliance` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_joueur` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_attaque` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_spy` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_exploit` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_transport` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_expedition` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_general` INT( 11 ) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`mnl_buildlist` INT (11) NOT NULL , ";
|
|
||||||
$QryTableUsers .= "`bana` int(11) default NULL , ";
|
|
||||||
$QryTableUsers .= "`multi_validated` int(11) default NULL , ";
|
|
||||||
$QryTableUsers .= "`banaday` int(11) default NULL , ";
|
|
||||||
$QryTableUsers .= "`raids1` int(11) default NULL , ";
|
|
||||||
$QryTableUsers .= "`raidswin` int(11) default NULL , ";
|
|
||||||
$QryTableUsers .= "`raidsloose` int(11) default NULL ";
|
|
||||||
$QryTableUsers .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
// Multi
|
|
||||||
$QryTableMulti = "CREATE TABLE `{{table}}` ( ";
|
|
||||||
$QryTableMulti .= "`id` int(11) NOT NULL auto_increment, ";
|
|
||||||
$QryTableMulti .= "`player` bigint(11) unsigned NOT NULL, ";
|
|
||||||
$QryTableMulti .= "`sharer` bigint(11) unsigned NOT NULL, ";
|
|
||||||
$QryTableMulti .= "`reason` text character set latin1 NOT NULL, ";
|
|
||||||
$QryTableMulti .= "PRIMARY KEY (`id`) ";
|
|
||||||
$QryTableMulti .= ") ENGINE=MyISAM;";
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,157 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of XNova:Legacies
|
|
||||||
*
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
* @see http://www.xnova-ng.org/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* --> NOTICE <--
|
|
||||||
* This file is part of the core development branch, changing its contents will
|
|
||||||
* make you unable to use the automatic updates manager. Please refer to the
|
|
||||||
* documentation for further information about customizing XNova.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debug class
|
|
||||||
*
|
|
||||||
* @todo Clean up source code
|
|
||||||
*/
|
|
||||||
class Nova_Core_Debug
|
|
||||||
{
|
|
||||||
const CRITICAL = 0x80;
|
|
||||||
const ERROR = 0x40;
|
|
||||||
const WARNING = 0x20;
|
|
||||||
const INFO = 0x10;
|
|
||||||
const MESSAGE = 0x08;
|
|
||||||
const AUDIT_FAILED = 0x04;
|
|
||||||
const AUDIT_SUCCESS = 0x02;
|
|
||||||
const DEBUG = 0x01;
|
|
||||||
|
|
||||||
const DEFAULT_LOGFILE = 'var/log/system.log';
|
|
||||||
|
|
||||||
protected $_logLevelNames = array(
|
|
||||||
self::CRITICAL => 'CRITICAL',
|
|
||||||
self::ERROR => 'ERROR',
|
|
||||||
self::WARNING => 'WARNING',
|
|
||||||
self::INFO => 'INFO',
|
|
||||||
self::MESSAGE => 'MESSAGE',
|
|
||||||
self::AUDIT_FAILED => 'AUDIT_FAILED',
|
|
||||||
self::AUDIT_SUCCESS => 'AUDIT_SUCCESS',
|
|
||||||
self::DEBUG => 'DEBUG'
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clean logging method
|
|
||||||
*
|
|
||||||
* @param string $message
|
|
||||||
* @param string $resource
|
|
||||||
* @param int $level
|
|
||||||
* @return unknown_type
|
|
||||||
*/
|
|
||||||
public function log($message, $resource = self::DEFAULT_LOGFILE, $level = self::DEBUG)
|
|
||||||
{
|
|
||||||
if(!($fp = fopen($resource, 'a'))) {
|
|
||||||
trigger_error('Unable to open logs.', E_USER_ERROR);
|
|
||||||
trigger_error($message, E_USER_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
fprintf($fp, '[%s] | %s - %s', $this->_logLevelNames[$level], date('r'), $message);
|
|
||||||
fclose($fp);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @todo Clean up source code
|
|
||||||
*/
|
|
||||||
class Debug
|
|
||||||
extends Nova_Core_Debug
|
|
||||||
{
|
|
||||||
protected $_logMessages = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @param string $message
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function add($message)
|
|
||||||
{
|
|
||||||
$this->log($message);
|
|
||||||
$this->_logMessages[] = $message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function echo_log()
|
|
||||||
{
|
|
||||||
$messages = implode(PHP_EOL, $this->_logMessages);
|
|
||||||
echo <<<EOF
|
|
||||||
<dl class="k">
|
|
||||||
<dt>
|
|
||||||
<a href="admin/settings.php">Debug Log</a>:
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
<pre><code>{$messages}</code></pre>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
EOF;
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @todo Clean up source code
|
|
||||||
* @param $message
|
|
||||||
* @param $title
|
|
||||||
* @return unknown_type
|
|
||||||
*/
|
|
||||||
function error($message, $title)
|
|
||||||
{
|
|
||||||
global $link, $gameConfig;
|
|
||||||
|
|
||||||
if($gameConfig['debug']==1){
|
|
||||||
echo "<h2>$title</h2><br><font color=red>$message</font><br><hr>";
|
|
||||||
echo "<table>".$this->log."</table>";
|
|
||||||
}
|
|
||||||
|
|
||||||
global $user;
|
|
||||||
$config = include ROOT_PATH . 'config.' . PHPEXT;
|
|
||||||
if(!$link) die('La base de donnee n est pas disponible pour le moment, desole pour la gene occasionnee...');
|
|
||||||
$query = "INSERT INTO {{table}} SET
|
|
||||||
`error_sender` = '{$user['id']}' ,
|
|
||||||
`error_time` = '".time()."' ,
|
|
||||||
`error_type` = '{$title}' ,
|
|
||||||
`error_text` = '".mysql_escape_string($message)."';";
|
|
||||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"].'errors',$query))
|
|
||||||
or die('error fatal');
|
|
||||||
$query = "explain select * from {{table}}";
|
|
||||||
$q = mysql_fetch_array(mysql_query(str_replace("{{table}}", $dbsettings["prefix"].
|
|
||||||
'errors', $query))) or die('error fatal: ');
|
|
||||||
|
|
||||||
if (!function_exists('message')) {
|
|
||||||
echo "Erreur, merci de contacter l'admin. Erreur n<>: <b>".$q['rows']."</b>";
|
|
||||||
} else {
|
|
||||||
message("Erreur, merci de contacter l'admin. Erreur n<>: <b>".$q['rows']."</b>", "Erreur");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue