Compare commits

..
Author SHA1 Message Date
Grégory PLANCHAT
2fde7653cf Merge pull request #6 from Noxgame/patch-1
Update src/application/code/core/Legacies/Empire/install/mysql5/install-...
2013-02-26 00:40:39 -08:00
Grégory PLANCHAT
7dcc790e65 Merge pull request #7 from loic-talon/master
Fix different error
2013-02-26 00:39:42 -08:00
Loïc TALON
5797328adc Fix date of messages and undefined var 2013-02-24 20:45:07 +01:00
Loïc TALON
6f1e5e4467 Fix Marchand
Fix undefined value in options.php
2013-02-24 19:01:04 +01:00
Loïc TALON
8ebc4cd91f Fix undefined dpath (options.php) 2013-02-24 18:11:09 +01:00
Loïc TALON
4b92511bae Fix second parameter of function date (options.php) 2013-02-24 17:58:42 +01:00
Mandalorien
74c4f31f7f Update src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php
correction
2013-01-22 17:21:24 +01:00
Gregory PLANCHAT
50538bd332 Updated profiler default visibility
Updated comments blocks

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-06-03 22:25:54 +02:00
Gregory PLANCHAT
9e3c1e68bf Added application handler
Fixed fleet bugs
Fixed colonization bug
Updated mail handler support
Fixed galaxy bugs
Updated license block

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-05-28 23:18:54 +02:00
Gregory PLANCHAT
4b2167c133 Fixed minor bugs
Updated redesign

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-05-02 23:06:18 +02:00
Gregory PLANCHAT
fa9fa5d3a5 Started interface redesign
Minor bug fixes

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-04-29 22:36:00 +02:00
Gregory PLANCHAT
b09c4e6c62 Bug fixes
Removed some dowuery calls in deprecated code.
Updated labels
Updated requirements & types for ore miner

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-04-09 20:01:45 +02:00
Gregory PLANCHAT
422f2c1295 Fixed minor bugs
Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-25 18:35:28 +02:00
Gregory PLANCHAT
a531d61639 Updated home page
Fixed buildings consruction time

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-24 15:51:26 +01:00
Gregory PLANCHAT
347952319a Fixed DML queries errors
Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-23 21:50:44 +01:00
Gregory PLANCHAT
70145967d0 Updated front controller
Fixed DML queries errors (partly implemented)
Fixed minor bugs

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-21 01:41:56 +01:00
Gregory PLANCHAT
3dde300c80 Added building/research-lab/shipyard/defenses MVC controllers
Refactored View & Model base classes
Added database adapter error messages and status utility methods
Fixed login error
Fixed HTTP 404 error on home page
Fixed minor bugs

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-20 21:31:33 +01:00
Gregory PLANCHAT
802be5f8c3 Updated Database component
Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-10 08:17:38 +01:00
Gregory PLANCHAT
7e7924e97e Updated Database component
Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-08 19:11:30 +01:00
Gregory PLANCHAT
03efb85c0b Refactored Controller
Refactored Database adapters

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-03-01 18:20:05 +01:00
Gregory PLANCHAT
690a7f60f3 Updated data access layer
Renamed classes, methods & variables from "User" to "Player"
Fixed dependencies requirements in the research lab queue
Updated overview
Added MVC's controller
Added build files
Updated directory structure

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-02-28 22:43:37 +01:00
Gregory PLANCHAT
d40313279a Updated layout file format to XML
Fixed config & install inconstinstencies
Fixed form management updates

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-01-24 22:27:32 +01:00
Gregory PLANCHAT
66805034a6 Configuration & Layout architecture updates
Fixed production bug
Fixed styles
Updated Action Controller

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2012-01-13 23:36:03 +01:00
Gregory PLANCHAT
dfa3dfb086 Finished install script
Updated configuration data loading
Added Website and Game models

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-12-27 19:37:28 +01:00
Gregory PLANCHAT
5393be4daf Updated installer
Added Website and Game models
Updted config loading

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-12-15 22:10:35 +01:00
Gregory PLANCHAT
fcd1f5b740 Updated config management
Updated install

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-12-14 23:45:09 +01:00
Gregory PLANCHAT
4bb4693d2e Updated install script
Fixed CSS issues

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-12-05 18:52:05 +01:00
Gregory PLANCHAT
5acde87794 Updated install
Added Form manager
Added session messages display

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-11-18 08:05:42 +01:00
Gregory PLANCHAT
9636b4bb00 Updated install and fixed bugs
Added session messages display
Fixed field and validator loading.
Updated form validation
Updated root config management
Muted error reporting in file evaluation
Added menu updates
Fixed galaxy data access error
Fixed config bug
Added HTTP request method checks
Added Form manager
Fixed core bugs

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-11-08 08:56:53 +01:00
Grégory PLANCHAT
c38e53706e Merge pull request #2 from warlof/patch-1
correction des caractères spéciaux et fermeture des chaîne de caractè
2011-10-26 01:10:05 -07:00
Gregory PLANCHAT
6d61e93c47 Updated page display
Updated signature image generator
Navigation menu has been finalized
Some deprectaed templates has been removed
Fixed registration
Fixed galaxy notices messages

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-10-24 19:19:04 +02:00
warlof
fc311855b4 correction des caractères spéciaux et fermeture des chaîne de caractère 60 et 65 2011-10-23 17:51:27 +03:00
Gregory PLANCHAT
ec7e40e1aa Refactored to 2 namespaces: Wootook & Legacies
Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-10-04 19:57:00 +02:00
Gregory PLANCHAT
cfeb6aca6d Fixed mysql_* calls
Updated skin
Fixed minor bugs in shipyard pages display
Fixed various bugs in legacy fleet pages source code.

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-09-22 01:19:45 +02:00
Gregory PLANCHAT
be8c6a6629 Updated alliances page, fixed SQL injections (hoegarden)
Fided minor bugs

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-09-15 09:08:32 +02:00
Gregory PLANCHAT
8f0f7a4d46 Updated themes
Updated buildings
Updated shipyard page (ships & defense)
Added Buildings building queue display & cancel build action.
Added research lab
Added navigation block structure
Removed old code
Updated registration
Added files to .gitignore

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
2011-09-13 12:54:03 +02:00
1627 changed files with 43215 additions and 21412 deletions

