diff --git a/.gitignore b/.gitignore index 24b99ed..b74decb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1 @@ -config.php -.buildpath -.project -.settings/ -.idea/ -coverage/ -src/application/cache/* -src/application/configs/local.php +/config.php diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..5eb217c --- /dev/null +++ b/.htaccess @@ -0,0 +1,2 @@ +SetEnv DEBUG On +SetEnv DEPRECATION Off \ No newline at end of file diff --git a/src/LICENCE b/LICENCE similarity index 100% rename from src/LICENCE rename to LICENCE diff --git a/add_declare.php b/add_declare.php new file mode 100644 index 0000000..c1cc82e --- /dev/null +++ b/add_declare.php @@ -0,0 +1,68 @@ + + * 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 . + * + * --> 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); + + +?> \ No newline at end of file diff --git a/src/admin/ElementQueueFixer.php b/admin/ElementQueueFixer.php similarity index 90% rename from src/admin/ElementQueueFixer.php rename to admin/ElementQueueFixer.php index be19843..4411b89 100644 --- a/src/admin/ElementQueueFixer.php +++ b/admin/ElementQueueFixer.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/src/admin/QueryExecute.php b/admin/QueryExecute.php similarity index 84% rename from src/admin/QueryExecute.php rename to admin/QueryExecute.php index 9e75ebf..1ef16cb 100644 --- a/src/admin/QueryExecute.php +++ b/admin/QueryExecute.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/src/admin/autounban.php b/admin/ShowFlyingFleets.php similarity index 58% rename from src/admin/autounban.php rename to admin/ShowFlyingFleets.php index 5d9a6a9..9d66c27 100644 --- a/src/admin/autounban.php +++ b/admin/ShowFlyingFleets.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'] ); + } + +?> \ No newline at end of file diff --git a/src/admin/XNovaResetUnivers.php b/admin/XNovaResetUnivers.php similarity index 94% rename from src/admin/XNovaResetUnivers.php rename to admin/XNovaResetUnivers.php index e789d4d..bf64d50 100644 --- a/src/admin/XNovaResetUnivers.php +++ b/admin/XNovaResetUnivers.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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); diff --git a/admin/activeplanet.php b/admin/activeplanet.php new file mode 100644 index 0000000..9cd3871 --- /dev/null +++ b/admin/activeplanet.php @@ -0,0 +1,66 @@ + + * 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 . + * + * --> 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'] .= ""; + $parse['online_list'] .= "
". $ActivPlanet['name'] ."
"; + $parse['online_list'] .= "
[". $ActivPlanet['galaxy'] .":". $ActivPlanet['system'] .":". $ActivPlanet['planet'] ."]
"; + $parse['online_list'] .= "
". pretty_number($ActivPlanet['points'] / 1000) ."
"; + $parse['online_list'] .= "
". pretty_time(time() - $ActivPlanet['last_update']) . "
"; + $parse['online_list'] .= ""; + $Count++; + } + $parse['online_list'] .= ""; + $parse['online_list'] .= "". $lang['adm_pl_they'] ." ". $Count ." ". $lang['adm_pl_apla'] .""; + $parse['online_list'] .= ""; + + $page = parsetemplate( $PageTPL , $parse ); + display( $page, $lang['adm_pl_title'], false, '', true ); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/add_fleet.php b/admin/add_fleet.php new file mode 100644 index 0000000..dc03f9c --- /dev/null +++ b/admin/add_fleet.php @@ -0,0 +1,101 @@ + + * 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 . + * + * --> 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'] ); + } + +?> \ No newline at end of file diff --git a/admin/add_money.php b/admin/add_money.php new file mode 100644 index 0000000..87beb94 --- /dev/null +++ b/admin/add_money.php @@ -0,0 +1,67 @@ + + * 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 . + * + * --> 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'] ); + } + +?> \ No newline at end of file diff --git a/src/admin/add_moon.php b/admin/add_moon.php similarity index 88% rename from src/admin/add_moon.php rename to admin/add_moon.php index 63c2851..f2f220f 100644 --- a/src/admin/add_moon.php +++ b/admin/add_moon.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/admin/autounban.php b/admin/autounban.php new file mode 100644 index 0000000..fae8ef9 --- /dev/null +++ b/admin/autounban.php @@ -0,0 +1,48 @@ + + * 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 . + * + * --> 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'] ); + } + +?> + diff --git a/src/admin/banned.php b/admin/banned.php similarity index 91% rename from src/admin/banned.php rename to admin/banned.php index 89b6f01..9867ced 100644 --- a/src/admin/banned.php +++ b/admin/banned.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/src/admin/changelog.php b/admin/changelog.php similarity index 83% rename from src/admin/changelog.php rename to admin/changelog.php index 6ef7ced..abca21c 100644 --- a/src/admin/changelog.php +++ b/admin/changelog.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/src/admin/chat.php b/admin/chat.php similarity index 88% rename from src/admin/chat.php rename to admin/chat.php index b6ca379..860ae00 100644 --- a/src/admin/chat.php +++ b/admin/chat.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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; diff --git a/src/admin/credit.php b/admin/credit.php similarity index 90% rename from src/admin/credit.php rename to admin/credit.php index 00c282d..8eef023 100644 --- a/src/admin/credit.php +++ b/admin/credit.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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; diff --git a/src/admin/declare_list.php b/admin/declare_list.php similarity index 82% rename from src/admin/declare_list.php rename to admin/declare_list.php index 6ecc761..973f7df 100644 --- a/src/admin/declare_list.php +++ b/admin/declare_list.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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"; diff --git a/src/admin/deletuser.php b/admin/deletuser.php similarity index 84% rename from src/admin/deletuser.php rename to admin/deletuser.php index 370ddcb..5bbfecd 100644 --- a/src/admin/deletuser.php +++ b/admin/deletuser.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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" ); diff --git a/src/admin/errors.php b/admin/errors.php similarity index 89% rename from src/admin/errors.php rename to admin/errors.php index 0ff6a7b..a99f1e0 100644 --- a/src/admin/errors.php +++ b/admin/errors.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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; diff --git a/src/admin/leftmenu.php b/admin/leftmenu.php similarity index 67% rename from src/admin/leftmenu.php rename to admin/leftmenu.php index cce8699..4b41251 100644 --- a/src/admin/leftmenu.php +++ b/admin/leftmenu.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'] ); } diff --git a/admin/mass_message.php b/admin/mass_message.php new file mode 100644 index 0000000..3d22c76 --- /dev/null +++ b/admin/mass_message.php @@ -0,0 +1,66 @@ + + * 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 . + * + * --> 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`='Administracja', + `message_subject`='{$gameConfig['temat']}', + `message_text`='{$gameConfig['tresc']}' + ","messages"); + $parent->db->query("UPDATE {{table}} SET new_message=new_message+1 WHERE id='{$u['id']}'",'users'); + } + $parent->smarty->assign("message","Wys�a�e� wiadomo�� do wszystkich graczy"); + } + } + $parent->smarty->display("mass_message.tpl"); +} + +function mass_message_info(){ + return array("name" => "Send MassMessages","description"=>"Sends messagess to all players","default_weight"=>"0"); +} \ No newline at end of file diff --git a/src/admin/md5changepass.php b/admin/md5changepass.php similarity index 87% rename from src/admin/md5changepass.php rename to admin/md5changepass.php index 71bf636..72ca6c4 100644 --- a/src/admin/md5changepass.php +++ b/admin/md5changepass.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/src/admin/md5enc.php b/admin/md5enc.php similarity index 85% rename from src/admin/md5enc.php rename to admin/md5enc.php index ba3c4e5..20f3c2a 100644 --- a/src/admin/md5enc.php +++ b/admin/md5enc.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/src/admin/messagelist.php b/admin/messagelist.php similarity index 96% rename from src/admin/messagelist.php rename to admin/messagelist.php index a4c75cf..c6d31d0 100644 --- a/src/admin/messagelist.php +++ b/admin/messagelist.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/admin/messall.php b/admin/messall.php new file mode 100644 index 0000000..a05bb0d --- /dev/null +++ b/admin/messall.php @@ -0,0 +1,75 @@ + + * 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 . + * + * --> 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 = "". $ranga ." ".$user['username'].""; + $Subject = "". $gameConfig['temat'] .""; + $Message = "". $gameConfig['tresc'] .""; + while ($u = $sq->fetch(PDO::FETCH_BOTH)) { + SendSimpleMessage ( $u['id'], $user['id'], $Time, 97, $From, $Subject, $Message); + } + message("Wys�a�e� wiadomo�� do wszystkich graczy", "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']); + } +?> \ No newline at end of file diff --git a/src/admin/moonlist.php b/admin/moonlist.php similarity index 88% rename from src/admin/moonlist.php rename to admin/moonlist.php index 932e607..02b64b6 100644 --- a/src/admin/moonlist.php +++ b/admin/moonlist.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/src/admin/multi.php b/admin/multi.php similarity index 87% rename from src/admin/multi.php rename to admin/multi.php index 4b41308..46af676 100644 --- a/src/admin/multi.php +++ b/admin/multi.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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'); diff --git a/admin/overview.php b/admin/overview.php new file mode 100644 index 0000000..f89a7ed --- /dev/null +++ b/admin/overview.php @@ -0,0 +1,116 @@ + + * 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 . + * + * --> 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�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'] = ""; + } else { + $Bloc['state_vacancy'] = ""; + } + + if ($TheUser['bana'] == 1) { + $Bloc['is_banned'] = ""; + } 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'] ); + } + +?> diff --git a/src/admin/paneladmina.php b/admin/paneladmina.php similarity index 72% rename from src/admin/paneladmina.php rename to admin/paneladmina.php index 1ea59d8..86793a2 100644 --- a/src/admin/paneladmina.php +++ b/admin/paneladmina.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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 =<<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 =<<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 ); diff --git a/src/admin/planetlist.php b/admin/planetlist.php similarity index 85% rename from src/admin/planetlist.php rename to admin/planetlist.php index 4a154a5..954600c 100644 --- a/src/admin/planetlist.php +++ b/admin/planetlist.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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 ?> \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php new file mode 100644 index 0000000..3c5d441 --- /dev/null +++ b/admin/settings.php @@ -0,0 +1,310 @@ + + * 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 . + * + * --> 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� ! + 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 ); + +?> diff --git a/src/admin/statbuilder.php b/admin/statbuilder.php similarity index 89% rename from src/admin/statbuilder.php rename to admin/statbuilder.php index 97caec7..4784fee 100644 --- a/src/admin/statbuilder.php +++ b/admin/statbuilder.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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']; diff --git a/src/admin/statfunctions.php b/admin/statfunctions.php similarity index 87% rename from src/admin/statfunctions.php rename to admin/statfunctions.php index db1a760..0e1ea28 100644 --- a/src/admin/statfunctions.php +++ b/admin/statfunctions.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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 ] ]; } diff --git a/src/admin/unbanned.php b/admin/unbanned.php similarity index 86% rename from src/admin/unbanned.php rename to admin/unbanned.php index 8b0967d..8636506 100644 --- a/src/admin/unbanned.php +++ b/admin/unbanned.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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))) { diff --git a/src/admin/userlist.php b/admin/userlist.php similarity index 86% rename from src/admin/userlist.php rename to admin/userlist.php index 84fb74f..922b23a 100644 --- a/src/admin/userlist.php +++ b/admin/userlist.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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']; diff --git a/src/admin/variables.php b/admin/variables.php similarity index 83% rename from src/admin/variables.php rename to admin/variables.php index bcc6642..10599ea 100644 --- a/src/admin/variables.php +++ b/admin/variables.php @@ -1,11 +1,11 @@ + * Copyright (c) 2009-Present, XNova Support Team * 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))) { diff --git a/ainfo.php b/ainfo.php new file mode 100644 index 0000000..a1ae4f2 --- /dev/null +++ b/ainfo.php @@ -0,0 +1,70 @@ + + * 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 . + * + * --> 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 .=""; + + if($allyrow["ally_image"] != ""){ + $page .= ""; + } + + $page .= ""; + + if($allyrow["ally_description"] != ""){ + $page .= ""; + } + + + if($allyrow["ally_web"] != ""){ + $page .=" + + + "; + } + $page .= "
Informations sur l'alliance
Tag".$allyrow["ally_tag"]."
Nom".$allyrow["ally_name"]."
Membres$ally_member_scount
".$allyrow["ally_description"]."
Site internet".$allyrow["ally_web"]."
"; + + display($page,"Information sur l'alliance [".$allyrow["ally_name"]."]",false); + +?> \ No newline at end of file diff --git a/alliance.php b/alliance.php new file mode 100644 index 0000000..1301154 --- /dev/null +++ b/alliance.php @@ -0,0 +1,1199 @@ + + * 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 . + * + * --> 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('INSTALL' , false); + +$mode = $_GET['mode']; +if (empty($mode)) { unset($mode); } +$a = intval($_GET['a']); +if (empty($a)) { unset($a); } +$sort1 = intval($_GET['sort1']); +if (empty($sort1)) { unset($sort1); } +$sort2 = intval($_GET['sort2']); +if (empty($sort2)) { unset($sort2); } +$d = $_GET['d']; +if ((!is_numeric($d)) || (empty($d) && $d != 0)) + unset($d); + +$edit = $_GET['edit']; + +if (empty($edit)) + unset($edit); + +$rank = intval($_GET['rank']); +if (empty($rank)) + unset($rank); + +$kick = intval($_GET['kick']); +if (empty($kick)) + unset($kick); + +$id = intval($_GET['id']); +if (empty($id)) + unset($id); + +define('INSIDE' , true); +require_once dirname(__FILE__) .'/common.php'; + + +if(empty($user['id'])){ +echo ''; +} + +$mode = $_GET['mode']; +$yes = $_GET['yes']; +$edit = $_GET['edit']; +$allyid = intval($_GET['allyid']); +$show = intval($_GET['show']); +$sort = intval($_GET['sort']); +$sendmail = intval($_GET['sendmail']); +$t = $_GET['t']; +$a = intval($_GET['a']); +$tag = mysql_escape_string($_GET['tag']); + +includeLang('alliance'); + + +/* + Alianza consiste en tres partes. + La primera es la comun. Es decir, no se necesita comprobar si se esta en una alianza o no. + La segunda, es sin alianza. Eso implica las solicitudes. + La ultima, seria cuando ya se esta dentro de una. +*/ +// Parte inicial. + +if ($_GET['mode'] == 'ainfo') { + $a = intval($_GET['a']); + $tag = mysql_escape_string($_GET['tag']); + // Evitamos errores casuales xD + // query + $lang['Alliance_information'] = "Information Alliance"; + + if (isset($_GET['tag'])) { + $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)"); + } + // Si no existe + if (!$allyrow) { + message("Cette alliance n'existe pas !", "Information Alliance (1)"); + } + extract($allyrow); + + if ($ally_image != "") { + $ally_image = ""; + } + + if ($ally_description != "") { + $ally_description = "{$ally_description}"; + } else + $ally_description = "Il n'y as aucune descriptions de cette alliance."; + + if ($ally_web != "") { + $ally_web = " + {$lang['Initial_page']} + {$ally_web} + "; + } + + $lang['ally_member_scount'] = $ally_members; + $lang['ally_name'] = $ally_name; + $lang['ally_tag'] = $ally_tag; + // codigo raro + $patterns[] = "#\[fc\]([a-z0-9\#]+)\[/fc\](.*?)\[/f\]#Ssi"; + $replacements[] = '\2'; + $patterns[] = '#\[img\](.*?)\[/img\]#Smi'; + $replacements[] = '\1'; + $patterns[] = "#\[fc\]([a-z0-9\#\ \[\]]+)\[/fc\]#Ssi"; + $replacements[] = ''; + $patterns[] = "#\[/f\]#Ssi"; + $replacements[] = ''; + $ally_description = preg_replace($patterns, $replacements, $ally_description); + + $lang['ally_description'] = nl2br($ally_description); + $lang['ally_image'] = $ally_image; + $lang['ally_web'] = $ally_web; + + if ($user['ally_id'] == 0) { + $lang['bewerbung'] = " + Candidature + Cliquer ici pour ecrire votre candidature + + "; + } else + $lang['bewerbung'] = "Candidature"; + + $page .= parsetemplate(gettemplate('alliance_ainfo'), $lang); + display($page, str_replace('%s', $ally_name, $lang['Info_of_Alliance'])); +} +// --[Comprobaciones de alianza]------------------------- +if ($user['ally_id'] == 0) { // Sin alianza + if ($mode == 'make' && $user['ally_request'] == 0) { // Make alliance + /* + Aca se crean las alianzas... + */ + if ($yes == 1 && $_POST) { + /* + Por el momento solo estoy improvisando, luego se perfeccionara el sistema :) + Creo que aqui se realiza una query para comprovar el nombre, y luego le pregunta si es el tag correcto... + */ + if (!$_POST['atag']) { + message($lang['have_not_tag'], $lang['make_alliance']); + } + if (!$_POST['aname']) { + message($lang['have_not_name'], $lang['make_alliance']); + } + $_POST['aname']=addslashes($_POST['aname']); + $_POST['atag']=addslashes($_POST['atag']); + + $tagquery = doquery("SELECT * FROM {{table}} WHERE ally_tag='{$_POST['atag']}'", 'alliance', true); + + if ($tagquery) { + message(str_replace('%s', $_POST['atag'], $lang['always_exist']), $lang['make_alliance']); + } + + doquery("INSERT INTO {{table}} SET + `ally_name`='{$_POST['aname']}', + `ally_tag`='{$_POST['atag']}' , + `ally_owner`='{$user['id']}', + `ally_owner_range`='Leader', + `ally_members`='1', + `ally_register_time`=" . time() , "alliance"); + + $allyquery = doquery("SELECT * FROM {{table}} WHERE ally_tag='{$_POST['atag']}'", 'alliance', true); + + doquery("UPDATE {{table}} SET + `ally_id`='{$allyquery['id']}', + `ally_name`='{$allyquery['ally_name']}', + `ally_register_time`='" . time() . "' + WHERE `id`='{$user['id']}'", "users"); + + $page = MessageForm(str_replace('%s', $_POST['atag'], $lang['ally_maked']), + + str_replace('%s', $_POST['atag'], $lang['alliance_has_been_maked']) . "

