Compare commits
3
.gitignore
vendored
|
|
@ -2,7 +2,4 @@ config.php
|
|||
.buildpath
|
||||
.project
|
||||
.settings/
|
||||
.idea/
|
||||
coverage/
|
||||
src/application/cache/*
|
||||
src/application/configs/local.php
|
||||
|
|
|
|||
2
.htaccess
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SetEnv DEBUG On
|
||||
SetEnv DEPRECATION Off
|
||||
68
add_declare.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
|
||||
includeLang('admin');
|
||||
|
||||
$mode = $_POST['mode'];
|
||||
|
||||
$PageTpl = gettemplate("add_declare");
|
||||
$parse = $lang;
|
||||
|
||||
if ($mode == 'addit') {
|
||||
$declarator = $user['id'];
|
||||
$declarator_name = addslashes(htmlspecialchars($user['username']));
|
||||
$decl1 = addslashes(htmlspecialchars($_POST['dec1']));
|
||||
$decl2 = addslashes(htmlspecialchars($_POST['dec2']));
|
||||
$decl3 = addslashes(htmlspecialchars($_POST['dec3']));
|
||||
$reason1 = addslashes(htmlspecialchars($_POST['reason']));
|
||||
|
||||
$QryDeclare = "INSERT INTO {{table}} SET ";
|
||||
$QryDeclare .= "`declarator` = '". $declarator ."', ";
|
||||
$QryDeclare .= "`declarator_name` = '". $declarator_name ."', "; $QryDeclare .= "`declared_1` = '". $decl1 ."', ";
|
||||
$QryDeclare .= "`declared_2` = '". $decl2 ."', ";
|
||||
$QryDeclare .= "`declared_3` = '". $decl3 ."', ";
|
||||
$QryDeclare .= "`reason` = '". $reason1 ."' ";
|
||||
|
||||
doquery( $QryDeclare, "declared");
|
||||
doquery("UPDATE {{table}} SET multi_validated ='1' WHERE username='{$user['username']}'","users");
|
||||
|
||||
AdminMessage ( "Merci, votre demande a ete prise en compte. Les autres joueurs que vous avez implique doivent egalement et imperativement suivre cette procedure aussi.", "Ajout" );
|
||||
}
|
||||
$Page = parsetemplate($PageTpl, $parse);
|
||||
|
||||
display ($Page, "Declaration d\'IP partagee", false, '', true);
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
includeLang('admin');
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
|
||||
includeLang('admin/Queries');
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,24 +24,27 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
|
||||
doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users');
|
||||
doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users');
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
includeLang('admin/fleets');
|
||||
$PageTPL = gettemplate('admin/fleet_body');
|
||||
|
||||
$response = Wootook::getResponse()
|
||||
->setRedirect(Wootook::getStaticUrl('admin/overview.php'))
|
||||
->sendHeaders();
|
||||
exit(0);
|
||||
} else {
|
||||
message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||
}
|
||||
$parse = $lang;
|
||||
$parse['flt_table'] = BuildFlyingFleetTable ();
|
||||
|
||||
$page = parsetemplate( $PageTPL, $parse );
|
||||
display ( $page, $lang['flt_title'], false, '', true);
|
||||
|
||||
} else {
|
||||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,18 +24,18 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
includeLang('admin');
|
||||
|
||||
function WootookResetUnivers ( $CurrentUser ) {
|
||||
function XNovaResetUnivers ( $CurrentUser ) {
|
||||
global $lang;
|
||||
|
||||
if (in_array($CurrentUser['authlevel'], array(LEVEL_ADMIN))) {
|
||||
|
|
@ -129,7 +129,7 @@ function WootookResetUnivers ( $CurrentUser ) {
|
|||
$parse = $lang;
|
||||
|
||||
if ($mode == 'reset') {
|
||||
WootookResetUnivers ( $user );
|
||||
XNovaResetUnivers ( $user );
|
||||
} else {
|
||||
$Page = parsetemplate($PageTpl, $parse);
|
||||
display ($Page, $lang['Reset'], false, '', true);
|
||||
66
admin/activeplanet.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?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'] );
|
||||
}
|
||||
|
||||
?>
|
||||
101
admin/add_fleet.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?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'] );
|
||||
}
|
||||
|
||||
?>
|
||||
67
admin/add_money.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
includeLang('admin');
|
||||
|
||||
$mode = $_POST['mode'];
|
||||
|
||||
$PageTpl = gettemplate("admin/add_money");
|
||||
$parse = $lang;
|
||||
|
||||
if ($mode == 'addit') {
|
||||
$id = $_POST['id'];
|
||||
$metal = $_POST['metal'];
|
||||
$cristal = $_POST['cristal'];
|
||||
$deut = $_POST['deut'];
|
||||
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`metal` = `metal` + '". $metal ."', ";
|
||||
$QryUpdatePlanet .= "`crystal` = `crystal` + '". $cristal ."', ";
|
||||
$QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $deut ."' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '". $id ."' ";
|
||||
doquery( $QryUpdatePlanet, "planets");
|
||||
|
||||
AdminMessage ( $lang['adm_am_done'], $lang['adm_am_ttle'] );
|
||||
}
|
||||
$Page = parsetemplate($PageTpl, $parse);
|
||||
|
||||
display ($Page, $lang['adm_am_ttle'], false, '', true);
|
||||
} else {
|
||||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
includeLang('admin/addmoon');
|
||||
48
admin/autounban.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?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))) {
|
||||
$lang['PHP_SELF'] = 'options.'.PHPEXT;
|
||||
doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users');
|
||||
doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users');
|
||||
$parse = $gameConfig;
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":'';
|
||||
} else {
|
||||
message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
includeLang('admin');
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
includeLang('changelog');
|
||||
$template = gettemplate('changelog_table');
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
includeLang('admin');
|
||||
$parse = $lang;
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
includeLang('credit');
|
||||
$parse = $lang;
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,23 +24,19 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
includeLang('admin');
|
||||
if ($_GET['cmd'] == 'dele') {
|
||||
$player = new Wootook_Player_Model_Entity();
|
||||
$player->load(intval($_GET['user']));
|
||||
if ($player->getId()) {
|
||||
$player->delete();
|
||||
}
|
||||
DeleteSelectedUser ( $_GET['user'] );
|
||||
}
|
||||
if ($_GET['cmd'] == 'sort') {
|
||||
$TypeSort = $_GET['type'];
|
||||
|
|
@ -57,7 +53,7 @@ require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
|||
$parse['adm_ul_table'] = "";
|
||||
$i = 0;
|
||||
$Color = "lime";
|
||||
while ($u = $query->fetch(PDO::FETCH_ASSOC) ) {
|
||||
while ($u = mysql_fetch_assoc ($query) ) {
|
||||
if ($PrevIP != "") {
|
||||
if ($PrevIP == $u['declarator']) {
|
||||
$Color = "red";
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($CurrentUser['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
$PageTpl = gettemplate( "admin/deletuser" );
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
includeLang('admin');
|
||||
$parse = $lang;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,25 +24,25 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
includeLang('leftmenu');
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
$parse = $lang;
|
||||
$parse['mf'] = "Hauptframe";
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['WootookRelease'] = VERSION;
|
||||
$parse['servername'] = 'Wootook';
|
||||
$Page = parsetemplate(gettemplate('admin/left_menu'), $parse);
|
||||
display($Page, "", false, '', true);
|
||||
$parse = $lang;
|
||||
$parse['mf'] = "Hauptframe";
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['XNovaRelease'] = VERSION;
|
||||
$parse['servername'] = XNova;
|
||||
$Page = parsetemplate(gettemplate('admin/left_menu'), $parse);
|
||||
display( $Page, "", false, '', true);
|
||||
} else {
|
||||
message( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||
}
|
||||
66
admin/mass_message.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
|
||||
function mass_message_run($parent){
|
||||
if($_POST["mode"] == "change"){
|
||||
if(isset($_POST["tresc"])&& $_POST["tresc"] != ''){
|
||||
$gameConfig['tresc'] = $parent->safe_get_post_var("tresc");
|
||||
}
|
||||
if(isset($_POST["temat"])&& $_POST["temat"] != ''){
|
||||
$gameConfig['temat'] = $parent->safe_get_post_var("temat");
|
||||
}
|
||||
$kolor = 'red';
|
||||
if($gameConfig['tresc'] !='' and $gameConfig['temat']){
|
||||
$sq = $parent->db->query("SELECT `id` FROM {{table}}","users");
|
||||
while($u = $parent->db->fetch_assoc($sq)){
|
||||
doquery("INSERT INTO {{table}} SET
|
||||
`message_owner`='{$u['id']}',
|
||||
`message_sender`='1' ,
|
||||
`message_time`='".time()."',
|
||||
`message_type`='0',
|
||||
`message_from`='<font color=\"$kolor\">Administracja</font>',
|
||||
`message_subject`='<font color=\"$kolor\">{$gameConfig['temat']}</font>',
|
||||
`message_text`='<font color=\"$kolor\"><b>{$gameConfig['tresc']}</b></font>'
|
||||
","messages");
|
||||
$parent->db->query("UPDATE {{table}} SET new_message=new_message+1 WHERE id='{$u['id']}'",'users');
|
||||
}
|
||||
$parent->smarty->assign("message","<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>");
|
||||
}
|
||||
}
|
||||
$parent->smarty->display("mass_message.tpl");
|
||||
}
|
||||
|
||||
function mass_message_info(){
|
||||
return array("name" => "Send MassMessages","description"=>"Sends messagess to all players","default_weight"=>"0");
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
includeLang('admin/changepass');
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
includeLang('admin/md5enc');
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
includeLang('admin/messagelist');
|
||||
75
admin/messall.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
if ($_POST && $mode == "change") {
|
||||
if (isset($_POST["tresc"]) && $_POST["tresc"] != '') {
|
||||
$gameConfig['tresc'] = $_POST['tresc'];
|
||||
}
|
||||
if (isset($_POST["temat"]) && $_POST["temat"] != '') {
|
||||
$gameConfig['temat'] = $_POST['temat'];
|
||||
}
|
||||
if ($user['authlevel'] == LEVEL_ADMIN) {
|
||||
$kolor = 'red';
|
||||
$ranga = 'Administrator';
|
||||
} elseif ($user['authlevel'] == LEVEL_OPERATOR) {
|
||||
$kolor = 'skyblue';
|
||||
$ranga = 'Operator';
|
||||
} elseif ($user['authlevel'] == LEVEL_MODERATOR) {
|
||||
$kolor = 'yellow';
|
||||
$ranga = 'Moderator';
|
||||
}
|
||||
if ($gameConfig['tresc'] != '' and $gameConfig['temat']) {
|
||||
$sq = doquery("SELECT `id` FROM {{table}}", "users");
|
||||
$Time = time();
|
||||
$From = "<font color=\"". $kolor ."\">". $ranga ." ".$user['username']."</font>";
|
||||
$Subject = "<font color=\"". $kolor ."\">". $gameConfig['temat'] ."</font>";
|
||||
$Message = "<font color=\"". $kolor ."\"><b>". $gameConfig['tresc'] ."</b></font>";
|
||||
while ($u = $sq->fetch(PDO::FETCH_BOTH)) {
|
||||
SendSimpleMessage ( $u['id'], $user['id'], $Time, 97, $From, $Subject, $Message);
|
||||
}
|
||||
message("<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>", "Complete", "../overview." . PHPEXT, 3);
|
||||
}
|
||||
} else {
|
||||
$parse = $gameConfig;
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":'';
|
||||
$page .= parsetemplate(gettemplate('admin/messall_body'), $parse);
|
||||
display($page, '', false,'', true);
|
||||
}
|
||||
} else {
|
||||
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
includeLang('overview');
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
includeLang('admin/multi');
|
||||
116
admin/overview.php
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
includeLang('admin');
|
||||
|
||||
if ($_GET['cmd'] == 'sort') {
|
||||
$TypeSort = $_GET['type'];
|
||||
} else {
|
||||
$TypeSort = "id";
|
||||
}
|
||||
|
||||
$PageTPL = gettemplate('admin/overview_body');
|
||||
$RowsTPL = gettemplate('admin/overview_rows');
|
||||
|
||||
$parse = $lang;
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['mf'] = $mf;
|
||||
$parse['adm_ov_data_yourv'] = colorRed(VERSION);
|
||||
|
||||
$Last15Mins = doquery("SELECT * FROM {{table}} WHERE `onlinetime` >= '". (time() - 15 * 60) ."' ORDER BY `". $TypeSort ."` ASC;", 'users');
|
||||
$Count = 0;
|
||||
$Color = "lime";
|
||||
while ( $TheUser = mysql_fetch_array($Last15Mins) ) {
|
||||
if ($PrevIP != "") {
|
||||
if ($PrevIP == $TheUser['user_lastip']) {
|
||||
$Color = "red";
|
||||
} else {
|
||||
$Color = "lime";
|
||||
}
|
||||
}
|
||||
|
||||
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $TheUser['id'] . "';", 'statpoints', true);
|
||||
$Bloc['dpath'] = $dpath;
|
||||
$Bloc['adm_ov_altpm'] = $lang['adm_ov_altpm'];
|
||||
$Bloc['adm_ov_wrtpm'] = $lang['adm_ov_wrtpm'];
|
||||
$Bloc['adm_ov_data_id'] = $TheUser['id'];
|
||||
$Bloc['adm_ov_data_name'] = $TheUser['username'];
|
||||
$Bloc['adm_ov_data_agen'] = $TheUser['user_agent'];
|
||||
$Bloc['current_page'] = $TheUser['current_page'];
|
||||
$Bloc['usr_s_id'] = $TheUser['id'];
|
||||
|
||||
$Bloc['adm_ov_data_clip'] = $Color;
|
||||
$Bloc['adm_ov_data_adip'] = $TheUser['user_lastip'];
|
||||
$Bloc['adm_ov_data_ally'] = $TheUser['ally_name'];
|
||||
$Bloc['adm_ov_data_point'] = pretty_number ( $UserPoints['total_points'] );
|
||||
$Bloc['adm_ov_data_activ'] = pretty_time ( time() - $TheUser['onlinetime'] );
|
||||
$Bloc['adm_ov_data_pict'] = "m.gif";
|
||||
$PrevIP = $TheUser['user_lastip'];
|
||||
|
||||
//Tweaks vue g<>n<EFBFBD>rale
|
||||
$Bloc['usr_email'] = $TheUser['email'];
|
||||
$Bloc['usr_xp_raid'] = $TheUser['xpraid'];
|
||||
$Bloc['usr_xp_min'] = $TheUser['xpminier'];
|
||||
|
||||
if ($TheUser['urlaubs_modus'] == 1) {
|
||||
$Bloc['state_vacancy'] = "<img src=\"../images/true.png\" >";
|
||||
} else {
|
||||
$Bloc['state_vacancy'] = "<img src=\"../images/false.png\">";
|
||||
}
|
||||
|
||||
if ($TheUser['bana'] == 1) {
|
||||
$Bloc['is_banned'] = "<img src=\"../images/banned.png\" >";
|
||||
} else {
|
||||
$Bloc['is_banned'] = $lang['is_banned_lang'];
|
||||
}
|
||||
$Bloc['usr_planet_gal'] = $TheUser['galaxy'];
|
||||
$Bloc['usr_planet_sys'] = $TheUser['system'];
|
||||
$Bloc['usr_planet_pos'] = $TheUser['planet'];
|
||||
|
||||
|
||||
$parse['adm_ov_data_table'] .= parsetemplate( $RowsTPL, $Bloc );
|
||||
$Count++;
|
||||
}
|
||||
|
||||
$parse['adm_ov_data_count'] = $Count;
|
||||
$Page = parsetemplate($PageTPL, $parse);
|
||||
|
||||
display ( $Page, $lang['sys_overview'], false, '', true);
|
||||
} else {
|
||||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ define('INSIDE' , true);
|
|||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
|
||||
|
|
@ -50,79 +50,37 @@ require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
|||
|
||||
switch ($_GET['result']){
|
||||
case 'usr_search':
|
||||
$db = Legacies_Database::getSingleton();
|
||||
$sql =<<<SQL_EOF
|
||||
SELECT
|
||||
planet.id AS planet_id,
|
||||
planet.name AS planet_name,
|
||||
planet.galaxy AS planet_galaxy,
|
||||
planet.system AS planet_system,
|
||||
planet.planet AS planet_position,
|
||||
user.id AS user_id,
|
||||
user.username AS username,
|
||||
user.user_lastip AS user_lastip,
|
||||
user.email AS email,
|
||||
user.authlevel AS authlevel,
|
||||
user.sex AS sex
|
||||
|
||||
FROM {{table}}planets AS planet
|
||||
INNER JOIN {{table}}users AS user ON user.id_planet=planet.id
|
||||
WHERE user.id = {$db->quote('%' . str_replace('*', '%', str_replace('%', '%%', $_GET['player'])) . '%')}"
|
||||
SQL_EOF;
|
||||
$statement = $db->prepare($sql);
|
||||
$statement->execute();
|
||||
$data = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
$pattern = mysql_real_escape_string($_GET['player']);
|
||||
$SelUser = doquery("SELECT * FROM {{table}} WHERE `username` LIKE '%". $pattern ."%' LIMIT 1;", 'users', true);
|
||||
$UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $SelUser['id_planet'] ."';", 'planets', true);
|
||||
|
||||
$bloc = $lang;
|
||||
$bloc['answer1'] = $data['user_id'];
|
||||
$bloc['answer2'] = $data['username'];
|
||||
$bloc['answer3'] = $data['user_lastip'];
|
||||
$bloc['answer4'] = $data['email'];
|
||||
$bloc['answer5'] = $lang['adm_usr_level'][$data['authlevel']];
|
||||
$bloc['answer6'] = $lang['adm_usr_genre'][$data['sex']];
|
||||
$bloc['answer7'] = "[".$data['planet_id']."] {$data['planet_name']}";
|
||||
$bloc['answer8'] = "[".$SelUser['planet_galaxy'].":".$SelUser['planet_system'].":".$SelUser['planet_position']."] ";
|
||||
$bloc['answer1'] = $SelUser['id'];
|
||||
$bloc['answer2'] = $SelUser['username'];
|
||||
$bloc['answer3'] = $SelUser['user_lastip'];
|
||||
$bloc['answer4'] = $SelUser['email'];
|
||||
$bloc['answer5'] = $lang['adm_usr_level'][ $SelUser['authlevel'] ];
|
||||
$bloc['answer6'] = $lang['adm_usr_genre'][ $SelUser['sex'] ];
|
||||
$bloc['answer7'] = "[".$SelUser['id_planet']."] ".$UsrMain['name'];
|
||||
$bloc['answer8'] = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] ";
|
||||
$SubPanelTPL = gettemplate('admin/admin_panel_asw1');
|
||||
$parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
|
||||
$parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
|
||||
break;
|
||||
|
||||
case 'usr_data':
|
||||
$db = Legacies_Database::getSingleton();
|
||||
$sql =<<<SQL_EOF
|
||||
SELECT
|
||||
planet.id AS planet_id,
|
||||
planet.name AS planet_name,
|
||||
planet.galaxy AS planet_galaxy,
|
||||
planet.system AS planet_system,
|
||||
planet.planet AS planet_position,
|
||||
user.id AS user_id,
|
||||
user.username AS username,
|
||||
user.user_lastip AS user_lastip,
|
||||
user.email AS email,
|
||||
user.authlevel AS authlevel,
|
||||
user.sex AS sex
|
||||
|
||||
FROM {{table}}planets AS planet
|
||||
INNER JOIN {{table}}users AS user ON user.id_planet=planet.id
|
||||
WHERE user.id = {$db->quote('%' . str_replace('*', '%', str_replace('%', '%%', $_GET['player'])) . '%')}"
|
||||
SQL_EOF;
|
||||
$statement = $db->prepare($sql);
|
||||
$statement->execute();
|
||||
$data = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$pattern = mysql_real_escape_string($_GET['player']);
|
||||
$SelUser = doquery("SELECT * FROM {{table}} WHERE `username` LIKE '%". $pattern ."%' LIMIT 1;", 'users', true);
|
||||
$UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $SelUser['id_planet'] ."';", 'planets', true);
|
||||
|
||||
$bloc = $lang;
|
||||
$bloc['answer1'] = $data['user_id'];
|
||||
$bloc['answer2'] = $data['username'];
|
||||
$bloc['answer3'] = $data['user_lastip'];
|
||||
$bloc['answer4'] = $data['email'];
|
||||
$bloc['answer5'] = $lang['adm_usr_level'][$data['authlevel']];
|
||||
$bloc['answer6'] = $lang['adm_usr_genre'][$data['sex']];
|
||||
$bloc['answer7'] = "[".$data['planet_id']."] {$data['planet_name']}";
|
||||
$bloc['answer8'] = "[".$SelUser['planet_galaxy'].":".$SelUser['planet_system'].":".$SelUser['planet_position']."] ";
|
||||
$bloc['answer1'] = $SelUser['id'];
|
||||
$bloc['answer2'] = $SelUser['username'];
|
||||
$bloc['answer3'] = $SelUser['user_lastip'];
|
||||
$bloc['answer4'] = $SelUser['email'];
|
||||
$bloc['answer5'] = $lang['adm_usr_level'][ $SelUser['authlevel'] ];
|
||||
$bloc['answer6'] = $lang['adm_usr_genre'][ $SelUser['sex'] ];
|
||||
$bloc['answer7'] = "[".$SelUser['id_planet']."] ".$UsrMain['name'];
|
||||
$bloc['answer8'] = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] ";
|
||||
$SubPanelTPL = gettemplate('admin/admin_panel_asw1');
|
||||
$parse['adm_sub_form1'] = parsetemplate( $SubPanelTPL, $bloc );
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
|
||||
|
|
@ -59,5 +59,5 @@ require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
|||
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
|
||||
}
|
||||
|
||||
// Created by e-Zobar. All rights reversed (C) Wootook Team 2008
|
||||
// Created by e-Zobar. All rights reversed (C) XNova Team 2008
|
||||
?>
|
||||
310
admin/settings.php
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
<?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 );
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ define('INSIDE' , true);
|
|||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
include(ROOT_PATH . 'admin/statfunctions.' . PHPEXT);
|
||||
|
||||
|
|
@ -42,16 +42,14 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
$StatDate = time();
|
||||
// Rotation des statistiques
|
||||
doquery ( "DELETE FROM {{table}} WHERE `stat_code` >= '10';" , 'statpoints');
|
||||
doquery ( "DELETE FROM {{table}} WHERE `stat_code` = '2';" , 'statpoints');
|
||||
doquery ( "UPDATE {{table}} SET `stat_code` = `stat_code` + '1';" , 'statpoints');
|
||||
|
||||
$GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users');
|
||||
|
||||
$resourceMultiplier = Wootook::getGameConfig('game/resource/multiplier');
|
||||
|
||||
while ($CurUser = $GameUsers->fetch(PDO::FETCH_ASSOC)) {
|
||||
// Recuperation des anciennes statistiques
|
||||
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';", 'statpoints', true);
|
||||
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';",'statpoints');
|
||||
if ($OldStatRecord) {
|
||||
$OldTotalRank = $OldStatRecord['total_rank'];
|
||||
$OldTechRank = $OldStatRecord['tech_rank'];
|
||||
|
|
@ -71,7 +69,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
// Total des unitées consommée pour la recherche
|
||||
$Points = GetTechnoPoints ( $CurUser );
|
||||
$TTechCount = $Points['TechCount'];
|
||||
$TTechPoints = ($Points['TechPoint'] / $resourceMultiplier);
|
||||
$TTechPoints = ($Points['TechPoint'] / $gameConfig['stat_settings']);
|
||||
|
||||
// Totalisation des points accumulés par planete
|
||||
$TBuildCount = 0;
|
||||
|
|
@ -83,24 +81,24 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
$GCount = $TTechCount;
|
||||
$GPoints = $TTechPoints;
|
||||
$UsrPlanets = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '". $CurUser['id'] ."';", 'planets');
|
||||
while ($CurPlanet = $UsrPlanets->fetch(PDO::FETCH_ASSOC)) {
|
||||
while ($CurPlanet = mysql_fetch_assoc($UsrPlanets) ) {
|
||||
$Points = GetBuildPoints ( $CurPlanet );
|
||||
$TBuildCount += $Points['BuildCount'];
|
||||
$GCount += $Points['BuildCount'];
|
||||
$PlanetPoints = ($Points['BuildPoint'] / $resourceMultiplier);
|
||||
$TBuildPoints += ($Points['BuildPoint'] / $resourceMultiplier);
|
||||
$PlanetPoints = ($Points['BuildPoint'] / $gameConfig['stat_settings']);
|
||||
$TBuildPoints += ($Points['BuildPoint'] / $gameConfig['stat_settings']);
|
||||
|
||||
$Points = GetDefensePoints ( $CurPlanet );
|
||||
$TDefsCount += $Points['DefenseCount'];;
|
||||
$GCount += $Points['DefenseCount'];
|
||||
$PlanetPoints += ($Points['DefensePoint'] / $resourceMultiplier);
|
||||
$TDefsPoints += ($Points['DefensePoint'] / $resourceMultiplier);
|
||||
$PlanetPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']);
|
||||
$TDefsPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']);
|
||||
|
||||
$Points = GetFleetPoints ( $CurPlanet );
|
||||
$TFleetCount += $Points['FleetCount'];
|
||||
$GCount += $Points['FleetCount'];
|
||||
$PlanetPoints += ($Points['FleetPoint'] / $resourceMultiplier);
|
||||
$TFleetPoints += ($Points['FleetPoint'] / $resourceMultiplier);
|
||||
$PlanetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']);
|
||||
$TFleetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']);
|
||||
|
||||
$GPoints += $PlanetPoints;
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
|
|
@ -136,7 +134,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
$Rank = 1;
|
||||
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `tech_points` DESC;", 'statpoints');
|
||||
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
|
||||
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
|
||||
$QryUpdateStats = "UPDATE {{table}} SET ";
|
||||
$QryUpdateStats .= "`tech_rank` = '". $Rank ."' ";
|
||||
$QryUpdateStats .= "WHERE ";
|
||||
|
|
@ -147,7 +145,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
$Rank = 1;
|
||||
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `build_points` DESC;", 'statpoints');
|
||||
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC) ) {
|
||||
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
|
||||
$QryUpdateStats = "UPDATE {{table}} SET ";
|
||||
$QryUpdateStats .= "`build_rank` = '". $Rank ."' ";
|
||||
$QryUpdateStats .= "WHERE ";
|
||||
|
|
@ -158,7 +156,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
$Rank = 1;
|
||||
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `defs_points` DESC;", 'statpoints');
|
||||
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
|
||||
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
|
||||
$QryUpdateStats = "UPDATE {{table}} SET ";
|
||||
$QryUpdateStats .= "`defs_rank` = '". $Rank ."' ";
|
||||
$QryUpdateStats .= "WHERE ";
|
||||
|
|
@ -169,7 +167,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
$Rank = 1;
|
||||
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `fleet_points` DESC;", 'statpoints');
|
||||
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
|
||||
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
|
||||
$QryUpdateStats = "UPDATE {{table}} SET ";
|
||||
$QryUpdateStats .= "`fleet_rank` = '". $Rank ."' ";
|
||||
$QryUpdateStats .= "WHERE ";
|
||||
|
|
@ -180,7 +178,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
$Rank = 1;
|
||||
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `total_points` DESC;", 'statpoints');
|
||||
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
|
||||
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
|
||||
$QryUpdateStats = "UPDATE {{table}} SET ";
|
||||
$QryUpdateStats .= "`total_rank` = '". $Rank ."' ";
|
||||
$QryUpdateStats .= "WHERE ";
|
||||
|
|
@ -194,7 +192,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
while ($CurAlly = $GameAllys->fetch(PDO::FETCH_ASSOC)) {
|
||||
// Recuperation des anciennes statistiques
|
||||
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints', true);
|
||||
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints');
|
||||
if ($OldStatRecord) {
|
||||
$OldTotalRank = $OldStatRecord['total_rank'];
|
||||
$OldTechRank = $OldStatRecord['tech_rank'];
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ function GetTechnoPoints ( $CurrentUser ) {
|
|||
foreach ( $reslist['tech'] as $n => $Techno ) {
|
||||
if ( $CurrentUser[ $resource[ $Techno ] ] > 0 ) {
|
||||
for ( $Level = 1; $Level < $CurrentUser[ $resource[ $Techno ] ]; $Level++ ) {
|
||||
$Units = $pricelist[ $Techno ]['metal'] + $pricelist[ $Techno ]['cristal'] + $pricelist[ $Techno ]['deuterium'];
|
||||
$Units = $pricelist[ $Techno ]['metal'] + $pricelist[ $Techno ]['crystal'] + $pricelist[ $Techno ]['deuterium'];
|
||||
$LevelMul = pow( $pricelist[ $Techno ]['factor'], $Level );
|
||||
$TechPoints += ($Units * $LevelMul);
|
||||
$TechCounts += 1;
|
||||
|
|
@ -57,7 +57,7 @@ function GetBuildPoints ( $CurrentPlanet ) {
|
|||
foreach($reslist['build'] as $n => $Building) {
|
||||
if ( $CurrentPlanet[ $resource[ $Building ] ] > 0 ) {
|
||||
for ( $Level = 1; $Level < $CurrentPlanet[ $resource[ $Building ] ]; $Level++ ) {
|
||||
$Units = $pricelist[ $Building ]['metal'] + $pricelist[ $Building ]['cristal'] + $pricelist[ $Building ]['deuterium'];
|
||||
$Units = $pricelist[ $Building ]['metal'] + $pricelist[ $Building ]['crystal'] + $pricelist[ $Building ]['deuterium'];
|
||||
$LevelMul = pow( $pricelist[ $Building ]['factor'], $Level );
|
||||
$BuildPoints += ($Units * $LevelMul);
|
||||
$BuildCounts += 1;
|
||||
|
|
@ -77,7 +77,7 @@ function GetDefensePoints ( $CurrentPlanet ) {
|
|||
$DefensePoints = 0;
|
||||
foreach($reslist['defense'] as $n => $Defense) {
|
||||
if ($CurrentPlanet[ $resource[ $Defense ] ] > 0) {
|
||||
$Units = $pricelist[ $Defense ]['metal'] + $pricelist[ $Defense ]['cristal'] + $pricelist[ $Defense ]['deuterium'];
|
||||
$Units = $pricelist[ $Defense ]['metal'] + $pricelist[ $Defense ]['crystal'] + $pricelist[ $Defense ]['deuterium'];
|
||||
$DefensePoints += ($Units * $CurrentPlanet[ $resource[ $Defense ] ]);
|
||||
$DefenseCounts += $CurrentPlanet[ $resource[ $Defense ] ];
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ function GetFleetPoints ( $CurrentPlanet ) {
|
|||
$FleetPoints = 0;
|
||||
foreach($reslist['fleet'] as $n => $Fleet) {
|
||||
if ($CurrentPlanet[ $resource[ $Fleet ] ] > 0) {
|
||||
$Units = $pricelist[ $Fleet ]['metal'] + $pricelist[ $Fleet ]['cristal'] + $pricelist[ $Fleet ]['deuterium'];
|
||||
$Units = $pricelist[ $Fleet ]['metal'] + $pricelist[ $Fleet ]['crystal'] + $pricelist[ $Fleet ]['deuterium'];
|
||||
$FleetPoints += ($Units * $CurrentPlanet[ $resource[ $Fleet ] ]);
|
||||
$FleetCounts += $CurrentPlanet[ $resource[ $Fleet ] ];
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,23 +24,19 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
includeLang('admin');
|
||||
if ($_GET['cmd'] == 'dele') {
|
||||
$player = new Wootook_Player_Model_Entity();
|
||||
$player->load(intval($_GET['user']));
|
||||
if ($player->getId()) {
|
||||
$player->delete();
|
||||
}
|
||||
DeleteSelectedUser ( $_GET['user'] );
|
||||
}
|
||||
if ($_GET['cmd'] == 'sort') {
|
||||
$TypeSort = $_GET['type'];
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('IN_ADMIN', true);
|
||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||
require_once dirname(dirname(__FILE__)) .'/common.php';
|
||||
|
||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||
|
||||
70
ainfo.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
$dpath = (!$userrow["dpath"]) ? DEFAULT_SKINPATH : $userrow["dpath"];
|
||||
|
||||
|
||||
if(!is_numeric($_GET["a"]) || !$_GET["a"] ){ message("Ungültige Allianz-ID","Fehler");}
|
||||
|
||||
$allyrow = doquery("SELECT ally_name,ally_tag,ally_description,ally_web,ally_image FROM {{table}} WHERE id=".$_GET["a"],"alliance",true);
|
||||
|
||||
if(!$allyrow){ message("Alliance non trouvée","Erreur");}
|
||||
|
||||
$count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=".$_GET["a"].";","users",true);
|
||||
$ally_member_scount = $count[0];
|
||||
|
||||
$page .="<table width=519><tr><td class=c colspan=2>Informations sur l'alliance</td></tr>";
|
||||
|
||||
if($allyrow["ally_image"] != ""){
|
||||
$page .= "<tr><th colspan=2><img src=\"".$allyrow["ally_image"]."\"></td></tr>";
|
||||
}
|
||||
|
||||
$page .= "<tr><th>Tag</th><th>".$allyrow["ally_tag"]."</th></tr><tr><th>Nom</th><th>".$allyrow["ally_name"]."</th></tr><tr><th>Membres</th><th>$ally_member_scount</th></tr>";
|
||||
|
||||
if($allyrow["ally_description"] != ""){
|
||||
$page .= "<tr><th colspan=2 height=100>".$allyrow["ally_description"]."</th></tr>";
|
||||
}
|
||||
|
||||
|
||||
if($allyrow["ally_web"] != ""){
|
||||
$page .="<tr>
|
||||
<th>Site internet</th>
|
||||
<th><a href=\"".$allyrow["ally_web"]."\">".$allyrow["ally_web"]."</a></th>
|
||||
</tr>";
|
||||
}
|
||||
$page .= "</table>";
|
||||
|
||||
display($page,"Information sur l'alliance [".$allyrow["ally_name"]."]",false);
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,16 +24,16 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSTALL' , false);
|
||||
define('INSIDE' , true);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
|
||||
$db = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection(Wootook_Core_Database_ConnectionManager::DEFAULT_CONNECTION_NAME);
|
||||
$user = Legacies_Empire_Model_User::getSingleton();
|
||||
$db = Legacies_Database::getSingleton();
|
||||
|
||||
if(!$user->getId()){
|
||||
echo '<script language="javascript">';
|
||||
|
|
@ -41,31 +41,30 @@ echo 'parent.location="../";';
|
|||
echo '</script>';
|
||||
}
|
||||
|
||||
$request = Wootook::getRequest();
|
||||
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
|
||||
$yes = isset($_GET['yes']) ? $_GET['yes'] : null;
|
||||
$edit = isset($_GET['edit']) ? $_GET['edit'] : null;
|
||||
$allyid = isset($_GET['allyid']) ? intval($_GET['allyid']) : null;
|
||||
$kick = isset($_GET['kick']) ? $_GET['kick'] : null;
|
||||
$show = isset($_GET['show']) ? intval($_GET['show']) : null;
|
||||
$sort = isset($_GET['sort']) ? intval($_GET['sort']) : null;
|
||||
$sendmail = isset($_GET['sendmail']) ? intval($_GET['sendmail']) : null;
|
||||
$rank = isset($_GET['rank']) ? intval($_GET['rank']) : null;
|
||||
$t = isset($_GET['t']) ? $_GET['t'] : null;
|
||||
$a = isset($_GET['a']) ? intval($_GET['a']) : null;
|
||||
$tag = isset($_GET['tag']) ? $db->quote($_GET['tag']) : null;
|
||||
$page = isset($page) ? $page : null;
|
||||
$d = isset($_GET['d']) ? $_GET['d'] : null;
|
||||
$id = isset($_GET['id']) ? $_GET['id'] : null;
|
||||
|
||||
$mode = $request->getQuery('mode');
|
||||
$yes = $request->getQuery('yes');
|
||||
$edit = $request->getQuery('edit');
|
||||
$allyid = intval($request->getQuery('allyid'));
|
||||
$kick = $request->getQuery('kick');
|
||||
$show = intval($request->getQuery('show'));
|
||||
$sort = intval($request->getQuery('sort'));
|
||||
$sendmail = intval($request->getQuery('sendmail'));
|
||||
$rank = intval($request->getQuery('rank'));
|
||||
$t = $request->getQuery('t');
|
||||
$allianceId = intval($request->getQuery('a'));
|
||||
$tag = $request->getQuery('tag');
|
||||
$page = $request->getQuery('page');
|
||||
$d = $request->getQuery('d');
|
||||
$id = $request->getQuery('id');
|
||||
|
||||
$allianceIds = $request->getPost('id');
|
||||
$actionType = $request->getPost('t');
|
||||
$options = $request->getPost('options');
|
||||
$action = $request->getPost('action');
|
||||
$_POST['id'] = isset($_POST['id']) ? $_POST['id'] : null;
|
||||
$_POST['t'] = isset($_POST['t']) ? $_POST['t'] : null;
|
||||
$_POST['options'] = isset($_POST['options']) ? $_POST['options'] : null;
|
||||
$_POST['action'] = isset($_POST['action']) ? $_POST['action'] : null;
|
||||
|
||||
includeLang('alliance');
|
||||
|
||||
|
||||
/**
|
||||
*Alliance information display.
|
||||
*/
|
||||
|
|
@ -74,9 +73,9 @@ if ($mode == 'ainfo') {
|
|||
$lang['Alliance_information'] = "Information Alliance";
|
||||
|
||||
if ($tag) {
|
||||
$allyrow = doquery("SELECT * FROM {{table}} WHERE ally_tag={$db->quote($tag)}", "alliance", true);
|
||||
} elseif (is_numeric($allianceId) && $allianceId != 0) {
|
||||
$allyrow = doquery("SELECT * FROM {{table}} WHERE id='{$allianceId}'", "alliance", true);
|
||||
$allyrow = doquery("SELECT * FROM {{table}} WHERE ally_tag={$tag}", "alliance", true);
|
||||
} elseif (is_numeric($a) && $a != 0) {
|
||||
$allyrow = doquery("SELECT * FROM {{table}} WHERE id='{$a}'", "alliance", true);
|
||||
} else {
|
||||
message("Cette alliance n'existe pas !", "Information Alliance (1)");
|
||||
}
|
||||
|
|
@ -139,17 +138,17 @@ if ($user->getData('ally_id') == 0) {
|
|||
/*
|
||||
* Creation of the alliance
|
||||
*/
|
||||
if ($yes == 1 && $request->isPost()) {
|
||||
if ($yes == 1 && isset($_POST)) {
|
||||
|
||||
if ($request->getPost('atag') !== null) {
|
||||
if (empty($_POST['atag'])) {
|
||||
message($lang['have_not_tag'], $lang['make_alliance']);
|
||||
}
|
||||
if ($request->getPost('aname') !== null) {
|
||||
if (empty($_POST['aname'])) {
|
||||
message($lang['have_not_name'], $lang['make_alliance']);
|
||||
}
|
||||
|
||||
$alliance_name = $db->quote($request->getPost('aname'));
|
||||
$alliance_tag = $db->quote($request->getPost('atag'));
|
||||
$alliance_name = $db->quote($_POST['aname']);
|
||||
$alliance_tag = $db->quote($_POST['atag']);
|
||||
|
||||
$tagquery = doquery("SELECT * FROM {{table}} WHERE ally_tag=" .$alliance_tag. ";", 'alliance', true);
|
||||
|
||||
|
|
@ -157,7 +156,7 @@ if ($user->getData('ally_id') == 0) {
|
|||
message(str_replace('%s', $alliance_tag, $lang['always_exist']), $lang['make_alliance']);
|
||||
}
|
||||
$ranks = '';
|
||||
$allianz_raenge[] = array('name' => 'Novice',
|
||||
$allianz_raenge[] = array('name' => 'Novice',
|
||||
'mails' => 0,
|
||||
'delete' => 0,
|
||||
'kick' => 0,
|
||||
|
|
@ -176,7 +175,7 @@ if ($user->getData('ally_id') == 0) {
|
|||
`ally_tag`=" . $alliance_tag . " ,
|
||||
`ally_owner`='" .$user->getId(). "',
|
||||
`ally_owner_range`='Leader',
|
||||
`ally_ranks`='" . $ranks . "',
|
||||
`ally_ranks`='" . $ranks . "',
|
||||
`ally_members`='1',
|
||||
`ally_register_time`=" . time() , "alliance");
|
||||
|
||||
|
|
@ -201,11 +200,11 @@ if ($user->getData('ally_id') == 0) {
|
|||
if ($mode == 'search' && $user->getData('ally_request') == 0) {
|
||||
|
||||
$parse = $lang;
|
||||
$search_text = $request->getPost('searchtext');
|
||||
$search_text = isset($_POST['searchtext']) ? $_POST['searchtext'] : null;
|
||||
$lang['searchtext'] = $search_text;
|
||||
$page = parsetemplate(gettemplate('alliance_searchform'), $lang);
|
||||
|
||||
if ($request->getPost('searchtext') !== null) {
|
||||
if (isset($_POST['searchtext'])) {
|
||||
$stmt = $db->prepare("SELECT * FROM {$db->getTable('alliance')} WHERE ally_name LIKE :search_field OR ally_tag LIKE :search_field LIMIT 30");
|
||||
$stmt->execute(array(':search_field' => '%' .$search_text. '%'));
|
||||
if ($stmt->rowCount() != 0) {
|
||||
|
|
@ -245,8 +244,8 @@ if ($user->getData('ally_id') == 0) {
|
|||
|
||||
extract($allyrow);
|
||||
|
||||
if ($request->getPost('further') !== null && $request->getPost('further') == $lang['Send']) {
|
||||
doquery("UPDATE {{table}} SET `ally_request`='" . $allyid . "', ally_request_text=" . $db->quote($request->getPost('text')) . ", ally_register_time='" . time() . "' WHERE `id`='" . $user->getId(). "'", "users");
|
||||
if (isset($_POST['further']) && $_POST['further'] == $lang['Send']) {
|
||||
doquery("UPDATE {{table}} SET `ally_request`='" . $allyid . "', ally_request_text=" . $db->quote($_POST['text']) . ", ally_register_time='" . time() . "' WHERE `id`='" . $user->getId(). "'", "users");
|
||||
message($lang['apply_registered'], $lang['your_apply']);
|
||||
} else {
|
||||
$text_apply = ($ally_request) ? $ally_request : $lang['There_is_no_a_text_apply'];
|
||||
|
|
@ -270,7 +269,7 @@ if ($user->getData('ally_id') == 0) {
|
|||
$allyquery = doquery("SELECT ally_tag FROM {{table}} WHERE id='" . $user->getData('ally_request') . "' ORDER BY `id`", "alliance", true);
|
||||
|
||||
extract($allyquery);
|
||||
if ($request->getPost('bcancel') !== null) {
|
||||
if (isset($_POST['bcancel'])) {
|
||||
doquery("UPDATE {{table}} SET `ally_request`=0 WHERE `id`=" . $user->getId('id'), "users");
|
||||
|
||||
$lang['request_text'] = str_replace('%s', $ally_tag, $lang['Canceled_a_request_text']);
|
||||
|
|
@ -395,9 +394,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
message($lang['Denied_access'], $lang['Members_list']);
|
||||
}
|
||||
// Order of displaying the different users
|
||||
$sort2 = intval($request->getQuery('sort2'));
|
||||
$sort2 = isset($_GET['sort2']) ? intval($_GET['sort2']) : null;
|
||||
if ($sort2) {
|
||||
$sort1 = intval($request->getQuery('sort1'));
|
||||
$sort1 = isset($_GET['sort1']) ? intval($_GET['sort1']) : null;
|
||||
switch($sort1){
|
||||
case 1:
|
||||
$sort = " ORDER BY `username`";
|
||||
|
|
@ -507,9 +506,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
}
|
||||
|
||||
if ($sendmail == 1) {
|
||||
if ($request->getPost('r') !== null && is_numeric($request->getPost('r'))){
|
||||
$group_rank = intval($request->getPost('r'));
|
||||
$message_text = $db->quote($request->getPost('text'));
|
||||
if (isset($_POST['r']) && is_numeric($_POST['r'])){
|
||||
$group_rank = intval($_POST['r']);
|
||||
$message_text = $db->quote($_POST['text']);
|
||||
if ($group_rang == 0) {
|
||||
$sq = doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}'", "users");
|
||||
} else {
|
||||
|
|
@ -559,8 +558,8 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
|
||||
if ($ally['ally_owner'] != $user->getId() && !$user_can_edit_rights) {
|
||||
message($lang['Denied_access'], $lang['Members_list']);
|
||||
} else if ($request->getPost('newrangname') != '') {
|
||||
$name = strip_tags($request->getPost('newrangname'));
|
||||
} elseif (!empty($_POST['newrangname'])) {
|
||||
$name = strip_tags($_POST['newrangname']);
|
||||
|
||||
$allianz_raenge[] = array('name' => $name,
|
||||
'mails' => 0,
|
||||
|
|
@ -582,63 +581,63 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
|
||||
header("Location: " . $goto);
|
||||
exit();
|
||||
} elseif (is_array($allianceIds) && !empty($allianceIds)) {
|
||||
} elseif ($_POST['id'] != '' && is_array($_POST['id'])) {
|
||||
$ally_ranks_new = array();
|
||||
|
||||
foreach ($allianceIds as $id) {
|
||||
foreach ($_POST['id'] as $id) {
|
||||
$name = $allianz_raenge[$id]['name'];
|
||||
|
||||
$ally_ranks_new[$id]['name'] = $name;
|
||||
|
||||
if ($request->getPost('u' . $id . 'r0') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r0'])) {
|
||||
$ally_ranks_new[$id]['delete'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['delete'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r1') !== null && $ally['ally_owner'] == $user->getId()) {
|
||||
if (isset($_POST['u' . $id . 'r1']) && $ally['ally_owner'] == $user->getId()) {
|
||||
$ally_ranks_new[$id]['kick'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['kick'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r2') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r2'])) {
|
||||
$ally_ranks_new[$id]['bewerbungen'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['bewerbungen'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r3') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r3'])) {
|
||||
$ally_ranks_new[$id]['memberlist'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['memberlist'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r4') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r4'])) {
|
||||
$ally_ranks_new[$id]['bewerbungenbearbeiten'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['bewerbungenbearbeiten'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r5') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r5'])) {
|
||||
$ally_ranks_new[$id]['administrieren'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['administrieren'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r6') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r6'])) {
|
||||
$ally_ranks_new[$id]['onlinestatus'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['onlinestatus'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r7') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r7'])) {
|
||||
$ally_ranks_new[$id]['mails'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['mails'] = 0;
|
||||
}
|
||||
|
||||
if ($request->getPost('u' . $id . 'r8') !== null) {
|
||||
if (isset($_POST['u' . $id . 'r8'])) {
|
||||
$ally_ranks_new[$id]['rechtehand'] = 1;
|
||||
} else {
|
||||
$ally_ranks_new[$id]['rechtehand'] = 0;
|
||||
|
|
@ -672,6 +671,7 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
foreach($ally_ranks as $a => $b) {
|
||||
if ($ally['ally_owner'] == $user->getId()) {
|
||||
$lang['id'] = $a;
|
||||
$lang['delete'] = "<a href=\"alliance.php?mode=admin&edit=rights&d={$a}\"><img src=\"../pic/abort.gif\" alt=\"{$lang['Delete_range']}\" border=0></a>";
|
||||
$lang['r0'] = $b['name'];
|
||||
$lang['a'] = $a;
|
||||
$lang['r1'] = "<input type=checkbox name=\"u{$a}r0\"" . (($b['delete'] == 1)?' checked="checked"':'') . ">"; //{$b[1]}
|
||||
|
|
@ -688,6 +688,7 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
} else {
|
||||
$lang['id'] = $a;
|
||||
$lang['r0'] = $b['name'];
|
||||
$lang['delete'] = "<a href=\"alliance.php?mode=admin&edit=rights&d={$a}\"><img src=\"./pic/abort.gif\" alt=\"{$lang['Delete_range']}\" border=0></a>";
|
||||
$lang['a'] = $a;
|
||||
$lang['r1'] = "<b>-</b>";
|
||||
$lang['r2'] = "<input type=checkbox name=\"u{$a}r1\"" . (($b['kick'] == 1)?' checked="checked"':'') . ">";
|
||||
|
|
@ -720,18 +721,24 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
if ($t != 1 && $t != 2 && $t != 3) {
|
||||
$t = 1;
|
||||
}
|
||||
if (!get_magic_quotes_gpc()) {
|
||||
$_POST['owner_range'] = isset($_POST['owner_range']) ? stripslashes($_POST['owner_range']) : null;
|
||||
$_POST['web'] = isset($_POST['web']) ? stripslashes($_POST['web']) : null;
|
||||
$_POST['image'] = isset($_POST['image']) ? stripslashes($_POST['image']) : null;
|
||||
$_POST['text'] = isset($_POST['text']) ? stripslashes($_POST['text']) : null;
|
||||
}
|
||||
|
||||
if ($options) {
|
||||
$ally['ally_owner_range'] = htmlspecialchars(strip_tags($request->getPost('owner_range')));
|
||||
if ($_POST['options']) {
|
||||
$ally['ally_owner_range'] = htmlspecialchars(strip_tags($_POST['owner_range']));
|
||||
|
||||
$ally['ally_web'] = htmlspecialchars(strip_tags($request->getPost('web')));
|
||||
$ally['ally_web'] = htmlspecialchars(strip_tags($_POST['web']));
|
||||
|
||||
$ally['ally_image'] = htmlspecialchars(strip_tags($request->getPost('image')));
|
||||
$ally['ally_image'] = htmlspecialchars(strip_tags($_POST['image']));
|
||||
|
||||
$ally['ally_request_notallow'] = intval($request->getPost('request_notallow'));
|
||||
$ally['ally_request_notallow'] = intval($_POST['request_notallow']);
|
||||
|
||||
if ($ally['ally_request_notallow'] != 0 && $ally['ally_request_notallow'] != 1) {
|
||||
message("Aller � \"Candidature\" et sur une option dans le formulaire!", "Erreur");
|
||||
message("Aller � \"Candidature\" et sur une option dans le formulaire!", "Erreur");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
@ -741,20 +748,20 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
`ally_web`={$db->quote($ally['ally_web'])},
|
||||
`ally_request_notallow`='{$ally['ally_request_notallow']}'
|
||||
WHERE `id`='{$ally['id']}'", "alliance");
|
||||
} elseif ($actionType) {
|
||||
} elseif ($_POST['t']) {
|
||||
if ($t == 3) {
|
||||
$ally['ally_request'] = strip_tags($request->getPost('text'));
|
||||
$ally['ally_request'] = strip_tags($_POST['text']);
|
||||
|
||||
doquery("UPDATE {{table}} SET
|
||||
`ally_request`={$db->quote($ally['ally_request'])}
|
||||
WHERE `id`='{$ally['id']}'", "alliance");
|
||||
} elseif ($t == 2) {
|
||||
$ally['ally_text'] = strip_tags($request->getPost('text'));
|
||||
$ally['ally_text'] = strip_tags($_POST['text']);
|
||||
doquery("UPDATE {{table}} SET
|
||||
`ally_text`={$db->quote($ally['ally_text'])}
|
||||
WHERE `id`='{$ally['id']}'", "alliance");
|
||||
} else {
|
||||
$ally['ally_description'] = strip_tags($request->getPost('text'));
|
||||
$ally['ally_description'] = strip_tags($_POST['text']);
|
||||
|
||||
doquery("UPDATE {{table}} SET
|
||||
`ally_description`=" . $db->quote($ally['ally_description']) . "
|
||||
|
|
@ -801,8 +808,8 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
}
|
||||
|
||||
if ($mode == 'admin' && $edit == 'give') {
|
||||
if ($request->getPost('id')) {
|
||||
doquery("update {{table}} set `ally_owner`=".$db->quote($request->getPost('id'))." where `id`='".$user['ally_id']."'",'alliance');
|
||||
if ($_POST["id"]) {
|
||||
doquery("update {{table}} set `ally_owner`=".$db->quote($_POST["id"])." where `id`='".$user['ally_id']."'",'alliance');
|
||||
} else {
|
||||
$selection=doquery("SELECT * FROM {{table}} where ally_id='".$user['ally_id']."'",'users');
|
||||
$select='';
|
||||
|
|
@ -841,12 +848,12 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
if ($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
|
||||
doquery("UPDATE {{table}} SET `ally_id`='0', `ally_name`='', `ally_rank_id` = '0' WHERE `id`='{$u['id']}'", 'users');
|
||||
}
|
||||
} else if ($request->getPost('newrang') !== null) {
|
||||
$newrank = $request->getPost('newrang');
|
||||
$selectedUser = Wootook_Player_Model_Entity::factory($id);
|
||||
} elseif (isset($_POST['newrang'])) {
|
||||
$newrank = isset($_POST['newrang']) ? intval($_POST['newrang']) : null;
|
||||
$q = doquery("SELECT * FROM {{table}} WHERE id='{intval($id}' LIMIT 1", 'users', true);
|
||||
|
||||
if ($newrank !== null && isset($ally_ranks[$newrank]) && $selectedUser->getId() != $ally['ally_owner']) {
|
||||
$selectedUser->setData('ally_rank_id', $newrank)->save();
|
||||
if (isset($ally_ranks[$newrank]) && $q['id'] != $ally['ally_owner']) {
|
||||
doquery("UPDATE {{table}} SET `ally_rank_id`=" . $newrank . " WHERE `id`='" . intval($id) . "'", 'users');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -854,9 +861,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
$f_template = gettemplate('alliance_admin_members_function');
|
||||
|
||||
// Order of displaying the different users
|
||||
$sort2 = intval($request->getQuery('sort2'));
|
||||
$sort2 = isset($_GET['sort2']) ? intval($_GET['sort2']) : null;
|
||||
if ($sort2) {
|
||||
$sort1 = intval($request->getQuery('sort1'));
|
||||
$sort1 = isset($_GET['sort1']) ? intval($_GET['sort1']) : null;
|
||||
switch($sort1){
|
||||
case 1:
|
||||
$sort = " ORDER BY `username`";
|
||||
|
|
@ -992,7 +999,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
message($lang['Denied_access'], $lang['Check_the_requests']);
|
||||
}
|
||||
|
||||
if ($action == "Accepter") {
|
||||
if ($_POST['action'] == "Accepter") {
|
||||
$_POST['text'] = strip_tags($_POST['text']);
|
||||
|
||||
$u = doquery("SELECT * FROM {{table}} WHERE id=$show", 'users', true);
|
||||
// add points from the user who join the alliance
|
||||
doquery("UPDATE {{table}} SET
|
||||
|
|
@ -1008,7 +1017,7 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
mnl_alliance=mnl_alliance+1
|
||||
WHERE id='{$show}'", 'users');
|
||||
|
||||
$message = "Bonjour,<br>L'Alliance <b>{$ally['ally_name']}</b> a accepté votre candidature.<br>Charte:<br>{$request->getPost('text')}";
|
||||
$message = "Bonjour,<br>L'Alliance <b>{$ally['ally_name']}</b> a accepté votre candidature.<br>Charte:<br>{$_POST['text']}";
|
||||
// Send a message to the new member of the alliance
|
||||
doquery("INSERT INTO {{table}} SET
|
||||
`message_owner`=" .$db->quote($show).",
|
||||
|
|
@ -1022,10 +1031,12 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
header('Location: alliance.php?mode=admin&edit=requests');
|
||||
die();
|
||||
|
||||
} elseif ($action == "Refuser" && $action != '') {
|
||||
} elseif ($_POST['action'] == "Refuser" && $_POST['action'] != '') {
|
||||
$_POST['text'] = strip_tags($_POST['text']);
|
||||
|
||||
doquery("UPDATE {{table}} SET ally_request_text='',ally_request='0',ally_id='0',new_message=new_message+1, mnl_alliance=mnl_alliance+1 WHERE id={$db->quote($show)}", 'users');
|
||||
|
||||
$message = "Bonjour,<br>L'Alliance <b>{$ally['ally_name']}</b> a refusé votre candidature.<br>Raison:<br>{$request->getPost('text')}";
|
||||
$message = "Bonjour,<br>L'Alliance <b>{$ally['ally_name']}</b> a refusé votre candidature.<br>Raison:<br>{$_POST['text']}";
|
||||
// Send a polite message to the player that he is too noobish for that alliance.
|
||||
doquery("INSERT INTO {{table}} SET
|
||||
`message_owner`=" .$db->quote($show).",
|
||||
|
|
@ -1093,10 +1104,10 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
message($lang['Denied_access'], $lang['Members_list']);
|
||||
}
|
||||
|
||||
if ($request->getPost('newname') !== null) {
|
||||
if (isset($_POST['newname'])) {
|
||||
// Y a le nouveau Nom
|
||||
// New name so lets update all
|
||||
$ally['ally_name'] = strip_tags($request->getPost('newname'));
|
||||
$ally['ally_name'] = strip_tags($_POST['newname']);
|
||||
doquery("UPDATE {{table}} SET `ally_name` = ". $db->quote($ally['ally_name']) ." WHERE `id` = '". $user->getData('ally_id') ."';", 'alliance');
|
||||
doquery("UPDATE {{table}} SET `ally_name` = ". $db->quote($ally['ally_name']) ." WHERE `ally_id` = '". $ally['id'] ."';", 'users');
|
||||
}
|
||||
|
|
@ -1121,10 +1132,10 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
|
|||
message($lang['Denied_access'], $lang['Members_list']);
|
||||
}
|
||||
|
||||
if ($request->getPost('newtag') !== null) {
|
||||
if (isset($_POST['newtag'])) {
|
||||
// Y a le nouveau TAG
|
||||
// new TAG, lets update the table
|
||||
$ally['ally_tag'] = strip_tags($request->getPost('newtag'));
|
||||
$ally['ally_tag'] = strip_tags($_POST['newtag']);
|
||||
doquery("UPDATE {{table}} SET `ally_tag` = ". $db->quote($ally['ally_tag']) ." WHERE `id` = '". $user->getData('ally_id') ."';", 'alliance');
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,33 +24,42 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
|
||||
$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read');
|
||||
$writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write');
|
||||
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : null;
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
$users = doquery("SELECT * FROM {{table}} WHERE id='".$user['id']."';", 'users');
|
||||
$annonce = doquery("SELECT * FROM {{table}} ", 'annonce');
|
||||
$action = $_GET['action'];
|
||||
|
||||
if ($action == 5) {
|
||||
$writeAdapter->insert()
|
||||
->into($writeAdapter->getTable('annonce'))
|
||||
->set('user', $user->getUsername())
|
||||
->set('galaxie', $planet->getGalaxy())
|
||||
->set('systeme', $planet->getSystem())
|
||||
->set('metala', Wootook::getRequest()->getParam('metalvendre'))
|
||||
->set('cristala', Wootook::getRequest()->getParam('cristalvendre'))
|
||||
->set('deuta', Wootook::getRequest()->getParam('deutvendre'))
|
||||
->set('metals', Wootook::getRequest()->getParam('metalsouhait'))
|
||||
->set('cristals', Wootook::getRequest()->getParam('cristalsouhait'))
|
||||
->set('deuts', Wootook::getRequest()->getParam('deutsouhait'))
|
||||
->execute()
|
||||
;
|
||||
$metalvendre = $_POST['metalvendre'];
|
||||
$cristalvendre = $_POST['cristalvendre'];
|
||||
$deutvendre = $_POST['deutvendre'];
|
||||
|
||||
$metalsouhait = $_POST['metalsouhait'];
|
||||
$cristalsouhait = $_POST['cristalsouhait'];
|
||||
$deutsouhait = $_POST['deutsouhait'];
|
||||
|
||||
while ($v_annonce = $users->fetch(PDO::FETCH_BOTH)) {
|
||||
$user = $v_annonce['username'];
|
||||
$galaxie = $v_annonce['galaxy'];
|
||||
$systeme = $v_annonce['system'];
|
||||
}
|
||||
|
||||
doquery("INSERT INTO {{table}} SET
|
||||
user='{$user}',
|
||||
galaxie='{$galaxie}',
|
||||
systeme='{$systeme}',
|
||||
metala='{$metalvendre}',
|
||||
cristala='{$cristalvendre}',
|
||||
deuta='{$deutvendre}',
|
||||
metals='{$metalsouhait}',
|
||||
cristals='{$cristalsouhait}',
|
||||
deuts='{$deutsouhait}'" , "annonce");
|
||||
|
||||
$page2 .= <<<HTML
|
||||
<center>
|
||||
|
|
@ -64,7 +73,7 @@ HTML;
|
|||
}
|
||||
|
||||
if ($action != 5) {
|
||||
$statement = $readAdapter->select()->from(array('annonce' => $readAdapter->getTable('annonce')))->order('id', 'DESC')->prepare();
|
||||
$annonce = doquery("SELECT * FROM {{table}} ORDER BY `id` DESC ", "annonce");
|
||||
|
||||
$page2 = "<HTML>
|
||||
<center>
|
||||
|
|
@ -73,9 +82,12 @@ if ($action != 5) {
|
|||
<td class=\"c\" colspan=\"10\"><font color=\"#FFFFFF\">Petites Annonces</font></td></tr>
|
||||
<tr><th colspan=\"3\">Infos de livraison</th><th colspan=\"3\">Ressources à vendre</th><th colspan=\"3\">Ressources souhaitées</th><th>Action</th></tr>
|
||||
<tr><th>Vendeur</th><th>Galaxie</th><th>Système</th><th>Métal</th><th>Cristal</th><th>Deuterium</th><th>Métal</th><th>Cristal</th><th>Deuterium</th><th>Delet</th></tr>
|
||||
";
|
||||
|
||||
foreach ($statement as $b) {
|
||||
|
||||
|
||||
|
||||
";
|
||||
while ($b = $annonce->fetch(PDO::FETCH_BOTH)) {
|
||||
$page2 .= '<tr><th> ';
|
||||
$page2 .= $b["user"] ;
|
||||
$page2 .= '</th><th>';
|
||||
|
|
@ -107,3 +119,4 @@ if ($action != 5) {
|
|||
display($page2);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
$actions = $_GET['action'];
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
|
||||
includeLang('banned');
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
includeLang('buddy');
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ if ( $a == 1 ) {
|
|||
}
|
||||
$buddyrow = doquery( "SELECT * FROM {{table}} " . $query, 'buddy' );
|
||||
|
||||
while ( $b = $buddyrow->fetch(PDO::FETCH_BOTH) ) {
|
||||
while ( $b = mysql_fetch_array( $buddyrow ) ) {
|
||||
// para solicitudes
|
||||
if ( !isset( $i ) && isset( $a ) ) {
|
||||
$page .= "
|
||||
146
build.xml
|
|
@ -1,146 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?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>
|
||||
151
buildings.php
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('planet.shipyard');
|
||||
|
||||
echo $layout->render();
|
||||
break;
|
||||
|
||||
case 'research':
|
||||
if ($planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB) === null) {
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('message');
|
||||
|
||||
$block = $layout->getBlock('message');
|
||||
$block['title'] = Legacies::__('Research lab is required');
|
||||
$block['title'] = Legacies::__('In order to do technological researches, you will need to build a research lab building.');
|
||||
|
||||
$layout->render();
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($_GET['research']) && !empty($_GET['research'])) {
|
||||
$data = $planet->getAllDatas();
|
||||
$planet->appendBuildingQueue(intval($_GET['research']), isset($_GET['destroy']));
|
||||
$planet->save();
|
||||
} else if (isset($_GET['cancel']) && !empty($_GET['cancel'])) {
|
||||
$planet->dequeueItem($_GET['cancel']);
|
||||
$planet->save();
|
||||
}
|
||||
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('planet.research-lab');
|
||||
|
||||
echo $layout->render();
|
||||
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();
|
||||
}
|
||||
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('planet.defense');
|
||||
|
||||
/** @var Legacies_Empire_Block_Planet_Shipyard $block */
|
||||
$block = $layout->getBlock('item-list');
|
||||
$block->setType(Legacies_Empire::TYPE_DEFENSE);
|
||||
|
||||
echo $layout->render();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isset($_GET['building']) && !empty($_GET['building'])) {
|
||||
$data = $planet->getAllDatas();
|
||||
$planet->appendBuildingQueue(intval($_GET['building']), isset($_GET['destroy']));
|
||||
$planet->save();
|
||||
} else if (isset($_GET['cancel']) && !empty($_GET['cancel'])) {
|
||||
$planet->dequeueItem($_GET['cancel']);
|
||||
$planet->save();
|
||||
}
|
||||
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('planet.buildings');
|
||||
echo $layout->render();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
includeLang('changelog');
|
||||
|
||||
$template = gettemplate('changelog_table');
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
includeLang('chat');
|
||||
$BodyTPL = gettemplate('chat_body');
|
||||
|
|
@ -41,5 +41,5 @@ require_once dirname(__FILE__) .'/application/bootstrap.php';
|
|||
$page = parsetemplate($BodyTPL, $parse);
|
||||
display($page, $lang['Chat'], false);
|
||||
|
||||
// Shoutbox by e-Zobar - Copyright Wootook Team 2008
|
||||
// Shoutbox by e-Zobar - Copyright XNova Team 2008
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
// On récupère les informations du message et de l'envoyeur
|
||||
if (isset($_POST["msg"]) && isset($user['username'])) {
|
||||
|
|
@ -49,5 +49,5 @@ require_once dirname(__FILE__) .'/application/bootstrap.php';
|
|||
$query = doquery("INSERT INTO {{table}}(user, message, timestamp) VALUES ('".$nick."', '".$msg."', '".time()."')", "chat");
|
||||
}
|
||||
|
||||
// Shoutbox by e-Zobar - Copyright Wootook Team 2008
|
||||
// Shoutbox by e-Zobar - Copyright XNova Team 2008
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
// On efface les anciens messages
|
||||
$timemoment=time();
|
||||
|
|
@ -62,12 +62,12 @@ while($v=mysql_fetch_object($query)){
|
|||
$msg=preg_replace("#:\(#isU","<img src=\"images/smileys/sad.png\" align=\"absmiddle\" title=\":(\" alt=\":(\">",$msg);
|
||||
$msg=preg_replace("#;\)#isU","<img src=\"images/smileys/wink.png\" align=\"absmiddle\" title=\";)\" alt=\";)\">",$msg);
|
||||
$msg=preg_replace("#:s#isU","<img src=\"images/smileys/shit.png\" align=\"absmiddle\" title=\":s\" alt=\":s\">",$msg);
|
||||
$msg=preg_replace("#xnova#","<a href=\"http://wootook.org\">Wootook</a>",$msg);
|
||||
$msg=preg_replace("#xnova#","<a href=\"http://www.xnova-ng.org\">XNova</a>",$msg);
|
||||
|
||||
// Affichage du message
|
||||
$msg="<div align=\"left\">".$nick." > ".$msg."<br></div>";
|
||||
print stripslashes($msg);
|
||||
}
|
||||
|
||||
// Shoutbox by e-Zobar - Copyright Wootook Team 2008
|
||||
// Shoutbox by e-Zobar - Copyright XNova Team 2008
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,15 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHP_VERSION_ID')) {
|
||||
$version = explode('.',PHP_VERSION);
|
||||
define('PHP_VERSION_ID', (((int)$version[0]) * 10000 + ((int)$version[1]) * 100 + ((int)$version[2])));
|
||||
unset($version);
|
||||
}
|
||||
defined('BCNUMBERS') || define('BCNUMBERS', true);
|
||||
defined('DEPRECATION') || define('DEPRECATION', true);
|
||||
defined('DEBUG') || define('DEBUG', true);
|
||||
|
||||
if (!defined('DEBUG') && ($env = getenv('DEBUG')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) {
|
||||
define('DEBUG', true);
|
||||
|
|
@ -59,12 +57,12 @@ if (!defined('DEBUG')) {
|
|||
@error_reporting(E_ALL | E_STRICT);
|
||||
}
|
||||
|
||||
defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
|
||||
defined('APPLICATION_PATH') || define('APPLICATION_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
||||
defined('ROOT_PATH') || define('ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
||||
defined('APPLICATION_PATH') || define('APPLICATION_PATH', ROOT_PATH . 'includes' . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR);
|
||||
|
||||
defined('PHPEXT') || define('PHPEXT', 'php');
|
||||
defined('PHPEXT') || define('PHPEXT', require 'extension.inc');
|
||||
|
||||
defined('VERSION') || define('VERSION', '1.5.0-beta2');
|
||||
defined('VERSION') || define('VERSION', '2011.1');
|
||||
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'libraries',
|
||||
|
|
@ -78,63 +76,52 @@ function __autoload($class) {
|
|||
include_once str_replace('_', '/', $class) . '.php';
|
||||
}
|
||||
|
||||
if (defined('IN_ADMIN')) {
|
||||
$website = new Wootook_Core_Model_Website();
|
||||
$website->setId(0)->setData('code', 'admin');
|
||||
Wootook::addWebsite($website);
|
||||
Wootook::setDefaultWebsite($website);
|
||||
Legacies_Core_Time::init();
|
||||
Legacies_Core_ErrorProfiler::register();
|
||||
|
||||
$game = new Wootook_Core_Model_Game();
|
||||
$game->setId(0)->setData('code', 'admin')->setData('website_id', $website->getId());
|
||||
Wootook::addGame($game);
|
||||
Wootook::setDefaultGame($game);
|
||||
if (0 === filesize(ROOT_PATH . 'config.php')) {
|
||||
header('Location: install/');
|
||||
die();
|
||||
}
|
||||
|
||||
include ROOT_PATH . 'includes/constants.php';
|
||||
|
||||
if (defined('DEBUG')) {
|
||||
Wootook_Core_ErrorProfiler::register();
|
||||
}
|
||||
Wootook_Core_Helper_Config_Events::registerEvents();
|
||||
|
||||
if (!Wootook::$isInstalled) {
|
||||
Wootook::getResponse()
|
||||
->setRedirect(Wootook::getStaticUrl('install/'), Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_TEMPORARY)
|
||||
->sendHeaders();
|
||||
exit(0);
|
||||
foreach (include ROOT_PATH . 'includes/data/events.php' as $event => $listenerList) {
|
||||
foreach ($listenerList as $listener) {
|
||||
Legacies::registerListener($event, $listener);
|
||||
}
|
||||
}
|
||||
|
||||
$lang = array();
|
||||
|
||||
define('TEMPLATE_DIR', realpath(ROOT_PATH . '/templates/'));
|
||||
define('TEMPLATE_NAME', 'OpenGame');
|
||||
define('DEFAULT_LANG', 'fr');
|
||||
|
||||
include(ROOT_PATH . 'includes/debug.class.'.PHPEXT);
|
||||
$debug = new Debug();
|
||||
|
||||
include(ROOT_PATH . 'includes/constants.' . PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions.' . PHPEXT);
|
||||
include(ROOT_PATH . 'includes/unlocalised.' . PHPEXT);
|
||||
include(ROOT_PATH . 'includes/todofleetcontrol.' . PHPEXT);
|
||||
include(ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg');
|
||||
include(ROOT_PATH . 'includes/vars.' . PHPEXT);
|
||||
include(ROOT_PATH . 'db/mysql.' . PHPEXT);
|
||||
include(ROOT_PATH . 'includes/strings.' . PHPEXT);
|
||||
|
||||
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
|
||||
$gameConfig = Legacies_Core_Model_Config::getSingleton();
|
||||
if (isset($gameConfig['cookie_name']) && !empty($gameConfig['cookie_name'])) {
|
||||
Legacies_Empire_Model_User::setCookieName($gameConfig['cookie_name']);
|
||||
}
|
||||
$user = Legacies_Empire_Model_User::getSingleton();
|
||||
|
||||
if (!defined('DISABLE_IDENTITY_CHECK')) {
|
||||
if ($user === null || !$user->getId()) {
|
||||
Wootook::getResponse()
|
||||
->setRedirect(Wootook::getUrl('player/account/login'))
|
||||
->sendHeaders();
|
||||
if (($user === null || !$user->getId())) {
|
||||
header('Location: login.php');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//var_dump(Wootook::getGameConfig('game/general/active'));
|
||||
if (!Wootook::getGameConfig('game/general/active')/* && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))*/) {
|
||||
$layout = new Wootook_Core_Model_Layout(Wootook_Core_Model_Layout::DOMAIN_FRONTEND);
|
||||
$layout->load('message');
|
||||
|
||||
$block = $layout->getBlock('message');
|
||||
$block['title'] = Wootook::__('Game is disabled.');
|
||||
$block['message'] = Wootook::getGameConfig('game/general/closing-message');
|
||||
|
||||
echo $layout->render();
|
||||
if ($gameConfig->isEnabled() && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) {
|
||||
message(stripslashes($gameConfig->getData('close_reason')), $gameConfig->getData('game_name'));
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -156,7 +143,7 @@ if (($user !== null && $user->getId())) {
|
|||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Wootook::dispatchEvent('planet.update', array(
|
||||
Legacies::dispatchEvent('planet.update', array(
|
||||
'planet' => $planet
|
||||
));
|
||||
$planet->save();
|
||||
21
config.php.default
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?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'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('DISABLE_IDENTITY_CHECK', true);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
includeLang('contact');
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ require_once dirname(__FILE__) .'/application/bootstrap.php';
|
|||
$QrySelectUser .= "WHERE `authlevel` != '0' ORDER BY `authlevel` DESC;";
|
||||
$GameOps = doquery ( $QrySelectUser, 'users');
|
||||
|
||||
while( $Ops = $GameOps->fetch(PDO::FETCH_ASSOC) ) {
|
||||
while( $Ops = mysql_fetch_assoc($GameOps) ) {
|
||||
$bloc['ctc_data_name'] = $Ops['username'];
|
||||
$bloc['ctc_data_auth'] = $lang['user_level'][$Ops['authlevel']];
|
||||
$bloc['ctc_data_mail'] = "<a href=mailto:".$Ops['email'].">".$Ops['email']."</a>";
|
||||
64
db/mysql.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 782 B After Width: | Height: | Size: 782 B |
|
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 718 B |
|
Before Width: | Height: | Size: 669 B After Width: | Height: | Size: 669 B |
|
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 495 B |
|
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 683 B |
|
Before Width: | Height: | Size: 954 B After Width: | Height: | Size: 954 B |
|
Before Width: | Height: | Size: 733 B After Width: | Height: | Size: 733 B |
1
extension.inc
Normal file
|
|
@ -0,0 +1 @@
|
|||
<?php return 'php';
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
285
fleet.php
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
$maxfleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets', true);
|
||||
|
||||
$MaxFlyingFleets = $maxfleet['actcnt'];
|
||||
|
||||
//Compteur de flotte en expéditions et nombre d'expédition maximum
|
||||
$MaxExpedition = $user[$resource[124]];
|
||||
if ($MaxExpedition >= 1) {
|
||||
$maxexpde = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets', true);
|
||||
$ExpeditionEnCours = $maxexpde['expedi'];
|
||||
$EnvoiMaxExpedition = 1 + floor( $MaxExpedition / 3 );
|
||||
}
|
||||
|
||||
$MaxFlottes = 1 + $user[$resource[108]];
|
||||
|
||||
CheckPlanetUsedFields($planetrow);
|
||||
|
||||
includeLang('fleet');
|
||||
|
||||
$missiontype = array(
|
||||
1 => $lang['type_mission'][1],
|
||||
2 => $lang['type_mission'][2],
|
||||
3 => $lang['type_mission'][3],
|
||||
4 => $lang['type_mission'][4],
|
||||
5 => $lang['type_mission'][5],
|
||||
6 => $lang['type_mission'][6],
|
||||
7 => $lang['type_mission'][7],
|
||||
8 => $lang['type_mission'][8],
|
||||
9 => $lang['type_mission'][9],
|
||||
15 => $lang['type_mission'][15]
|
||||
);
|
||||
|
||||
// Histoire de recuperer les infos passées par galaxy
|
||||
$galaxy = $_GET['galaxy'];
|
||||
$system = $_GET['system'];
|
||||
$planet = $_GET['planet'];
|
||||
$planettype = $_GET['planettype'];
|
||||
$target_mission = $_GET['target_mission'];
|
||||
|
||||
if (!$galaxy) {
|
||||
$galaxy = $planetrow['galaxy'];
|
||||
}
|
||||
if (!$system) {
|
||||
$system = $planetrow['system'];
|
||||
}
|
||||
if (!$planet) {
|
||||
$planet = $planetrow['planet'];
|
||||
}
|
||||
if (!$planettype) {
|
||||
$planettype = $planetrow['planet_type'];
|
||||
}
|
||||
|
||||
$page = "<script language=\"JavaScript\" src=\"scripts/flotten.js\"></script>\n";
|
||||
$page .= "<script language=\"JavaScript\" src=\"scripts/ocnt.js\"></script>\n";
|
||||
$page .= "<br><center>";
|
||||
$page .= "<table width='519' border='0' cellpadding='0' cellspacing='1'>";
|
||||
$page .= "<tr height='20'>";
|
||||
$page .= "<td colspan='9' class='c'>";
|
||||
$page .= "<table border=\"0\" width=\"100%\">";
|
||||
$page .= "<tbody><tr>";
|
||||
$page .= "<td style=\"background-color: transparent;\">";
|
||||
$page .= $lang['fl_title']." ".$MaxFlyingFleets." ".$lang['fl_sur']." ".$MaxFlottes;
|
||||
$page .= "</td><td style=\"background-color: transparent;\" align=\"right\">";
|
||||
$page .= $ExpeditionEnCours."/".$EnvoiMaxExpedition." ".$lang['fl_expttl'];
|
||||
$page .= "</td>";
|
||||
$page .= "</tr></tbody></table>";
|
||||
$page .= "</td>";
|
||||
$page .= "</tr><tr height='20'>";
|
||||
$page .= "<th>".$lang['fl_id']."</th>";
|
||||
$page .= "<th>".$lang['fl_mission']."</th>";
|
||||
$page .= "<th>".$lang['fl_count']."</th>";
|
||||
$page .= "<th>".$lang['fl_from']."</th>";
|
||||
$page .= "<th>".$lang['fl_start_t']."</th>";
|
||||
$page .= "<th>".$lang['fl_dest']."</th>";
|
||||
$page .= "<th>".$lang['fl_dest_t']."</th>";
|
||||
// $page .= "<th>".$lang['fl_back_t']."</th>";
|
||||
$page .= "<th>".$lang['fl_back_in']."</th>";
|
||||
$page .= "<th>".$lang['fl_order']."</th>";
|
||||
$page .= "</tr>";
|
||||
|
||||
// Gestion des flottes du joueur actif
|
||||
$fq = doquery("SELECT * FROM {{table}} WHERE fleet_owner={$user[id]}", "fleets");
|
||||
$i = 0;
|
||||
|
||||
|
||||
while ($f = $fq->fetch(PDO::FETCH_BOTH)) {
|
||||
$i++;
|
||||
$page .= "<tr height=20>";
|
||||
// (01) Fleet ID
|
||||
$page .= "<th>".$i."</th>";
|
||||
// (02) Fleet Mission
|
||||
$page .= "<th>";
|
||||
$page .= "<a>". $missiontype[$f[fleet_mission]] ."</a>";
|
||||
if (($f['fleet_start_time'] + 1) == $f['fleet_end_time']) {
|
||||
$page .= "<br><a title=\"".$lang['fl_back_to_ttl']."\">".$lang['fl_back_to']."</a>";
|
||||
} else {
|
||||
$page .= "<br><a title=\"".$lang['fl_get_to_ttl']."\">".$lang['fl_get_to']."</a>";
|
||||
}
|
||||
$page .= "</th>";
|
||||
// (03) Fleet Mission
|
||||
$page .= "<th><a title=\"";
|
||||
// Fleet details (commentaire)
|
||||
$fleet = explode(";", $f['fleet_array']);
|
||||
$e = 0;
|
||||
foreach ($fleet as $a => $b) {
|
||||
if ($b != '') {
|
||||
$e++;
|
||||
$a = explode(",", $b);
|
||||
$page .= $lang['tech'][$a[0]]. ":". $a[1] ."\n";
|
||||
if ($e > 1) {
|
||||
$page .= "\t";
|
||||
}
|
||||
}
|
||||
}
|
||||
$page .= "\">". pretty_number($f[fleet_amount]) ."</a></th>";
|
||||
// (04) Fleet From (Planete d'origine)
|
||||
$page .= "<th>[".$f[fleet_start_galaxy].":".$f[fleet_start_system].":".$f[fleet_start_planet]."]</th>";
|
||||
// (05) Fleet Start Time
|
||||
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_start_time']) ."</th>";
|
||||
// (06) Fleet Target (Planete de destination)
|
||||
$page .= "<th>[".$f[fleet_end_galaxy].":".$f[fleet_end_system].":".$f[fleet_end_planet]."]</th>";
|
||||
// (07) Fleet Target Time
|
||||
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_end_time']) ."</th>";
|
||||
// (08) Fleet Back Time
|
||||
// $page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
|
||||
// (09) Fleet Back In
|
||||
$page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
|
||||
// (10) Orders
|
||||
$page .= "<th>";
|
||||
if ($f['fleet_mess'] == 0) {
|
||||
$page .= "<form action=\"fleetback.php\" method=\"post\">";
|
||||
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
|
||||
$page .= "<input value=\" ".$lang['fl_back_to_ttl']." \" type=\"submit\" name=\"send\">";
|
||||
$page .= "</form>";
|
||||
if ($f[fleet_mission] == 1) {
|
||||
$page .= "<form action=\"verband.php\" method=\"post\">";
|
||||
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
|
||||
$page .= "<input value=\" ".$lang['fl_associate']." \" type=\"submit\">";
|
||||
$page .= "</form>";
|
||||
}
|
||||
} else {
|
||||
$page .= " - ";
|
||||
}
|
||||
$page .= "</th>";
|
||||
// Fin de ligne
|
||||
$page .= "</tr>";
|
||||
}
|
||||
|
||||
// Y a pas de flottes en vol ... on met des '-'
|
||||
if ($i == 0) {
|
||||
$page .= "<tr>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
// $page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "</tr>";
|
||||
}
|
||||
|
||||
if ($MaxFlottes == $MaxFlyingFleets) {
|
||||
$page .= "<tr height=\"20\"><th colspan=\"9\"><font color=\"red\">".$lang['fl_noslotfree']."</font></th></tr>";
|
||||
}
|
||||
|
||||
$page .= "</table></center>";
|
||||
|
||||
$page .= "<center>";
|
||||
|
||||
// Selection d'une nouvelle mission
|
||||
$page .= "<form action=\"floten1.php\" method=\"post\">";
|
||||
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<td colspan=\"4\" class=\"c\">".$lang['fl_new_miss']."</td>";
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th>".$lang['fl_fleet_typ']."</th>";
|
||||
$page .= "<th>".$lang['fl_fleet_disp']."</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "<th>-</th>";
|
||||
$page .= "</tr>";
|
||||
|
||||
if (!$planetrow) {
|
||||
message($lang['fl_noplanetrow'], $lang['fl_error']);
|
||||
}
|
||||
|
||||
// Prise des coordonnées sur la ligne de commande
|
||||
$galaxy = intval($_GET['galaxy']);
|
||||
$system = intval($_GET['system']);
|
||||
$planet = intval($_GET['planet']);
|
||||
$planettype = intval($_GET['planettype']);
|
||||
$target_mission = intval($_GET['target_mission']);
|
||||
$ShipData = "";
|
||||
|
||||
foreach ($reslist['fleet'] as $n => $i) {
|
||||
if ($planetrow[$resource[$i]] > 0) {
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th><a title=\"". $lang['fl_fleetspeed'] . $CurrentShipSpeed ."\">" . $lang['tech'][$i] . "</a></th>";
|
||||
$page .= "<th>". pretty_number ($planetrow[$resource[$i]]);
|
||||
$ShipData .= "<input type=\"hidden\" name=\"maxship". $i ."\" value=\"". $planetrow[$resource[$i]] ."\" />";
|
||||
$ShipData .= "<input type=\"hidden\" name=\"consumption". $i ."\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
|
||||
$ShipData .= "<input type=\"hidden\" name=\"speed" .$i ."\" value=\"" . GetFleetMaxSpeed ("", $i, $user) . "\" />";
|
||||
$ShipData .= "<input type=\"hidden\" name=\"capacity". $i ."\" value=\"". $pricelist[$i]['capacity'] ."\" />";
|
||||
$page .= "</th>";
|
||||
// Satelitte Solaire (eux ne peuvent pas bouger !)
|
||||
if ($i == 212) {
|
||||
$page .= "<th></th><th></th>";
|
||||
} else {
|
||||
$page .= "<th><a href=\"javascript:maxShip('ship". $i ."'); shortInfo();\">".$lang['fl_selmax']."</a> </th>";
|
||||
$page .= "<th><input name=\"ship". $i ."\" size=\"10\" value=\"0\" onfocus=\"javascript:if(this.value == '0') this.value='';\" onblur=\"javascript:if(this.value == '') this.value='0';\" alt=\"". $lang['tech'][$i] . $planetrow[$resource[$i]] ."\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" /></th>";
|
||||
}
|
||||
$page .= "</tr>";
|
||||
}
|
||||
$have_ships = true;
|
||||
}
|
||||
|
||||
$btncontinue = "<tr height=\"20\"><th colspan=\"4\"><input type=\"submit\" value=\" ".$lang['fl_continue']." \" /></th>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
if (!$have_ships) {
|
||||
// Il n'y a pas de vaisseaux sur cette planete
|
||||
$page .= "<th colspan=\"4\">". $lang['fl_noships'] ."</th>";
|
||||
$page .= "</tr>";
|
||||
$page .= $btncontinue;
|
||||
} else {
|
||||
$page .= "<th colspan=\"2\"><a href=\"javascript:noShips();shortInfo();noResources();\" >". $lang['fl_unselectall'] ."</a></th>";
|
||||
$page .= "<th colspan=\"2\"><a href=\"javascript:maxShips();shortInfo();\" >". $lang['fl_selectall'] ."</a></th>";
|
||||
$page .= "</tr>";
|
||||
|
||||
if ($MaxFlottes > $MaxFlyingFleets) {
|
||||
$page .= $btncontinue;
|
||||
}
|
||||
}
|
||||
$page .= "</tr>";
|
||||
$page .= "</table>";
|
||||
$page .= $ShipData;
|
||||
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $planet ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"planet_type\" value=\"". $planettype ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"mission\" value=\"". $target_mission ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $EnvoiMaxExpedition ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
|
||||
$page .= "</form>";
|
||||
$page .= "</center>";
|
||||
|
||||
display($page, $lang['fl_title']);
|
||||
|
||||
?>
|
||||
73
fleetback.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?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);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
?>
|
||||
165
fleetshortcut.php
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
|
||||
$mode = $_GET['mode'];
|
||||
$a = $_GET['a'];
|
||||
/*
|
||||
Este script es original xD
|
||||
La funcion de este script es administrar una variable del $user
|
||||
Permite agregar y quitar arrays...
|
||||
*/
|
||||
//Lets start!
|
||||
if(isset($_GET['mode'])){
|
||||
if($_POST){
|
||||
//Pegamos el texto :P
|
||||
if($_POST["n"] == ""){$_POST["n"] = "Unbenannt";}
|
||||
|
||||
$r = strip_tags($_POST[n]).",".intval($_POST[g]).",".intval($_POST[s]).",".intval($_POST[p]).",".intval($_POST[t])."\r\n";
|
||||
$user['fleet_shortcut'] .= $r;
|
||||
doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users");
|
||||
message("Le raccourcis a été enregistré !","Enregistrment","fleetshortcut.php");
|
||||
}
|
||||
$page = "<form method=POST><table border=0 cellpadding=0 cellspacing=1 width=519>
|
||||
<tr height=20>
|
||||
<td colspan=2 class=c>Nom [Galaxie/Système solaire/Planète]</td>
|
||||
</tr><tr height=\"20\"><th>
|
||||
<input type=text name=n value=\"$g\" size=32 maxlength=32 title=\"Name\">
|
||||
<input type=text name=g value=\"$s\" size=3 maxlength=1 title=\"Galaxie\">
|
||||
<input type=text name=s value=\"$p\" size=3 maxlength=3 title=\"Sonnensystem\">
|
||||
<input type=text name=p value=\"$t\" size=3 maxlength=3 title=\"Planet\">
|
||||
<select name=t>";
|
||||
$page .= '<option value="1"'.(($c[4]==1)?" SELECTED":"").">Planète</option>";
|
||||
$page .= '<option value="2"'.(($c[4]==2)?" SELECTED":"").">Débris</option>";
|
||||
$page .= '<option value="3"'.(($c[4]==3)?" SELECTED":"").">Lune</option>";
|
||||
$page .= "</select>
|
||||
</th></tr><tr>
|
||||
<th><input type=\"reset\" value=\"Zurücksetzen\"> <input type=\"submit\" value=\"Enregistrer\">";
|
||||
//Muestra un (L) si el destino pertenece a luna, lo mismo para escombros
|
||||
$page .= "</th></tr>";
|
||||
$page .= '<tr><td colspan=2 class=c><a href=fleetshortcut.php>Effacer</a></td></tr></tr></table></form>';
|
||||
}
|
||||
elseif(isset($_GET['a'])){
|
||||
if($_POST){
|
||||
//Armamos el array...
|
||||
$scarray = explode("\r\n",$user['fleet_shortcut']);
|
||||
if($_POST["delete"]){
|
||||
unset($scarray[$a]);
|
||||
$user['fleet_shortcut'] = implode("\r\n",$scarray);
|
||||
doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users");
|
||||
message("Shortcut wurde gelöscht","Gelöscht","fleetshortcut.php");
|
||||
}
|
||||
else{
|
||||
$r = explode(",",$scarray[$a]);
|
||||
$r[0] = strip_tags($_POST['n']);
|
||||
$r[1] = intval($_POST['g']);
|
||||
$r[2] = intval($_POST['s']);
|
||||
$r[3] = intval($_POST['p']);
|
||||
$r[4] = intval($_POST['t']);
|
||||
$scarray[$a] = implode(",",$r);
|
||||
$user['fleet_shortcut'] = implode("\r\n",$scarray);
|
||||
doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users");
|
||||
message("Le raccourcis a été édité !.","Editer","fleetshortcut.php");
|
||||
}
|
||||
}
|
||||
if($user['fleet_shortcut']){
|
||||
|
||||
$scarray = explode("\r\n",$user['fleet_shortcut']);
|
||||
$c = explode(',',$scarray[$a]);
|
||||
|
||||
$page = "<form method=POST><table border=0 cellpadding=0 cellspacing=1 width=519>
|
||||
<tr height=20>
|
||||
<td colspan=2 class=c>Editer: {$c[0]} [{$c[1]}:{$c[2]}:{$c[3]}]</td>
|
||||
</tr>";
|
||||
//if($i==0){$page .= "";}
|
||||
$page .= "<tr height=\"20\"><th>
|
||||
<input type=hidden name=a value=$a>
|
||||
<input type=text name=n value=\"{$c[0]}\" size=32 maxlength=32>
|
||||
<input type=text name=g value=\"{$c[1]}\" size=3 maxlength=1>
|
||||
<input type=text name=s value=\"{$c[2]}\" size=3 maxlength=3>
|
||||
<input type=text name=p value=\"{$c[3]}\" size=3 maxlength=3>
|
||||
<select name=t>";
|
||||
$page .= '<option value="1"'.(($c[4]==1)?" SELECTED":"").">Planète</option>";
|
||||
$page .= '<option value="2"'.(($c[4]==2)?" SELECTED":"").">Débris</option>";
|
||||
$page .= '<option value="3"'.(($c[4]==3)?" SELECTED":"").">Lune</option>";
|
||||
$page .= "</select>
|
||||
</th></tr><tr>
|
||||
<th><input type=reset value=\"Reset\"> <input type=submit value=\"Enregistrer\"> <input type=submit name=delete value=\"Supprimer\">";
|
||||
$page .= "</th></tr>";
|
||||
|
||||
}else{$page .= message("Le raccourcis a été enregistré !","Enregistrer","fleetshortcut.php");}
|
||||
|
||||
$page .= '<tr><td colspan=2 class=c><a href=fleetshortcut.php>Retour</a></td></tr></tr></table></form>';
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$page = '<table border="0" cellpadding="0" cellspacing="1" width="519">
|
||||
<tr height="20">
|
||||
<td colspan="2" class="c">Raccourcis(<a href="?mode=add">Ajout</a>)</td>
|
||||
</tr>';
|
||||
|
||||
if($user['fleet_shortcut']){
|
||||
/*
|
||||
Dentro de fleet_shortcut, se pueden almacenar las diferentes direcciones
|
||||
de acceso directo, el formato es el siguiente.
|
||||
Nombre, Galaxia,Sistema,Planeta,Tipo
|
||||
*/
|
||||
$scarray = explode("\r\n",$user['fleet_shortcut']);
|
||||
$i=$e=0;
|
||||
foreach($scarray as $a => $b){
|
||||
if($b!=""){
|
||||
$c = explode(',',$b);
|
||||
if($i==0){$page .= "<tr height=\"20\">";}
|
||||
$page .= "<th><a href=\"?a=".$e++."\">";
|
||||
$page .= "{$c[0]} {$c[1]}:{$c[2]}:{$c[3]}";
|
||||
//Muestra un (L) si el destino pertenece a luna, lo mismo para escombros
|
||||
if($c[4]==2){$page .= " (E)";}elseif($c[4]==3){$page .= " (L)";}
|
||||
$page .= "</a></th>";
|
||||
if($i==1){$page .= "</tr>";}
|
||||
if($i==1){$i=0;}else{$i=1;}
|
||||
}
|
||||
|
||||
}
|
||||
if($i==1){$page .= "<th></th></tr>";}
|
||||
|
||||
}else{$page .= "<th colspan=\"2\">Pas de Raccourcis</th>";}
|
||||
|
||||
$page .= '<tr><td colspan=2 class=c><a href=fleet.php>Retour</a></td></tr></tr></table>';
|
||||
}
|
||||
display($page,"Shortcutmanager");
|
||||
|
||||
// Created by Perberos. All rights reversed (C) 2006
|
||||
?>
|
||||
286
floten1.php
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
<?php
|
||||
/**
|
||||
* Tis file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
includeLang('fleet');
|
||||
|
||||
$speed = array(10 => 100,
|
||||
9 => 90,
|
||||
8 => 80,
|
||||
7 => 70,
|
||||
6 => 60,
|
||||
5 => 50,
|
||||
4 => 40,
|
||||
3 => 30,
|
||||
2 => 20,
|
||||
1 => 10,
|
||||
);
|
||||
|
||||
$g = $_POST['galaxy'];
|
||||
$s = $_POST['system'];
|
||||
$p = $_POST['planet'];
|
||||
$t = $_POST['planet_type'];
|
||||
|
||||
if (!$g) {
|
||||
$g = $planetrow['galaxy'];
|
||||
}
|
||||
if (!$s) {
|
||||
$s = $planetrow['system'];
|
||||
}
|
||||
if (!$p) {
|
||||
$p = $planetrow['planet'];
|
||||
}
|
||||
if (!$t) {
|
||||
$t = $planetrow['planet_type'];
|
||||
}
|
||||
|
||||
// Verifions si nous avons bien tout ce que nous voullons envoyer
|
||||
$FleetHiddenBlock = "";
|
||||
foreach ($reslist['fleet'] as $n => $i) {
|
||||
if ($i > 200 && $i < 300 && $_POST["ship$i"] > "0") {
|
||||
if ($_POST["ship$i"] > $planetrow[$resource[$i]]) {
|
||||
$page .= $lang['fl_noenought'];
|
||||
$speedalls[$i] = GetFleetMaxSpeed ( "", $i, $user );
|
||||
} else {
|
||||
$fleet['fleetarray'][$i] = $_POST["ship$i"];
|
||||
// Tableau des vaisseaux avec leur nombre
|
||||
$fleet['fleetlist'] .= $i . "," . $_POST["ship$i"] . ";";
|
||||
// Nombre total de vaisseaux
|
||||
$fleet['amount'] += $_POST["ship$i"];
|
||||
// Tableau des vitesses
|
||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"consumption". $i ."\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
|
||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"speed". $i ."\" value=\"". GetFleetMaxSpeed ( "", $i, $user ) ."\" />";
|
||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"capacity". $i ."\" value=\"". $pricelist[$i]['capacity'] ."\" />";
|
||||
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"ship". $i ."\" value=\"". $_POST["ship$i"] ."\" />";
|
||||
$speedalls[$i] = GetFleetMaxSpeed ( "", $i, $user );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$fleet['fleetlist']) {
|
||||
message($lang['fl_unselectall'], $lang['fl_error'], "fleet." . PHPEXT, 1);
|
||||
} else {
|
||||
$speedallsmin = min($speedalls);
|
||||
}
|
||||
$page .= "<script type=\"text/javascript\" src=\"scripts/flotten.js\"></script>";
|
||||
$page .= "<script type=\"text/javascript\">\n";
|
||||
$page .= "function getStorageFaktor() {\n";
|
||||
$page .= " return 1\n";
|
||||
$page .= "}\n";
|
||||
$page .= "</script>\n";
|
||||
$page .= "<form action=\"floten2.php\" method=\"post\">";
|
||||
$page .= $FleetHiddenBlock;
|
||||
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $speedallsmin ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". str_rot13(base64_encode(serialize($fleet['fleetarray']))) ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $planetrow['galaxy'] ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow['system'] ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow['planet'] ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"galaxyend\" value=\"". intval($_POST['galaxy']) ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"systemend\" value=\"". intval($_POST['system']) ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"planetend\" value=\"". intval($_POST['planet']) ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". GetGameSpeedFactor () ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $planetrow['planet_type'] ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow['metal']) ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"thisresource2\" value=\"". floor($planetrow['crystal']) ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow['deuterium']) ."\" />";
|
||||
|
||||
$page .= "<br><div><center>";
|
||||
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_floten1_ttl'] ."</td>";
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th width=\"50%\">". $lang['fl_dest'] ."</th>";
|
||||
$page .= "<th>";
|
||||
$page .= "<input name=\"galaxy\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $g ."\" />";
|
||||
$page .= "<input name=\"system\" size=\"3\" maxlength=\"3\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $s ."\" />";
|
||||
$page .= "<input name=\"planet\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $p ."\" />";
|
||||
$page .= "<select name=\"planettype\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
|
||||
$page .= "<option value=\"1\"". (($t == 1) ? " SELECTED" : "" ) .">". $lang['fl_planet'] ." </option>";
|
||||
$page .= "<option value=\"2\"". (($t == 2) ? " SELECTED" : "" ) .">". $lang['fl_ruins'] ." </option>";
|
||||
$page .= "<option value=\"3\"". (($t == 3) ? " SELECTED" : "" ) .">". $lang['fl_moon'] ." </option>";
|
||||
$page .= "</select>";
|
||||
$page .= "</th>";
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th>". $lang['fl_speed'] ."</th>";
|
||||
$page .= "<th>";
|
||||
$page .= "<select name=\"speed\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
|
||||
foreach ($speed as $a => $b) {
|
||||
$page .= "<option value=\"".$a."\">".$b."</option>";
|
||||
}
|
||||
$page .= "</select> %";
|
||||
$page .= "</th>";
|
||||
$page .= "</tr>";
|
||||
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th>". $lang['fl_dist'] ."</th>";
|
||||
$page .= "<th><div id=\"distance\">-</div></th>";
|
||||
$page .= "</tr><tr height=\"20\">";
|
||||
$page .= "<th>". $lang['fl_fltime'] ."</th>";
|
||||
$page .= "<th><div id=\"duration\">-</div></th>";
|
||||
$page .= "</tr><tr height=\"20\">";
|
||||
/* A faire assez rapidement (faut juste savoir comment)
|
||||
$page .= "<th>". $lang['fl_time_go'] ."</th>";
|
||||
$page .= "<th><font color=\"lime\"><div id=\"llegada1\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
|
||||
$page .= "</tr><tr height=\"20\">";
|
||||
$page .= "<th>". $lang['fl_time_back'] ."</th>";
|
||||
$page .= "<th><font color=\"lime\"><div id=\"llegada2\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
|
||||
$page .= "</tr><tr height=\"20\">";
|
||||
*/
|
||||
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
|
||||
$page .= "<th><div id=\"consumption\">-</div></th>";
|
||||
$page .= "</tr><tr height=\"20\">";
|
||||
$page .= "<th>". $lang['fl_speed_max'] ."</th>";
|
||||
$page .= "<th><div id=\"maxspeed\">-</div></th>";
|
||||
$page .= "</tr><tr height=\"20\">";
|
||||
$page .= "<th>". $lang['fl_max_load'] ."</th>";
|
||||
$page .= "<th><div id=\"storage\">-</div></th>";
|
||||
$page .= "</tr>";
|
||||
|
||||
// Gestion des raccourcis sur la galaxie
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_shortcut'] ." <a href=\"fleetshortcut.php\">". $lang['fl_shortlnk'] ."</a></td>";
|
||||
$page .= "</tr>";
|
||||
if ($user['fleet_shortcut']) {
|
||||
$scarray = explode("\r\n", $user['fleet_shortcut']);
|
||||
$i = 0;
|
||||
foreach ($scarray as $a => $b) {
|
||||
if ($b != "") {
|
||||
$c = explode(',', $b);
|
||||
if ($i == 0) {
|
||||
$page .= "<tr height=\"20\">";
|
||||
}
|
||||
$page .= "<th><a href=\"javascript:setTarget(". $c[1] .",". $c[2] .",". $c[3] .",". $c[4] ."); shortInfo();\"";
|
||||
$page .= ">". $c[0] ." ". $c[1] .":". $c[2] .":". $c[3] ." ";
|
||||
// Signalisation du type de raccourci ...
|
||||
// (P)lanete
|
||||
// (D)ebris
|
||||
// (L)une
|
||||
if ($c[4] == 1) {
|
||||
$page .= $lang['fl_shrtcup1'];
|
||||
} elseif ($c[4] == 2) {
|
||||
$page .= $lang['fl_shrtcup2'];
|
||||
} elseif ($c[4] == 3) {
|
||||
$page .= $lang['fl_shrtcup3'];
|
||||
}
|
||||
$page .= "</a></th>";
|
||||
if ($i == 1) {
|
||||
$page .= "</tr>";
|
||||
}
|
||||
if ($i == 1) {
|
||||
$i = 0;
|
||||
} else {
|
||||
$i = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($i == 1) {
|
||||
$page .= "<th></th></tr>";
|
||||
}
|
||||
} else {
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th colspan=\"2\">". $lang['fl_noshortc'] ."</th>";
|
||||
$page .= "</tr>";
|
||||
}
|
||||
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_myplanets'] ."</td>";
|
||||
$page .= "</tr>";
|
||||
|
||||
// Gestion des raccourcis vers ses propres colonies ou planetes
|
||||
$kolonien = SortUserPlanets ( $user );
|
||||
$currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true);
|
||||
|
||||
if (mysql_num_rows($kolonien) > 1) {
|
||||
$i = 0;
|
||||
$w = 0;
|
||||
$tr = true;
|
||||
while ($row = $kolonien->fetch(PDO::FETCH_BOTH)) {
|
||||
if ($w == 0 && $tr) {
|
||||
$page .= "<tr height=\"20\">";
|
||||
$tr = false;
|
||||
}
|
||||
if ($w == 2) {
|
||||
$page .= "</tr>";
|
||||
$w = 0;
|
||||
$tr = true;
|
||||
}
|
||||
|
||||
if ($row['planet_type'] == 3) {
|
||||
$row['name'] .= " ". $lang['fl_shrtcup3'];
|
||||
}
|
||||
|
||||
if ($currentplanet['galaxy'] == $row['galaxy'] &&
|
||||
$currentplanet['system'] == $row['system'] &&
|
||||
$currentplanet['planet'] == $row['planet'] &&
|
||||
$currentplanet['planet_type'] == $row['planet_type'] ) {
|
||||
// $page .= '<th><a href="javascript:setTarget('.$row['galaxy'].','.$row['system'].','.$row['planet'].','.$row['planet_type'].'); shortInfo();">'.$row['name'].' '.$row['galaxy'].':'.$row['system'].':'.$row['planet'].'</a></th>';
|
||||
} else {
|
||||
$page .= "<th><a href=\"javascript:setTarget(". $row['galaxy'] .",". $row['system'] .",". $row['planet'] .",". $row['planet_type'] ."); shortInfo();\">". $row['name'] ." ". $row['galaxy'] .":". $row['system'] .":". $row['planet'] ."</a></th>";
|
||||
$w++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($i % 2 != 0) {
|
||||
$page .= "<th> </th></tr>";
|
||||
} elseif ($w == 2) {
|
||||
$page .= "</tr>";
|
||||
}
|
||||
} else {
|
||||
$page .= "<th colspan=\"2\">". $lang['fl_nocolonies'] ."</th>";
|
||||
}
|
||||
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_grattack'] ."</td>";
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th colspan=\"2\">-</th>";
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th colspan=\"2\"><input type=\"submit\" value=\"". $lang['fl_continue'] ."\" /></th>";
|
||||
$page .= "</tr>";
|
||||
$page .= "</table>";
|
||||
$page .= "</div></center>";
|
||||
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />";
|
||||
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
|
||||
$page .= "</form>";
|
||||
$page .= "<script>javascript:shortInfo(); </script>";
|
||||
|
||||
display($page, $lang['fl_title']);
|
||||
|
||||
// Updated by Chlorel. 16 Jan 2008 (String extraction, bug corrections, code uniformisation
|
||||
// Created by Perberos. All rights reversed (C) 2006
|
||||
?>
|
||||
281
floten2.php
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
includeLang('fleet');
|
||||
|
||||
$galaxy = intval($_POST['galaxy']);
|
||||
$system = intval($_POST['system']);
|
||||
$planet = intval($_POST['planet']);
|
||||
$planettype = intval($_POST['planettype']);
|
||||
|
||||
// Test d'existance et de proprieté de la planete
|
||||
$YourPlanet = false;
|
||||
$UsedPlanet = false;
|
||||
$select = doquery("SELECT * FROM {{table}}", "planets");
|
||||
|
||||
while ($row = $select->fetch(PDO::FETCH_BOTH)) {
|
||||
if ($galaxy == $row['galaxy'] &&
|
||||
$system == $row['system'] &&
|
||||
$planet == $row['planet'] &&
|
||||
$planettype == $row['planet_type']) {
|
||||
if ($row['id_owner'] == $user['id']) {
|
||||
$YourPlanet = true;
|
||||
$UsedPlanet = true;
|
||||
} else {
|
||||
$UsedPlanet = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Determinons les type de missions possibles par rapport a la planete cible
|
||||
if ($_POST['planettype'] == "2") {
|
||||
if ($_POST['ship209'] >= 1) {
|
||||
$missiontype = array(8 => $lang['type_mission'][8]);
|
||||
} else {
|
||||
$missiontype = array();
|
||||
}
|
||||
} elseif ($_POST['planettype'] == "1" || $_POST['planettype'] == "3") {
|
||||
if ($_POST['ship208'] >= 1 && !$UsedPlanet) {
|
||||
$missiontype = array(7 => $lang['type_mission'][7]);
|
||||
} elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
|
||||
$missiontype = array(6 => $lang['type_mission'][6]);
|
||||
}
|
||||
|
||||
if ($_POST['ship202'] >= 1 ||
|
||||
$_POST['ship203'] >= 1 ||
|
||||
$_POST['ship204'] >= 1 ||
|
||||
$_POST['ship205'] >= 1 ||
|
||||
$_POST['ship206'] >= 1 ||
|
||||
$_POST['ship207'] >= 1 ||
|
||||
$_POST['ship210'] >= 1 ||
|
||||
$_POST['ship211'] >= 1 ||
|
||||
$_POST['ship213'] >= 1 ||
|
||||
$_POST['ship214'] >= 1 ||
|
||||
$_POST['ship215'] >= 1 ||
|
||||
$_POST['ship216'] >= 1) {
|
||||
if (!$YourPlanet) {
|
||||
$missiontype[1] = $lang['type_mission'][1];
|
||||
$missiontype[5] = $lang['type_mission'][5];
|
||||
}
|
||||
$missiontype[3] = $lang['type_mission'][3];
|
||||
}
|
||||
|
||||
|
||||
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208'] >= 1) {
|
||||
$missiontype[3] = $lang['type_mission'][3];
|
||||
}
|
||||
if ($YourPlanet)
|
||||
$missiontype[4] = $lang['type_mission'][4];
|
||||
|
||||
if ( $_POST['planettype'] == 3 &&
|
||||
($_POST['ship214'] ||
|
||||
$_POST['ship213']) &&
|
||||
!$YourPlanet &&
|
||||
$UsedPlanet) {
|
||||
$missiontype[2] = $lang['type_mission'][2];
|
||||
}
|
||||
if ( $_POST['planettype'] == 3 &&
|
||||
($_POST['ship214'] >= 1 || $_POST['ship216'] >= 1) &&
|
||||
!$YourPlanet &&
|
||||
$UsedPlanet) {
|
||||
$missiontype[9] = $lang['type_mission'][9];
|
||||
}
|
||||
|
||||
$fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"])));
|
||||
$mission = $_POST['target_mission'];
|
||||
$SpeedFactor = $_POST['speedfactor'];
|
||||
$AllFleetSpeed = GetFleetMaxSpeed ($fleetarray, 0, $user);
|
||||
$GenFleetSpeed = $_POST['speed'];
|
||||
$MaxFleetSpeed = min($AllFleetSpeed);
|
||||
|
||||
$distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] );
|
||||
$duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor );
|
||||
$consumption = GetFleetConsumption ( $fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user );
|
||||
|
||||
$MissionSelector = "";
|
||||
if (count($missiontype) > 0) {
|
||||
if ($planet == 16) {
|
||||
$MissionSelector .= "<tr height=\"20\">";
|
||||
$MissionSelector .= "<th>";
|
||||
$MissionSelector .= "<input type=\"radio\" name=\"mission\" value=\"15\" checked=\"checked\">". $lang['type_mission'][15] ."<br /><br />";
|
||||
$MissionSelector .= "<font color=\"red\">". $lang['fl_expe_warning'] ."</font>";
|
||||
$MissionSelector .= "</th>";
|
||||
$MissionSelector .= "</tr>";
|
||||
} else {
|
||||
$i = 0;
|
||||
foreach ($missiontype as $a => $b) {
|
||||
$MissionSelector .= "<tr height=\"20\">";
|
||||
$MissionSelector .= "<th>";
|
||||
$MissionSelector .= "<input id=\"inpuT_".$i."\" type=\"radio\" name=\"mission\" value=\"".$a."\"". ($mission == $a ? " checked=\"checked\"":"") .">";
|
||||
$MissionSelector .= "<label for=\"inpuT_".$i."\">".$b."</label><br>";
|
||||
$MissionSelector .= "</th>";
|
||||
$MissionSelector .= "</tr>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$MissionSelector .= "<tr height=\"20\">";
|
||||
$MissionSelector .= "<th>";
|
||||
$MissionSelector .= "<font color=\"red\">". $lang['fl_bad_mission'] ."</font>";
|
||||
$MissionSelector .= "</th>";
|
||||
$MissionSelector .= "</tr>";
|
||||
}
|
||||
|
||||
if ($_POST['thisplanettype'] == 1) {
|
||||
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_planet'] ."";
|
||||
} elseif ($_POST['thisplanettype'] == 3) {
|
||||
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_moon'] ."";
|
||||
}
|
||||
|
||||
$page = "<script type=\"text/javascript\" src=\"scripts/flotten.js\">\n</script>";
|
||||
$page .= "<script type=\"text/javascript\">\n";
|
||||
$page .= "function getStorageFaktor() {\n";
|
||||
$page .= " return 1;\n";
|
||||
$page .= "}\n";
|
||||
$page .= "</script>\n";
|
||||
$page .= "<br><center>";
|
||||
$page .= "<form action=\"floten3.php\" method=\"post\">\n";
|
||||
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow["metal"]) ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"thisresource2\" value=\"". floor($planetrow["crystal"]) ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow["deuterium"]) ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"consumption\" value=\"". $consumption ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"dist\" value=\"". $distance ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $_POST['speedfactor'] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $_POST["thisgalaxy"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $_POST["thissystem"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $_POST["thisplanet"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $_POST["galaxy"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $_POST["system"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $_POST["planet"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $_POST["thisplanettype"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"planettype\" value=\"". $_POST["planettype"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $_POST["speedallsmin"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"speed\" value=\"". $_POST['speed'] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $_POST["speedfactor"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". $_POST["usedfleet"] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />\n";
|
||||
foreach ($fleetarray as $Ship => $Count) {
|
||||
$page .= "<input type=\"hidden\" name=\"ship". $Ship ."\" value=\"". $Count ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"capacity". $Ship ."\" value=\"". $pricelist[$Ship]['capacity'] ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"consumption". $Ship ."\" value=\"". GetShipConsumption ( $Ship, $user ) ."\" />\n";
|
||||
$page .= "<input type=\"hidden\" name=\"speed". $Ship ."\" value=\"". GetFleetMaxSpeed ( "", $Ship, $user ) ."\" />\n";
|
||||
|
||||
}
|
||||
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">\n";
|
||||
$page .= "<tbody>\n";
|
||||
$page .= "<tr align=\"left\" height=\"20\">\n";
|
||||
$page .= "<td class=\"c\" colspan=\"2\">". $TableTitle ."</td>\n";
|
||||
$page .= "</tr>\n";
|
||||
$page .= "<tr align=\"left\" valign=\"top\">\n";
|
||||
$page .= "<th width=\"50%\">\n";
|
||||
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
|
||||
$page .= "<tbody>\n";
|
||||
$page .= "<tr height=\"20\">\n";
|
||||
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_mission'] ."</td>\n";
|
||||
$page .= "</tr>\n";
|
||||
$page .= $MissionSelector;
|
||||
$page .= "</tbody>\n";
|
||||
$page .= "</table>\n";
|
||||
$page .= "</th>\n";
|
||||
$page .= "<th>\n";
|
||||
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
|
||||
$page .= "<tbody>\n";
|
||||
$page .= "<tr height=\"20\">\n";
|
||||
$page .= "<td colspan=\"3\" class=\"c\">". $lang['fl_ressources'] ."</td>\n";
|
||||
$page .= "</tr><tr height=\"20\">\n";
|
||||
$page .= "<th>". $lang['Metal'] ."</th>\n";
|
||||
$page .= "<th><a href=\"javascript:maxResource('1');\">". $lang['fl_selmax'] ."</a></th>\n";
|
||||
$page .= "<th><input name=\"resource1\" alt=\"". $lang['Metal'] ." ". floor($planetrow["metal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
|
||||
$page .= "</tr><tr height=\"20\">\n";
|
||||
$page .= "<th>". $lang['Crystal'] ."</th>\n";
|
||||
$page .= "<th><a href=\"javascript:maxResource('2');\">". $lang['fl_selmax'] ."</a></th>\n";
|
||||
$page .= "<th><input name=\"resource2\" alt=\"". $lang['Crystal'] ." ". floor($planetrow["crystal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
|
||||
$page .= "</tr><tr height=\"20\">\n";
|
||||
$page .= "<th>". $lang['Deuterium'] ."</th>\n";
|
||||
$page .= "<th><a href=\"javascript:maxResource('3');\">". $lang['fl_selmax'] ."</a></th>\n";
|
||||
$page .= "<th><input name=\"resource3\" alt=\"". $lang['Deuterium'] ." ". floor($planetrow["deuterium"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
|
||||
$page .= "</tr><tr height=\"20\">\n";
|
||||
$page .= "<th>". $lang['fl_space_left'] ."</th>\n";
|
||||
$page .= "<th colspan=\"2\"><div id=\"remainingresources\">-</div></th>\n";
|
||||
$page .= "</tr><tr height=\"20\">\n";
|
||||
$page .= "<th colspan=\"3\"><a href=\"javascript:maxResources()\">". $lang['fl_allressources'] ."</a></th>\n";
|
||||
$page .= "</tr><tr height=\"20\">\n";
|
||||
$page .= "<th colspan=\"3\"> </th>\n";
|
||||
$page .= "</tr>\n";
|
||||
if ($planet == 16) {
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th colspan=\"3\">";
|
||||
$page .= "<select name=\"expeditiontime\" >";
|
||||
$page .= "<option value=\"1\">1</option>";
|
||||
$page .= "<option value=\"2\">2</option>";
|
||||
$page .= "</select>";
|
||||
$page .= $lang['fl_expe_hours'];
|
||||
$page .= "</th>";
|
||||
$page .= "</tr>";
|
||||
} elseif ( $missiontype[5] != '' ) {
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
|
||||
$page .= "</tr>";
|
||||
$page .= "<tr height=\"20\">";
|
||||
$page .= "<th colspan=\"3\">";
|
||||
$page .= "<select name=\"holdingtime\" >";
|
||||
$page .= "<option value=\"0\">0</option>";
|
||||
$page .= "<option value=\"1\">1</option>";
|
||||
$page .= "<option value=\"2\">2</option>";
|
||||
$page .= "<option value=\"4\">4</option>";
|
||||
$page .= "<option value=\"8\">8</option>";
|
||||
$page .= "<option value=\"16\">16</option>";
|
||||
$page .= "<option value=\"32\">32</option>";
|
||||
$page .= "</select>";
|
||||
$page .= $lang['fl_expe_hours'];
|
||||
$page .= "</th>";
|
||||
$page .= "</tr>";
|
||||
}
|
||||
$page .= "</tbody>\n";
|
||||
$page .= "</table>\n";
|
||||
$page .= "</th>\n";
|
||||
$page .= "</tr><tr height=\"20\">\n";
|
||||
$page .= "<th colspan=\"2\"><input accesskey=\"z\" value=\"". $lang['fl_continue'] ."\" type=\"submit\"></th>\n";
|
||||
$page .= "</tr>\n";
|
||||
$page .= "</tbody>\n";
|
||||
$page .= "</table>\n";
|
||||
$page .= "</form></center>\n";
|
||||
|
||||
display($page, $lang['fl_title']);
|
||||
|
||||
?>
|
||||
539
floten3.php
Normal file
|
|
@ -0,0 +1,539 @@
|
|||
<?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
|
||||
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
includeLang('galaxy');
|
||||
includeLang('fleet');
|
||||
|
|
@ -70,9 +70,9 @@ require_once dirname(__FILE__) .'/application/bootstrap.php';
|
|||
}
|
||||
}
|
||||
|
||||
$PrNoob = Wootook::getGameConfig('game/noob-protection/active');
|
||||
$PrNoobTime = Wootook::getGameConfig('game/noob-protection/points-cap');
|
||||
$PrNoobMulti = Wootook::getGameConfig('game/noob-protection/multiplier');
|
||||
$PrNoob = $gameConfig['noobprotection'];
|
||||
$PrNoobTime = $gameConfig['noobprotectiontime'];
|
||||
$PrNoobMulti = $gameConfig['noobprotectionmulti'];
|
||||
|
||||
// Petit Test de coherance
|
||||
$galaxy = intval($_POST['galaxy']);
|
||||
53
frames.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
defined('DEPRECATION') || define('DEPRECATION', false);
|
||||
defined('DEBUG') || define('DEBUG', false);
|
||||
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
Legacies_Core_ErrorProfiler::unregister(true);
|
||||
?>
|
||||
<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" src="leftmenu.php" marginwidth="0" marginheight="0">
|
||||
<frame name="Hauptframe" src="overview.php">
|
||||
<noframes>
|
||||
<body>
|
||||
<p>Votre navigateur ne gère pas les frames.</p>
|
||||
</body>
|
||||
</noframes>
|
||||
</frameset>
|
||||
</html>
|
||||
163
galaxy.php
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
includeLang('galaxy');
|
||||
|
||||
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_planet'] ."';", 'planets', true);
|
||||
$lunarow = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_luna'] ."';", 'lunas', true);
|
||||
$galaxyrow = doquery("SELECT * FROM {{table}} WHERE `id_planet` = '". $CurrentPlanet['id'] ."';", 'galaxy', true);
|
||||
|
||||
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
|
||||
$fleetmax = $user['computer_tech'] + 1;
|
||||
$CurrentPlID = $CurrentPlanet['id'];
|
||||
$CurrentMIP = $CurrentPlanet['interplanetary_misil'];
|
||||
$CurrentRC = $CurrentPlanet['recycler'];
|
||||
$CurrentSP = $CurrentPlanet['spy_sonde'];
|
||||
$HavePhalanx = $CurrentPlanet['phalanx'];
|
||||
$CurrentSystem = $CurrentPlanet['system'];
|
||||
$CurrentGalaxy = $CurrentPlanet['galaxy'];
|
||||
$CanDestroy = $CurrentPlanet[$resource[213]] + $CurrentPlanet[$resource[214]];
|
||||
|
||||
$maxfleet = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '". $user['id'] ."';", 'fleets');
|
||||
$maxfleet_count = mysql_num_rows($maxfleet);
|
||||
|
||||
CheckPlanetUsedFields($CurrentPlanet);
|
||||
CheckPlanetUsedFields($lunarow);
|
||||
|
||||
if (!isset($mode)) {
|
||||
if (isset($_GET['mode'])) {
|
||||
$mode = intval($_GET['mode']);
|
||||
} else {
|
||||
$mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$galaxy = 1;
|
||||
$system = 1;
|
||||
$planet = null;
|
||||
|
||||
if ($mode == 0) {
|
||||
$galaxy = $CurrentGalaxy;
|
||||
$system = $CurrentSystem;
|
||||
} elseif ($mode == 1 || $mode == 3) {
|
||||
if (isset($_POST["galaxyLeft"])) {
|
||||
if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 1 || $_POST["galaxy"] > MAX_GALAXY_IN_WORLD) {
|
||||
$galaxy = 1;
|
||||
} else {
|
||||
$galaxy = intval($_POST["galaxy"]) - 1;
|
||||
}
|
||||
} elseif (isset($_POST["galaxyRight"])) {
|
||||
if (!isset($_POST["galaxy"]) || $_POST["galaxy"] >= MAX_GALAXY_IN_WORLD) {
|
||||
$galaxy = MAX_GALAXY_IN_WORLD;
|
||||
} else {
|
||||
$galaxy = intval($_POST["galaxy"]) + 1;
|
||||
}
|
||||
} else if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 1 || $_POST["galaxy"] > MAX_GALAXY_IN_WORLD) {
|
||||
$galaxy = 1;
|
||||
} else {
|
||||
$galaxy = intval($_POST["galaxy"]);
|
||||
}
|
||||
|
||||
if (isset($_POST["systemLeft"])) {
|
||||
if (!isset($_POST["system"]) || $_POST["system"] <= 1 || $_POST["system"] > MAX_SYSTEM_IN_GALAXY) {
|
||||
$system = 1;
|
||||
} else {
|
||||
$system = intval($_POST["system"]) - 1;
|
||||
}
|
||||
} elseif (isset($_POST["systemRight"])) {
|
||||
if (!isset($_POST["system"]) || $_POST["system"] >= MAX_SYSTEM_IN_GALAXY) {
|
||||
$system = MAX_SYSTEM_IN_GALAXY;
|
||||
} else {
|
||||
$system = intval($_POST["system"]) + 1;
|
||||
}
|
||||
} else if (!isset($_POST["system"]) || $_POST["system"] <= 1 || $_POST["system"] > MAX_SYSTEM_IN_GALAXY) {
|
||||
$system = 1;
|
||||
} else {
|
||||
$system = intval($_POST["system"]);
|
||||
}
|
||||
} elseif ($mode == 2) {
|
||||
if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 0) {
|
||||
$galaxy = 1;
|
||||
} else if ($_POST["galaxy"] >= MAX_GALAXY_IN_WORLD) {
|
||||
$galaxy = MAX_GALAXY_IN_WORLD;
|
||||
} else {
|
||||
$galaxy = intval($_POST["galaxy"]) + 1;
|
||||
}
|
||||
|
||||
if (!isset($_POST["system"]) || $_POST["system"] <= 0) {
|
||||
$system = 1;
|
||||
} else if ($_POST["system"] >= MAX_SYSTEM_IN_GALAXY) {
|
||||
$system = MAX_SYSTEM_IN_GALAXY;
|
||||
} else {
|
||||
$system = intval($_POST["system"]) + 1;
|
||||
}
|
||||
|
||||
if (!isset($_POST["planet"]) || $_POST["planet"] <= 0) {
|
||||
$planet = 1;
|
||||
} else if ($_POST["planet"] >= MAX_PLANET_IN_SYSTEM) {
|
||||
$planet = MAX_PLANET_IN_SYSTEM;
|
||||
} else {
|
||||
$planet = intval($_POST["planet"]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
$planetcount = 0;
|
||||
$lunacount = 0;
|
||||
|
||||
$page = InsertGalaxyScripts($CurrentPlanet);
|
||||
|
||||
$page .= "<body style=\"overflow: hidden;\" onUnload=\"\"><br><br>";
|
||||
$page .= ShowGalaxySelector ( $galaxy, $system );
|
||||
|
||||
if ($mode == 2) {
|
||||
$page .= ShowGalaxyMISelector($galaxy, $system, $planet, $CurrentPlanet['id'], $CurrentMIP);
|
||||
}
|
||||
|
||||
$page .= "<table width=569><tbody>";
|
||||
|
||||
$page .= ShowGalaxyTitles($galaxy, $system);
|
||||
$page .= ShowGalaxyRows($galaxy, $system);
|
||||
$page .= ShowGalaxyFooter($galaxy, $system, $CurrentMIP, $CurrentRC, $CurrentSP);
|
||||
|
||||
$page .= "</tbody></table></div>";
|
||||
|
||||
display ($page, $lang[''], false, '', false);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
// History version
|
||||
// 1.0 - Created by Perberos
|
||||
// 1.1 - Modified by -MoF- (UGamela germany)
|
||||
// 1.2 - 1er Nettoyage Chlorel ...
|
||||
// 1.3 - 2eme Nettoyage Chlorel ... Mise en fonction et debuging complet
|
||||
?>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
includeLang('imperium');
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ foreach ($planet as $p) {
|
|||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Wootook::dispatchEvent('planet.update', array(
|
||||
Legacies::dispatchEvent('planet.update', array(
|
||||
'planet' => $p
|
||||
));
|
||||
$p->save();
|
||||
|
|
@ -77,13 +77,13 @@ foreach ($planet as $p) {
|
|||
|
||||
foreach ($resource as $i => $res) {
|
||||
if (in_array($i, $reslist['build']))
|
||||
$data['text'] = ($p[$resource[$i]] == 0) ? '-' : '<a href="' . Wootook::getUrl('empire/buildings', array('cp' => $p['id'], 're' => 0, 'planettype' => $p['planet_type'])) . '">' . $p[$resource[$i]] . '</a>';
|
||||
$data['text'] = ($p[$resource[$i]] == 0) ? '-' : "<a href=\"buildings.php?cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>";
|
||||
elseif (in_array($i, $reslist['tech']))
|
||||
$data['text'] = ($p[$resource[$i]] == 0) ? '-' : '<a href="' . Wootook::getUrl('empire/research-lab', array('cp' => $p['id'], 're' => 0, 'planettype' => $p['planet_type'])) . '">' . $p[$resource[$i]] . '</a>';
|
||||
$data['text'] = ($user[$resource[$i]] == 0) ? '-' : "<a href=\"buildings.php?mode=research&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$user[$resource[$i]]}</a>";
|
||||
elseif (in_array($i, $reslist['fleet']))
|
||||
$data['text'] = ($p[$resource[$i]] == 0) ? '-' : '<a href="' . Wootook::getUrl('empire/shipyard', array('cp' => $p['id'], 're' => 0, 'planettype' => $p['planet_type'])) . '">' . $p[$resource[$i]] . '</a>';
|
||||
$data['text'] = ($p[$resource[$i]] == 0) ? '-' : "<a href=\"buildings.php?mode=fleet&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>";
|
||||
elseif (in_array($i, $reslist['defense']))
|
||||
$data['text'] = ($p[$resource[$i]] == 0) ? '-' : '<a href="' . Wootook::getUrl('empire/defenses', array('cp' => $p['id'], 're' => 0, 'planettype' => $p['planet_type'])) . '">' . $p[$resource[$i]] . '</a>';
|
||||
$data['text'] = ($p[$resource[$i]] == 0) ? '-' : "<a href=\"buildings.php?mode=defense&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>";
|
||||
|
||||
$r[$i] .= parsetemplate($row2, $data);
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
$CombatCaps = Wootook_Empire_Helper_Config_Combat::getSingleton();
|
||||
$CombatCaps = Legacies_Empire_Model_Game_Combat::getSingleton();
|
||||
|
||||
$AtFleet = array ( 203 => 2 );
|
||||
$AtTechn = array ( 109 => 3, 110 => 5, 111 => 3 );
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.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
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* --> 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 Wootook.
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
219
includes/application/code/core/Legacies.php
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Bootstrap class, used to access main and global functionalities
|
||||
*
|
||||
* @package Legacies
|
||||
* @category core
|
||||
*/
|
||||
class Legacies
|
||||
{
|
||||
/**
|
||||
* Static list of application event listeners
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_listeners = array();
|
||||
|
||||
/**
|
||||
* Static list of all locale translators
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_translators = array();
|
||||
|
||||
/**
|
||||
* HTTP request management object
|
||||
*
|
||||
* @var Legacies_Core_Controller_Request_Http
|
||||
*/
|
||||
protected static $_request = null;
|
||||
|
||||
/**
|
||||
* HTTP response management object
|
||||
*
|
||||
* @var Legacies_Core_Controller_Response
|
||||
*/
|
||||
protected static $_response = null;
|
||||
|
||||
/**
|
||||
* The current timestamp
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected static $_now = null;
|
||||
|
||||
/**
|
||||
* Default locale identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $_defaultLocale = 'fr_FR';
|
||||
|
||||
/**
|
||||
* Registers an event listener to be called later in the application.
|
||||
*
|
||||
* @param string $event The event identifier
|
||||
* @param callback $listener The event callback to be called
|
||||
*/
|
||||
public static function registerListener($event, $listener)
|
||||
{
|
||||
if (!isset(self::$_listeners[$event])) {
|
||||
self::$_listeners[$event] = array();
|
||||
}
|
||||
self::$_listeners[$event][] = $listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all event listeners
|
||||
*/
|
||||
public static function clearAllListeners()
|
||||
{
|
||||
self::$_listeners = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a specific event's listeners
|
||||
*
|
||||
* @param unknown_type $event
|
||||
*/
|
||||
public static function clearEventListeners($event)
|
||||
{
|
||||
if (isset(self::$_listeners[$event])) {
|
||||
self::$_listeners[$event] = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an event, calls all callbacks that were previously registered
|
||||
*
|
||||
* @param string $event The event identifier
|
||||
* @param array $params The event params
|
||||
*/
|
||||
public static function dispatchEvent($event, $params)
|
||||
{
|
||||
$eventObject = new Legacies_Core_Event($params);
|
||||
|
||||
if (!isset(self::$_listeners[$event])) {
|
||||
return $eventObject;
|
||||
}
|
||||
|
||||
foreach (self::$_listeners[$event] as $listener) {
|
||||
call_user_func($listener, $eventObject);
|
||||
}
|
||||
|
||||
return $eventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param unknown_type $namespace
|
||||
* @return Legacies_Core_Model_Session
|
||||
*/
|
||||
public static function getSession($namespace)
|
||||
{
|
||||
return Legacies_Core_Model_Session::factory($namespace);
|
||||
}
|
||||
|
||||
public static function getTranslator($locale = null)
|
||||
{
|
||||
if ($locale === null) {
|
||||
$locale = self::getDefaultLocale();
|
||||
}
|
||||
|
||||
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::getDefaultLocale())->translateArgs($message, $args);
|
||||
}
|
||||
|
||||
public static function setDefaultLocale($locale)
|
||||
{
|
||||
$oldLocale = self::$_defaultLocale;
|
||||
self::$_defaultLocale = $locale;
|
||||
|
||||
return $oldLocale;
|
||||
}
|
||||
|
||||
public static function getDefaultLocale()
|
||||
{
|
||||
return self::$_defaultLocale;
|
||||
}
|
||||
|
||||
public static function now()
|
||||
{
|
||||
if (self::$_now === null) {
|
||||
self::$_now = time();
|
||||
}
|
||||
return self::$_now;
|
||||
}
|
||||
|
||||
public static function getRequest()
|
||||
{
|
||||
if (self::$_request === null) {
|
||||
self::$_request = new Legacies_Core_Controller_Request_Http();
|
||||
}
|
||||
return self::$_request;
|
||||
}
|
||||
|
||||
public static function setRequest($request)
|
||||
{
|
||||
self::$_request = $request;
|
||||
}
|
||||
|
||||
public static function getResponse()
|
||||
{
|
||||
if (self::$_response === null) {
|
||||
self::$_response = new Legacies_Core_Controller_Response_Http();
|
||||
}
|
||||
return self::$_response;
|
||||
}
|
||||
|
||||
public static function setResponse($response)
|
||||
{
|
||||
self::$_response = $response;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Block_Concat
|
||||
extends Wootook_Core_Mvc_View_View
|
||||
class Legacies_Core_Block_Concat
|
||||
extends Legacies_Core_View
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Block_Html_Form
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
public function getFormKey()
|
||||
{
|
||||
$session = Legacies::getSession('security');
|
||||
return $session->getFormKey(true);
|
||||
}
|
||||
}
|
||||
145
includes/application/code/core/Legacies/Core/Block/Html/Head.php
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Block_Html_Navigation
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
public function addLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null)
|
||||
{
|
||||
$explodedPath = explode('/', $name);
|
||||
$baseName = array_pop($explodedPath);
|
||||
$parent = $this->_getNode($explodedPath);
|
||||
|
||||
$child = $this->getLayout()
|
||||
->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array(
|
||||
'url' => array(
|
||||
'uri' => $uri,
|
||||
'params' => $params
|
||||
),
|
||||
'label' => $label,
|
||||
'title' => $title,
|
||||
'classes' => $classes
|
||||
));
|
||||
$parent->setPartial($baseName, $child);
|
||||
|
||||
if ($template !== null) {
|
||||
$child->setTemplate($template);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setNodeTitle($path, $title)
|
||||
{
|
||||
return $this->getNode($path)->setTitle($title);
|
||||
}
|
||||
|
||||
public function setNodeTemplate($path, $template)
|
||||
{
|
||||
return $this->getNode($path)->setTemplate($template);
|
||||
}
|
||||
|
||||
public function getNode($path)
|
||||
{
|
||||
return $this->_getNode(explode('/', $path));
|
||||
}
|
||||
|
||||
protected function _getNode($explodedPath)
|
||||
{
|
||||
$name = array_shift($explodedPath);
|
||||
|
||||
if ($this->hasPartial($name)) {
|
||||
$child = $this->getPartial($name)->_getNode($explodedPath);
|
||||
} else {
|
||||
$child = $this->getLayout()
|
||||
->createBlock('core/html.navigation.node', $this->getNameInLayout() . '.' . $name);
|
||||
}
|
||||
|
||||
if ($child instanceof Legacies_Core_Block_Html_Navigation_Link) {
|
||||
throw new RuntimeException('Node is a link. Could not append a child node to a link node.');
|
||||
}
|
||||
|
||||
if (count($explodedPath) == 0) {
|
||||
return $child;
|
||||
}
|
||||
return $child->_getNode($explodedPath);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Block_Html_Navigation_Link
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
protected $_label = '';
|
||||
protected $_title = '';
|
||||
protected $_uri = '';
|
||||
protected $_params = array();
|
||||
protected $_classes = array('link');
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
if ($this->_template !== null) {
|
||||
return $this->_template;
|
||||
}
|
||||
return 'page/html/navigation/link.phtml';
|
||||
}
|
||||
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->_label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->_label;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
public function setUrl($uri, $params = array())
|
||||
{
|
||||
$this->_uri = $uri;
|
||||
$this->_params = $params;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLinkUrl($moreParams = array())
|
||||
{
|
||||
$params = array_merge($this->_params, $moreParams);
|
||||
return $this->getUrl($this->_uri, $params);
|
||||
}
|
||||
|
||||
public function addClass($class)
|
||||
{
|
||||
$this->_classes[] = $class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearClasses()
|
||||
{
|
||||
$this->_classes = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function renderClasses($moreClasses)
|
||||
{
|
||||
$classes = array_merge($this->_classes, $moreClasses);
|
||||
return implode(' ', $classes);
|
||||
}
|
||||
|
||||
public function __construct(Array $data = array())
|
||||
{
|
||||
if (isset($data['label'])) {
|
||||
$this->setLabel($data['label']);
|
||||
unset($data['label']);
|
||||
}
|
||||
|
||||
if (isset($data['title'])) {
|
||||
$this->setTitle($data['title']);
|
||||
unset($data['title']);
|
||||
}
|
||||
|
||||
if (isset($data['url'])) {
|
||||
if (is_array($data['url']) && isset($data['url']['uri'])) {
|
||||
if (isset($data['url']['params'])) {
|
||||
$this->setUrl($data['url']['uri'], $data['url']['params']);
|
||||
} else {
|
||||
$this->setUrl($data['url']['uri']);
|
||||
}
|
||||
} else {
|
||||
$this->setUrl($data['url']);
|
||||
}
|
||||
unset($data['url']);
|
||||
}
|
||||
|
||||
if (isset($data['classes'])) {
|
||||
$classes = (array) $data['classes'];
|
||||
unset($data['classes']);
|
||||
|
||||
foreach ($classes as $class) {
|
||||
$this->set($class);
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($data);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Block_Html_Navigation_Node
|
||||
extends Wootook_Core_Block_Html_Navigation
|
||||
class Legacies_Core_Block_Html_Navigation_Node
|
||||
extends Legacies_Core_Block_Html_Navigation
|
||||
{
|
||||
protected $_title = '';
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Block_Html_Page
|
||||
extends Wootook_Core_Block_Template
|
||||
class Legacies_Core_Block_Html_Page
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
protected $_bodyClasses = array();
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Block_Template
|
||||
extends Legacies_Core_View
|
||||
{
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Block_Text
|
||||
extends Wootook_Core_Mvc_View_View
|
||||
class Legacies_Core_Block_Text
|
||||
extends Legacies_Core_View
|
||||
{
|
||||
protected $_content = null;
|
||||
|
||||
345
includes/application/code/core/Legacies/Core/Collection.php
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?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];
|
||||
}
|
||||
|
||||
public function getServer($key, $default = null)
|
||||
{
|
||||
if (!isset($_SERVER[$key])) {
|
||||
return $default;
|
||||
}
|
||||
return $_SERVER[$key];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,12 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Mvc_Controller_Response_Http
|
||||
extends Wootook_Core_Mvc_Controller_Response_Response
|
||||
class Legacies_Core_Controller_Response_Http
|
||||
extends Legacies_Object
|
||||
{
|
||||
const STATUS_OK = 200;
|
||||
|
||||
const REDIRECT_MOVED_PERMANENTLY = 301;
|
||||
const REDIRECT_FOUND = 302;
|
||||
const REDIRECT_SEE_OTHER = 303;
|
||||
const REDIRECT_TEMPORARY = 307;
|
||||
|
||||
protected static $_redirectCodes = array(
|
||||
self::REDIRECT_MOVED_PERMANENTLY => 'Moved Permanently',
|
||||
self::REDIRECT_FOUND => 'Found',
|
||||
self::REDIRECT_SEE_OTHER => 'See Other',
|
||||
self::REDIRECT_TEMPORARY => 'Temporary Redirect'
|
||||
);
|
||||
|
||||
protected $_returnCode = self::STATUS_OK;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array());
|
||||
}
|
||||
|
||||
public function setBody($data)
|
||||
{
|
||||
|
|
@ -45,9 +34,6 @@ class Wootook_Core_Mvc_Controller_Response_Http
|
|||
|
||||
public function sendBody()
|
||||
{
|
||||
if (!isset($this->_data['body']) || empty($this->_data['body'])) {
|
||||
return '';
|
||||
}
|
||||
return implode('', $this->_data['body']);
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +69,7 @@ class Wootook_Core_Mvc_Controller_Response_Http
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setRawHeader($value)
|
||||
public function setRawHeader($name, $value)
|
||||
{
|
||||
if (!isset($this->_data['raw_headers']) || !is_array($this->_data['raw_headers'])) {
|
||||
$this->clearRawHeaders();
|
||||
|
|
@ -110,9 +96,22 @@ class Wootook_Core_Mvc_Controller_Response_Http
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function isRedirect()
|
||||
public function setIsRedirect($value = null)
|
||||
{
|
||||
return $this->_returnCode >= 300 && $this->_returnCode < 400;
|
||||
if (is_bool($value)) {
|
||||
$this->_data['is_redirect'] = $value;
|
||||
}
|
||||
return $this->_data['is_redirect'];
|
||||
}
|
||||
|
||||
public function setIsDispatched($dispatched = true)
|
||||
{
|
||||
return $this->setData('id_dispatched', $dispatched);
|
||||
}
|
||||
|
||||
public function getIsDispatched()
|
||||
{
|
||||
return $this->getData('id_dispatched');
|
||||
}
|
||||
|
||||
public function setCookie($name, $value, $lifetime = null, $path = null, $domain = null)
|
||||
|
|
@ -127,35 +126,7 @@ class Wootook_Core_Mvc_Controller_Response_Http
|
|||
|
||||
public function setRawCookie($name, $value, $lifetime = null, $path = null, $domain = null)
|
||||
{
|
||||
$date = new Wootook_Core_DateTime();
|
||||
$date->add($lifetime);
|
||||
|
||||
setcookie($name, $value, $date->getTimestamp(), $path, $domain);
|
||||
setcookie($name, $value, time() + $lifetime, $path, $domain);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setRedirect($url, $code = self::REDIRECT_FOUND)
|
||||
{
|
||||
if (!in_array($code, self::$_redirectCodes)) {
|
||||
$code = self::REDIRECT_FOUND;
|
||||
}
|
||||
|
||||
$this->_returnCode = $code;
|
||||
|
||||
$statusText = self::$_redirectCodes[$code];
|
||||
$this->setRawHeader("HTTP/1.1 {$code} {$statusText}")
|
||||
->setHeader('Location', $url);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render($send = true)
|
||||
{
|
||||
if ($send) {
|
||||
$this->sendHeaders();
|
||||
echo $this->sendBody();
|
||||
} else {
|
||||
return $this->sendBody();
|
||||
}
|
||||
}
|
||||
}
|
||||
32
includes/application/code/core/Legacies/Core/Email.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Email
|
||||
{
|
||||
protected static $_defaultHeadrs = array(
|
||||
);
|
||||
|
||||
protected $_headers = array();
|
||||
|
||||
public function send($to, $from, $subject, $body, Array $headers = array())
|
||||
{
|
||||
$this->_prepareHeaders($headers);
|
||||
}
|
||||
|
||||
public function setHeader($name, $value)
|
||||
{
|
||||
$this->_headers[$name] = $value;
|
||||
}
|
||||
|
||||
protected function _prepareHeaders($headers)
|
||||
{
|
||||
foreach ($headers as $name => $value) {
|
||||
$this->setHeader($name, $value);
|
||||
}
|
||||
|
||||
$this->addHeader('X-Mailer', 'PHP/' . PHP_VERSION . ' Legacies/' . VERSION);
|
||||
$this->addHeader('Content-Transfer-Encoding', '7bit');
|
||||
$this->addHeader('Content-Type', 'text/plain; charset=utf-8');
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
155
includes/application/code/core/Legacies/Core/Entity.php
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,14 +2,15 @@
|
|||
|
||||
/**
|
||||
*
|
||||
* @uses Wootook_Object
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
* @uses Wootook_Player_Model_Entity
|
||||
* @uses Legacies_Empire_User
|
||||
*/
|
||||
abstract class Wootook_Core_Mvc_Model_Entity_SubTable
|
||||
extends Wootook_Core_Database_Resource
|
||||
abstract class Legacies_Core_Entity_SubTable
|
||||
extends Legacies_Core_Model
|
||||
{
|
||||
private $_isLoaded = false;
|
||||
protected $_tableName = null;
|
||||
protected $_idFieldNames = array();
|
||||
|
||||
protected $_eventPrefix = 'entity.sub-table';
|
||||
|
|
@ -31,7 +32,7 @@ abstract class Wootook_Core_Mvc_Model_Entity_SubTable
|
|||
$idFields = '(' . implode(') AND (', $idFields) . ')';
|
||||
$fields = implode(', ', $fields);
|
||||
|
||||
$database = $this->getWriteConnection();
|
||||
$database = Legacies_Database::getSingleton();
|
||||
$sql =<<<SQL_EOF
|
||||
UPDATE {$database->getTable(self::getTableName())}
|
||||
SET {$fields}
|
||||
|
|
@ -50,7 +51,7 @@ SQL_EOF;
|
|||
}
|
||||
$tokens = implode(', ', $tokens);
|
||||
|
||||
$database = $this->getWriteConnection();
|
||||
$database = Legacies_Database::getSingleton();
|
||||
$sql =<<<SQL_EOF
|
||||
INSERT INTO {$database->getTable(self::getTableName())} ($fields)
|
||||
VALUES ({$tokens})
|
||||
|
|
@ -65,28 +66,28 @@ SQL_EOF;
|
|||
protected function _load()
|
||||
{
|
||||
$idValues = func_get_arg(0);
|
||||
$database = $this->getReadConnection();
|
||||
|
||||
$select = $database->select()
|
||||
->from(array('main_table' => $database->getTable($this->getTableName())))
|
||||
->limit(1);
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
$idFields = array();
|
||||
foreach ($this->_idFieldNames as $field) {
|
||||
$select->where("{$database->quoteIdentifier($field)}=:{$field}");
|
||||
$idFields[] = "{$field}=:{$field}";
|
||||
}
|
||||
$idFields = '(' . implode(') AND (', $idFields) . ')';
|
||||
|
||||
$statement = $database->prepare($select);
|
||||
$sql =<<<SQL_EOF
|
||||
SELECT * FROM {$database->getTable(self::getTableName())}
|
||||
WHERE $idFields
|
||||
LIMIT 1
|
||||
SQL_EOF;
|
||||
$statement = $database->prepare($sql);
|
||||
$statement->execute($idValues);
|
||||
|
||||
$datas = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
if (!is_array($datas) || empty($datas)) {
|
||||
throw new Wootook_Core_Exception_DataAccessException('Could not load data: this id combination could not be found.');
|
||||
throw new Legacies_Core_Model_Exception('Could not load data: this id combination could not be found.');
|
||||
}
|
||||
|
||||
$this->_data = array();
|
||||
$this->getDataMapper()->decode($this, $datas);
|
||||
|
||||
$this->_data = $datas;
|
||||
$this->_isLoaded = true;
|
||||
|
||||
return $this;
|
||||
|
|
@ -94,7 +95,7 @@ SQL_EOF;
|
|||
|
||||
protected function _delete()
|
||||
{
|
||||
$database = $this->getWriteConnection();
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
$idFields = array();
|
||||
$idValues = array();
|
||||
|
|
@ -117,4 +118,16 @@ SQL_EOF;
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTableName($tableName)
|
||||
{
|
||||
$this->_tableName = $tableName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTableName()
|
||||
{
|
||||
return $this->_tableName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?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);
|
||||
}
|
||||
179
includes/application/code/core/Legacies/Core/ErrorProfiler.php
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
<?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'));
|
||||
}
|
||||
}
|
||||
}
|
||||