9
.gitignore vendored
View file

@ -1 +1,8 @@
/config.php config.php
.buildpath
.project
.settings/
.idea/
coverage/
src/application/cache/*
src/application/configs/local.php

View file

@ -1,2 +0,0 @@
SetEnv DEBUG On
SetEnv DEPRECATION Off

View file

@ -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);
?>

View file

@ -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'] );
}
?>

View file

@ -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'] );
}
?>

View file

@ -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'] );
}
?>

View file

@ -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");
}

View file

@ -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']);
}
?>

View file

@ -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'] );
}
?>

View file

@ -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 );
?>

View file

@ -1,70 +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&uuml;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&eacute;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);
?>

File diff suppressed because it is too large Load diff

146
build.xml Normal file
View 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
View 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
View 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>

View file

@ -1,178 +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();
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
switch ($mode) {
case 'fleet':
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) === null) {
$layout = new Legacies_Core_Layout();
$layout->load('message');
$block = $layout->getBlock('message');
$block['title'] = Legacies::__('Shipyard is required');
$block['message'] = Legacies::__('In order to build ships you will need to build a shipyard building.');
$layout->render();
break;
}
/** @var Legacies_Empire_Model_Planet_Building_Shipyard $shipyard */
$shipyard = $planet->getShipyard();
if (isset($_POST['ship']) && is_array($_POST['ship'])) {
foreach ($_POST['ship'] as $shipId => $count) {
$shipId = intval($shipId);
$count = intval($count);
$shipyard->appendQueue($shipId, $count);
}
$planet->save();
}
$types = Legacies_Empire_Model_Game_Types::getSingleton();
$layout = new Legacies_Core_Layout();
$layout->load('planet.shipyard');
/** @var Legacies_Core_Block_Concat $parentBlock */
$parentBlock = $layout->getBlock('item-list.items');
foreach ($types->getData(Legacies_Empire::TYPE_SHIP) as $shipId) {
if (!$shipyard->checkAvailability($shipId)) {
continue;
}
$blockName = "ship({$shipId})";
$block = $layout->createBlock('empire/planet.shipyard.item', $blockName);
$block->setTemplate('empire/planet/shipyard/item.phtml');
$block->setPlanet($planet);
$block->setItemId($shipId);
$parentBlock->setPartial($blockName, $block);
}
echo $layout->render();
break;
case 'research':
// --------------------------------------------------------------------------------------------------
ResearchBuildingPage($planet, $user, $IsWorking['OnWork'], $IsWorking['WorkOn'] );
break;
case 'defense':
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) === null) {
$layout = new Legacies_Core_Layout();
$layout->load('message');
$block = $layout->getBlock('message');
$block['title'] = Legacies::__('Shipyard is required');
$block['title'] = Legacies::__('In order to build ships you will need to build a shipyard building.');
$layout->render();
break;
}
/** @var Legacies_Empire_Model_Planet_Building_Shipyard $shipyard */
$shipyard = $planet->getShipyard();
if (isset($_POST['defense']) && is_array($_POST['defense'])) {
foreach ($_POST['defense'] as $defenseId => $count) {
$defenseId = intval($defenseId);
$count = intval($count);
$shipyard->appendQueue($defenseId, $count);
}
$planet->save();
}
$types = Legacies_Empire_Model_Game_Types::getSingleton();
$layout = new Legacies_Core_Layout();
$layout->load('planet.shipyard');
/** @var Legacies_Core_Block_Concat $parentBlock */
$parentBlock = $layout->getBlock('item-list.items');
foreach ($types->getData(Legacies_Empire::TYPE_DEFENSE) as $defenseId) {
if (!$shipyard->checkAvailability($defenseId)) {
continue;
}
$blockName = "defense({$defenseId})";
$block = $layout->createBlock('empire/planet.shipyard.item', $blockName);
$block->setTemplate('empire/planet/shipyard/item.phtml');
$block->setPlanet($planet);
$block->setItemId($defenseId);
$parentBlock->setPartial($blockName, $block);
}
echo $layout->render();
break;
default:
if (isset($_GET['building']) && !empty($_GET['building'])) {
$buildingId = intval($_GET['building']);
$planet->appendBuildingQueue($shipId, isset($_GET['destroy']));
$planet->save();
}
$types = Legacies_Empire_Model_Game_Types::getSingleton();
$layout = new Legacies_Core_Layout();
$layout->load('planet.buildings');
/** @var Legacies_Core_Block_Concat $parentBlock */
$parentBlock = $layout->getBlock('item-list.items');
$type = Legacies_Empire::TYPE_BUILDING_PLANET;
if ($planet->isMoon()) {
$type = Legacies_Empire::TYPE_BUILDING_MOON;
}
foreach ($types->getData($type) as $buildingId) {
if (!$planet->checkAvailability($buildingId)) {
continue;
}
$blockName = "building({$buildingId})";
$block = $layout->createBlock('empire/planet.buildings.item', $blockName);
$block->setTemplate('empire/planet/buildings/item.phtml');
$block->setPlanet($planet);
$block->setItemId($buildingId);
$parentBlock->setPartial($blockName, $block);
}
echo $layout->render();
break;
}