", "", $lang['Ok']); + } else { + $page .= parsetemplate(gettemplate('alliance_make'), $lang); + } + + display($page, $lang['make_alliance']); + } + + if ($mode == 'search' && $user['ally_request'] == 0) { // search one + + $parse = $lang; + $lang['searchtext'] = $_POST['searchtext']; + $page = parsetemplate(gettemplate('alliance_searchform'), $lang); + + if ($_POST) { // esta parte es igual que el buscador de search.php... + // searchtext + $search = doquery("SELECT * FROM {{table}} WHERE ally_name LIKE '%{$_POST['searchtext']}%' or ally_tag LIKE '%{$_POST['searchtext']}%' LIMIT 30", "alliance"); + + if (mysql_num_rows($search) != 0) { + $template = gettemplate('alliance_searchresult_row'); + + while ($s = $search->fetch(PDO::FETCH_BOTH)) { + $entry = array(); + $entry['ally_tag'] = "[{$s['ally_tag']}]"; + $entry['ally_name'] = $s['ally_name']; + $entry['ally_members'] = $s['ally_members']; + + $parse['result'] .= parsetemplate($template, $entry); + } + + $page .= parsetemplate(gettemplate('alliance_searchresult_table'), $parse); + } + } + + display($page, $lang['search_alliance']); + } + + if ($mode == 'apply' && $user['ally_request'] == 0) { // solicitudes + if (!is_numeric($_GET['allyid']) || !$_GET['allyid'] || $user['ally_request'] != 0 || $user['ally_id'] != 0) { + message($lang['it_is_not_posible_to_apply'], $lang['it_is_not_posible_to_apply']); + } + // pedimos la info de la alianza + $allyrow = doquery("SELECT ally_tag,ally_request FROM {{table}} WHERE id='" . intval($_GET['allyid']) . "'", "alliance", true); + + if (!$allyrow) { + message($lang['it_is_not_posible_to_apply'], $lang['it_is_not_posible_to_apply']); + } + + extract($allyrow); + + if ($_POST['further'] == $lang['Send']) { // esta parte es igual que el buscador de search.php... + doquery("UPDATE {{table}} SET `ally_request`='" . intval($allyid) . "', ally_request_text='" . mysql_escape_string(strip_tags($_POST['text'])) . "', ally_register_time='" . time() . "' WHERE `id`='" . $user['id'] . "'", "users"); + // mensaje de cuando se envia correctamente el mensaje + message($lang['apply_registered'], $lang['your_apply']); + // mensaje de cuando falla el envio + // message($lang['apply_cantbeadded'], $lang['your_apply']); + } else { + $text_apply = ($ally_request) ? $ally_request : $lang['There_is_no_a_text_apply']; + } + + $parse = $lang; + $parse['allyid'] = intval($_GET['allyid']); + $parse['chars_count'] = strlen($text_apply); + $parse['text_apply'] = $text_apply; + $parse['Write_to_alliance'] = str_replace('%s', $ally_tag, $lang['Write_to_alliance']); + + $page = parsetemplate(gettemplate('alliance_applyform'), $parse); + + display($page, $lang['Write_to_alliance']); + } + + if ($user['ally_request'] != 0) { // Esperando una respuesta + // preguntamos por el ally_tag + $allyquery = doquery("SELECT ally_tag FROM {{table}} WHERE id='" . intval($user['ally_request']) . "' ORDER BY `id`", "alliance", true); + + extract($allyquery); + if ($_POST['bcancel']) { + doquery("UPDATE {{table}} SET `ally_request`=0 WHERE `id`=" . $user['id'], "users"); + + $lang['request_text'] = str_replace('%s', $ally_tag, $lang['Canceled_a_request_text']); + $lang['button_text'] = $lang['Ok']; + $page = parsetemplate(gettemplate('alliance_apply_waitform'), $lang); + } else { + $lang['request_text'] = str_replace('%s', $ally_tag, $lang['Waiting_a_request_text']); + $lang['button_text'] = $lang['Delete_apply']; + $page = parsetemplate(gettemplate('alliance_apply_waitform'), $lang); + } + // mysql_escape_string(strip_tags()); + display($page, "Deine Anfrage"); + } else { // Vista sin allianza + /* + Vista normal de cuando no se tiene ni solicitud ni alianza + */ + $page .= parsetemplate(gettemplate('alliance_defaultmenu'), $lang); + display($page, $lang['alliance']); + } +} + +//--------------------------------------------------------------------------------------------------------------------------------------------------- +// Parte de adentro de la alianza +elseif ($user['ally_id'] != 0 && $user['ally_request'] == 0) { // Con alianza + + $ally = doquery("SELECT * FROM {{table}} WHERE id='{$user['ally_id']}'", "alliance", true); + + $ally_ranks = unserialize($ally['ally_ranks']); + + $allianz_raenge = unserialize($ally['ally_ranks']); + + if ($allianz_raenge[$user['ally_rank_id']-1]['onlinestatus'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_watch_memberlist_status = true; + } else + $user_can_watch_memberlist_status = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['memberlist'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_watch_memberlist = true; + } else + $user_can_watch_memberlist = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['mails'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_send_mails = true; + } else + $user_can_send_mails = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['kick'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_kick = true; + } else + $user_can_kick = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['rechtehand'] == 1 || $ally['ally_owner'] == $user['id']) + $user_can_edit_rights = true; + else + $user_can_edit_rights = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['delete'] == 1 || $ally['ally_owner'] == $user['id']) + $user_can_exit_alliance = true; + else + $user_can_exit_alliance = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['bewerbungen'] == 1 || $ally['ally_owner'] == $user['id']) + $user_bewerbungen_einsehen = true; + else + $user_bewerbungen_einsehen = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['bewerbungenbearbeiten'] == 1 || $ally['ally_owner'] == $user['id']) + $user_bewerbungen_bearbeiten = true; + else + $user_bewerbungen_bearbeiten = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['administrieren'] == 1 || $ally['ally_owner'] == $user['id']) + $user_admin = true; + else + $user_admin = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['onlinestatus'] == 1 || $ally['ally_owner'] == $user['id']) + $user_onlinestatus = true; + else + $user_onlinestatus = false; + + if (!$ally) { + doquery("UPDATE {{table}} SET `ally_name`='',`ally_id`=0 WHERE `id`='{$user['id']}'", "users"); + message($lang['ally_notexist'], $lang['your_alliance'], 'alliance.php'); + } + + if ($mode == 'exit') { + if ($ally['ally_owner'] == $user['id']) { + message($lang['Owner_cant_go_out'], $lang['Alliance']); + } + // se sale de la alianza + if ($_GET['yes'] == 1) { + doquery("UPDATE {{table}} SET `ally_id`=0, `ally_name` = '' WHERE `id`='{$user['id']}'", "users"); + $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); + $page = MessageForm($lang['Go_out_welldone'], "
", $PHP_SELF, $lang['Ok']); + // Se quitan los puntos del user en la alianza + } else { + // se pregunta si se quiere salir + $lang['Want_go_out'] = str_replace("%s", $ally_name, $lang['Want_go_out']); + $page = MessageForm($lang['Want_go_out'], "
", "?mode=exit&yes=1", "Oui"); + } + display($page); + } + + if ($mode == 'memberslist') { // Lista de miembros. + /* + Lista de miembros. + Por lo que parece solo se hace una query fijandose los usuarios con el mismo ally_id. + seguido del query del planeta principal de cada uno para sacarle la posicion, pero + voy a ver si tambien agrego las cordenadas en el id user... + */ + // obtenemos el array de los rangos + // $ally_ranks = unserialize($ally['ally_ranks']); + $allianz_raenge = unserialize($ally['ally_ranks']); + // $user_can_watch_memberlist + // comprobamos el permiso + if ($ally['ally_owner'] != $user['id'] && !$user_can_watch_memberlist) { + message($lang['Denied_access'], $lang['Members_list']); + } + // El orden de aparicion + if ($sort2) { + $sort1 = intval($_GET['sort1']); + $sort2 = intval($_GET['sort2']); + + if ($sort1 == 1) { + $sort = " ORDER BY `username`"; + } elseif ($sort1 == 2) { + $sort = " ORDER BY `username`"; + } elseif ($sort1 == 4) { + $sort = " ORDER BY `ally_register_time`"; + } elseif ($sort1 == 5) { + $sort = " ORDER BY `onlinetime`"; + } else { + $sort = " ORDER BY `id`"; + } + + if ($sort2 == 1) { + $sort .= " DESC;"; + } elseif ($sort2 == 2) { + $sort .= " ASC;"; + } + $listuser = doquery("SELECT * FROM {{table}} WHERE ally_id='{$user['ally_id']}'{$sort}", 'users'); + } else { + $listuser = doquery("SELECT * FROM {{table}} WHERE ally_id='{$user['ally_id']}'", 'users'); + } + // contamos la cantidad de usuarios. + $i = 0; + // Como es costumbre. un row template + $template = gettemplate('alliance_memberslist_row'); + $page_list = ''; + while ($u = $listuser->fetch(PDO::FETCH_BOTH)) { + $UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $u['id'] . "';", 'statpoints', true); + + $i++; + $u['i'] = $i; + + if ($u["onlinetime"] + 60 * 10 >= time() && $user_can_watch_memberlist_status) { + $u["onlinetime"] = "lime>{$lang['On']}<"; + } elseif ($u["onlinetime"] + 60 * 20 >= time() && $user_can_watch_memberlist_status) { + $u["onlinetime"] = "yellow>{$lang['15_min']}<"; + } elseif ($user_can_watch_memberlist_status) { + $u["onlinetime"] = "red>{$lang['Off']}<"; + } else $u["onlinetime"] = "orange>-<"; + // Nombre de rango + if ($ally['ally_owner'] == $u['id']) { + $u["ally_range"] = ($ally['ally_owner_range'] == '')?"Leader":$ally['ally_owner_range']; + } elseif (isset($allianz_raenge[$u['ally_rank_id']]['name'])) { + $u["ally_range"] = $allianz_raenge[$u['ally_rank_id']]['name']; + } else { + $u["ally_range"] = $lang['Novate']; + } + + $u["dpath"] = $dpath; + $u['points'] = "" . pretty_number($UserPoints['total_points']) . ""; + + if ($u['ally_register_time'] > 0) + $u['ally_register_time'] = date("Y-m-d h:i:s", $u['ally_register_time']); + else + $u['ally_register_time'] = "-"; + + $page_list .= parsetemplate($template, $u); + } + // para cambiar el link de ordenar. + if ($sort2 == 1) { + $s = 2; + } elseif ($sort2 == 2) { + $s = 1; + } else { + $s = 1; + } + + if ($i != $ally['ally_members']) { + doquery("UPDATE {{table}} SET `ally_members`='{$i}' WHERE `id`='{$ally['id']}'", 'alliance'); + } + + $parse = $lang; + $parse['i'] = $i; + $parse['s'] = $s; + $parse['list'] = $page_list; + + $page .= parsetemplate(gettemplate('alliance_memberslist_table'), $parse); + + display($page, $lang['Members_list']); + } + + if ($mode == 'circular') { // Correo circular + /* + Mandar un correo circular. + creo que aqui tendria que ver yo como crear el sistema de mensajes... + */ + // un loop para mostrar losrangos + $allianz_raenge = unserialize($ally['ally_ranks']); + // comprobamos el permiso + if ($ally['ally_owner'] != $user['id'] && !$user_can_send_mails) { + message($lang['Denied_access'], $lang['Send_circular_mail']); + } + + if ($sendmail == 1) { + $_POST['r'] = intval($_POST['r']); + $_POST['text'] = mysql_escape_string(strip_tags($_POST['text'])); + + if ($_POST['r'] == 0) { + $sq = doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}'", "users"); + } else { + $sq = doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}' AND ally_rank_id='{$_POST['r']}'", "users"); + } + // looooooop + $list = ''; + while ($u = $sq->fetch(PDO::FETCH_BOTH)) { + doquery("INSERT INTO {{table}} SET + `message_owner`='{$u['id']}', + `message_sender`='{$user['id']}' , + `message_time`='" . time() . "', + `message_type`='2', + `message_from`='{$ally['ally_tag']}', + `message_subject`='{$user['username']}', + `message_text`='{$_POST['text']}' + ", "messages"); + $list .= "
{$u['username']} "; + } + // doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}' ORDER BY `id`","users"); + doquery("UPDATE {{table}} SET `new_message`=new_message+1 WHERE ally_id='{$user['ally_id']}' AND ally_rank_id='{$_POST['r']}'", "users"); + doquery("UPDATE {{table}} SET `mnl_alliance`=mnl_alliance+1 WHERE ally_id='{$user['ally_id']}' AND ally_rank_id='{$_POST['r']}'", "users"); + /* + Aca un mensajito diciendo que a quien se mando. + */ + $page = MessageForm($lang['Circular_sended'], "Les membres suivants ont re�u un message:" . $list, "alliance.php", $lang['Ok'], true); + display($page, $lang['Send_circular_mail']); + } + + $lang['r_list'] = ""; + if ($allianz_raenge) { + foreach($allianz_raenge as $id => $array) { + $lang['r_list'] .= ""; + } + } + + $page .= parsetemplate(gettemplate('alliance_circular'), $lang); + + display($page, $lang['Send_circular_mail']); + } + + if ($mode == 'admin' && $edit == 'rights') { // Administrar leyes + $allianz_raenge = unserialize($ally['ally_ranks']); + + if ($ally['ally_owner'] != $user['id'] && !$user_can_edit_rights) { + message($lang['Denied_access'], $lang['Members_list']); + } elseif (!empty($_POST['newrangname'])) { + $name = mysql_escape_string(strip_tags($_POST['newrangname'])); + + $allianz_raenge[] = array('name' => $name, + 'mails' => 0, + 'delete' => 0, + 'kick' => 0, + 'bewerbungen' => 0, + 'administrieren' => 0, + 'bewerbungenbearbeiten' => 0, + 'memberlist' => 0, + 'onlinestatus' => 0, + 'rechtehand' => 0 + ); + + $ranks = serialize($allianz_raenge); + + doquery("UPDATE {{table}} SET `ally_ranks`='" . $ranks . "' WHERE `id`=" . $ally['id'], "alliance"); + + $goto = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']; + + header("Location: " . $goto); + exit(); + } elseif ($_POST['id'] != '' && is_array($_POST['id'])) { + $ally_ranks_new = array(); + + foreach ($_POST['id'] as $id) { + $name = $allianz_raenge[$id]['name']; + + $ally_ranks_new[$id]['name'] = $name; + + if (isset($_POST['u' . $id . 'r0'])) { + $ally_ranks_new[$id]['delete'] = 1; + } else { + $ally_ranks_new[$id]['delete'] = 0; + } + + if (isset($_POST['u' . $id . 'r1']) && $ally['ally_owner'] == $user['id']) { + $ally_ranks_new[$id]['kick'] = 1; + } else { + $ally_ranks_new[$id]['kick'] = 0; + } + + if (isset($_POST['u' . $id . 'r2'])) { + $ally_ranks_new[$id]['bewerbungen'] = 1; + } else { + $ally_ranks_new[$id]['bewerbungen'] = 0; + } + + if (isset($_POST['u' . $id . 'r3'])) { + $ally_ranks_new[$id]['memberlist'] = 1; + } else { + $ally_ranks_new[$id]['memberlist'] = 0; + } + + if (isset($_POST['u' . $id . 'r4'])) { + $ally_ranks_new[$id]['bewerbungenbearbeiten'] = 1; + } else { + $ally_ranks_new[$id]['bewerbungenbearbeiten'] = 0; + } + + if (isset($_POST['u' . $id . 'r5'])) { + $ally_ranks_new[$id]['administrieren'] = 1; + } else { + $ally_ranks_new[$id]['administrieren'] = 0; + } + + if (isset($_POST['u' . $id . 'r6'])) { + $ally_ranks_new[$id]['onlinestatus'] = 1; + } else { + $ally_ranks_new[$id]['onlinestatus'] = 0; + } + + if (isset($_POST['u' . $id . 'r7'])) { + $ally_ranks_new[$id]['mails'] = 1; + } else { + $ally_ranks_new[$id]['mails'] = 0; + } + + if (isset($_POST['u' . $id . 'r8'])) { + $ally_ranks_new[$id]['rechtehand'] = 1; + } else { + $ally_ranks_new[$id]['rechtehand'] = 0; + } + } + + $ranks = serialize($ally_ranks_new); + + doquery("UPDATE {{table}} SET `ally_ranks`='" . $ranks . "' WHERE `id`=" . $ally['id'], "alliance"); + + $goto = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']; + + header("Location: " . $goto); + exit(); + } + // borrar una entrada + elseif (isset($d) && isset($ally_ranks[$d])) { + unset($ally_ranks[$d]); + $ally['ally_rank'] = serialize($ally_ranks); + + doquery("UPDATE {{table}} SET `ally_ranks`='{$ally['ally_rank']}' WHERE `id`={$ally['id']}", "alliance"); + } + + if (count($ally_ranks) == 0 || $ally_ranks == '') { // si no hay rangos + $list = "{$lang['There_is_not_range']}"; + } else { // Si hay rangos + // cargamos la template de tabla + $list = parsetemplate(gettemplate('alliance_admin_laws_head'), $lang); + $template = gettemplate('alliance_admin_laws_row'); + // Creamos la lista de rangos + $i = 0; + + foreach($ally_ranks as $a => $b) { + if ($ally['ally_owner'] == $user['id']) { + // $i++;u2r5 + $lang['id'] = $a; + $lang['delete'] = "\"{$lang['Delete_range']}\""; + $lang['r0'] = $b['name']; + $lang['a'] = $a; + $lang['r1'] = ""; //{$b[1]} + $lang['r2'] = ""; + $lang['r3'] = ""; + $lang['r4'] = ""; + $lang['r5'] = ""; + $lang['r6'] = ""; + $lang['r7'] = ""; + $lang['r8'] = ""; + $lang['r9'] = ""; + + $list .= parsetemplate($template, $lang); + } else { + $lang['id'] = $a; + $lang['r0'] = $b['name']; + $lang['delete'] = "\"{$lang['Delete_range']}\""; + $lang['a'] = $a; + $lang['r1'] = "-"; + $lang['r2'] = ""; + $lang['r3'] = ""; + $lang['r4'] = ""; + $lang['r5'] = ""; + $lang['r6'] = ""; + $lang['r7'] = ""; + $lang['r8'] = ""; + $lang['r9'] = ""; + + $list .= parsetemplate($template, $lang); + } + } + + if (count($ally_ranks) != 0) { + $list .= parsetemplate(gettemplate('alliance_admin_laws_feet'), $lang); + } + } + + $lang['list'] = $list; + $lang['dpath'] = $dpath; + $page .= parsetemplate(gettemplate('alliance_admin_laws'), $lang); + + display($page, $lang['Law_settings']); + } + + if ($mode == 'admin' && $edit == 'ally') { // Administrar la alianza *pendiente urgente* + if ($t != 1 && $t != 2 && $t != 3) { + $t = 1; + } + // post! + if ($_POST) { + if (!get_magic_quotes_gpc()) { + $_POST['owner_range'] = stripslashes($_POST['owner_range']); + $_POST['web'] = stripslashes($_POST['web']); + $_POST['image'] = stripslashes($_POST['image']); + $_POST['text'] = stripslashes($_POST['text']); + } + } + + if ($_POST['options']) { + $ally['ally_owner_range'] = mysql_escape_string(htmlspecialchars(strip_tags($_POST['owner_range']))); + + $ally['ally_web'] = mysql_escape_string(htmlspecialchars(strip_tags($_POST['web']))); + + $ally['ally_image'] = mysql_escape_string(htmlspecialchars(strip_tags($_POST['image']))); + + $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"); + exit; + } + + doquery("UPDATE {{table}} SET + `ally_owner_range`='{$ally['ally_owner_range']}', + `ally_image`='{$ally['ally_image']}', + `ally_web`='{$ally['ally_web']}', + `ally_request_notallow`='{$ally['ally_request_notallow']}' + WHERE `id`='{$ally['id']}'", "alliance"); + } elseif ($_POST['t']) { + if ($t == 3) { + $ally['ally_request'] = mysql_escape_string(strip_tags($_POST['text'])); + + doquery("UPDATE {{table}} SET + `ally_request`='{$ally['ally_request']}' + WHERE `id`='{$ally['id']}'", "alliance"); + } elseif ($t == 2) { + $ally['ally_text'] = mysql_escape_string(strip_tags($_POST['text'])); + doquery("UPDATE {{table}} SET + `ally_text`='{$ally['ally_text']}' + WHERE `id`='{$ally['id']}'", "alliance"); + } else { + $ally['ally_description'] = mysql_escape_string(strip_tags(stripslashes($_POST['text']))); + + doquery("UPDATE {{table}} SET + `ally_description`='" . $ally['ally_description'] . "' + WHERE `id`='{$ally['id']}'", "alliance"); + } + } + $lang['dpath'] = $dpath; + /* + Depende del $t, muestra el formulario para cada tipo de texto. + */ + if ($t == 3) { + $lang['request_type'] = $lang['Show_of_request_text']; + } elseif ($t == 2) { + $lang['request_type'] = $lang['Internal_text_of_alliance']; + } else { + $lang['request_type'] = $lang['Public_text_of_alliance']; + } + + if ($t == 2) { + $lang['text'] = $ally['ally_text']; + $lang['Texts'] = "Texte Interne"; + $lang['Show_of_request_text'] = "Texte Interne d'ALliance"; + } else { + $lang['text'] = $ally['ally_description']; + } + + if ($t == 3) { + } + $lang['t'] = $t; + + $lang['ally_web'] = $ally['ally_web']; + $lang['ally_image'] = $ally['ally_image']; + $lang['ally_request_notallow_0'] = (($ally['ally_request_notallow'] == 1) ? ' SELECTED' : ''); + $lang['ally_request_notallow_1'] = (($ally['ally_request_notallow'] == 0) ? ' SELECTED' : ''); + $lang['ally_owner_range'] = $ally['ally_owner_range']; + $lang['Transfer_alliance'] = MessageForm("Abandonner / Transférer L'alliance", "", "?mode=admin&edit=give", $lang['Continue']); + $lang['Disolve_alliance'] = MessageForm("Dissoudre L'alliance", "", "?mode=admin&edit=exit", $lang['Continue']); + + $page .= parsetemplate(gettemplate('alliance_admin'), $lang); + display($page, $lang['Alliance_admin']); + } + + if ($mode == 'admin' && $edit == 'give') { + if ($_POST["id"]) { + doquery("update {{table}} set `ally_owner`='".$_POST["id"]."' where `id`='".$user['ally_id']."'",'alliance'); + } else { + $selection=doquery("SELECT * FROM {{table}} where ally_id='".$user['ally_id']."'",'users'); + $select=''; +while ($data = $selection->fetch(PDO::FETCH_BOTH)){ + $select.='