View file

@ -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'
)
)
);

View file

@ -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;
}
}

View file

@ -1 +0,0 @@
<?php return 'php';

285
fleet.php
View file

@ -1,285 +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 .= "&nbsp;-&nbsp;";
}
$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']);
?>

View file

@ -1,73 +0,0 @@
<?php
/*
Galacticnova : An open-source web-based game !
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
License: AGPL
Author: Vincent Debarre <vinilox@vinilox.eu>
Website: http://project.galacticnova.vinilox.eu/
Last revision: 13/07/11
*/
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 || $FleetRow['fleet_mess'] == 2) {
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);
// -----------------------------------------------------------------------------------------------------------
?>

View file

@ -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 &eacute;t&eacute; enregistr&eacute; !","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&egrave;me solaire/Plan&egrave;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&egrave;te</option>";
$page .= '<option value="2"'.(($c[4]==2)?" SELECTED":"").">D&eacute;bris</option>";
$page .= '<option value="3"'.(($c[4]==3)?" SELECTED":"").">Lune</option>";
$page .= "</select>
</th></tr><tr>
<th><input type=\"reset\" value=\"Zur&uuml;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&ouml;scht","Gel&ouml;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 &eacute;t&eacute; &eacute;dit&eacute; !.","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&egrave;te</option>";
$page .= '<option value="2"'.(($c[4]==2)?" SELECTED":"").">D&eacute;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 &eacute;t&eacute; enregistr&eacute; !","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
?>

View file

@ -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>&nbsp;</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
?>

View file

@ -1,281 +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\">&nbsp;</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']);
?>

View file

@ -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
?>

View file

@ -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>

View file

@ -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
?>

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -1,6 +0,0 @@
<?php
class Legacies_Core_Block_Html_Navigation
extends Legacies_Core_Block_Template
{
}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Core_Block_Template
extends Legacies_Core_View
{
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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];
}
}

View file

@ -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;
}
}

View file

@ -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);
}

View file

@ -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'));
}
}
}

View file

@ -1,6 +0,0 @@
<?php
class Legacies_Core_Event
extends Legacies_Object
{
}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Core_Event_Break
extends Exception
implements Legacies_Core_Exception
{
}

View file

@ -1,3 +0,0 @@
<?php
interface Legacies_Core_Exception extends Legacies_Exception {}

View file

@ -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();
}
}

View file

@ -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);
}
}

View file

@ -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');
}
}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Core_Model_Exception
extends RuntimeException
implements Legacies_Core_Exception
{
}

View file

@ -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;
}
}

View file

@ -1,6 +0,0 @@
<?php
interface Legacies_Core_Singleton
{
public static function getSingleton();
}

View file

@ -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);
}
}

View file

@ -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()
{
}
}

View file

@ -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;
}
}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Empire_Block_Overview
extends Legacies_Core_Block_Template
{
}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Empire_Block_Overview_DestroyPlanet
extends Legacies_Core_Block_Html_Form
{
}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Empire_Block_Overview_RenamePlanet
extends Legacies_Core_Block_Html_Form
{
}

View file

@ -1,102 +0,0 @@
<?php
class Legacies_Empire_Block_Planet_Buildings_Item
extends Legacies_Core_Block_Template
{
protected $_planet = null;
protected $_itemId = null;
public function setPlanet(Legacies_Empire_Model_Planet $planet)
{
$this->_planet = $planet;
return $this;
}
public function getPlanet()
{
return $this->_planet;
}
public function setItemId($itemId)
{
$this->_itemId = $itemId;
return $this;
}
public function getItemId()
{
return $this->_itemId;
}
public function getItemInfoUrl()
{
return $this->getUrl('infos.php', array('gid' => $this->getItemId()));
}
public function getItemImageUrl()
{
return $this->getSkinUrl('graphics/gebaeude/' . $this->getItemId() . '.gif');
}
public function getName()
{
static $lang = null;
if ($lang === null) {
// FIXME: implement a cleaner way to get names
$lang = includeLang('tech');
}
if (isset($lang['tech']) && isset($lang['tech'][$this->getItemId()])) {
return $this->__($lang['tech'][$this->getItemId()]);
}
return '';
}
public function getDescription()
{
static $lang = null;
if ($lang === null) {
// FIXME: implement a cleaner way to get names
$lang = includeLang('tech');
}
if (isset($lang['res']) && isset($lang['res']['descriptions']) && isset($lang['res']['descriptions'][$this->getItemId()])) {
return $this->__($lang['res']['descriptions'][$this->getItemId()]);
}
return '';
}
public function getResourceName($resourceId)
{
static $lang = null;
if ($lang === null) {
// FIXME: implement a cleaner way to get names
$lang = includeLang('imperium');
}
if ($resourceId == 'cristal') {
$resourceId = 'crystal';
}
if (isset($lang[$resourceId])) {
return $this->__($lang[$resourceId]);
}
return '';
}
public function getLevel()
{
return $this->_planet->getElement($this->getItemId());
}
public function getResourcesNeeded()
{
return $this->_planet->getResourcesNeeded($this->getItemId(), 1);
}
public function getItemTime()
{
return $this->_planet->getBuildingTime($this->getItemId(), 1);
}
}

View file

@ -1,109 +0,0 @@
<?php
class Legacies_Empire_Block_Planet_Shipyard_Item
extends Legacies_Core_Block_Template
{
protected $_planet = null;
protected $_shipyard = null;
protected $_itemId = null;
public function setPlanet(Legacies_Empire_Model_Planet $planet)
{
$this->_planet = $planet;
$this->_shipyard = $this->_planet->getShipyard();
return $this;
}
public function getPlanet()
{
return $this->_planet;
}
public function setItemId($shipId)
{
$this->_itemId = $shipId;
return $this;
}
public function getItemId()
{
return $this->_itemId;
}
public function getItemInfoUrl()
{
return $this->getUrl('infos.php', array('gid' => $this->getItemId()));
}
public function getItemImageUrl()
{
return $this->getSkinUrl('graphics/gebaeude/' . $this->getItemId() . '.gif');
}
public function getName()
{
static $lang = null;
if ($lang === null) {
// FIXME: implement a cleaner way to get names
$lang = includeLang('tech');
}
if (isset($lang['tech']) && isset($lang['tech'][$this->getItemId()])) {
return $this->__($lang['tech'][$this->getItemId()]);
}
return '';
}
public function getDescription()
{
static $lang = null;
if ($lang === null) {
// FIXME: implement a cleaner way to get names
$lang = includeLang('tech');
}
if (isset($lang['res']) && isset($lang['res']['descriptions']) && isset($lang['res']['descriptions'][$this->getItemId()])) {
return $this->__($lang['res']['descriptions'][$this->getItemId()]);
}
return '';
}
public function getResourceName($resourceId)
{
static $lang = null;
if ($lang === null) {
// FIXME: implement a cleaner way to get names
$lang = includeLang('imperium');
}
if ($resourceId == 'cristal') {
$resourceId = 'crystal';
}
if (isset($lang[$resourceId])) {
return $this->__($lang[$resourceId]);
}
return '';
}
public function getQty()
{
return $this->_planet->getElement($this->getItemId());
}
public function getResourcesNeeded()
{
return $this->_shipyard->getResourcesNeeded($this->getItemId(), 1);
}
public function getBuildingTime()
{
return $this->_shipyard->getBuildingTime($this->getItemId(), 1);
}
public function getMaximumBuildableElementsCount()
{
return $this->_shipyard->getMaximumBuildableElementsCount($this->getItemId());
}
}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Empire_Block_PlanetList
extends Legacies_Core_Block_Template
{
}

View file

@ -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();
}
}

View file

@ -1,3 +0,0 @@
<?php
interface Legacies_Empire_Exception extends Legacies_Exception {}

View file

@ -1,7 +0,0 @@
<?php
class Legacies_Empire_Model_Builder_Break
extends Exception
{
}

View file

@ -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';
}
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -1,183 +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 getBuildingTime($buildingId, $level)
{
return 0;
}
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;
}
/**
* 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);
$remainingAmounts = $this->_calculateResourceRemainingAmounts($resourcesNeeded);
if ($remainingAmounts === false) {
return $this;
}
$this->enqueue($buildingId, $level, $time);
$this->_currentPlanet->setData('b_building_id', $this->serialize());
foreach ($remainingAmounts as $resourceId => $resourceAmount) {
$this->_currentPlanet[$resourceId] = $resourceAmount;
}
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;
}
}

View file

@ -1,6 +0,0 @@
<?php
class Legacies_Empire_Model_Planet_Builder_Item
extends Legacies_Empire_Model_Builder_Item
{
}

View file

@ -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)
);
}
}

View file

@ -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)
);
}
}

View file

@ -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)
);
}
}

View file

@ -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)
);
}
}

View file

@ -1,206 +0,0 @@
<?php
class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
extends Legacies_Empire_Model_BuilderAbstract
{
/**
* @var int
*/
protected $_maxLength = 0;
public function init()
{
$this->_unserializeQueue($this->_currentUser->getData('b_laboratory_id'));
}
/**
* @param int $buildingId
* @param int $level
* @param int $time
*/
public function _initItem()
{
$technologyId = func_get_arg(0);
$level = func_get_arg(1);
$time = func_get_arg(2);
return new Legacies_Empire_Model_Planet_Building_ResearchLab_Item(array(
'technology_id' => $technologyId,
'level' => $level,
'created_at' => $time,
'updated_at' => $time
));
}
/**
* Check if a technology type is actually buildable on the current
* planet, depending on the technology and buildings requirements.
*
* @param int $technologyId
* @return bool
*/
public function checkAvailability($technologyId)
{
$types = Legacies_Empire_Model_Game_Types::getSingleton();
if (!$types->is($technologyId, Legacies_Empire::TYPE_RESEARCH)) {
return false;
}
parent::checkAvailability($technologyId);
return true;
}
/**
* Returns the time needed to build $level of $technologyId
*
* @param int $technologyId
* @param int $level
*/
public function getBuildingTime($technologyId, $level)
{
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
$types = Legacies_Empire_Model_Game_Types::getSingleton();
$gameConfig = Legacies_Core_Model_Config::getSingleton();
Math::setPrecision(50);
// FIXME: Resource dependency
$totalCost = Math::mul(Math::add($prices[$technologyId][Legacies_Empire::RESOURCE_METAL], $prices[$technologyId][Legacies_Empire::RESOURCE_CRISTAL]), $level);
$speedFactor = $gameConfig->getData('game_speed');
// FIXME: Building & Technology dependency
$extraLaboratoriesLevels = 0;
$researchNetworkLevel = $this->_currentUser->getElement(Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK);
if ($researchNetworkLevel > 0) {
$laboratoriesLevels = array();
foreach ($this->_currentUser->getPlanetCollection() as $planet) {
if ($this->_currentPlanet->getId() == $planet->getId()) {
continue;
}
$level = $planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB);
if ($level > 0) {
$laboratoriesLevels[] = (int) $level;
}
}
sort($laboratoriesLevels, SORT_NUMERIC);
$extraLaboratoriesLevels = array_sum(array_slice(array_reverse($laboratoriesLevels), 0, $researchNetworkLevel));
}
$laboratorySpeedup = Math::div($totalCost, ($this->_currentPlanet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB) + 1 + $extraLaboratoriesLevels));
Math::setPrecision();
$baseTime = ($totalCost / $speedFactor) * $laboratorySpeedup;
return (int) Math::floor($baseTime * 3600);
}
/**
* (non-PHPdoc)
* @see Legacies_Empire_Model_BuilderAbstract::getResourcesNeeded()
*/
public function getResourcesNeeded($technologyId, $level)
{
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
$resources = Legacies_Empire_Model_Game_Resources::getSingleton();
if (!isset($prices[$technologyId])) {
return array();
}
$resourcesNeeded = array();
foreach ($resources as $resourceId => $resourceConfig) {
if (!isset($prices[$technologyId][$resourceId])) {
continue;
}
if (Math::isPositive($prices[$technologyId][$resourceId])) {
$firstLevelCost = $prices[$technologyId][$resourceId];
$partialLevelCost = Math::mul($firstLevelCost, Math::pow($prices[$technologyId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
$resourcesNeeded[$resourceId] = Math::sub($partialLevelCost, $firstLevelCost);
}
}
return $resourcesNeeded;
}
/**
* Update the contruction queue.
*
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function updateQueue($time)
{
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
$elapsedTime = $time - $this->_currentUser->getData('b_laboratory');
foreach ($this->getQueue() as $element) {
$technologyId = $element->getData('research_id');
$level = $element->getData('level');
$buildTime = $this->getBuildingTime($technologyId, $level);
if ($elapsedTime >= $buildTime) {
$this->_currentUser[$fields[$technologyId]] = Math::add($this->_currentUser[$fields[$technologyId]], $level);
$elapsedTime -= $buildTime;
$this->dequeue($element);
continue;
}
$timeRatio = $elapsedTime / $buildTime;
$itemsBuilt = Math::mul($timeRatio, $level);
$element->setData('updated_at', $time);
$element->setData('level', Math::sub($level, $itemsBuilt));
$this->_currentUser->setData($fields[$technologyId], Math::add($this->_currentUser->getData($fields[$technologyId]), $itemsBuilt));
break;
}
$this->_currentUser->setData('b_laboratory_id', $this->serialize());
$this->_currentUser->setData('b_laboratory', $time);
return $this;
}
/**
* Append items to build to the construction list
*
* @param int $technologyId
* @param int|string $level
* @return Legacies_Empire_Model_Planet_Building_ResearchLab
*/
public function appendQueue($technologyId, $level, $time)
{
if ($this->_maxLength > 0 && $this->count() >= $this->_maxLength) {
return $this;
}
if (!Math::isPositive($level)) {
return $this;
}
$types = Legacies_Empire_Model_Game_Types::getSingleton();
if (!$types->is($technologyId, Legacies_Empire::TYPE_RESEARCH)) {
return $this;
}
if (!$this->checkAvailability($technologyId)) {
return $this;
}
$resourcesNeeded = $this->getResourcesNeeded($technologyId, $level);
$remainingAmounts = $this->_calculateResourceRemainingAmounts($resourcesNeeded);
if ($remainingAmounts === false) {
return $this;
}
$this->enqueue($technologyId, $level, $time);
$this->_currentUser->setData('b_laboratory_id', $this->serialize());
foreach ($remainingAmounts as $resourceId => $resourceAmount) {
$this->_currentPlanet[$resourceId] = $resourceAmount;
}
return $this;
}
};

View file

@ -1,6 +0,0 @@
<?php
class Legacies_Empire_Model_Planet_Building_ResearchLab_Item
extends Legacies_Empire_Model_Builder_Item
{
}

View file

@ -1,6 +0,0 @@
<?php
class Legacies_Empire_Model_Planet_Building_Shipyard_Item
extends Legacies_Empire_Model_Builder_Item
{
}

View file

@ -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)
);
}
}

View file

@ -1,5 +0,0 @@
<?php
interface Legacies_Empire_Model_Planet_BuildingInterface
{
}

View file

@ -1,3 +0,0 @@
<?php
class Legacies_Empire_Model_Planet_Exception implements Legacies_Core_Exception {}

View file

@ -1,6 +0,0 @@
<?php
interface Legacies_Empire_Model_Planet_ResourceProductionInterface
{
public function getProductionRatios($level, $produtionRatio, $planet, $user);
}

View file

@ -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));
}
}

View file

@ -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));
}
}
}

View file

@ -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;
}
}

View file

@ -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));
}
}
}

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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');
}
}

View file

@ -1,3 +0,0 @@
<?php
interface Legacies_Exception {}

View file

@ -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);
}
}
}
}
}

View file

@ -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;
}
}
}

View file

@ -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, ',', '.');
}
}

View file

@ -1,100 +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'
),
)
)
)
),
'planet.buildings' => array(
'update' => '1column',
'reference' => array(
'content' => array(
'children' => array(
'topnav' => array(
'type' => 'empire/topnav',
'template' => 'empire/topnav.phtml',
),
'queue' => array(
'type' => 'core/template',
'template' => 'empire/planet/buildings/queue.phtml'
),
'item-list' => array(
'type' => 'core/template',
'template' => 'empire/planet/buildings.phtml',
'children' => array(
'item-list.items' => array(
'type' => 'core/concat'
),
)
),
)
)
)
),
'planet.shipyard' => array(
'update' => '1column',
'reference' => array(
'content' => array(
'children' => array(
'topnav' => array(
'type' => 'empire/topnav',
'template' => 'empire/topnav.phtml',
),
'item-list' => array(
'type' => 'core/template',
'template' => 'empire/planet/shipyard.phtml',
'children' => array(
'item-list.items' => array(
'type' => 'core/concat'
),
)
),
'queue' => array(
'type' => 'core/template',
'template' => 'empire/planet/shipyard/queue.phtml'
),
)
)
)
)
);

View file

@ -1,134 +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'
)
)
),
'message' => array(
'update' => 'default',
'reference' => array(
'content' => array(
'children' => array(
'message' => array(
'type' => 'core/template',
'template' => 'page/html/message.phtml'
),
)
)
)
)
);

View file

@ -1,35 +0,0 @@
<br><br>
<h2><?php echo $this->getData('adm_ov_title')?></h2>
<table width="600">
<tr>
<td class="c" colspan="2"><?php echo $this->getData('adm_ov_infos')?></td>
</tr><tr>
<td class="b" style="color:#FFFFFF"><?php echo $this->getData('adm_ov_yourv')?>: <strong><?php echo $this->getData('adm_ov_data_yourv')?></strong></td>
<td class="b" style="color:#FFFFFF"><?php echo $this->getData('adm_ov_lastv')?>: <b><a style="color:orange;" href="http://www.xnova-ng.org/"><?php echo $this->getData('adm_ov_here')?></a></b></td>
</tr>
</table>
<br>
<table width="600">
<tr>
<td class="c" colspan="13"><?php echo $this->getData('adm_ov_onlin')?></td>
</tr>
<tr>
<th><a href="?cmd=sort&type=id"><?php echo $this->getData('adm_ul_id')?></a></th>
<th><a href="?cmd=sort&type=username"><?php echo $this->getData('adm_ul_name')?></a></th>
<th><a href="?cmd=sort&type=user_lastip"><?php echo $this->getData('adm_ul_adip')?></a></th>
<th><a href="?cmd=sort&type=ally_name"><?php echo $this->getData('adm_ov_ally')?></a></th>
<th><?php echo $this->getData('adm_ov_point')?></th>
<th><a href="?cmd=sort&type=onlinetime"><?php echo $this->getData('adm_ov_activ')?></a></th>
<th><?php echo $this->getData('usr_email')?></th>
<th><?php echo $this->getData('xp_raid')?></th>
<th><?php echo $this->getData('xp_min')?></th>
<th><?php echo $this->getData('lang_vacancy')?></th>
<th><?php echo $this->getData('banned_lang')?></th>
<th><?php echo $this->getData('usr_current_planet')?></th>
<th><?php echo $this->getData('usr_current_page')?></th>
</tr>
<?php echo $this->getData('adm_ov_data_table')?>
<tr>
<th class="b" colspan="13"><?php echo $this->getData('adm_ov_count')?>: <?php echo $this->getData('adm_ov_data_count')?></th>
</tr>
</table>

View file

@ -1,70 +0,0 @@
<br>
<table width=519><tr><td class=c colspan=11><?php echo $this->getData('Configure_laws')?></td></tr>
<?php echo $this->getData('list')?>
</table>
<br>
<form action="alliance.php?mode=admin&edit=rights&add=name" method=POST>
<table width=519>
<tr>
<td class=c colspan=2><?php echo $this->getData('Range_make')?></td>
</tr>
<tr>
<th><?php echo $this->getData('Range_name')?></th>
<th><input type=text name="newrangname" size=20 maxlength=30></th>
</tr>
<tr>
<th colspan=2><input type=submit value="<?php echo $this->getData('Make')?>"></th>
</tr>
</form>
</table>
<form action="alliance.php?mode=admin&edit=rights" method=POST>
<table width=519>
<tr>
<td class=c colspan=2><?php echo $this->getData('Law_leyends')?></td>
</tr>
<tr>
<th><img src=images/r1.png></th>
<th><?php echo $this->getData('Alliance_dissolve')?></th>
</tr>
<tr>
<th><img src=images/r2.png></th>
<th><?php echo $this->getData('Expel_users')?></th>
</tr>
<tr>
<th><img src=images/r3.png></th>
<th><?php echo $this->getData('See_the_requests')?></th>
</tr>
<tr>
<th><img src=images/r4.png></th>
<th><?php echo $this->getData('See_the_list_members')?></th>
</tr>
<tr>
<th><img src=images/r5.png></th>
<th><?php echo $this->getData('Check_the_requests')?></th>
</tr>
<tr>
<th><img src=images/r6.png></th>
<th><?php echo $this->getData('Alliance_admin')?></th>
</tr>
<tr>
<th><img src=images/r7.png></th>
<th><?php echo $this->getData('See_the_online_list_member')?></th>
</tr>
<tr>
<th><img src=images/r8.png></th><th><?php echo $this->getData('Make_a_circular_message')?></th>
</tr>
<tr>
<th><img src=images/r9.png></th><th><?php echo $this->getData('Left_hand_text')?></th>
</tr>
<tr>
<td class="c" colspan="2"><a href="alliance.php?mode=admin&edit=ally"><?php echo $this->getData('Return_to_overview')?></a></td>
</tr>
</form>
</table>

View file

@ -1,15 +0,0 @@
<br>
<form action="alliance.php?mode=admin&edit=rights" method=POST>
<tr>
<th></th>
<th><?php echo $this->getData('Range_name')?></th>
<th><img src=images/r1.png></th>
<th><img src=images/r2.png></th>
<th><img src=images/r3.png></th>
<th><img src=images/r4.png></th>
<th><img src=images/r5.png></th>
<th><img src=images/r6.png></th>
<th><img src=images/r7.png></th>
<th><img src=images/r8.png></th>
<th><img src=images/r9.png></th>
</tr>

View file

@ -1,16 +0,0 @@
<br>
<tr>
<th><?php echo $this->getData('delete')?></th>
<th>&nbsp;<?php echo $this->getData('r0')?>&nbsp;</th>
<input type="hidden" name="id[]" value="<?php echo $this->getData('a')?>">
<th><?php echo $this->getData('r1')?></th>
<th><?php echo $this->getData('r2')?></th>
<th><?php echo $this->getData('r3')?></th>
<th><?php echo $this->getData('r4')?></th>
<th><?php echo $this->getData('r5')?></th>
<th><?php echo $this->getData('r6')?></th>
<th><?php echo $this->getData('r7')?></th>
<th><?php echo $this->getData('r8')?></th>
<th><?php echo $this->getData('r9')?></th>
</tr>
<tr>

View file

@ -1,27 +0,0 @@
<br>
<form action="alliance.php?mode=admin&edit=requests&show=<?php echo $this->getData('id')?>&sort=0" method="POST">
<tr>
<th colspan=2><?php echo $this->getData('Request_from')?></th>
</tr>
<tr>
<th colspan=2><?php echo $this->getData('ally_request_text')?></th>
</tr>
<tr>
<td class="c" colspan=2><?php echo $this->getData('Request_responde')?></td>
</tr>
<tr>
<th>&#160;</th>
<th><input type="submit" name="action" value="Accepter"></th>
</tr>
<tr>
<th><?php echo $this->getData('Motive_optional')?> <span id="cntChars">0</span> / 500 <?php echo $this->getData('characters')?></th>
<th><textarea name="text" cols=40 rows=10 onkeyup="javascript:cntchar(500)"></textarea></th>
</tr>
<tr>
<th>&#160;</th>
<th><input type="submit" name="action" value="Refuser"></th>
</tr>
<tr>
<td colspan=2>&#160;</td>
</tr>
</form>

View file

@ -1,15 +0,0 @@
<center>
<br />
<?php echo $this->getData('BuildListScript')?>
<table width=530>
<?php echo $this->getData('BuildList')?>
<tr>
<th ><?php echo $this->getData('bld_usedcells')?></th>
<th colspan="2" >
<font color="#00FF00"><?php echo $this->getData('planet_field_current')?></font> / <font color="#FF0000"><?php echo $this->getData('planet_field_max')?></font> <?php echo $this->getData('bld_theyare')?> <?php echo $this->getData('field_libre')?> <?php echo $this->getData('bld_cellfree')?>
</th >
</tr>
<?php echo $this->getData('BuildingsList')?>
</table>
<br />
</center>

View file

@ -1,107 +0,0 @@
<script src="scripts/cnt.js" type="text/javascript"></script>
<div id="btc" class="z"></div><script language="JavaScript">
pp = '<?php echo $this->getData('time')?>';
pk = '<?php echo $this->getData('building_id')?>';
pl = '<?php echo $this->getData('id')?>';
ps = 'buildings.php';
t();
</script>
<script type="text/javascript">
v = new Date();
p = 0;
g = <?php echo $this->getData('b_building_queue')?>;
s = 0;
hs = 0;
of = 1;
c = new Array(<?php echo $this->getData('c')?>'');
b = new Array(<?php echo $this->getData('b')?>'');
a = new Array(<?php echo $this->getData('a')?>'');
aa = '<?php echo $this->getData('completed')?>';
function t() {
if ( hs == 0 ) {
xd();
hs = 1;
}
n = new Date();
s = c[p]-g-Math.round((n.getTime()-v.getTime())/1000.);
s = Math.round(s);
m = 0;
h = 0;
if ( s < 0 ) {
a[p]--;
xd();
if ( a[p] <= 0 ) {
p++;
xd();
}
g = 0;
v = new Date();
s = 0;
}
if ( s > 59 ) {
m = Math.floor( s / 60 );
s = s - m * 60;
}
if ( m > 59 ) {
h = Math.floor( m / 60 );
m = m - h * 60;
}
if ( s < 10 ) {
s = "0" + s;
}
if ( m < 10 ) {
m = "0" + m;
}
if (p > b.length - 2) {
document.getElementById("bx").innerHTML=aa ;
} else {
document.getElementById("bx").innerHTML= b[p] + " " + h + ":" + m + ":" + s;
}
window.setTimeout("t();", 200);
}
function xd() {
while (document.Atr.auftr.length > 0) {
document.Atr.auftr.options[document.Atr.auftr.length-1] = null;
}
if ( p > b.length - 2 ) {
document.Atr.auftr.options[document.Atr.auftr.length] = new Option(aa);
}
for (iv = p; iv <= b.length - 2; iv++) {
if ( a[iv] < 2 ) {
ae = " ";
} else {
ae = " ";
}
if ( iv == p ) {
act = " (<?php echo $this->getData('in_working')?>)";
} else {
act = "";
}
document.Atr.auftr.options[document.Atr.auftr.length] = new Option( a[iv] + ae + " \"" + b[iv] + "\"" + act, iv + of );
}
}
window.onload = t;
</script>
<center>
<br>
<form name="Atr" method="get" action="buildings.php">
<input type="hidden" name="mode" value="fleet">
<table width="530">
<tr>
<td class="c" ><?php echo $this->getData('work_todo')?></td>
</tr><tr>
<th ><select name="auftr" size="10"></select></th>
</tr><tr>
<td class="c" ></td>
</tr>
</table>
</form>
<?php echo $this->getData('total_left_time')?>
<?php echo $this->getData('pretty_time_b_hangar')?>
<br>
</center>

View file

@ -1,15 +0,0 @@
<tr>
<td class="l">
<a href="infos.php?gid=<?php echo $this->getData('i')?>">
<img border="0" src="<?php echo $this->getData('dpath')?>gebaeude/<?php echo $this->getData('i')?>.gif" align="top" width="120" height="120">
</a>
</td>
<td class="l">
<a href="infos.php?gid=<?php echo $this->getData('i')?>"><?php echo $this->getData('n')?></a><?php echo $this->getData('nivel')?><br>
<?php echo $this->getData('descriptions')?><br>
<?php echo $this->getData('price')?>
<?php echo $this->getData('time')?>
<?php echo $this->getData('rest_price')?>
</td>
<td class="k"><?php echo $this->getData('click')?></td>
</tr>

View file

@ -1,8 +0,0 @@
<script src="scripts/cnt.js" type="text/javascript"></script>
<div id="btc" class="z"></div><SCRIPT language="JavaScript">
pp='<?php echo $this->getData('time')?>';
pk='<?php echo $this->getData('building_id')?>';
pl='<?php echo $this->getData('id')?>';
ps='buildings.php';
t();
</script>

View file

@ -1,19 +0,0 @@
<center>
<br />
<table align="top">
<tr>
<td>
<form action="buildings.php?mode=defense" method="post">
<table width=530>
<?php echo $this->getData('buildlist')?>
<tr>
<td class="c" colspan=2 align="center"><input type="submit" value="<?php echo $this->getData('Construire')?>"></td>
</tr>
</table>
</form>
</td>
<td valign="top"></td>
</tr>
</table>
<?php echo $this->getData('buildinglist')?>
</center>

Some files were not shown because too many files have changed in this diff Show more